当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManagerInterface::getViewModeOptions方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\EntityManagerInterface::getViewModeOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManagerInterface::getViewModeOptions方法的具体用法?PHP EntityManagerInterface::getViewModeOptions怎么用?PHP EntityManagerInterface::getViewModeOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\EntityManagerInterface的用法示例。


在下文中一共展示了EntityManagerInterface::getViewModeOptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: blockForm

 /**
  * Overrides \Drupal\Core\Block\BlockBase::blockForm().
  *
  * Adds body and description fields to the block configuration form.
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $options = $this->entityManager->getViewModeOptions('block_content');
     $form['view_mode'] = array('#type' => 'select', '#options' => $options, '#title' => $this->t('View mode'), '#description' => $this->t('Output the block in this view mode.'), '#default_value' => $this->configuration['view_mode'], '#access' => count($options) > 1);
     $form['title']['#description'] = $this->t('The title of the block as shown to the user.');
     return $form;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:12,代码来源:BlockContentBlock.php

示例2: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = array('#type' => 'select', '#options' => $this->entityManager->getViewModeOptions($this->entityType), '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode']);
     $label = $this->entityManager->getDefinition($this->entityType)->getLabel();
     $target = $this->options['target'];
     // If the target does not contain tokens, try to load the entity and
     // display the entity ID to the admin form user.
     // @todo Use a method to check for tokens in
     //   https://www.drupal.org/node/2396607.
     if (strpos($this->options['target'], '{{') === FALSE) {
         // @todo If the entity does not exist, this will will show the config
         //   target identifier. Decide if this is the correct behavior in
         //   https://www.drupal.org/node/2415391.
         if ($target_entity = $this->entityManager->loadEntityByConfigTarget($this->entityType, $this->options['target'])) {
             $target = $target_entity->id();
         }
     }
     $form['target'] = ['#title' => $this->t('@entity_type_label ID', ['@entity_type_label' => $label]), '#type' => 'textfield', '#default_value' => $target];
     $form['bypass_access'] = array('#type' => 'checkbox', '#title' => $this->t('Bypass access checks'), '#description' => $this->t('If enabled, access permissions for rendering the entity are not checked.'), '#default_value' => !empty($this->options['bypass_access']));
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:24,代码来源:Entity.php

示例3: blockForm

 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form['view_mode'] = ['#type' => 'select', '#options' => $this->entityManager->getViewModeOptions($this->getDerivativeId()), '#title' => $this->t('View mode'), '#default_value' => $this->configuration['view_mode']];
     return $form;
 }
开发者ID:AllieRays,项目名称:debugging-drupal-8,代码行数:8,代码来源:EntityView.php

示例4: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = ['#type' => 'select', '#options' => $this->entityManager->getViewModeOptions($this->getEntityTypeId()), '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode']];
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:8,代码来源:RenderedEntity.php

示例5: getViewModeOptions

 /**
  * {@inheritdoc}
  */
 public function getViewModeOptions($entity_type_id, $include_disabled = FALSE)
 {
     return $this->entityManager->getViewModeOptions($entity_type_id, $include_disabled);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:EntityManagerWrapper.php


注:本文中的Drupal\Core\Entity\EntityManagerInterface::getViewModeOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。