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

Commit 88014bb

Browse files
committed
Add @method annotations for setItemprop and update docs to include them
1 parent 651621d commit 88014bb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

doc/book/helpers/head-meta.md

+18
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,21 @@ echo $this->headMeta();
125125
// <meta property="og:title" content="my article title" />
126126
// <meta property="og:type" content="article" />
127127
```
128+
129+
## Usage with HTML5 doctype
130+
131+
Enabling the HTML5 doctype with the [Doctype helper](doctype.md) enables the use
132+
of the `itemprop` attribute (in addition to the standard `name` and
133+
`http-equiv`) with `HeadMeta`. This is typically used to add
134+
[Microdata](https://schema.org) to the head of your document.
135+
136+
```php
137+
$this->doctype(Zend\View\Helper\Doctype::HTML5);
138+
$this->headMeta()->setItemprop('headline', 'My Article Headline');
139+
$this->headMeta()->setItemprop('dateCreated', $date->format('c'));
140+
echo $this->headMeta();
141+
142+
// output is:
143+
// <meta itemprop="headline" content="My Article Headline">
144+
// <meta itemprop="dateCreated" content="2018-07-12T22:19:06+00:00">
145+
```

src/Helper/HeadMeta.php

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
* @method HeadMeta offsetGetProperty($index, $keyValue, $content, $modifiers = array())
3232
* @method HeadMeta prependProperty($keyValue, $content, $modifiers = array())
3333
* @method HeadMeta setProperty($keyValue, $content, $modifiers = array())
34+
* @method HeadMeta appendItemprop($keyValue, $content, $modifiers = array())
35+
* @method HeadMeta offsetGetItemprop($index, $keyValue, $content, $modifiers = array())
36+
* @method HeadMeta prependItemprop($keyValue, $content, $modifiers = array())
37+
* @method HeadMeta setItemprop($keyValue, $content, $modifiers = array())
3438
*/
3539
class HeadMeta extends Placeholder\Container\AbstractStandalone
3640
{

0 commit comments

Comments
 (0)