本文整理汇总了PHP中Drupal\Core\Entity\EntityListBuilder::getDefaultOperations方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityListBuilder::getDefaultOperations方法的具体用法?PHP EntityListBuilder::getDefaultOperations怎么用?PHP EntityListBuilder::getDefaultOperations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityListBuilder
的用法示例。
在下文中一共展示了EntityListBuilder::getDefaultOperations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
$operations['edit']['title'] = $this->t('Edit items');
return $operations;
}
示例2: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['query']['destination'] = 'admin/structure/block/block-content';
}
return $operations;
}
示例3: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if ($entity->access('update') && $entity->hasLinkTemplate('reassign-form')) {
$operations['reassign'] = array('title' => $this->t('Reassign'), 'weight' => 20, 'url' => $entity->toUrl('reassign-form'));
}
return $operations;
}
示例4: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['query']['destination'] = $entity->url('collection');
}
return $operations;
}
示例5: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['title'] = t('Edit');
}
$operations['view'] = array('title' => t('View'), 'url' => $entity->toUrl());
return $operations;
}
示例6: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($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;
}
示例7: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
/** @var \Drupal\tmgmt_local\Entity\LocalTaskItem $entity */
$operations = parent::getDefaultOperations($entity);
if ($entity->access('view', \Drupal::currentUser()) && $entity->getTask()->getAssignee()->id() == \Drupal::currentUser()->id()) {
if ($entity->isPending()) {
$operations['translate'] = ['url' => $entity->urlInfo(), 'title' => t('Translate'), 'weight' => 0];
} else {
$operations['view'] = ['url' => $entity->urlInfo(), 'title' => t('View'), 'weight' => 0];
}
}
return $operations;
}
示例8: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if ($entity->isSubmittable() && $entity->access('submit')) {
$operations['submit'] = array('url' => $entity->urlInfo()->setOption('query', array('destination' => Url::fromRoute('<current>')->getInternalPath())), 'title' => t('Submit'), 'weight' => -10);
} else {
$operations['manage'] = array('url' => $entity->urlInfo()->setOption('query', array('destination' => Url::fromRoute('<current>')->getInternalPath())), 'title' => t('Manage'), 'weight' => -10);
}
if ($entity->isAbortable() && $entity->access('submit')) {
$operations['abort'] = array('url' => $entity->urlInfo('abort-form')->setOption('query', array('destination' => Url::fromRoute('<current>')->getInternalPath())), 'title' => t('Abort'), 'weight' => 10);
}
return $operations;
}
示例9: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
/** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
$operations = parent::getDefaultOperations($entity);
if ($this->entityType->hasKey('status')) {
if (!$entity->status() && $entity->hasLinkTemplate('enable')) {
$operations['enable'] = array('title' => t('Enable'), 'weight' => -10, 'url' => $entity->urlInfo('enable'));
} elseif ($entity->hasLinkTemplate('disable')) {
$operations['disable'] = array('title' => t('Disable'), 'weight' => 40, 'url' => $entity->urlInfo('disable'));
}
}
return $operations;
}
示例10: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if ($entity->getCountTranslated() > 0 && $entity->access('accept')) {
$operations['review'] = array('url' => $entity->urlInfo(), 'title' => t('Review'));
} elseif (!$entity->getJob()->isUnprocessed()) {
$operations['view'] = array('url' => $entity->urlInfo(), 'title' => t('View'));
}
// Display abort button on active or needs review job items.
if ($entity->isActive() || $entity->isNeedsReview()) {
$operations['abort'] = array('url' => $entity->urlInfo('abort-form')->setOption('query', array('destination' => Url::fromRoute('<current>')->getInternalPath())), 'title' => t('Abort'), 'weight' => 10);
}
return $operations;
}
示例11: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['query']['destination'] = $entity->url('collection');
}
if (isset($operations['delete'])) {
$operations['delete']['query']['destination'] = $entity->url('collection');
}
if ($entity->access('version-history') && $entity->hasLinkTemplate('version-history')) {
$operations['version-history'] = ['title' => $this->t('Version history'), 'weight' => 10, 'url' => $entity->urlInfo('version-history')];
}
return $operations;
}
示例12: getDefaultOperations
/**
* {@inheritdoc}
*/
public function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
/* @var $transition WorkflowTransitionInterface */
$transition = $entity;
if (isset($operations['edit'])) {
$destination = \Drupal::destination()->getAsArray();
$operations['edit']['query'] = $destination;
}
return $operations;
}
示例13: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
$destination = $this->redirectDestination->getAsArray();
foreach ($operations as $key => $operation) {
$operations[$key]['query'] = $destination;
}
return $operations;
}
示例14: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
$operations['edit']['weight'] = 0;
if ($entity->access('import') && $entity->hasLinkTemplate('import-form')) {
$operations['import'] = ['title' => $this->t('Import'), 'weight' => 2, 'url' => $entity->urlInfo('import-form')];
}
if ($entity->access('clear') && $entity->hasLinkTemplate('clear-form')) {
$operations['clear'] = ['title' => $this->t('Delete items'), 'weight' => 3, 'url' => $entity->urlInfo('clear-form')];
}
$destination = $this->redirectDestination->getAsArray();
foreach ($operations as $key => $operation) {
$operations[$key]['query'] = $destination;
}
return $operations;
}
示例15: getDefaultOperations
/**
* {@inheritdoc}
*/
protected function getDefaultOperations(EntityInterface $entity)
{
$operations = parent::getDefaultOperations($entity);
if ($entity->access('view') && $entity->hasLinkTemplate('canonical')) {
$operations['view'] = array('title' => $this->t('View'), 'weight' => 0, 'url' => $entity->urlInfo('canonical'));
}
return $operations;
}