class DrupalImageCaption in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption
Defines the "drupalimagecaption" plugin.
Plugin annotation
@CKEditorPlugin(
id = "drupalimagecaption",
label = @Translation("Drupal image caption widget"),
module = "ckeditor"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption implements CKEditorPluginContextualInterface, CKEditorPluginInterface
Expanded class hierarchy of DrupalImageCaption
File
- core/
modules/ ckeditor/ src/ Plugin/ CKEditorPlugin/ DrupalImageCaption.php, line 24 - Contains \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption.
Namespace
Drupal\ckeditor\Plugin\CKEditorPluginView source
class DrupalImageCaption extends PluginBase implements CKEditorPluginInterface, CKEditorPluginContextualInterface {
/**
* {@inheritdoc}
*/
public function isInternal() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getDependencies(Editor $editor) {
return array();
}
/**
* {@inheritdoc}
*/
public function getLibraries(Editor $editor) {
return array(
'ckeditor/drupal.ckeditor.plugins.drupalimagecaption',
);
}
/**
* {@inheritdoc}
*/
public function getFile() {
return drupal_get_path('module', 'ckeditor') . '/js/plugins/drupalimagecaption/plugin.js';
}
/**
* {@inheritdoc}
*/
public function getConfig(Editor $editor) {
$format = $editor
->getFilterFormat();
return array(
'image2_captionedClass' => 'caption caption-img',
'image2_alignClasses' => array(
'align-left',
'align-center',
'align-right',
),
'drupalImageCaption_captionPlaceholderText' => t('Enter caption here'),
// Only enable those parts of DrupalImageCaption for which the
// corresponding Drupal text filters are enabled.
'drupalImageCaption_captionFilterEnabled' => $format
->filters('filter_caption')->status,
'drupalImageCaption_alignFilterEnabled' => $format
->filters('filter_align')->status,
);
}
/**
* {@inheritdoc}
*/
function isEnabled(Editor $editor) {
if (!$editor
->hasAssociatedFilterFormat()) {
return FALSE;
}
// Automatically enable this plugin if the text format associated with this
// text editor uses the filter_align or filter_caption filter and the
// DrupalImage button is enabled.
$format = $editor
->getFilterFormat();
if ($format
->filters('filter_align')->status || $format
->filters('filter_caption')->status) {
$enabled = FALSE;
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
foreach ($group['items'] as $button) {
if ($button === 'DrupalImage') {
$enabled = TRUE;
}
}
}
}
return $enabled;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalImageCaption:: |
public | function |
Returns the additions to CKEDITOR.config for a specific CKEditor instance. Overrides CKEditorPluginInterface:: |
|
DrupalImageCaption:: |
public | function |
Returns a list of plugins this plugin requires. Overrides CKEditorPluginInterface:: |
|
DrupalImageCaption:: |
public | function |
Returns the Drupal root-relative file path to the plugin JavaScript file. Overrides CKEditorPluginInterface:: |
|
DrupalImageCaption:: |
public | function |
Returns a list of libraries this plugin requires. Overrides CKEditorPluginInterface:: |
|
DrupalImageCaption:: |
function |
Checks if this plugin should be enabled based on the editor configuration. Overrides CKEditorPluginContextualInterface:: |
||
DrupalImageCaption:: |
public | function |
Indicates if this plugin is part of the optimized CKEditor build. Overrides CKEditorPluginInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 69 |