You are here

public function MaskedinputFieldWidgetDefault::settingsSummary in Masked Input 8

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides StringTextfieldWidget::settingsSummary

File

src/Plugin/Field/FieldWidget/MaskedinputFieldWidgetDefault.php, line 106

Class

MaskedinputFieldWidgetDefault
Plugin implementation of the 'masked_input_field_widget_default default' widget.

Namespace

Drupal\masked_input\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = array();
  $summary[] = $this
    ->t('Textfield size: @size', array(
    '@size' => $this
      ->getSetting('size'),
  ));
  $placeholder = $this
    ->getSetting('placeholder');
  $mask_placeholder = $this
    ->getSetting('mask_placeholder');
  if (!empty($placeholder)) {
    $summary[] = $this
      ->t('Placeholder: @placeholder', array(
      '@placeholder' => $placeholder,
    ));
  }
  if (!empty($mask_placeholder)) {
    $summary[] = $this
      ->t('mask_placeholder: @mask_placeholder', array(
      '@mask_placeholder' => $mask_placeholder,
    ));
  }
  $mask = $this
    ->getSetting('mask');
  if (!empty($mask)) {
    $summary[] = $this
      ->t('Mask: @mask', array(
      '@mask' => $mask,
    ));
  }
  return $summary;
}