src/Forms/FieldList.php
public function makeFieldReadonly($field)
    {
        if (!is_array($field)) {
            $field = [$field];
        }

        foreach ($field as $item) {
            $fieldName = ($item instanceof FormField) ? $item->getName() : $item;
            $srcField = $this->dataFieldByName($fieldName);
            if ($srcField) {
                $this->replaceField($fieldName, $srcField->performReadonlyTransformation());
            } else {
                user_error("Trying to make field '$fieldName' readonly, but it does not exist in the list", E_USER_WARNING);
            }
        }
    }
public function makeFieldReadonly($field)
    {
        if (!is_array($field)) {
            $field = [$field];
        }

        foreach ($field as $item) {
            $fieldName = ($item instanceof FormField) ? $item->getName() : $item;
            $srcField = $this->dataFieldByName($fieldName);
            if ($srcField) {
                $this->replaceField($fieldName, $srcField->performReadonlyTransformation());
            } else {
                user_error("Trying to make field '$fieldName' readonly, but it does not exist in the list", E_USER_WARNING);
            }
        }
    }
public function makeFieldReadonly ( $ field ) { if ( ! is_array ( $ field ) ) { $ field = [ $ field ] ; } foreach ( $ field as $ item ) { $ fieldName = ( $ item instanceof FormField ) ? $ item -> getName ( ) : $ item ; $ srcField = $ this -> dataFieldByName ( $ fieldName ) ; if ( $ srcField ) { $ this -> replaceField ( $ fieldName , $ srcField -> performReadonlyTransformation ( ) ) ; } else { user_error ( "Trying to make field '$fieldName' readonly, but it does not exist in the list" , E_USER_WARNING ) ; } } }
Transform the named field into a readonly field.

@param string|array|FormField $field
Transform the named field into a readonly field .