public function Update240::renameSaveToMyMediaLibrary in Lightning Media 8.4
Same name and namespace in other branches
- 8.2 src/Update/Update240.php \Drupal\lightning_media\Update\Update240::renameSaveToMyMediaLibrary()
- 8.3 src/Update/Update240.php \Drupal\lightning_media\Update\Update240::renameSaveToMyMediaLibrary()
Renames the "Save to my media library" field of all media types.
@update
@ask Do you want to rename the "Save to my media library" field of all media types to "Show in media library"?
File
- src/
Update/ Update240.php, line 62
Class
- Update240
- Contains optional updates targeting Lightning Media 2.4.0.
Namespace
Drupal\lightning_media\UpdateCode
public function renameSaveToMyMediaLibrary() {
/** @var \Drupal\field\Entity\FieldConfig[] $field_configs */
$field_configs = $this->fieldConfigStorage
->loadByProperties([
'field_name' => 'field_media_in_library',
'entity_type' => 'media',
]);
foreach ($field_configs as $field_config) {
$field_config
->setLabel('Show in media library')
->setSettings([
'on_label' => 'Shown in media library',
'off_label' => 'Hidden in media library',
])
->save();
}
}