Backend\Core\Engine\Meta::generateURL PHP Method

generateURL() public method

Generate an url, using the predefined callback.
Deprecation: use the generateUrl method on the meta repository
public generateURL ( string $url ) : string
$url string The base-url to start from.
return string
    public function generateURL($url)
    {
        return Model::get('fork.repository.meta')->generateURL($url, $this->callback['class'], $this->callback['method'], $this->callback['parameters']);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // create bogus form
     $frm = new BackendForm('meta');
     // get parameters
     $URL = \SpoonFilter::getPostValue('url', null, '', 'string');
     $metaId = \SpoonFilter::getPostValue('meta_id', null, null);
     $baseFieldName = \SpoonFilter::getPostValue('baseFieldName', null, '', 'string');
     $custom = \SpoonFilter::getPostValue('custom', null, false, 'bool');
     $className = \SpoonFilter::getPostValue('className', null, '', 'string');
     $methodName = \SpoonFilter::getPostValue('methodName', null, '', 'string');
     $parameters = \SpoonFilter::getPostValue('parameters', null, '', 'string');
     // cleanup values
     $metaId = $metaId ? (int) $metaId : null;
     $parameters = @unserialize($parameters);
     // meta object
     $this->meta = new BackendMeta($frm, $metaId, $baseFieldName, $custom);
     // set callback for generating an unique URL
     $this->meta->setUrlCallback($className, $methodName, $parameters);
     // fetch generated meta url
     $URL = urldecode($this->meta->generateURL($URL));
     // output
     $this->output(self::OK, $URL);
 }