You are here

function hook_quickedit_editor_info in Quick Edit 7

Declares in-place editor plugins provided by a module.

In Drupal 8, we use plugin annotations for this.

Return value

array An array whose keys are (unique) in-place editor plugin IDs and whose value is an array of plugin metadata. Plugin metadata arrays contain the following key-value pairs:

  • alternativeTo: an array of in-place editors plugin IDs that have registered themselves as alternatives to this in-place editor.
  • file: the Drupal root-relative file path to the PHP file that should be loaded to be able to use the in-place editor plugin class
  • class: the name of the class that represents this in-place editor.

See also

Drupal 8's \Drupal\quickedit\Annotation\InPlaceEditor

Drupal 8's \Drupal\quickedit\Plugin\InPlaceEditorBase

InPlaceEditors/CKEditor.php

InPlaceEditors/formEditor.php

InPlaceEditors/plainTextEditor.php

1 function implements hook_quickedit_editor_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

quickedit_quickedit_editor_info in ./quickedit.quickedit.inc
Implements hook_quickedit_editor_info().
1 invocation of hook_quickedit_editor_info()
quickedit_editor_list in ./quickedit.module
Discovers all available editors by invoking hook_quickedit_editor_info().

File

./quickedit.api.php, line 35
Hooks provided by the Quick Edit module.

Code

function hook_quickedit_editor_info() {
  $path = drupal_get_path('module', 'quickedit') . '/InPlaceEditors';

  // The "plain_text" in-place editor only works for text fields without a text
  // format.
  $editors['plain_text'] = array(
    'file' => $path . '/plainTextEditor.php',
    'class' => 'PlainTextEditor',
  );

  // The "ckeditor" in-place editor only works for text fields with a text
  // format, and only those text formats that are configured to use CKEditor.
  if (module_exists('ckeditor')) {
    $editors['ckeditor'] = array(
      // Therefor, the "ckeditor" in-place editor is marked as an alternative to
      // the "plain_text" in-place editor. Thanks to both plugins'
      // implementations of QuickEditInPlaceEditorInterface::isCompatible(), it
      // is ensured that the right in-place editor is used.
      'alternativeTo' => array(
        'plain_text',
      ),
      'file' => $path . '/CKEditor.php',
      'class' => 'CKEditor',
    );
  }
  return $editors;
}