class Image
Same name in this branch
- 11.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
- 11.x core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
- 11.x core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
Same name and namespace in other branches
- 9 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
- 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image
- 9 core/modules/quickedit/src/Plugin/InPlaceEditor/Image.php \Drupal\quickedit\Plugin\InPlaceEditor\Image
- 9 core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image
- 9 core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
- 9 core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
- 8.9.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
- 8.9.x core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image
- 8.9.x core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
- 8.9.x core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
- 10 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
- 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image
- 10 core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
- 10 core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
CKEditor 5 Image plugin.
@internal Plugin classes are internal.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image extends \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableInterface uses \Drupal\ckeditor5\Plugin\CKEditor5PluginConfigurableTrait, \Drupal\ckeditor5\Plugin\CKEditor5Plugin\DynamicPluginConfigWithCsrfTokenUrlTrait implements \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault
- class \Drupal\ckeditor5\Plugin\CKEditor5PluginDefault extends \Drupal\ckeditor5\Plugin\CKEditor5PluginInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Image
343 string references to 'Image'
- 344b943c-b231-4d73-9669-0b0a2be12aa5.yml in core/
tests/ fixtures/ default_content/ media/ 344b943c-b231-4d73-9669-0b0a2be12aa5.yml - core/tests/fixtures/default_content/media/344b943c-b231-4d73-9669-0b0a2be12aa5.yml
- AjaxFileManagedMultipleTest::testMultipleFilesUpload in core/
modules/ file/ tests/ src/ FunctionalJavascript/ AjaxFileManagedMultipleTest.php - Tests if managed file form element works well with multiple files upload.
- banner.component.yml in core/
profiles/ demo_umami/ themes/ umami/ components/ banner/ banner.component.yml - core/profiles/demo_umami/themes/umami/components/banner/banner.component.yml
- ckeditor5.ckeditor5.yml in core/
modules/ ckeditor5/ ckeditor5.ckeditor5.yml - core/modules/ckeditor5/ckeditor5.ckeditor5.yml
- ckeditor5.ckeditor5.yml in core/
modules/ ckeditor5/ ckeditor5.ckeditor5.yml - core/modules/ckeditor5/ckeditor5.ckeditor5.yml
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Image.php, line 20
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginView source
class Image extends CKEditor5PluginDefault implements CKEditor5PluginConfigurableInterface {
use CKEditor5PluginConfigurableTrait;
use DynamicPluginConfigWithCsrfTokenUrlTrait;
/**
* {@inheritdoc}
*/
public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
$config = $static_plugin_config;
if ($editor->getImageUploadSettings()['status'] === TRUE) {
$config += [
'drupalImageUpload' => [
'uploadUrl' => self::getUrlWithReplacedCsrfTokenPlaceholder(Url::fromRoute('ckeditor5.upload_image')->setRouteParameter('editor', $editor->getFilterFormat()
->id())),
'withCredentials' => TRUE,
'headers' => [
'Accept' => 'application/json',
'text/javascript',
],
],
];
$config['image']['insert']['integrations'][] = 'upload';
}
else {
$config['image']['insert']['integrations'][] = 'url';
}
return $config;
}
/**
* {@inheritdoc}
*
* @see editor_image_upload_settings_form()
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form_state->loadInclude('editor', 'admin.inc');
return editor_image_upload_settings_form($form_state->get('editor'));
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$form_state->setValue('status', (bool) $form_state->getValue('status'));
$directory = $form_state->getValue([
'directory',
]);
$form_state->setValue([
'directory',
], trim($directory) === '' ? NULL : $directory);
$max_size = $form_state->getValue([
'max_size',
]);
$form_state->setValue([
'max_size',
], trim($max_size) === '' ? NULL : $max_size);
$max_width = $form_state->getValue([
'max_dimensions',
'width',
]);
$form_state->setValue([
'max_dimensions',
'width',
], trim($max_width) === '' ? NULL : (int) $max_width);
$max_height = $form_state->getValue([
'max_dimensions',
'height',
]);
$form_state->setValue([
'max_dimensions',
'height',
], trim($max_height) === '' ? NULL : (int) $max_height);
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$settings = $form_state->getValues();
if (!$settings['status']) {
// Remove all other settings to comply with config schema.
$settings = [
'status' => FALSE,
];
}
// Store this configuration in its out-of-band location.
$form_state->get('editor')
->setImageUploadSettings($settings);
}
/**
* {@inheritdoc}
*
* This returns an empty array as image upload config is stored out of band.
*/
public function defaultConfiguration() {
return [];
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
CKEditor5PluginConfigurableTrait::getConfiguration | public | function | ||||
CKEditor5PluginConfigurableTrait::setConfiguration | public | function | ||||
CKEditor5PluginDefault::__construct | public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | Overrides PluginBase::__construct | 3 | |
DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | |||
DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | |||
DependencySerializationTrait::__sleep | public | function | 3 | |||
DependencySerializationTrait::__wakeup | public | function | 3 | |||
DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder | private static | function | Gets the given URL with all placeholders replaced. | |||
Image::buildConfigurationForm | public | function | Overrides PluginFormInterface::buildConfigurationForm | |||
Image::defaultConfiguration | public | function | This returns an empty array as image upload config is stored out of band. | Overrides ConfigurableInterface::defaultConfiguration | ||
Image::getDynamicPluginConfig | public | function | Allows a plugin to modify its static configuration. | Overrides CKEditor5PluginDefault::getDynamicPluginConfig | ||
Image::submitConfigurationForm | public | function | Form submission handler. | Overrides PluginFormInterface::submitConfigurationForm | ||
Image::validateConfigurationForm | public | function | Form validation handler. | Overrides PluginFormInterface::validateConfigurationForm | ||
MessengerTrait::$messenger | protected | property | The messenger. | 25 | ||
MessengerTrait::messenger | public | function | Gets the messenger. | 25 | ||
MessengerTrait::setMessenger | public | function | Sets the messenger. | |||
PluginBase::$configuration | protected | property | Configuration information passed into the plugin. | 1 | ||
PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | ||
PluginBase::$pluginId | protected | property | The plugin ID. | |||
PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||||
PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | ||
PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | ||
PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 2 | |
PluginBase::getPluginId | public | function | Gets the plugin ID of the plugin instance. | Overrides PluginInspectionInterface::getPluginId | ||
PluginBase::isConfigurable | Deprecated | public | function | Determines if the plugin is configurable. | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | ||
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | ||
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.