Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Method "headLink" does not exist #4105

Merged
merged 1 commit into from Jul 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions library/Zend/View/Helper/HeadLink.php
Expand Up @@ -56,6 +56,21 @@ public function __construct()
$this->setSeparator(PHP_EOL);
}

/**
* Proxy to __invoke()
*
* Allows calling $helper->headLink(), but, more importantly, chaining calls
* like ->appendStylesheet()->headLink().
*
* @param array $attributes
* @param string $placement
* @return HeadLink
*/
public function headLink(array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND)
{
return call_user_func_array(array($this, '__invoke'), func_get_args());
}

/**
* headLink() - View Helper Method
*
Expand Down
8 changes: 4 additions & 4 deletions tests/ZendTest/View/Helper/HeadLinkTest.php
Expand Up @@ -92,16 +92,16 @@ public function testOffsetSetThrowsExceptionWithoutArrayArgument()
$this->helper->offsetSet(1, 'foo');
}

public function testCreatingLinkStackViaHeadScriptCreatesAppropriateOutput()
public function testCreatingLinkStackViaHeadLinkCreatesAppropriateOutput()
{
$links = array(
'link1' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'foo'),
'link2' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'bar'),
'link3' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'baz'),
);
$this->helper->__invoke($links['link1'])
->__invoke($links['link2'], 'PREPEND')
->__invoke($links['link3']);
$this->helper->headLink($links['link1'])
->headLink($links['link2'], 'PREPEND')
->headLink($links['link3']);

$string = $this->helper->toString();
$lines = substr_count($string, PHP_EOL);
Expand Down