Hi,
Try:
class SimpleAuthorizationHelper extends AppHelper {
On 21 Mrz., 04:35, welzie <[email protected]> wrote:
> I am trying to call $this->Html->link(...) in a helper method I
> created. My helper method has the same method signature as the Html->link
> method does, but for some reason the $htmlAttributes parameter
>
> is null. What I really don't understand is when I call the Html->link
> method with the same parameters it works. Below is an example of
> each. Please help me understand this.
>
> The call to html helper that DOES work:
> <?php
> echo $html->link( 'linkTitle', array('controller'=>'candidates',
> 'action'=>'index') );
> ?>
>
> The call to my helper method that does NOT work.
> <?php
> echo $simpleAuthorization->createLinkIfAuthorized( 'linkTitle', array
> ('controller'=>'candidates', 'action'=>'index') );
> ?>
>
> My helper class (not all methods are shown)::
> <?php
> class SimpleAuthorizationHelper extends Helper {
>
> var $helpers = array('Session', 'Html');
>
> function createLinkIfAuthorized($title, $url = null,
> $htmlAttributes = array(), $confirmMessage = false, $escapeTitle =
> true) {
> $controllerName = $htmlAttributes['controller'];
> $actionName = $htmlAttributes['action'];
> if ($this->isCurrentUserAuthorized($controllerName,
> $actionName)) {
> return $this->Html->link($title, $url, $htmlAttributes,
> $confirmMessage, $escapeTitle);
> }
> //more methods not shown....
> }
>
> }?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---