src/Form.php
public function getField($fieldName)
    {
        $this->debug->group(__METHOD__, $fieldName);
        $field = false;
        if (\preg_match('|^(.*?)[/.](.*)$|', $fieldName, $matches)) {
            $pageName = $matches[1];
            $fieldName = $matches[2];
        } else {
            $pageName = $this->status['currentPageName'];
        }
        if ($pageName == $this->status['currentPageName'] && isset($this->currentFields[$fieldName])) {
            $field = &$this->currentFields[$fieldName];
            if (!\is_object($field)) {
                $field['pageI'] = $this->persist->get('i');
                $this->currentFields[$fieldName] = $this->buildField($field, $fieldName);
            }
        } elseif (isset($this->cfg['pages'][$pageName])) {
            $pages = $this->persist->get('pages');
            foreach ($pages as $pageI => $page) {
                if ($page['name'] != $pageName) {
                    continue;
                }
                foreach ($this->cfg['pages'][$pageName] as $k => $fieldProps) {
                    if ($k === $fieldName
                        || isset($fieldProps['attribs']['name']) && $fieldProps['attribs']['name'] == $fieldName
                        || isset($fieldProps['name']) && $fieldProps['name'] == $fieldName
                    ) {
                        $this->debug->info('found field');
                        $fieldProps['pageI'] = $pageI;
                        $field = $this->buildField($fieldProps, $k);
                        $val = $this->getValue($fieldName, $pageI);
                        $field->val($val, false);
                        break 2;
                    }
                }
                break;
            }
        }
        $this->debug->groupEnd();
        return $field;
    }
public function getField($fieldName)
    {
        $this->debug->group(__METHOD__, $fieldName);
        $field = false;
        if (\preg_match('|^(.*?)[/.](.*)$|', $fieldName, $matches)) {
            $pageName = $matches[1];
            $fieldName = $matches[2];
        } else {
            $pageName = $this->status['currentPageName'];
        }
        if ($pageName == $this->status['currentPageName'] && isset($this->currentFields[$fieldName])) {
            $field = &$this->currentFields[$fieldName];
            if (!\is_object($field)) {
                $field['pageI'] = $this->persist->get('i');
                $this->currentFields[$fieldName] = $this->buildField($field, $fieldName);
            }
        } elseif (isset($this->cfg['pages'][$pageName])) {
            $pages = $this->persist->get('pages');
            foreach ($pages as $pageI => $page) {
                if ($page['name'] != $pageName) {
                    continue;
                }
                foreach ($this->cfg['pages'][$pageName] as $k => $fieldProps) {
                    if ($k === $fieldName
                        || isset($fieldProps['attribs']['name']) && $fieldProps['attribs']['name'] == $fieldName
                        || isset($fieldProps['name']) && $fieldProps['name'] == $fieldName
                    ) {
                        $this->debug->info('found field');
                        $fieldProps['pageI'] = $pageI;
                        $field = $this->buildField($fieldProps, $k);
                        $val = $this->getValue($fieldName, $pageI);
                        $field->val($val, false);
                        break 2;
                    }
                }
                break;
            }
        }
        $this->debug->groupEnd();
        return $field;
    }
public function getField ( $ fieldName ) { $ this -> debug -> group ( __METHOD__ , $ fieldName ) ; $ field = false ; if ( \ preg_match ( '|^(.*?)[/.](.*)$|' , $ fieldName , $ matches ) ) { $ pageName = $ matches [ 1 ] ; $ fieldName = $ matches [ 2 ] ; } else { $ pageName = $ this -> status [ 'currentPageName' ] ; } if ( $ pageName == $ this -> status [ 'currentPageName' ] && isset ( $ this -> currentFields [ $ fieldName ] ) ) { $ field = & $ this -> currentFields [ $ fieldName ] ; if ( ! \ is_object ( $ field ) ) { $ field [ 'pageI' ] = $ this -> persist -> get ( 'i' ) ; $ this -> currentFields [ $ fieldName ] = $ this -> buildField ( $ field , $ fieldName ) ; } } elseif ( isset ( $ this -> cfg [ 'pages' ] [ $ pageName ] ) ) { $ pages = $ this -> persist -> get ( 'pages' ) ; foreach ( $ pages as $ pageI => $ page ) { if ( $ page [ 'name' ] != $ pageName ) { continue ; } foreach ( $ this -> cfg [ 'pages' ] [ $ pageName ] as $ k => $ fieldProps ) { if ( $ k === $ fieldName || isset ( $ fieldProps [ 'attribs' ] [ 'name' ] ) && $ fieldProps [ 'attribs' ] [ 'name' ] == $ fieldName || isset ( $ fieldProps [ 'name' ] ) && $ fieldProps [ 'name' ] == $ fieldName ) { $ this -> debug -> info ( 'found field' ) ; $ fieldProps [ 'pageI' ] = $ pageI ; $ field = $ this -> buildField ( $ fieldProps , $ k ) ; $ val = $ this -> getValue ( $ fieldName , $ pageI ) ; $ field -> val ( $ val , false ) ; break 2 ; } } break ; } } $ this -> debug -> groupEnd ( ) ; return $ field ; }
Get form field

@param string $fieldName field's name

@return Field
Get form field