X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Flinkit%2Fsrc%2FProfileListBuilder.php;fp=web%2Fmodules%2Fcontrib%2Flinkit%2Fsrc%2FProfileListBuilder.php;h=562cd4a938627b6207c7d41e92611f91125b1907;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/linkit/src/ProfileListBuilder.php b/web/modules/contrib/linkit/src/ProfileListBuilder.php new file mode 100644 index 000000000..562cd4a93 --- /dev/null +++ b/web/modules/contrib/linkit/src/ProfileListBuilder.php @@ -0,0 +1,73 @@ + t('Description'), + 'class' => [RESPONSIVE_PRIORITY_MEDIUM], + ]; + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /** @var \Drupal\linkit\ProfileInterface $linkitProfile */ + $linkitProfile = $entity; + $row['label'] = $linkitProfile->label(); + $row['description']['data'] = ['#markup' => $linkitProfile->getDescription()]; + return $row + parent::buildRow($entity); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOperations(EntityInterface $entity) { + $operations = parent::getDefaultOperations($entity); + + if (isset($operations['edit'])) { + $operations['edit']['title'] = t('Edit profile'); + } + + $operations['matchers'] = [ + 'title' => t('Manage matchers'), + 'weight' => 10, + 'url' => Url::fromRoute('linkit.matchers', [ + 'linkit_profile' => $entity->id() + ]), + ]; + + $operations['attributes'] = [ + 'title' => t('Manage attributes'), + 'weight' => 20, + 'url' => Url::fromRoute('linkit.attributes', [ + 'linkit_profile' => $entity->id() + ]), + ]; + + return $operations; + } + +}