/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $entity->label(); $definition = $entity->getPlugin()->getPluginDefinition(); $row['plugin']['#markup'] = $definition['name']; $row['status']['#markup'] = $entity->status() ? $this->t('Enabled') : $this->t('Disabled'); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $theme = $entity->getTheme(); $plugin_definition = $entity->getPlugin()->getPluginDefinition(); $row['label'] = array('data' => $entity->label(), 'class' => 'table-filter-text-source'); $row['theme'] = array('data' => $this->themes[$theme]->info['name'], 'class' => 'table-filter-text-source'); $row['category'] = array('data' => $plugin_definition['category'], 'class' => 'table-filter-text-source'); $row['operations']['data'] = $this->buildOperations($entity); return $row; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $entity->label(); $row['id'] = $entity->id(); $row['type'] = $entity->get('type'); if ($plugin = $entity->getPlugin()) { $info = $plugin->getPluginDefinition(); $row['type'] = $info['title']; } return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { /** @var $entity \Drupal\search\SearchPageInterface */ if (in_array($operation, array('delete', 'disable')) && $entity->isDefaultSearch()) { return FALSE; } if ($operation == 'view') { if (!$entity->status()) { return FALSE; } $plugin = $entity->getPlugin(); if ($plugin instanceof AccessibleInterface) { return $plugin->access($operation, $account); } return TRUE; } return parent::checkAccess($entity, $operation, $langcode, $account); }
/** * {@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); }
/** * Updates the entity with the contents of a row. * * @param \Drupal\Core\Entity\EntityInterface $entity * The search page entity. * @param \Drupal\migrate\Row $row * The row object to update from. */ protected function updateEntity(EntityInterface $entity, Row $row) { $entity->setPlugin($row->getDestinationProperty('plugin')); $entity->getPlugin()->setConfiguration($row->getDestinationProperty('configuration')); }