src/FieldHandlers/FieldHandler.php
protected function fixOptions(array $options = []) : array
    {
        $result = $options;
        if (empty($result)) {
            return $result;
        }

        if (empty($result['fieldDefinitions'])) {
            return $result;
        }

        if (!is_array($result['fieldDefinitions'])) {
            return $result;
        }

        // Sometimes, when setting fieldDefinitions manually to render a particular
        // type, the name is omitted.  This works for an array, but doesn't work for
        // the CsvField instance, as the name is required.  Gladly, we know the name
        // and can fix it easily.
        if (empty($result['fieldDefinitions']['name'])) {
            $result['fieldDefinitions']['name'] = $this->config->getField();
        }

        // Previously, fieldDefinitions could be either an array or a CsvField instance.
        // Now we expect it to always be a CsvField instance.  So, if we have a non-empty
        // array, then instantiate CsvField with the values from it.
        $result['fieldDefinitions'] = new CsvField($result['fieldDefinitions']);

        return $result;
    }
protected function fixOptions(array $options = []) : array
    {
        $result = $options;
        if (empty($result)) {
            return $result;
        }

        if (empty($result['fieldDefinitions'])) {
            return $result;
        }

        if (!is_array($result['fieldDefinitions'])) {
            return $result;
        }

        // Sometimes, when setting fieldDefinitions manually to render a particular
        // type, the name is omitted.  This works for an array, but doesn't work for
        // the CsvField instance, as the name is required.  Gladly, we know the name
        // and can fix it easily.
        if (empty($result['fieldDefinitions']['name'])) {
            $result['fieldDefinitions']['name'] = $this->config->getField();
        }

        // Previously, fieldDefinitions could be either an array or a CsvField instance.
        // Now we expect it to always be a CsvField instance.  So, if we have a non-empty
        // array, then instantiate CsvField with the values from it.
        $result['fieldDefinitions'] = new CsvField($result['fieldDefinitions']);

        return $result;
    }
protected function fixOptions ( array $ options = [ ] ) : array { $ result = $ options ; if ( empty ( $ result ) ) { return $ result ; } if ( empty ( $ result [ 'fieldDefinitions' ] ) ) { return $ result ; } if ( ! is_array ( $ result [ 'fieldDefinitions' ] ) ) { return $ result ; } // Sometimes, when setting fieldDefinitions manually to render a particular // type, the name is omitted.  This works for an array, but doesn't work for // the CsvField instance, as the name is required.  Gladly, we know the name // and can fix it easily. if ( empty ( $ result [ 'fieldDefinitions' ] [ 'name' ] ) ) { $ result [ 'fieldDefinitions' ] [ 'name' ] = $ this -> config -> getField ( ) ; } // Previously, fieldDefinitions could be either an array or a CsvField instance. // Now we expect it to always be a CsvField instance.  So, if we have a non-empty // array, then instantiate CsvField with the values from it. $ result [ 'fieldDefinitions' ] = new CsvField ( $ result [ 'fieldDefinitions' ] ) ; return $ result ; }
Fix provided options

This method is here to fix some issues with backward
compatibility and make sure that $options parameters
are consistent throughout.

@param mixed[] $options Options to fix
@return mixed[] Fixed options
Fix provided options