src/Fields/TileField.php
/**
     * we intercept the request to figure out what tile class we're using. we then
     * inform the parent gridfield through a custom component (TileFieldDetailForm)
     * @param HTTPRequest $request
     * @return html
     */
we intercept the request to figure out what tile class we're using. we then
inform the parent gridfield through a custom component (TileFieldDetailForm)
@param HTTPRequest $request
@return html
we intercept the request to figure out what tile class we ' re using . we then inform the parent gridfield through a custom component ( TileFieldDetailForm ) @param HTTPRequest $request @return html
public function handleRequest(HTTPRequest $request)
    {
        if ($request->requestVar('TileType')) {
            $record = Injector::inst()->create(str_replace('_', '\\', $request->requestVar('TileType')));
            $this->setModelClass($record->ClassName);
            $config = $this->getConfig();
            $config->removeComponentsByType(new TileFieldDetailForm());
            $config->addComponent(new TileFieldDetailForm('', $record->ClassName));
            $this->setConfig($config);
        }
        return parent::handleRequest($request);
    }
public function handleRequest ( HTTPRequest $ request ) { if ( $ request -> requestVar ( 'TileType' ) ) { $ record = Injector :: inst ( ) -> create ( str_replace ( '_' , '\\' , $ request -> requestVar ( 'TileType' ) ) ) ; $ this -> setModelClass ( $ record -> ClassName ) ; $ config = $ this -> getConfig ( ) ; $ config -> removeComponentsByType ( new TileFieldDetailForm ( ) ) ; $ config -> addComponent ( new TileFieldDetailForm ( '' , $ record -> ClassName ) ) ; $ this -> setConfig ( $ config ) ; } return parent :: handleRequest ( $ request ) ; }
we intercept the request to figure out what tile class we're using.
we intercept the request to figure out what tile class we ' re using .
// replace TileFieldDetailForm