コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     /* @var $entity \Drupal\search_api_page\SearchApiPageInterface */
     $row['label'] = $entity->label();
     $path = $entity->getPath();
     if (!empty($path)) {
         $row['path'] = Link::fromTextAndUrl($entity->getPath(), Url::fromRoute('search_api_page.' . \Drupal::languageManager()->getDefaultLanguage()->getId() . '.' . $entity->id()));
     } else {
         $row['path'] = '';
     }
     return $row + parent::buildRow($entity);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     /** @var $entity SearchApiPage */
     $row['label'] = $entity->label();
     $row['path'] = \Drupal::l($entity->getPath(), Url::fromRoute('search_api_page.' . $entity->id()));
     return $row + parent::buildRow($entity);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 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);
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     $links = array('edit' => array('title' => t('Edit'), 'url' => Url::fromRoute('entity.empty_page.edit_form', ['empty_page' => $entity->getName()])), 'delete' => array('title' => t('Delete'), 'url' => Url::fromRoute('entity.empty_page.delete_form', ['empty_page' => $entity->getName()])));
     $row = array('title' => array('data' => $entity->getTitle()), 'name' => array('data' => $entity->getName()), 'path' => array('data' => array('#type' => 'link', '#title' => $entity->getPath(), '#url' => Url::fromUri('base://' . $entity->getPath()), '#options' => array('html' => TRUE))), 'operations' => array('data' => array('#type' => 'operations', '#links' => $links)));
     return $row + parent::buildRow($entity);
 }