Set package tool url with parameter
Permalink
Hi everyone
I've been looking around for an answer (maybe wrong keywords...)for a while.....
Problem:
Package Development/Block-Controller
Pass parameters to a tool file.
the tool-script 'check_url' is working, so please, dont tell me about....
I'd like tho pass the package handle, which is a getter in the block-controller
My best approach was...
but nope!
Please Help! ;-)
I've been looking around for an answer (maybe wrong keywords...)for a while.....
Problem:
Package Development/Block-Controller
Pass parameters to a tool file.
the tool-script 'check_url' is working, so please, dont tell me about....
public function add(){ $this->set_package_tool('check_url'); } // which calls private function set_package_tool($tool_name) { $tool_helper = Loader::helper('concrete/urls'); $this->set($tool_name, $tool_helper->getToolsURL($tool_name, $this->getPkgHandle())); }
I'd like tho pass the package handle, which is a getter in the block-controller
public function getPkgHandle() { return BlockType::getByHandle($this->btHandle)->getPackageHandle(); }
My best approach was...
// In th add()/edit() method $this->set('pkgHandle',$this->getPkgHandle()); // In the check_url.php I called it like in a view or so echo $pkgHandle;
Please Help! ;-)
Solution:
1. A getter in the controller
2. in the tools file
This is definitely a solo-thread, but if ev. someone is interested in this.....
I found a post from Jordan Lev(http://www.concrete5.org/profile/-/view/9756/) this morning.
For me that's the best (and only) answer!
http://www.concrete5.org/community/forums/customizing_c5/accessing-...
1. A getter in the controller
public function getPkgHandle() { return $this->pkgHandle; }
2. in the tools file
$bc = new MyBlockController(); $pkg = $bc->getPkgHandle();
This is definitely a solo-thread, but if ev. someone is interested in this.....
I found a post from Jordan Lev(http://www.concrete5.org/profile/-/view/9756/) this morning.
For me that's the best (and only) answer!
http://www.concrete5.org/community/forums/customizing_c5/accessing-...
But isn't there a clean way to resolve this ???