src/Controller/RoutesController.php
public function add()
    {
        if (!$this->request->isAll(['ajax', 'post'])) {
            throw new MethodNotAllowedException();
        }

        $model = $this->request->data('model');
        $foreignKey = (int)$this->request->data('foreign_key');
        $languageId = Wasabi::contentLanguage()->id;
        $url = $this->_formatUrl($this->request->data('url'));
        $routeType = (int)$this->request->data('route_type');
        $element = $this->request->data('element');

        $routeData = [
            'url' => $url,
            'model' => $model,
            'foreign_key' => $foreignKey,
            'language_id' => $languageId,
        ];

        $route = $this->_addRoute($routeType, $routeData);

        $this->_render($route, $element);
    }
public function add()
    {
        if (!$this->request->isAll(['ajax', 'post'])) {
            throw new MethodNotAllowedException();
        }

        $model = $this->request->data('model');
        $foreignKey = (int)$this->request->data('foreign_key');
        $languageId = Wasabi::contentLanguage()->id;
        $url = $this->_formatUrl($this->request->data('url'));
        $routeType = (int)$this->request->data('route_type');
        $element = $this->request->data('element');

        $routeData = [
            'url' => $url,
            'model' => $model,
            'foreign_key' => $foreignKey,
            'language_id' => $languageId,
        ];

        $route = $this->_addRoute($routeType, $routeData);

        $this->_render($route, $element);
    }
public function add ( ) { if ( ! $ this -> request -> isAll ( [ 'ajax' , 'post' ] ) ) { throw new MethodNotAllowedException ( ) ; } $ model = $ this -> request -> data ( 'model' ) ; $ foreignKey = ( int ) $ this -> request -> data ( 'foreign_key' ) ; $ languageId = Wasabi :: contentLanguage ( ) -> id ; $ url = $ this -> _formatUrl ( $ this -> request -> data ( 'url' ) ) ; $ routeType = ( int ) $ this -> request -> data ( 'route_type' ) ; $ element = $ this -> request -> data ( 'element' ) ; $ routeData = [ 'url' => $ url , 'model' => $ model , 'foreign_key' => $ foreignKey , 'language_id' => $ languageId , ] ; $ route = $ this -> _addRoute ( $ routeType , $ routeData ) ; $ this -> _render ( $ route , $ element ) ; }
Add action
AJAX POST

@throws MethodNotAllowedException
@throws BadRequestException
@return void
Add action AJAX POST