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

Add @method annotations for setItemprop and update docs to include them #156

Merged
merged 1 commit into from
Dec 6, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/book/helpers/head-meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,21 @@ echo $this->headMeta();
// <meta property="og:title" content="my article title" />
// <meta property="og:type" content="article" />
```

## Usage with HTML5 doctype

Enabling the HTML5 doctype with the [Doctype helper](doctype.md) enables the use
of the `itemprop` attribute (in addition to the standard `name` and
`http-equiv`) with `HeadMeta`. This is typically used to add
[Microdata](https://schema.org) to the head of your document.

```php
$this->doctype(Zend\View\Helper\Doctype::HTML5);
$this->headMeta()->setItemprop('headline', 'My Article Headline');
$this->headMeta()->setItemprop('dateCreated', $date->format('c'));
echo $this->headMeta();

// output is:
// <meta itemprop="headline" content="My Article Headline">
// <meta itemprop="dateCreated" content="2018-07-12T22:19:06+00:00">
```
4 changes: 4 additions & 0 deletions src/Helper/HeadMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
* @method HeadMeta offsetGetProperty($index, $keyValue, $content, $modifiers = array())
* @method HeadMeta prependProperty($keyValue, $content, $modifiers = array())
* @method HeadMeta setProperty($keyValue, $content, $modifiers = array())
* @method HeadMeta appendItemprop($keyValue, $content, $modifiers = array())
* @method HeadMeta offsetGetItemprop($index, $keyValue, $content, $modifiers = array())
* @method HeadMeta prependItemprop($keyValue, $content, $modifiers = array())
* @method HeadMeta setItemprop($keyValue, $content, $modifiers = array())
*/
class HeadMeta extends Placeholder\Container\AbstractStandalone
{
Expand Down