final class Update200 in Lightning Media 8.4
Same name and namespace in other branches
- 8.2 src/Update/Update200.php \Drupal\lightning_media\Update\Update200
- 8.3 src/Update/Update200.php \Drupal\lightning_media\Update\Update200
Contains optional updates targeting Lightning Media 2.0.0.
Plugin annotation
@Update("2.0.0");
Hierarchy
- class \Drupal\lightning_media\Update\Update200 implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of Update200
File
- src/
Update/ Update200.php, line 16
Namespace
Drupal\lightning_media\UpdateView source
final class Update200 implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Update200 constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation
* (optional) The string translation service.
*/
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $translation = NULL) {
$this->configFactory = $config_factory;
if ($translation) {
$this
->setStringTranslation($translation);
}
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'), $container
->get('string_translation'));
}
/**
* 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.
*/
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();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
Update200:: |
protected | property | The config factory service. | |
Update200:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Update200:: |
public | function | Renames the Media overview page's Source filter. | |
Update200:: |
public | function | Update200 constructor. |