public SearchPageListBuilder::buildRow(EntityInterface $entity)
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()
File
- core/modules/search/src/SearchPageListBuilder.php, line 117
Class
- SearchPageListBuilder
- Defines a class to build a listing of search page entities.
Namespace
Drupal\search
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | public function buildRow(EntityInterface $entity ) { /** @var $entity \Drupal\search\SearchPageInterface */ $row [ 'label' ] = $entity ->label(); $row [ 'url' ][ '#markup' ] = 'search/' . $entity ->getPath(); // If the search page is active, link to it. if ( $entity ->status()) { $row [ 'url' ] = array ( '#type' => 'link' , '#title' => $row [ 'url' ], '#url' => Url::fromRoute( 'search.view_' . $entity ->id()), ); } $definition = $entity ->getPlugin()->getPluginDefinition(); $row [ 'plugin' ][ '#markup' ] = $definition [ 'title' ]; if ( $entity ->isDefaultSearch()) { $status = $this ->t( 'Default' ); } elseif ( $entity ->status()) { $status = $this ->t( 'Enabled' ); } else { $status = $this ->t( 'Disabled' ); } $row [ 'status' ][ '#markup' ] = $status ; if ( $entity ->isIndexable()) { $status = $entity ->getPlugin()->indexStatus(); $row [ 'progress' ][ '#markup' ] = $this ->t( '%num_indexed of %num_total indexed' , array ( '%num_indexed' => $status [ 'total' ] - $status [ 'remaining' ], '%num_total' => $status [ 'total' ] )); } else { $row [ 'progress' ][ '#markup' ] = $this ->t( 'Does not use index' ); } return $row + parent::buildRow( $entity ); } |
Please login to continue.