You are here

function advanced_text_formatter_field_widget_third_party_settings_form in Advanced Text Formatter 2.1.x

Same name and namespace in other branches
  1. 8 advanced_text_formatter.module \advanced_text_formatter_field_widget_third_party_settings_form()
  2. 2.0.x advanced_text_formatter.module \advanced_text_formatter_field_widget_third_party_settings_form()

Implements hook_field_widget_third_party_settings_form().

File

./advanced_text_formatter.module, line 151
Advanced Text Formatter

Code

function advanced_text_formatter_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
  $element = array();
  if (\Drupal::moduleHandler()
    ->moduleExists('token')) {
    switch ($plugin
      ->getPluginId()) {
      case 'string_textfield':
      case 'string_textarea':
      case 'text_textfield':
      case 'text_textarea':
      case 'text_textarea_with_summary':
        $element['show_token_tree'] = array(
          '#type' => 'checkbox',
          '#title' => t("Show available tokens in field's description"),
          '#return_value' => 1,
          '#default_value' => _advanced_text_formatter_show_token_tree($plugin),
        );
        break;
    }
  }
  return $element;
}