public function Update200::renameMediaOverviewTypeFilter in Lightning Media 8.4
Same name and namespace in other branches
- 8.2 src/Update/Update200.php \Drupal\lightning_media\Update\Update200::renameMediaOverviewTypeFilter()
- 8.3 src/Update/Update200.php \Drupal\lightning_media\Update\Update200::renameMediaOverviewTypeFilter()
Renames the Media overview page's Source filter.
@update
@ask Do you want to rename the "Media Type" filter label on the Media overview page to "Type"? This will also change the filter's URL identifier to 'type' and will make the label and URL identifier consistent with new installs of Lightning.
File
- src/
Update/ Update200.php, line 63
Class
- Update200
- Contains optional updates targeting Lightning Media 2.0.0.
Namespace
Drupal\lightning_media\UpdateCode
public function renameMediaOverviewTypeFilter() {
$view = $this->configFactory
->getEditable('views.view.media');
if ($view
->isNew()) {
return;
}
$property = 'display.default.display_options.filters.bundle';
$filter = $view
->get($property);
if ($filter) {
$filter['expose']['label'] = 'Type';
$filter['expose']['identifier'] = 'type';
$view
->set($property, $filter)
->save();
}
}