You are here

function quickedit_field_formatter_info_alter in Quick Edit 7

Implements hook_field_formatter_info_alter().

Quick Edit extends the field formatter info hook metadata with the following keys:

  • quickedit: currently only contains one subkey 'editor' which indicates which in-place editor should be used. Possible values are 'form', 'plain_text', 'disabled' or another in-place editor other than the ones Quick Edit module provides.

See also

Drupal 8's quickedit_field_formatter_info_alter()

File

./quickedit.module, line 738
Provides in-place content editing functionality for fields.

Code

function quickedit_field_formatter_info_alter(&$info) {
  foreach ($info as $key => $settings) {

    // Set in-place editor to 'form' if none is supplied.
    if (empty($settings['settings']['quickedit'])) {
      $info[$key]['settings']['quickedit'] = array(
        'editor' => 'form',
      );
    }
  }

  // @see Drupal 8's \Drupal\text\Plugin\field\formatter\TextDefaultFormatter
  // @see Drupal 8's \Drupal\text\Plugin\field\formatter\TextPlainFormatter
  if (module_exists('text')) {
    $info['text_default']['settings']['quickedit']['editor'] = 'plain_text';
    $info['text_plain']['settings']['quickedit']['editor'] = 'plain_text';
  }
}