X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fconfig_translation%2Fsrc%2FController%2FConfigTranslationBlockListBuilder.php;fp=web%2Fcore%2Fmodules%2Fconfig_translation%2Fsrc%2FController%2FConfigTranslationBlockListBuilder.php;h=c226dfbd60a7ae9016e32d4c6183d2f3e9b7a26b;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php b/web/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php new file mode 100644 index 000000000..c226dfbd6 --- /dev/null +++ b/web/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php @@ -0,0 +1,99 @@ +themes = $theme_handler->listInfo(); + } + + /** + * {@inheritdoc} + */ + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + return new static( + $entity_type, + $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('theme_handler') + ); + } + + /** + * {@inheritdoc} + */ + public function getFilterLabels() { + $info = parent::getFilterLabels(); + + $info['placeholder'] = $this->t('Enter block, theme or category'); + $info['description'] = $this->t('Enter a part of the block, theme or category to filter by.'); + + return $info; + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $theme = $entity->getTheme(); + $plugin_definition = $entity->getPlugin()->getPluginDefinition(); + + $row['label'] = [ + 'data' => $entity->label(), + 'class' => 'table-filter-text-source', + ]; + + $row['theme'] = [ + 'data' => $this->themes[$theme]->info['name'], + 'class' => 'table-filter-text-source', + ]; + + $row['category'] = [ + 'data' => $plugin_definition['category'], + 'class' => 'table-filter-text-source', + ]; + + $row['operations']['data'] = $this->buildOperations($entity); + + return $row; + } + + /** + * {@inheritdoc} + */ + public function buildHeader() { + $header['label'] = $this->t('Block'); + $header['theme'] = $this->t('Theme'); + $header['category'] = $this->t('Category'); + $header['operations'] = $this->t('Operations'); + return $header; + } + + /** + * {@inheritdoc} + */ + public function sortRows($a, $b) { + return $this->sortRowsMultiple($a, $b, ['theme', 'category', 'label']); + } + +}