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


PHP EntityViewDisplay::loadMultiple方法代码示例

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


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

示例1: image_post_update_image_style_dependencies

/**
 * Saves the image style dependencies into form and view display entities.
 */
function image_post_update_image_style_dependencies()
{
    // Merge view and form displays. Use array_values() to avoid key collisions.
    $displays = array_merge(array_values(EntityViewDisplay::loadMultiple()), array_values(EntityFormDisplay::loadMultiple()));
    /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface[] $displays */
    foreach ($displays as $display) {
        // Re-save each config entity to add missed dependencies.
        $display->save();
    }
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:image.post_update.php

示例2: responsive_image_post_update_recreate_dependencies

/**
 * Make responsive image formatters dependent on responsive image styles.
 */
function responsive_image_post_update_recreate_dependencies()
{
    $displays = EntityViewDisplay::loadMultiple();
    array_walk($displays, function (EntityViewDisplayInterface $entity_view_display) {
        $old_dependencies = $entity_view_display->getDependencies();
        $new_dependencies = $entity_view_display->calculateDependencies()->getDependencies();
        if ($old_dependencies !== $new_dependencies) {
            $entity_view_display->save();
        }
    });
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:14,代码来源:responsive_image.post_update.php

示例3: replaceImageStyle

 /**
  * Update field settings if the image style name is changed.
  *
  * @param \Drupal\image\ImageStyleInterface $style
  *   The image style.
  */
 protected static function replaceImageStyle(ImageStyleInterface $style)
 {
     if ($style->id() != $style->getOriginalId()) {
         // Loop through all entity displays looking for formatters / widgets using
         // the image style.
         foreach (EntityViewDisplay::loadMultiple() as $display) {
             foreach ($display->getComponents() as $name => $options) {
                 if (isset($options['type']) && $options['type'] == 'image' && $options['settings']['image_style'] == $style->getOriginalId()) {
                     $options['settings']['image_style'] = $style->id();
                     $display->setComponent($name, $options)->save();
                 }
             }
         }
         foreach (EntityViewDisplay::loadMultiple() as $display) {
             foreach ($display->getComponents() as $name => $options) {
                 if (isset($options['type']) && $options['type'] == 'image_image' && $options['settings']['preview_image_style'] == $style->getOriginalId()) {
                     $options['settings']['preview_image_style'] = $style->id();
                     $display->setComponent($name, $options)->save();
                 }
             }
         }
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:29,代码来源:ImageStyle.php


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