本文整理汇总了PHP中Drupal\Core\Config\Entity\ConfigEntityListBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigEntityListBuilder类的具体用法?PHP ConfigEntityListBuilder怎么用?PHP ConfigEntityListBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigEntityListBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRow
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity)
{
$row = [];
$row['name'] = $entity->label();
$row['type'] = $entity->id();
return $row + parent::buildRow($entity);
}
示例2: buildRow
/**
* {@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);
}
示例3: buildRow
/**
* {@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);
}
示例4: render
/**
* 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;
}
示例5: getOperations
/**
* {@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;
}
示例6: buildRow
/**
* {@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);
}
示例7: buildRow
/**
* {@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;
}
示例8: buildRow
/**
* {@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);
}
示例9: render
/**
* {@inheritdoc}
*/
public function render()
{
if (!empty($this->weightKey)) {
return $this->formBuilder()->getForm($this);
}
return parent::render();
}
示例10: buildRow
/**
* {@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);
}
示例11: getDefaultOperations
/**
* {@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;
}
示例12: buildRow
/**
* {@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);
}
示例13: buildRow
/**
* {@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);
}
示例14: buildRow
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity)
{
$row['label'] = $this->getLabel($entity);
$row['id'] = $entity->id();
$row['key'] = $entity->getEncryptionKey();
return $row + parent::buildRow($entity);
}
示例15: getDefaultOperations
/**
* {@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;
}