class Image

Same name in this branch
  1. 9 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
  2. 9 core/modules/quickedit/src/Plugin/InPlaceEditor/Image.php \Drupal\quickedit\Plugin\InPlaceEditor\Image
  3. 9 core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image
  4. 9 core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
  5. 9 core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
Same name in other branches
  1. 8.9.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
  2. 8.9.x core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image
  3. 8.9.x core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
  4. 8.9.x core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
  5. 10 core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
  6. 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image
  7. 10 core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
  8. 10 core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image
  9. 11.x core/modules/media/src/Plugin/media/Source/Image.php \Drupal\media\Plugin\media\Source\Image
  10. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Image
  11. 11.x core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image
  12. 11.x core/lib/Drupal/Component/Utility/Image.php \Drupal\Component\Utility\Image

CKEditor 5 Image plugin.

@internal Plugin classes are internal.

Hierarchy

Expanded class hierarchy of Image

299 string references to 'Image'
aggregator_entity_extra_field_info in core/modules/aggregator/aggregator.module
Implements hook_entity_extra_field_info().
AjaxFileManagedMultipleTest::testMultipleFilesUpload in core/modules/file/tests/src/FunctionalJavascript/AjaxFileManagedMultipleTest.php
Tests if managed file form element works well with multiple files upload.
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
CKEditor5AllowedTagsTest::testImgAddedViaUploadPlugin in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
Tests that the img tag is added after enabling image uploads.

... See full list

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php, line 20

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin
View 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',
                    ],
                ],
            ];
        }
        return $config;
    }
    
    /**
     * {@inheritdoc}
     *
     * @see \Drupal\editor\Form\EditorImageDialog
     * @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'));
        $form_state->setValue([
            'max_dimensions',
            'width',
        ], (int) $form_state->getValue([
            'max_dimensions',
            'width',
        ]));
        $form_state->setValue([
            'max_dimensions',
            'height',
        ], (int) $form_state->getValue([
            'max_dimensions',
            'height',
        ]));
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
        // Store this configuration in its out-of-band location.
        $form_state->get('editor')
            ->setImageUploadSettings($form_state->getValues());
    }
    
    /**
     * {@inheritdoc}
     *
     * This returns an empty array as image upload config is stored out of band.
     */
    public function defaultConfiguration() {
        return [];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CKEditor5PluginConfigurableTrait::getConfiguration public function
CKEditor5PluginConfigurableTrait::setConfiguration public function
CKEditor5PluginDefault::__construct public function 2
DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder private static function Gets the given URL with all placeholders replaced.
Image::buildConfigurationForm public function
Image::defaultConfiguration public function This returns an empty array as image upload config is stored out of band.
Image::getDynamicPluginConfig public function Allows a plugin to modify its static configuration. Overrides CKEditor5PluginDefault::getDynamicPluginConfig
Image::submitConfigurationForm public function
Image::validateConfigurationForm public function
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 6
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.