public function AdministrativeArea::exposedInfo in Address 8
Tell the renderer about our exposed form. This only needs to be overridden for particularly complex forms. And maybe not even then.
Return value
array|null For standard exposed filters. An array with the following keys:
- operator: The $form key of the operator. Set to NULL if no operator.
- value: The $form key of the value. Set to NULL if no value.
- label: The label to use for this piece.
For grouped exposed filters. An array with the following keys:
- value: The $form key of the value. Set to NULL if no value.
- label: The label to use for this piece.
Overrides FilterPluginBase::exposedInfo
File
- src/
Plugin/ views/ filter/ AdministrativeArea.php, line 402
Class
- AdministrativeArea
- Filter by administrative area.
Namespace
Drupal\address\Plugin\views\filterCode
public function exposedInfo() {
$info = parent::exposedInfo();
if ($this->options['expose']['label_type'] == 'dynamic') {
$current_country = $this
->getCurrentCountry();
if (!empty($current_country)) {
$address_format = $this->addressFormatRepository
->get($current_country);
$labels = LabelHelper::getFieldLabels($address_format);
if (!empty($labels['administrativeArea'])) {
$info['label'] = $labels['administrativeArea'];
}
}
}
return $info;
}