public function modifyField($name, $modify)
    {
        if (is_array($modify)) {
            $this->getFieldManager()->modifyField($name, $modify);
        } elseif ($modify instanceof \Closure) {
            $field = $this->getField($name);

            // Initialize Modifying FieldsBuilder
            $modifyBuilder = new FieldsBuilder('');
            $modifyBuilder->addFields([$field]);

            /**
             * @var FieldsBuilder
             */
            $modifyBuilder = $modify($modifyBuilder);

            // Check if a FieldsBuilder is returned
            if (!$modifyBuilder instanceof FieldsBuilder) {
                throw new ModifyFieldReturnTypeException(gettype($modifyBuilder));
            }

            // Insert field(s)
            $this->getFieldManager()->replaceField($name, $modifyBuilder->getFields());
        }

        return $this;
    }
public function modifyField($name, $modify)
    {
        if (is_array($modify)) {
            $this->getFieldManager()->modifyField($name, $modify);
        } elseif ($modify instanceof \Closure) {
            $field = $this->getField($name);

            // Initialize Modifying FieldsBuilder
            $modifyBuilder = new FieldsBuilder('');
            $modifyBuilder->addFields([$field]);

            /**
             * @var FieldsBuilder
             */
            $modifyBuilder = $modify($modifyBuilder);

            // Check if a FieldsBuilder is returned
            if (!$modifyBuilder instanceof FieldsBuilder) {
                throw new ModifyFieldReturnTypeException(gettype($modifyBuilder));
            }

            // Insert field(s)
            $this->getFieldManager()->replaceField($name, $modifyBuilder->getFields());
        }

        return $this;
    }
public function modifyField ( $ name , $ modify ) { if ( is_array ( $ modify ) ) { $ this -> getFieldManager ( ) -> modifyField ( $ name , $ modify ) ; } elseif ( $ modify instanceof \ Closure ) { $ field = $ this -> getField ( $ name ) ; // Initialize Modifying FieldsBuilder $ modifyBuilder = new FieldsBuilder ( '' ) ; $ modifyBuilder -> addFields ( [ $ field ] ) ; /**
             * @var FieldsBuilder
             */ $ modifyBuilder = $ modify ( $ modifyBuilder ) ; // Check if a FieldsBuilder is returned if ( ! $ modifyBuilder instanceof FieldsBuilder ) { throw new ModifyFieldReturnTypeException ( gettype ( $ modifyBuilder ) ) ; } // Insert field(s) $ this -> getFieldManager ( ) -> replaceField ( $ name , $ modifyBuilder -> getFields ( ) ) ; } return $ this ; }
Modify an already defined field
@param  string $name   Name of the field
@param  array|\Closure  $modify Array of field configs or a closure that accepts
a FieldsBuilder and returns a FieldsBuilder.
@throws ModifyFieldReturnTypeException if $modify is a closure and doesn't
return a FieldsBuilder.
@throws FieldNotFoundException if the field name doesn't exist.
@return $this
Modify an already defined field