Added ability to get a specific item of content meta

This commit is contained in:
Andy Miller
2016-05-23 12:51:53 -06:00
parent 10d301a179
commit 83bbc497a8
2 changed files with 11 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
* Updated jQuery from 2.2.0 to 2.2.3
* Set `Uri::ip()` to static by default so it can be used in form fields
* Improved `Session` class with flash storage
* `Page::getContentMeta()` now supports an optional key.
1. [](#bugfix)
* Fixed "Invalid slug set in YAML frontmatter" when setting `Page::slug()` with empty string [#580](https://github.com/getgrav/grav-plugin-admin/issues/580)
* Only `.gitignore` Grav's vendor folder

View File

@@ -639,10 +639,19 @@ class Page
/**
* Return the whole contentMeta array as it currently stands
*
* @param null $name
* @return mixed
*/
public function getContentMeta()
public function getContentMeta($name = null)
{
if ($name) {
if(isset($this->content_meta[$name])) {
return $this->content_meta[$name];
} else {
return null;
}
}
return $this->content_meta;
}