X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fembed%2Fsrc%2FEmbedButtonListBuilder.php;fp=web%2Fmodules%2Fcontrib%2Fembed%2Fsrc%2FEmbedButtonListBuilder.php;h=629a1fbe1ddcf9f6dc18c866ac2711d26fa2e455;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/embed/src/EmbedButtonListBuilder.php b/web/modules/contrib/embed/src/EmbedButtonListBuilder.php new file mode 100644 index 000000000..629a1fbe1 --- /dev/null +++ b/web/modules/contrib/embed/src/EmbedButtonListBuilder.php @@ -0,0 +1,49 @@ +t('Embed button'); + $header['embed_type'] = $this->t('Embed type'); + $header['icon'] = [ + 'data' => $this->t('Icon'), + 'class' => [RESPONSIVE_PRIORITY_LOW], + ]; + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /** @var \Drupal\embed\EmbedButtonInterface $entity */ + $row = []; + $row['label'] = $entity->label(); + $row['embed_type'] = $entity->getTypeLabel(); + if ($icon_url = $entity->getIconUrl()) { + $row['icon']['data'] = [ + '#theme' => 'image', + '#uri' => $icon_url, + '#alt' => $this->t('Icon for the @label button.', ['@label' => $entity->label()]), + ]; + } + else { + $row['icon'] = $this->t('None'); + } + + return $row + parent::buildRow($entity); + } + +}