/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row = []; $row['name'] = $entity->label(); $row['type'] = $entity->id(); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['year'] = $entity->id(); $row['start_date'] = $entity->start_date; $row['end_date'] = $entity->end_date; return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); $row['id'] = $entity->id(); // You probably want a few more properties here... return $row + parent::buildRow($entity); }
/** * Adds some descriptive text to our entity list. * * @return array * Renderable array. */ public function render() { $build['description'] = array('#markup' => $this->t("<p>This is a list of the countries currently" . " defined for use on your Drupal site. This country data adheres to" . " the @iso standard for country and zone naming used by payment" . " providers and package couriers.</p>" . "<p>To make a country available for use at checkout or in a user's" . " address book, 'Enable' the country using the widget in the" . " 'Operations' for that country. You may also 'Disable' a country to" . " prevent customers from selecting that country as a billing or" . " shipping address.</p>" . "<p>You may also use the 'Edit' widget in the 'Operations' column to" . " edit a country's name or address format.</p>", ['@iso' => Link::fromTextAndUrl('ISO 3166', Url::fromUri('http://en.wikipedia.org/wiki/ISO_3166'))->toString()])); $build += parent::render(); $build['table']['#empty'] = $this->t('No countries have been configured yet.'); return $build; }
/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); // Place the edit operation after the operations added by field_ui.module // which have the weights 15, 20, 25. if (isset($operations['edit'])) { $operations['edit'] = [ 'title' => t('Edit'), 'weight' => 30, 'url' => $entity->urlInfo('edit-form') ]; } if (isset($operations['delete'])) { $operations['delete'] = [ 'title' => t('Delete'), 'weight' => 35, 'url' => $entity->urlInfo('delete-form') ]; } // Sort the operations to normalize link order. uasort($operations, [ 'Drupal\Component\Utility\SortArray', 'sortByWeightElement' ]); return $operations; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { global $base_url; $block_url = Url::fromRoute('block.admin_display'); $page_url = Url::fromUri($base_url . '/' . $entity->settings['path']); $modes = NULL; $mc_lists = mailchimp_get_lists(); switch ($entity->mode) { case MAILCHIMP_SIGNUP_BLOCK: $modes = \Drupal::l(t('Block'), $block_url); $block_only = TRUE; break; case MAILCHIMP_SIGNUP_PAGE: $modes = \Drupal::l(t('Page'), $page_url); break; case MAILCHIMP_SIGNUP_BOTH: $modes = \Drupal::l(t('Block'), $block_url) . ' and ' . \Drupal::l(t('Page'), $page_url); break; } $list_labels = array(); foreach ($entity->mc_lists as $list_id) { if (!empty($list_id)) { $list_url = Url::fromUri('https://admin.mailchimp.com/lists/dashboard/overview?id=' . $mc_lists[$list_id]['web_id'], array('attributes' => array('target' => '_blank'))); $list_labels[] = \Drupal::l($mc_lists[$list_id]['name'], $list_url); } } $row['label'] = $this->getLabel($entity) . ' (Machine name: ' . $entity->id() . ')'; $row['display_modes'] = $modes; $row['lists'] = implode(', ', $list_labels); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); $row['id'] = $entity->id(); // You probably want a few more properties here... $row += parent::buildRow($entity); $url = Url::fromRoute( 'block.admin_display', array(), ['query' => ['block_visibility_group' => $row['id']]] ); /*$row['manage_blocks'] = array( '#type' => 'link', '#title' => 'Manage Blocks', // @todo Why does this crash? '#url' => $url, ); */ $row['operations']['data']['#links']['manage_blocks'] = [ 'title' => $this->t('Manage Blocks'), 'weight' => 80, 'url' => $url, ]; uasort($row['operations']['data']['#links'], '\Drupal\Component\Utility\SortArray::sortByWeightElement'); return $row; }
/** * {@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); }
/** * {@inheritdoc} */ public function render() { if (!empty($this->weightKey)) { return $this->formBuilder()->getForm($this); } return parent::render(); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); $redirect = $entity->getRedirect(); $row['redirect'] = empty($redirect) ? $this->t('None') : $redirect; return $row += parent::buildRow($entity); }
/** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */ $operations = parent::getDefaultOperations($entity); $operations['set_default'] = array('title' => t('Set Default'), 'weight' => -10, 'url' => $entity->urlInfo('set-default')); return $operations; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row = array(); $row['title'] = array('data' => $this->getLabel($entity), 'class' => array('menu-label')); $row['description'] = Xss::filterAdmin($entity->description); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->l($this->getLabel($entity), new Url('entity.question.add_form', array('question_type' => $entity->id(), 'quiz' => $this->getQuizId()))); $row['id'] = $entity->id(); // You probably want a few more properties here... return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); $row['id'] = $entity->id(); $row['key'] = $entity->getEncryptionKey(); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); if (isset($operations['edit'])) { $operations['edit']['title'] = t('Edit profile'); } $operations['matchers'] = [ 'title' => t('Manage matchers'), 'weight' => 10, 'url' => Url::fromRoute('linkit.matchers', [ 'linkit_profile' => $entity->id() ]), ]; $operations['attributes'] = [ 'title' => t('Manage attributes'), 'weight' => 20, 'url' => Url::fromRoute('linkit.attributes', [ 'linkit_profile' => $entity->id() ]), ]; return $operations; }
/** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { /** @var \Drupal\commerce_tax\Entity\TaxRateInterface $entity */ $operations = parent::getDefaultOperations($entity); $operations['rate_amounts'] = ['title' => $this->t('View rate amounts'), 'url' => Url::fromRoute('entity.commerce_tax_rate_amount.collection', ['commerce_tax_rate' => $entity->id()])]; return $operations; }
/** * {@inheritdoc} */ public function render() { $build = parent::render(); $build['#empty'] = $this->t('There are currently no blocktabs. <a href=":url">Add a new one</a>.', array( ':url' => $this->urlGenerator->generateFromRoute('blocktabs.add'), )); return $build; }
/** * Constructs a new FieldStorageConfigListBuilder object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) { parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id())); $this->entityManager = $entity_manager; $this->bundles = $bundle_info_service->getAllBundleInfo(); $this->fieldTypeManager = $field_type_manager; $this->fieldTypes = $this->fieldTypeManager->getDefinitions(); }
/** * {@inheritdoc} */ public function render() { $build['description'] = array('#markup' => $this->t("<p>This is a list of the tax rates currently" . " defined on your Drupal site.</p><p>You may use the 'Add a tax rate'" . " button to add a new rate, or use the widget in the 'Operations'" . " column to edit, delete, or clone existing tax rates.</p>")); $build += parent::render(); $build['table']['#empty'] = $this->t('No tax rates have been configured yet.'); $build['table']['#tabledrag'] = array(array('action' => 'order', 'relationship' => 'sibling', 'group' => 'uc-tax-method-weight')); return $build; }
/** * Gets this list's default operations. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity the operations are for. * * @return array * The array structure is identical to the return value of * self::getOperations(). */ public function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); if ($entity->access('backups') && $entity->hasLinkTemplate('backups')) { $operations['backups'] = array('title' => $this->t('List Backups'), 'weight' => 100, 'url' => $entity->toUrl('backups')); } return $operations; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { /** @var \Drupal\crm_core_match\Entity\Matcher $entity */ $row['label'] = $entity->label(); $row['description'] = $entity->getDescription(); $row['plugin'] = $entity->getPluginTitle(); return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['id'] = $entity->id(); $row['key'] = $entity->key; $row['user_uuid'] = $entity->user_uuid; // You probably want a few more properties here... return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { /** @var \Drupal\facets\FacetInterface $entity */ $row = parent::buildRow($entity); $status_label = $entity->status() ? $this->t('Enabled') : $this->t('Disabled'); $status_icon = array('#theme' => 'image', '#uri' => $entity->status() ? 'core/misc/icons/73b355/check.svg' : 'core/misc/icons/e32700/error.svg', '#width' => 18, '#height' => 18, '#alt' => $status_label, '#title' => $status_label); return array('data' => array('type' => array('data' => 'Facet', 'class' => array('facets-type')), 'title' => array('data' => array('#type' => 'link', '#title' => $entity->getName(), '#suffix' => '<div>' . $entity->getFieldAlias() . ' - ' . $entity->getWidget() . '</div>') + $entity->toUrl('edit-form')->toRenderArray(), 'class' => array('search-api-title')), 'status' => array('data' => $status_icon, 'class' => array('checkbox')), 'operations' => $row['operations']), 'title' => $this->t('ID: @name', array('@name' => $entity->id())), 'class' => array('facet')); }
/** * Constructs a new FieldStorageConfigListBuilder object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id())); $this->entityManager = $entity_manager; $this->bundles = entity_get_bundles(); $this->fieldTypeManager = $field_type_manager; $this->fieldTypes = $this->fieldTypeManager->getDefinitions(); }
/** * Defines the default operations. */ public function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); // Add an operation for adding a new entity object of this type. $url = new Url('mymodule.myentity.add', array('myentity_type' => $entity->id())); $operations['add_new'] = array('title' => $this->t('Add new My Entity'), 'weight' => 11, 'url' => $url); return $operations; }
/** * {@inheritdoc} */ public function load() { $entities = array(); foreach (parent::load() as $entity) { $entities[$entity->getTargetType()][] = $entity; } return $entities; }
/** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { $ops = parent::getDefaultOperations($entity); // Do not allow deletion of the default configuration. if ($entity->id() == 'default') { unset($ops['delete']); } return $ops; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); $row['provider'] = $entity->get('provider'); $row['consumer'] = $entity->get('consumer'); $row['enabled'] = $entity->get('status') ? 'Yes' : 'No'; // You probably want a few more properties here... return $row + parent::buildRow($entity); }
/** * {@inheritdoc} */ public function render() { $build = parent::render(); // Get the definition of the referring entity. $bundle_of_definition = $this->getBundleOfDefinition(); // Override the empty text. $build['table']['#empty'] = $this->t('There are no @label types yet.', ['@label' => $bundle_of_definition->getLabel()]); return $build; }
/** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { /* @var $entity \Drupal\rules\Entity\ReactionRuleConfig */ $row['id'] = $entity->id(); $row['label'] = $this->getLabel($entity); $row['description'] = $entity->getDescription(); $row['tags'] = implode(', ', $entity->getTags()); return $row + parent::buildRow($entity); }