Nette\Forms\Form::getGroup PHP Method

getGroup() public method

Returns the specified group.
public getGroup ( $name ) : ControlGroup
return ControlGroup
    public function getGroup($name)
    {
        return isset($this->groups[$name]) ? $this->groups[$name] : NULL;
    }

Usage Example

 /**
  * @throws \RuntimeException
  * @return object[]
  */
 public function findGroups()
 {
     $formGroups = $visitedGroups = array();
     foreach ($this->priorGroups as $i => $group) {
         if (!$group instanceof Nette\Forms\ControlGroup) {
             if (!($group = $this->form->getGroup($group))) {
                 $groupName = (string) $this->priorGroups[$i];
                 throw new \RuntimeException("Form has no group {$groupName}.");
             }
         }
         $visitedGroups[] = $group;
         if ($group = $this->processGroup($group)) {
             $formGroups[] = $group;
         }
     }
     foreach ($this->form->groups as $group) {
         if (!in_array($group, $visitedGroups, TRUE) && ($group = $this->processGroup($group))) {
             $formGroups[] = $group;
         }
     }
     return $formGroups;
 }