public function createFluidContent($pid, $vendor, $ext, $file, $attrs = [])
    {
        // Simplify the build of a flexform

        if (isset($attrs['form'])) {
            $flexFormDef = [];

            foreach ($attrs['form'] as $key => $value) {
                $flexFormDef[$key] = [
                    'vDEF' => $value
                ];
            }

            $attrs['pi_flexform'] = [
                'data' => [
                    'options' => [
                        'lDEF' => $flexFormDef
                    ]
                ]
            ];

            unset($attrs['form']);
        }

        return $this->create($pid, array_merge($attrs, [
            'CType' => 'fluidcontent_content',
            'tx_fed_fcefile' => $vendor.'.'.$ext.':'.$file
        ]));
    }
public function createFluidContent($pid, $vendor, $ext, $file, $attrs = [])
    {
        // Simplify the build of a flexform

        if (isset($attrs['form'])) {
            $flexFormDef = [];

            foreach ($attrs['form'] as $key => $value) {
                $flexFormDef[$key] = [
                    'vDEF' => $value
                ];
            }

            $attrs['pi_flexform'] = [
                'data' => [
                    'options' => [
                        'lDEF' => $flexFormDef
                    ]
                ]
            ];

            unset($attrs['form']);
        }

        return $this->create($pid, array_merge($attrs, [
            'CType' => 'fluidcontent_content',
            'tx_fed_fcefile' => $vendor.'.'.$ext.':'.$file
        ]));
    }
public function createFluidContent ( $ pid , $ vendor , $ ext , $ file , $ attrs = [ ] ) { // Simplify the build of a flexform if ( isset ( $ attrs [ 'form' ] ) ) { $ flexFormDef = [ ] ; foreach ( $ attrs [ 'form' ] as $ key => $ value ) { $ flexFormDef [ $ key ] = [ 'vDEF' => $ value ] ; } $ attrs [ 'pi_flexform' ] = [ 'data' => [ 'options' => [ 'lDEF' => $ flexFormDef ] ] ] ; unset ( $ attrs [ 'form' ] ) ; } return $ this -> create ( $ pid , array_merge ( $ attrs , [ 'CType' => 'fluidcontent_content' , 'tx_fed_fcefile' => $ vendor . '.' . $ ext . ':' . $ file ] ) ) ; }
Create a Fluid Content element.

Simplifies the creation of the associated FlexForm by allowing you to pass
$attrs['form'], containing a hash of property name to value.

@param  int  $pid
@param  string  $vendor  Studly case (TheVendor) vendor name of ext. to load FCE from
@param  string  $ext  Studly case (TheExtension) ext. name to load FCE from
@param  string  $file  The FCE file name, including the extension (e.g Content.html)
@param  array  $attrs  Optional additional attrs
@return  int|null
Create a Fluid Content element .