src/Form/Container.php
public function get($key)
    {
        $return   = null;
        $lastKey  = null;
        $searchIn = $this->activeForms;
        $keySplit = explode('.', $key);

        while (0 < count($keySplit)) {
            $lastKey = array_shift($keySplit);
            foreach ($searchIn as $activeFormKey) {
                if ($lastKey == $activeFormKey) {
                    $searchIn = $this->getForm($activeFormKey);
                    unset($lastKey);
                    break;
                }
            }
        }
        if (!isset($lastKey) && !empty($keySplit)) {
            $lastKey = array_shift($keySplit);
        }
        if (isset($lastKey) && empty($keySplit)) {
            if ($searchIn instanceof FieldsetInterface) {
                // has reached a fieldset to search in
                $return = $searchIn->get($lastKey);
                unset($lastKey);
            } elseif (is_array($searchIn) || $searchIn instanceof \Traversable) {
                // is probably still in the container
                foreach ($searchIn as $activeKey) {
                    $activeForm = $this->getForm($activeKey);
                    if ($activeForm instanceof FieldsetInterface) {
                        $return = $activeForm->get($lastKey);
                    }
                }
            }
        }
        if (!isset($lastKey) && empty($keySplit) && !isset($return)) {
            $return = $searchIn;
        }
        return $return;
    }
public function get($key)
    {
        $return   = null;
        $lastKey  = null;
        $searchIn = $this->activeForms;
        $keySplit = explode('.', $key);

        while (0 < count($keySplit)) {
            $lastKey = array_shift($keySplit);
            foreach ($searchIn as $activeFormKey) {
                if ($lastKey == $activeFormKey) {
                    $searchIn = $this->getForm($activeFormKey);
                    unset($lastKey);
                    break;
                }
            }
        }
        if (!isset($lastKey) && !empty($keySplit)) {
            $lastKey = array_shift($keySplit);
        }
        if (isset($lastKey) && empty($keySplit)) {
            if ($searchIn instanceof FieldsetInterface) {
                // has reached a fieldset to search in
                $return = $searchIn->get($lastKey);
                unset($lastKey);
            } elseif (is_array($searchIn) || $searchIn instanceof \Traversable) {
                // is probably still in the container
                foreach ($searchIn as $activeKey) {
                    $activeForm = $this->getForm($activeKey);
                    if ($activeForm instanceof FieldsetInterface) {
                        $return = $activeForm->get($lastKey);
                    }
                }
            }
        }
        if (!isset($lastKey) && empty($keySplit) && !isset($return)) {
            $return = $searchIn;
        }
        return $return;
    }
public function get ( $ key ) { $ return = null ; $ lastKey = null ; $ searchIn = $ this -> activeForms ; $ keySplit = explode ( '.' , $ key ) ; while ( 0 < count ( $ keySplit ) ) { $ lastKey = array_shift ( $ keySplit ) ; foreach ( $ searchIn as $ activeFormKey ) { if ( $ lastKey == $ activeFormKey ) { $ searchIn = $ this -> getForm ( $ activeFormKey ) ; unset ( $ lastKey ) ; break ; } } } if ( ! isset ( $ lastKey ) && ! empty ( $ keySplit ) ) { $ lastKey = array_shift ( $ keySplit ) ; } if ( isset ( $ lastKey ) && empty ( $ keySplit ) ) { if ( $ searchIn instanceof FieldsetInterface ) { // has reached a fieldset to search in $ return = $ searchIn -> get ( $ lastKey ) ; unset ( $ lastKey ) ; } elseif ( is_array ( $ searchIn ) || $ searchIn instanceof \ Traversable ) { // is probably still in the container foreach ( $ searchIn as $ activeKey ) { $ activeForm = $ this -> getForm ( $ activeKey ) ; if ( $ activeForm instanceof FieldsetInterface ) { $ return = $ activeForm -> get ( $ lastKey ) ; } } } } if ( ! isset ( $ lastKey ) && empty ( $ keySplit ) && ! isset ( $ return ) ) { $ return = $ searchIn ; } return $ return ; }
if fieldsets there is get method to have access to any element by name
this method is similar
get('form') gets a form
get('element') gets an element, if an element has the same name as a form, the form get's first access
get('form.element') gets an element of a form, this is more efficent because it doesn't expand all forms in the container,
but just the one adressed
@param $key string
@return null|\Zend\Form\ElementInterface
if fieldsets there is get method to have access to any element by name this method is similar get ( form ) gets a form get ( element ) gets an element if an element has the same name as a form the form get s first access get ( form . element ) gets an element of a form this is more efficent because it doesn t expand all forms in the container but just the one adressed