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


PHP EntityManagerInterface::hasDefinition方法代碼示例

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


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

示例1: applies

 /**
  * {@inheritdoc}
  */
 public function applies($definition, $name, Route $route)
 {
     if (!empty($definition['type']) && strpos($definition['type'], 'entity:') === 0) {
         $entity_type = substr($definition['type'], strlen('entity:'));
         return $this->entityManager->hasDefinition($entity_type);
     }
     return FALSE;
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:11,代碼來源:EntityConverter.php

示例2: applies

 /**
  * {@inheritdoc}
  */
 public function applies($definition, $name, Route $route)
 {
     if (!empty($definition['type']) && strpos($definition['type'], 'entity_revision:') === 0) {
         $entity_type_id = substr($definition['type'], strlen('entity:'));
         if (strpos($definition['type'], '{') !== FALSE) {
             $entity_type_slug = substr($entity_type_id, 1, -1);
             return $name != $entity_type_slug && in_array($entity_type_slug, $route->compile()->getVariables(), TRUE);
         }
         return $this->entityManager->hasDefinition($entity_type_id);
     }
     return FALSE;
 }
開發者ID:sedurzu,項目名稱:ildeposito8,代碼行數:15,代碼來源:EntityRevisionConverter.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, PageInterface $page = NULL, $name = '')
 {
     $this->page = $page;
     $this->staticContext = $this->page->getStaticContext($name);
     // Allow the condition to add to the form.
     $form['label'] = ['#type' => 'textfield', '#title' => $this->t('Label'), '#default_value' => isset($this->staticContext['label']) ? $this->staticContext['label'] : '', '#required' => TRUE];
     $form['machine_name'] = ['#type' => 'machine_name', '#maxlength' => 64, '#required' => TRUE, '#machine_name' => ['exists' => [$this, 'contextExists'], 'source' => ['label']], '#default_value' => $name];
     $form['entity_type'] = ['#type' => 'select', '#title' => $this->t('Entity type'), '#options' => $this->entityManager->getEntityTypeLabels(TRUE), '#limit_validation_errors' => array(array('entity_type')), '#submit' => ['::rebuildSubmit'], '#executes_submit_callback' => TRUE, '#ajax' => array('callback' => '::updateEntityType', 'wrapper' => 'add-static-context-wrapper', 'method' => 'replace')];
     $entity = NULL;
     if ($form_state->hasValue('entity_type')) {
         $entity_type = $form_state->getValue('entity_type');
         if ($this->staticContext['value']) {
             $entity = $this->entityManager->loadEntityByUuid($entity_type, $this->staticContext['value']);
         }
     } elseif (!empty($this->staticContext['type'])) {
         list(, $entity_type) = explode(':', $this->staticContext['type']);
         $entity = $this->entityManager->loadEntityByUuid($entity_type, $this->staticContext['value']);
     } elseif ($this->entityManager->hasDefinition('node')) {
         $entity_type = 'node';
     } else {
         $entity_type = 'user';
     }
     $form['entity_type']['#default_value'] = $entity_type;
     $form['selection'] = ['#type' => 'entity_autocomplete', '#prefix' => '<div id="add-static-context-wrapper">', '#suffix' => '</div>', '#required' => TRUE, '#target_type' => $entity_type, '#default_value' => $entity, '#title' => $this->t('Select entity')];
     $form['actions'] = ['#type' => 'actions'];
     $form['actions']['submit'] = ['#type' => 'submit', '#value' => $this->submitButtonText(), '#button_type' => 'primary'];
     return $form;
 }
開發者ID:pulibrary,項目名稱:recap,代碼行數:31,代碼來源:StaticContextFormBase.php

示例4: remove

 /**
  * {@inheritdoc}
  */
 public function remove()
 {
     parent::remove();
     if ($this->entityManager->hasDefinition('block')) {
         $plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id'];
         foreach ($this->entityManager->getStorage('block')->loadByProperties(['plugin' => $plugin_id]) as $block) {
             $block->delete();
         }
     }
 }
開發者ID:ravibarnwal,項目名稱:laraitassociate.in,代碼行數:13,代碼來源:Block.php

示例5: hasDefinition

 /**
  * {@inheritdoc}
  */
 public function hasDefinition($plugin_id)
 {
     return $this->entityManager->hasDefinition($plugin_id);
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:7,代碼來源:EntityManagerWrapper.php


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