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


PHP StylePluginBase::render方法代码示例

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


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

示例1: render

 /**
  * Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::render().
  */
 public function render()
 {
     if (!empty($this->view->live_preview)) {
         return parent::render();
     }
     // Group the rows according to the grouping field, if specified.
     $sets = $this->renderGrouping($this->view->result, $this->options['grouping']);
     // Grab the alias of the 'id' field added by
     // entity_reference_plugin_display.
     $id_field_alias = $this->view->storage->get('base_field');
     // @todo We don't display grouping info for now. Could be useful for select
     // widget, though.
     $results = array();
     $this->view->row_index = 0;
     foreach ($sets as $records) {
         foreach ($records as $values) {
             // Sanitize HTML, remove line breaks and extra whitespace.
             $output = $this->view->rowPlugin->render($values);
             $output = drupal_render($output);
             $results[$values->{$id_field_alias}] = Xss::filterAdmin(preg_replace('/\\s\\s+/', ' ', str_replace("\n", '', $output)));
             $this->view->row_index++;
         }
     }
     unset($this->view->row_index);
     return $results;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:29,代码来源:EntityReference.php

示例2: render

 /**
  * {@inheritdoc}
  */
 public function render()
 {
     // Group the rows according to the grouping field, if specified.
     $sets = parent::render();
     // Render each group separately and concatenate.
     $output = $sets;
     foreach ($sets as $key => &$set) {
         // Add caption field if chosen.
         if (!empty($this->options['captionfield'])) {
             $caption_field = $this->options['captionfield'];
             foreach ($set['#rows'] as $index => $row) {
                 $set['#rows'][$index]['#caption'] = $this->rendered_fields[$index][$caption_field];
             }
         }
         $output[$key] = ['#theme' => $this->themeFunctions(), '#view' => $this->view, '#options' => $this->options, '#rows' => $set['#rows'], '#title' => $set['#title']];
     }
     return $output;
 }
开发者ID:r-daneelolivaw,项目名称:chalk,代码行数:21,代码来源:FlexSlider.php


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