Commit f255925a authored by borisson_'s avatar borisson_ Committed by StryKaizer

Issue #2937281 by borisson_: Display facets' machine name on the facets overview page

parent f684befe
...@@ -91,6 +91,7 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -91,6 +91,7 @@ class FacetListBuilder extends DraggableListBuilder {
public function buildHeader() { public function buildHeader() {
$header = [ $header = [
'type' => $this->t('Type'), 'type' => $this->t('Type'),
'machine_name' => $this->t('Machine name'),
'title' => [ 'title' => [
'data' => $this->t('Title'), 'data' => $this->t('Title'),
], ],
...@@ -103,10 +104,9 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -103,10 +104,9 @@ class FacetListBuilder extends DraggableListBuilder {
*/ */
public function buildRow(EntityInterface $entity) { public function buildRow(EntityInterface $entity) {
/** @var \Drupal\facets\FacetInterface $entity */ /** @var \Drupal\facets\FacetInterface $entity */
$facet = $entity;
$facet_configs = \Drupal::entityTypeManager() $facet_configs = \Drupal::entityTypeManager()
->getStorage('facets_facet') ->getStorage('facets_facet')
->load($facet->getConfigTarget()); ->load($entity->getConfigTarget());
$row = [ $row = [
'type' => [ 'type' => [
'#theme_wrappers' => [ '#theme_wrappers' => [
...@@ -117,16 +117,17 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -117,16 +117,17 @@ class FacetListBuilder extends DraggableListBuilder {
'#type' => 'markup', '#type' => 'markup',
'#markup' => 'Facet', '#markup' => 'Facet',
], ],
'machine_name' => ['#markup' => $entity->id()],
'title' => [ 'title' => [
'#type' => 'link', '#type' => 'link',
'#title' => $facet_configs->get('name'), '#title' => $facet_configs->get('name'),
'#suffix' => '<div>' . $entity->getFieldAlias() . ' - ' . $facet->getWidget()['type'] . '</div>', '#suffix' => '<div>' . $entity->getFieldAlias() . ' - ' . $entity->getWidget()['type'] . '</div>',
'#attributes' => [ '#attributes' => [
'class' => ['search-api-title'], 'class' => ['search-api-title'],
], ],
] + $facet->toUrl('edit-form')->toRenderArray(), ] + $entity->toUrl('edit-form')->toRenderArray(),
'#attributes' => [ '#attributes' => [
'title' => $this->t('ID: @name', ['@name' => $facet->id()]), 'title' => $this->t('ID: @name', ['@name' => $entity->id()]),
'class' => [ 'class' => [
'facet', 'facet',
], ],
...@@ -139,8 +140,6 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -139,8 +140,6 @@ class FacetListBuilder extends DraggableListBuilder {
* Builds an array of facet summary for display in the overview. * Builds an array of facet summary for display in the overview.
*/ */
public function buildFacetSummaryRow(FacetsSummaryInterface $entity) { public function buildFacetSummaryRow(FacetsSummaryInterface $entity) {
/** @var \Drupal\facets\FacetInterface $entity */
$facet = $entity;
$row = parent::buildRow($entity); $row = parent::buildRow($entity);
return [ return [
'type' => [ 'type' => [
...@@ -152,6 +151,7 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -152,6 +151,7 @@ class FacetListBuilder extends DraggableListBuilder {
'#type' => 'markup', '#type' => 'markup',
'#markup' => 'Facets Summary', '#markup' => 'Facets Summary',
], ],
'machine_name' => ['#markup' => $entity->id()],
'title' => [ 'title' => [
'#theme_wrappers' => [ '#theme_wrappers' => [
'container' => [ 'container' => [
...@@ -159,17 +159,17 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -159,17 +159,17 @@ class FacetListBuilder extends DraggableListBuilder {
], ],
], ],
'#type' => 'link', '#type' => 'link',
'#title' => $facet->label(), '#title' => $entity->label(),
'#attributes' => [ '#attributes' => [
'class' => ['search-api-title'], 'class' => ['search-api-title'],
], ],
'#wrapper_attributes' => [ '#wrapper_attributes' => [
'colspan' => 2, 'colspan' => 2,
], ],
] + $facet->toUrl('edit-form')->toRenderArray(), ] + $entity->toUrl('edit-form')->toRenderArray(),
'operations' => $row['operations'], 'operations' => $row['operations'],
'#attributes' => [ '#attributes' => [
'title' => $this->t('ID: @name', ['@name' => $facet->id()]), 'title' => $this->t('ID: @name', ['@name' => $entity->id()]),
'class' => [ 'class' => [
'facet', 'facet',
], ],
...@@ -200,7 +200,7 @@ class FacetListBuilder extends DraggableListBuilder { ...@@ -200,7 +200,7 @@ class FacetListBuilder extends DraggableListBuilder {
'#type' => 'markup', '#type' => 'markup',
'#markup' => $facet_source['id'], '#markup' => $facet_source['id'],
'#wrapper_attributes' => [ '#wrapper_attributes' => [
'colspan' => 2, 'colspan' => 3,
], ],
], ],
'operations' => [ 'operations' => [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment