本文整理汇总了PHP中Drupal\Core\Config\Entity\ConfigEntityListBuilder::getOperations方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigEntityListBuilder::getOperations方法的具体用法?PHP ConfigEntityListBuilder::getOperations怎么用?PHP ConfigEntityListBuilder::getOperations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Entity\ConfigEntityListBuilder
的用法示例。
在下文中一共展示了ConfigEntityListBuilder::getOperations方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getOperations
/**
* @inheritDoc
*/
public function getOperations(EntityInterface $entity)
{
$operations = parent::getOperations($entity);
if (!empty($operations['edit'])) {
/** @var \Drupal\Core\Url $edit */
$edit = $operations['edit']['url'];
$edit->setRouteParameters(['machine_name' => $entity->id(), 'step' => 'general']);
}
return $operations;
}
示例3: getOperations
/**
* {@inheritdoc}
*/
public function getOperations(EntityInterface $entity)
{
$operations = parent::getOperations($entity);
// Global and entity defaults can be reverted but not deleted.
if (strpos($entity->id(), '__') === FALSE) {
unset($operations['delete']);
$operations['revert'] = array('title' => t('Revert'), 'weight' => $operations['edit']['weight'] + 1, 'url' => $entity->urlInfo('revert-form'));
}
return $operations;
}
示例4: getOperations
/**
* {@inheritdoc}
*/
public function getOperations(EntityInterface $entity)
{
$operations = parent::getOperations($entity);
foreach (array_keys($operations) as $operation) {
// This is a translation UI for translators. Show the translation
// operation only.
if (!($operation == 'translate')) {
unset($operations[$operation]);
}
}
return $operations;
}
示例5: getOperations
/**
* {@inheritdoc}
*/
public function getOperations(EntityInterface $entity)
{
$operations = parent::getOperations($entity);
$operations['delete']['href'] = 'admin/config/domain/alias/delete/' . $entity->id();
return $operations;
}
示例6: getOperations
/**
* {@inheritdoc}
*/
public function getOperations(EntityInterface $entity)
{
$operations = parent::getOperations($entity);
if (isset($operations['translate'])) {
unset($operations['translate']);
}
return $operations;
}