src/Forms/FieldList.php
public function fieldByName($name)
    {
        if (strpos($name, '.') !== false) {
            list($name, $remainder) = explode('.', $name, 2);
        } else {
            $remainder = null;
        }

        foreach ($this as $child) {
            if (trim($name) == trim($child->getName()) || $name == $child->id) {
                if ($remainder) {
                    if ($child instanceof CompositeField) {
                        return $child->fieldByName($remainder);
                    } else {
                        $childClass = get_class($child);
                        user_error(
                            "Trying to get field '{$remainder}' from non-composite field {$childClass}.{$name}",
                            E_USER_WARNING
                        );
                        return null;
                    }
                } else {
                    return $child;
                }
            }
        }
        return null;
    }
public function fieldByName($name)
    {
        if (strpos($name, '.') !== false) {
            list($name, $remainder) = explode('.', $name, 2);
        } else {
            $remainder = null;
        }

        foreach ($this as $child) {
            if (trim($name) == trim($child->getName()) || $name == $child->id) {
                if ($remainder) {
                    if ($child instanceof CompositeField) {
                        return $child->fieldByName($remainder);
                    } else {
                        $childClass = get_class($child);
                        user_error(
                            "Trying to get field '{$remainder}' from non-composite field {$childClass}.{$name}",
                            E_USER_WARNING
                        );
                        return null;
                    }
                } else {
                    return $child;
                }
            }
        }
        return null;
    }
public function fieldByName ( $ name ) { if ( strpos ( $ name , '.' ) !== false ) { list ( $ name , $ remainder ) = explode ( '.' , $ name , 2 ) ; } else { $ remainder = null ; } foreach ( $ this as $ child ) { if ( trim ( $ name ) == trim ( $ child -> getName ( ) ) || $ name == $ child -> id ) { if ( $ remainder ) { if ( $ child instanceof CompositeField ) { return $ child -> fieldByName ( $ remainder ) ; } else { $ childClass = get_class ( $ child ) ; user_error ( "Trying to get field '{$remainder}' from non-composite field {$childClass}.{$name}" , E_USER_WARNING ) ; return null ; } } else { return $ child ; } } } return null ; }
Returns a named field.
You can use dot syntax to get fields from child composite fields

@todo Implement similarly to dataFieldByName() to support nested sets - or merge with dataFields()

@param string $name
@return FormField
Returns a named field . You can use dot syntax to get fields from child composite fields