You are here

function allowed_formats_field_widget_third_party_settings_form in Allowed Formats 8

Implements hook_field_widget_third_party_settings_form().

File

./allowed_formats.module, line 42
This is the allowed_formats module.

Code

function allowed_formats_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
  if (in_array($field_definition
    ->getType(), _allowed_formats_field_types())) {
    $element = [];
    $element['hide_help'] = [
      '#type' => 'checkbox',
      '#title' => t('Hide the help link <em>About text formats</em>.'),
      '#default_value' => $plugin
        ->getThirdPartySetting('allowed_formats', 'hide_help'),
    ];
    $element['hide_guidelines'] = [
      '#type' => 'checkbox',
      '#title' => t('Hide text format guidelines.'),
      '#default_value' => $plugin
        ->getThirdPartySetting('allowed_formats', 'hide_guidelines'),
    ];
    return $element;
  }
}