當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityInterface::isDefaultSearch方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityInterface::isDefaultSearch方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityInterface::isDefaultSearch方法的具體用法?PHP EntityInterface::isDefaultSearch怎麽用?PHP EntityInterface::isDefaultSearch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityInterface的用法示例。


在下文中一共展示了EntityInterface::isDefaultSearch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkAccess

 /**
  * {@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);
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:21,代碼來源:SearchPageAccessController.php

示例2: checkAccess

 /**
  * {@inheritdoc}
  */
 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account)
 {
     /** @var $entity \Drupal\search\SearchPageInterface */
     if (in_array($operation, array('delete', 'disable'))) {
         if ($entity->isDefaultSearch()) {
             return AccessResult::forbidden()->addCacheableDependency($entity);
         } else {
             return parent::checkAccess($entity, $operation, $account)->addCacheableDependency($entity);
         }
     }
     if ($operation == 'view') {
         if (!$entity->status()) {
             return AccessResult::forbidden()->addCacheableDependency($entity);
         }
         $plugin = $entity->getPlugin();
         if ($plugin instanceof AccessibleInterface) {
             return $plugin->access($operation, $account, TRUE)->addCacheableDependency($entity);
         }
         return AccessResult::allowed()->addCacheableDependency($entity);
     }
     return parent::checkAccess($entity, $operation, $account);
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:25,代碼來源:SearchPageAccessControlHandler.php

示例3: buildRow

 /**
  * {@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);
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:30,代碼來源:SearchPageListBuilder.php


注:本文中的Drupal\Core\Entity\EntityInterface::isDefaultSearch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。