public function HideIfAuthor::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/ HideIfAuthor.php, line 59
Class
- HideIfAuthor
- The plugin for check empty fields.
Namespace
Drupal\fico\Plugin\Field\FieldFormatter\ConditionCode
public function summary($settings) {
if (isset($settings['settings']['author'])) {
$user = User::load($settings['settings']['author']);
$user = $user
->getUsername();
}
else {
$config = \Drupal::config('user.settings');
$user = $config
->get('anonymous');
}
return t("Condition: %condition (%settings)", [
"%condition" => t('Hide if content from author'),
'%settings' => $user,
]);
}