You are here

public function HideIfString::summary in Field Formatter Condition 8

Return the summary string.

Parameters

array $settings: The current settings array.

Overrides FieldFormatterConditionBase::summary

File

src/Plugin/Field/FieldFormatter/Condition/HideIfString.php, line 62

Class

HideIfString
The plugin for check empty fields.

Namespace

Drupal\fico\Plugin\Field\FieldFormatter\Condition

Code

public function summary($settings) {
  $options = [];
  $fields = $this
    ->getEntityFields($settings['entity_type'], $settings['bundle']);
  $allowed_field_types = fico_text_types();
  foreach ($fields as $field_name => $field) {
    if ($field_name != $settings['field_name'] && in_array($field
      ->getType(), $allowed_field_types)) {
      $options[$field_name] = $field
        ->label();
    }
  }
  return t('Condition: %condition (%field = "%string")', [
    "%condition" => t('Hide when target field contains a string'),
    '%field' => $options[$settings['settings']['target_field']],
    '%string' => $settings['settings']['string'],
  ]);
}