Index: library/Zend/View/Helper/HeadLink.php =================================================================== --- library/Zend/View/Helper/HeadLink.php (revision 24537) +++ library/Zend/View/Helper/HeadLink.php (working copy) @@ -379,7 +379,7 @@ } $attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet', 'extras'); - return $this->createData($attributes); + return $this->createData($this->_applyExtras($attributes)); } /** @@ -432,6 +432,24 @@ $title = (string) $title; $attributes = compact('rel', 'href', 'type', 'title', 'extras'); - return $this->createData($attributes); + return $this->createData($this->_applyExtras($attributes)); } + + /** + * Apply any overrides specified in the 'extras' array + * @param array $attributes + * @return array + */ + protected function _applyExtras($attributes) + { + if (isset($attributes['extras'])) { + foreach ($attributes['extras'] as $eKey=>$eVal) { + if (isset($attributes[$eKey])) { + $attributes[$eKey] = $eVal; + unset($attributes['extras'][$eKey]); + } + } + } + return $attributes; + } } Index: tests/Zend/View/Helper/HeadLinkTest.php =================================================================== --- tests/Zend/View/Helper/HeadLinkTest.php (revision 24537) +++ tests/Zend/View/Helper/HeadLinkTest.php (working copy) @@ -467,6 +467,16 @@ $this->helper->appendStylesheet(array('href' => '/bar/baz', 'id' => 'foo')); $this->assertContains('id="foo"', $this->helper->toString()); } + + /** + * @group ZF-11811 + */ + public function testHeadLinkAllowsOverrideOfRelAttribute() + { + $this->helper->appendStylesheet('/css/auth.less', 'all', null, array('rel' => 'stylesheet/less')); + $this->assertEquals(1, substr_count($this->helper->toString(), "rel=\"")); + $this->assertContains('rel="stylesheet/less"', $this->helper->toString()); + } } // Call Zend_View_Helper_HeadLinkTest::main() if this source file is executed directly.