You are here

public function EmptyFieldText::settingsForm in Empty fields 8

Returns the configuration form elements specific to this plugin.

Plugins that need to add form elements to the configuration form should implement this method.

Parameters

array $form: The form definition array for the block configuration form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The renderable form array representing the entire configuration form.

Overrides EmptyFieldPluginBase::settingsForm

See also

\Drupal\Core\Field\FormatterInterface::settingsForm()

File

src/Plugin/EmptyFields/EmptyFieldText.php, line 34

Class

EmptyFieldText
Defines EmptyFieldText.

Namespace

Drupal\empty_fields\Plugin\EmptyFields

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $form['empty_text'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Display Custom Text'),
    '#default_value' => $this->configuration['empty_text'],
    '#description' => $this
      ->t('Display text if the field is empty.'),
  ];
  return $form;
}