Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292508

Improve DX when writing style plugins

$
0
0

Problem/Motivation

From #1876964-34: Improve DX when writing style plugins by adding a renderSingle function

<?php
     
//What if I don't want to use theme_views_view_grouping in my style plugin.
   
$theme_functions = views_theme_functions('views_view_grouping', $this->view, $this->view->display_handler->display);
    foreach (
$sets as $set) {
     
$row = reset($set['rows']);
     
// Render as a grouping set.
     
if (is_array($row) && isset($row['group'])) {
       
$output[] = array(
         
'#theme'=> $theme_functions,
         
'#view'=> $this->view,
         
'#grouping'=> $this->options['grouping'][$level],
         
'#grouping_level'=> $level,
         
'#rows'=> $set['rows'],
         
'#title'=> $set['group'],
        );
      }
?>

Proposed resolution

Replace views_view_grouping with $this->grouping_theme.
Or move $theme_functions = views_theme_functions('views_view_grouping', $this->view, $this->view->display_handler->display); to helper function.

Remaining tasks

Better Title.
Finalize the approach.
Create a patch.

User interface changes

None.

API changes

None

#1876964: Improve DX when writing style plugins by adding a renderSingle function
#1961702: Rename renderSingleGroup to renderRowGroup


Viewing all articles
Browse latest Browse all 292508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>