src/Forms/CompositeField.php
public function makeFieldReadonly($field)
    {
        $fieldName = ($field instanceof FormField) ? $field->getName() : $field;

        // Iterate on items, looking for the applicable field
        foreach ($this->children as $i => $item) {
            if ($item instanceof CompositeField) {
                if ($item->makeFieldReadonly($fieldName)) {
                    return true;
                };
            } elseif ($item instanceof FormField && $item->getName() == $fieldName) {
                // Once it's found, use FormField::transform to turn the field into a readonly version of itself.
                $this->children->replaceField($fieldName, $item->transform(new ReadonlyTransformation()));

                // A true results indicates that the field was found
                return true;
            }
        }
        return false;
    }
public function makeFieldReadonly($field)
    {
        $fieldName = ($field instanceof FormField) ? $field->getName() : $field;

        // Iterate on items, looking for the applicable field
        foreach ($this->children as $i => $item) {
            if ($item instanceof CompositeField) {
                if ($item->makeFieldReadonly($fieldName)) {
                    return true;
                };
            } elseif ($item instanceof FormField && $item->getName() == $fieldName) {
                // Once it's found, use FormField::transform to turn the field into a readonly version of itself.
                $this->children->replaceField($fieldName, $item->transform(new ReadonlyTransformation()));

                // A true results indicates that the field was found
                return true;
            }
        }
        return false;
    }
public function makeFieldReadonly ( $ field ) { $ fieldName = ( $ field instanceof FormField ) ? $ field -> getName ( ) : $ field ; // Iterate on items, looking for the applicable field foreach ( $ this -> children as $ i => $ item ) { if ( $ item instanceof CompositeField ) { if ( $ item -> makeFieldReadonly ( $ fieldName ) ) { return true ; } ; } elseif ( $ item instanceof FormField && $ item -> getName ( ) == $ fieldName ) { // Once it's found, use FormField::transform to turn the field into a readonly version of itself. $ this -> children -> replaceField ( $ fieldName , $ item -> transform ( new ReadonlyTransformation ( ) ) ) ; // A true results indicates that the field was found return true ; } } return false ; }
Transform the named field into a readonly feld.

@param string|FormField
@return bool
Transform the named field into a readonly feld .