Defines a "LlamaContextualAndbutton" plugin, with a contextually OR toolbar builder-enabled "llama" feature.
@CKEditorPlugin(
id = "llama_contextual_and_button",
label = @Translation("Contextual Llama With Button")
)
Expanded class hierarchy of LlamaContextualAndButton
class LlamaContextualAndButton extends Llama implements CKEditorPluginContextualInterface, CKEditorPluginButtonsInterface, CKEditorPluginConfigurableInterface {
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginContextualInterface::isEnabled().
*/
function isEnabled(Editor $editor) {
// Automatically enable this plugin if the Strike button is enabled.
foreach ($editor->settings['toolbar']['buttons'] as $row) {
if (in_array('Strike', $row)) {
return TRUE;
}
}
return FALSE;
}
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginButtonsInterface::getButtons().
*/
function getButtons() {
return array(
'Llama' => array(
'label' => t('Insert Llama'),
),
);
}
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
*/
function getFile() {
return drupal_get_path('module', 'ckeditor_test') . '/js/llama_contextual_and_button.js';
}
/**
* Implements \Drupal\ckeditor\Plugin\CKEditorPluginConfigurableInterface::settingsForm().
*/
function settingsForm(array $form, array &$form_state, Editor $editor) {
// Defaults.
$config = array(
'ultra_llama_mode' => FALSE,
);
if (isset($editor->settings['plugins']['llama_contextual_and_button'])) {
$config = $editor->settings['plugins']['llama_contextual_and_button'];
}
$form['ultra_llama_mode'] = array(
'#title' => t('Ultra llama mode'),
'#type' => 'checkbox',
'#default_value' => $config['ultra_llama_mode'],
);
return $form;
}
}
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Llama:: |
public | function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getButtons(). Overrides CKEditorPluginInterface:: |
|
Llama:: |
function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::isInternal(). Overrides CKEditorPluginInterface:: |
||
LlamaContextualAndButton:: |
function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginButtonsInterface::getButtons(). Overrides CKEditorPluginButtonsInterface:: |
||
LlamaContextualAndButton:: |
function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile(). Overrides Llama:: |
||
LlamaContextualAndButton:: |
function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginContextualInterface::isEnabled(). Overrides CKEditorPluginContextualInterface:: |
||
LlamaContextualAndButton:: |
function |
Implements \Drupal\ckeditor\Plugin\CKEditorPluginConfigurableInterface::settingsForm(). Overrides CKEditorPluginConfigurableInterface:: |
||
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
public | function |
Returns the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 17 |