コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function access(AccountInterface $account)
 {
     $bundles = $this->entityManager->getBundleInfo($this->getEntityType());
     if ($this->options['expose']['hide_single_bundle'] && count($bundles) <= 1) {
         return FALSE;
     }
     return parent::access($account);
 }
コード例 #2
0
ファイル: EntityBundle.php プロジェクト: marmouset/drupal
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['expose']['hide_single_bundle'] = ['#type' => 'checkbox', '#title' => t('Hide if there\'s only one bundle.'), '#default_value' => $this->options['expose']['hide_single_bundle']];
 }