Say, I have a component named Auth to check if the current logged in
user is able to perform an action or not. Now I want to write a helper
function that does the same as $html->link, but only printing the link
after making sure that the user is able to perform the action.
It'll be something like
class MiscHelper extends AppHelper {
var $helpers = array('Html');
function link($title, $url = null, $htmlAttributes = array(),
$confirmMessage = false, $escapeTitle = true) {
return ife($auth->check($url['controller'], $url['action']),
$this->Html->link($title, $url, $htmlAttributes, $confirmMessage,
$escapeTitle));
}
}
Obviously the above code doesn't work, as I haven't figured out how to
use the component within the helper yet.
My question is: Is it possible? If yes, how can I access the
component?
Any suggestions are welcomed. Thanks a lot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---