src/Charcoal/Ui/Form/FormTrait.php
public function groups(callable $groupCallback = null)
    {
        $groups = $this->groups;
        uasort($groups, [ $this, 'sortItemsByPriority' ]);

        $groupCallback = (isset($groupCallback) ? $groupCallback : $this->groupCallback);

        $groups = $this->finalizeFormGroups($groups);

        $i = 1;
        foreach ($groups as $group) {
            if ($groupCallback) {
                $groupCallback($group);
            }

            $GLOBALS['widget_template'] = $group->template();

            if (!$this->selectedFormGroup() && $this->isTabbable()) {
                $group->setIsHidden(false);
                if ($i > 1) {
                    $group->setIsHidden(true);
                }
            }
            $i++;

            yield $group;

            $GLOBALS['widget_template'] = '';
        }
    }
public function groups(callable $groupCallback = null)
    {
        $groups = $this->groups;
        uasort($groups, [ $this, 'sortItemsByPriority' ]);

        $groupCallback = (isset($groupCallback) ? $groupCallback : $this->groupCallback);

        $groups = $this->finalizeFormGroups($groups);

        $i = 1;
        foreach ($groups as $group) {
            if ($groupCallback) {
                $groupCallback($group);
            }

            $GLOBALS['widget_template'] = $group->template();

            if (!$this->selectedFormGroup() && $this->isTabbable()) {
                $group->setIsHidden(false);
                if ($i > 1) {
                    $group->setIsHidden(true);
                }
            }
            $i++;

            yield $group;

            $GLOBALS['widget_template'] = '';
        }
    }
public function groups ( callable $ groupCallback = null ) { $ groups = $ this -> groups ; uasort ( $ groups , [ $ this , 'sortItemsByPriority' ] ) ; $ groupCallback = ( isset ( $ groupCallback ) ? $ groupCallback : $ this -> groupCallback ) ; $ groups = $ this -> finalizeFormGroups ( $ groups ) ; $ i = 1 ; foreach ( $ groups as $ group ) { if ( $ groupCallback ) { $ groupCallback ( $ group ) ; } $ GLOBALS [ 'widget_template' ] = $ group -> template ( ) ; if ( ! $ this -> selectedFormGroup ( ) && $ this -> isTabbable ( ) ) { $ group -> setIsHidden ( false ) ; if ( $ i > 1 ) { $ group -> setIsHidden ( true ) ; } } $ i ++ ; yield $ group ; $ GLOBALS [ 'widget_template' ] = '' ; } }
Retrieve the form groups.

@param callable $groupCallback Optional callback applied to each form group.
@return FormGroupInterface[]|Generator
Retrieve the form groups .