public function FacetListBuilder::buildRow in Facets 8
Builds a row for an entity in the entity listing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
Return value
array A render array structure of fields for this entity.
Overrides DraggableListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
1 call to FacetListBuilder::buildRow()
- FacetListBuilder::buildForm in src/
FacetListBuilder.php - Form constructor.
File
- src/
FacetListBuilder.php, line 105
Class
- FacetListBuilder
- Builds a listing of facet entities.
Namespace
Drupal\facetsCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\facets\FacetInterface $entity */
$facet_configs = \Drupal::entityTypeManager()
->getStorage('facets_facet')
->load($entity
->getConfigTarget());
$row = [
'type' => [
'#theme_wrappers' => [
'container' => [
'#attributes' => [
'class' => 'facets-type',
],
],
],
'#type' => 'markup',
'#markup' => 'Facet',
],
'machine_name' => [
'#markup' => $entity
->id(),
],
'title' => [
'#type' => 'link',
'#title' => $facet_configs
->get('name'),
'#suffix' => '<div>' . $entity
->getFieldAlias() . ' - ' . $entity
->getWidget()['type'] . '</div>',
'#attributes' => [
'class' => [
'search-api-title',
],
],
] + $entity
->toUrl('edit-form')
->toRenderArray(),
'#attributes' => [
'title' => $this
->t('ID: @name', [
'@name' => $entity
->id(),
]),
'class' => [
'facet',
],
],
];
return array_merge_recursive($row, parent::buildRow($entity));
}