You are here

public function HideIfEmpty::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/HideIfEmpty.php, line 101

Class

HideIfEmpty
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']);
  foreach ($fields as $field_name => $field) {
    if ($field_name != $settings['field_name']) {
      $options[$field_name] = $field
        ->getLabel();
    }
  }
  return t("Condition: %condition (%settings)", [
    "%condition" => t('Hide when target field is empty'),
    '%settings' => $options[$settings['settings']['target_field']],
  ]);
}