You are here

public function SimpleIframeFieldType::fieldSettingsForm in Simple iframe 8

Returns a form for the field-level settings.

Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.

Parameters

array $form: The form where the settings form is being included in.

\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.

Return value

array The form definition for the field settings.

Overrides FieldItemBase::fieldSettingsForm

File

src/Plugin/Field/FieldType/SimpleIframeFieldType.php, line 100

Class

SimpleIframeFieldType
Plugin implementation of the 'simple_iframe_field_type' field type.

Namespace

Drupal\simple_iframe\Plugin\Field\FieldType

Code

public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
  $elements = [];
  $elements['width'] = [
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => $this
      ->getSetting('width'),
    '#required' => TRUE,
    '#description' => t('Default width of iframe. Set a number or %'),
  ];
  $elements['height'] = [
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => $this
      ->getSetting('height'),
    '#required' => TRUE,
    '#description' => t('Default height of iframe.'),
  ];
  return $elements;
}