canGroup example

$form['#groups'] = $groups;
    // We don't use getHandlers() because we want items without handlers to     // appear and show up as 'broken' so that the user can see them.     $form['filters'] = ['#tree' => TRUE];
    foreach ($handlers as $id => $field) {
      // If the group does not exist, move the filters to the default group.       if (empty($field['group']) || empty($groups['groups'][$field['group']])) {
        $field['group'] = 1;
      }

      $handler = $display->getHandler($type$id);
      if ($grouping && $handler && !$handler->canGroup()) {
        $field['group'] = 'ungroupable';
      }

      // If not grouping and the handler is set ungroupable, move it back to       // the default group to prevent weird errors from having it be in its       // own group:       if (!$grouping && $field['group'] == 'ungroupable') {
        $field['group'] = 1;
      }

      // Place this item into the proper group for rendering.
Home | Imprint | This part of the site doesn't use cookies.