public function MarkerLayerGroup::renderGrouping in Leaflet 8
Same name and namespace in other branches
- 2.1.x modules/leaflet_views/src/Plugin/views/style/MarkerLayerGroup.php \Drupal\leaflet_views\Plugin\views\style\MarkerLayerGroup::renderGrouping()
- 2.0.x modules/leaflet_views/src/Plugin/views/style/MarkerLayerGroup.php \Drupal\leaflet_views\Plugin\views\style\MarkerLayerGroup::renderGrouping()
Group records as needed for rendering.
Parameters
$records: An array of records from the view to group.
$groupings: An array of grouping instructions on which fields to group. If empty, the result set will be given a single group with an empty string as a label.
$group_rendered: Boolean value whether to use the rendered or the raw field value for grouping. If set to NULL the return is structured as before Views 7.x-3.0-rc2. After Views 7.x-3.0 this boolean is only used if $groupings is an old-style string or if the rendered option is missing for a grouping instruction.
Return value
The grouped record set. A nested set structure is generated if multiple grouping fields are used.
array(
'grouping_field_1:grouping_1' => array(
'group' => 'grouping_field_1:content_1',
'level' => 0,
'rows' => array(
'grouping_field_2:grouping_a' => array(
'group' => 'grouping_field_2:content_a',
'level' => 1,
'rows' => array(
$row_index_1 => $row_1,
$row_index_2 => $row_2,
),
),
),
),
'grouping_field_1:grouping_2' => array(),
);
Overrides StylePluginBase::renderGrouping
File
- modules/
leaflet_views/ src/ Plugin/ views/ style/ MarkerLayerGroup.php, line 29
Class
- MarkerLayerGroup
- Style plugin to render leaflet features in layer groups.
Namespace
Drupal\leaflet_views\Plugin\views\styleCode
public function renderGrouping($records, $groupings = [], $group_rendered = NULL) {
$sets = parent::renderGrouping($records, $groupings, $group_rendered);
if (!$groupings) {
// Set group label to display label, if empty.
$attachment_title = $this->view
->getDisplay()
->getOption('title');
$sets['']['group'] = $attachment_title ? $attachment_title : $this
->t('Label missing');
}
return $sets;
}