Created
May 14, 2015 08:55
-
-
Save gebv/0e464be788556b89f06f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Widgets Tag Processor (sample) | |
* | |
*/ | |
class SampleWidget extends TagProcessor | |
{ | |
/** | |
* Returns a link for editing. | |
* | |
* @param array $params Params. | |
* | |
* @return string | |
*/ | |
protected function ItemEditLink(array $params) | |
{ | |
$object = $this->getObject($params); | |
/* @var $object kDBList */ | |
$a_path = $this->App->getOptoins($this->Prefix, 'TemplatePath'); | |
$edit_template = $a_path . '/' . $this->App->getOptoins($this->Prefix, 'TemplatePrefix') . 'edit'; | |
$url_params = array( | |
'm_opener' => 'd', | |
$this->Prefix . '_event' => 'OnEdit', | |
$this->Prefix . '_id' => $object->GetID(), | |
'pass' => 'all,' . $this->Prefix, | |
'no_pass_through' => 1, | |
); | |
return $this->App->UrlFor($edit_template, '', $url_params); | |
} | |
/** | |
* Creates link to an item including only it's id. | |
* | |
* @param array $params Params. | |
* | |
* @return string | |
*/ | |
protected function ItemLink($params) | |
{ | |
$object = $this->getObject($params); | |
/* @var $object kDBItem */ | |
$params['pass'] = 'm,' . $this->Prefix; | |
$params[$object->Prefix . '_id'] = $object->GetID(); | |
$params[$object->Prefix . '_filename'] = $object->GetDBField('Title'); | |
return $this->App->UrlFor('m', 'Link', $params); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment