You are here

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

Class

HideIfBoolCheck
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();
    }
  }
  $not = $settings['settings']['negate'] ? sprintf(' %s', t('not')) : '';
  return t("Condition: %condition (%settings)", [
    "%condition" => t('Hide if checkbox is%not checked', [
      '%not' => $not,
    ]),
    '%settings' => $options[$settings['settings']['target_field']],
  ]);
}