public function CshsOptionsFromHelper::settingsSummary in Client-side Hierarchical Select 8
Same name and namespace in other branches
- 8.3 src/CshsOptionsFromHelper.php \Drupal\cshs\CshsOptionsFromHelper::settingsSummary()
- 8.2 src/CshsOptionsFromHelper.php \Drupal\cshs\CshsOptionsFromHelper::settingsSummary()
Returns a short summary for the settings.
Return value
array A short summary of the settings.
1 call to CshsOptionsFromHelper::settingsSummary()
- CshsWidget::settingsSummary in src/
Plugin/ Field/ FieldWidget/ CshsWidget.php - Returns a short summary for the current widget settings.
File
- src/
CshsOptionsFromHelper.php, line 92
Class
- CshsOptionsFromHelper
- Defines a class for getting options for a cshs form element from vocabulary.
Namespace
Drupal\cshsCode
public function settingsSummary() : array {
$settings = $this
->getSettings();
$summary = [];
$deepest = $this
->t('Deepest');
$none = $this
->t('None');
$yes = $this
->t('Yes');
$no = $this
->t('No');
$summary[] = $this
->t('Parent: @parent', [
'@parent' => empty($settings['parent']) ? $none : $this
->getTranslationFromContext($this
->getTermStorage()
->load($settings['parent']))
->label(),
]);
foreach (HIERARCHY_OPTIONS as $option_name => [
$title,
]) {
/** @noinspection NestedTernaryOperatorInspection */
// phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
$summary[] = $this
->t("{$title}: @{$option_name}", [
"@{$option_name}" => empty($settings['force_deepest']) ? empty($settings[$option_name]) ? $none : $settings[$option_name] : $deepest,
]);
}
$summary[] = $this
->t('Force deepest: @force_deepest', [
'@force_deepest' => empty($settings['force_deepest']) ? $no : $yes,
]);
$summary[] = $this
->t('Save lineage: @save_lineage', [
'@save_lineage' => empty($settings['save_lineage']) ? $no : $yes,
]);
$summary[] = $this
->t('Level labels: @level_labels', [
'@level_labels' => empty($settings['level_labels']) ? $none : $this
->getTranslatedLevelLabels(),
]);
return $summary;
}