Skip to content

Commit

Permalink
[ZF-11835] Fixed: Add conditional comments functionality to Zend_View…
Browse files Browse the repository at this point in the history
…_Helper_HeadMeta
  • Loading branch information
adamlundrigan committed Nov 21, 2011
1 parent 23e1985 commit c8bde6a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/Zend/View/Helper/HeadMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ public function itemToString(\stdClass $item)
$this->_escape($item->content),
$modifiersString
);

if (isset($item->modifiers['conditional'])
&& !empty($item->modifiers['conditional'])
&& is_string($item->modifiers['conditional']))
{
$meta = '<!--[if ' . $this->_escape($item->modifiers['conditional']) . ']>' . $meta . '<![endif]-->';
}

return $meta;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/Zend/View/Helper/HeadMetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,5 +441,16 @@ public function testCharset()
$view->plugin('headMeta')->toString());
}

/**
* @group ZF-11835
*/
public function testConditional()
{
$html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => 'lt IE 7'))->toString();

$this->assertRegExp("|^<!--\[if lt IE 7\]>|", $html);
$this->assertRegExp("|<!\[endif\]-->$|", $html);
}

}

0 comments on commit c8bde6a

Please sign in to comment.