Merge branch '1.6' of github.com:getgrav/grav into 1.6

This commit is contained in:
Andy Miller
2018-10-01 12:33:36 -06:00
4 changed files with 19 additions and 7 deletions

View File

@@ -19,6 +19,7 @@
* Added support for hiding form fields in blueprints by using dynamic property like `security@: admin.foobar`, `scope@: object` or `scope-ignore@: object` to any field
1. [](#improved)
* Doctrine filecache is now namespaced with prefix to support purging
* Register all page types into `blueprint://pages` stream
# v1.5.2
## mm/dd/2018

View File

@@ -137,7 +137,7 @@ class Page implements PageInterface
$this->metadata();
$this->url();
$this->visible();
$this->modularTwig($this->slug[0] === '_');
$this->modularTwig(strpos($this->slug(), '_') === 0);
$this->setPublishState();
$this->published();
$this->urlExtension();

View File

@@ -710,7 +710,6 @@ class Pages
public static function getTypes()
{
if (!self::$types) {
$grav = Grav::instance();
$scanBlueprintsAndTemplates = function () use ($grav) {
@@ -748,6 +747,18 @@ class Pages
$scanBlueprintsAndTemplates();
}
// Register custom paths to the locator.
$locator = $grav['locator'];
foreach (self::$types as $type => $paths) {
foreach ($paths as $k => $path) {
if (strpos($path, 'blueprints://') === 0) {
unset($paths[$k]);
}
}
if ($paths) {
$locator->addPath('blueprints', "pages/$type.yaml", $paths);
}
}
}
return self::$types;

View File

@@ -33,7 +33,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable
}
if (!$blueprint && $this->systemBlueprints) {
$blueprint = isset($this->systemBlueprints[$type]) ? $this->systemBlueprints[$type] : $this->systemBlueprints['default'];
$blueprint = $this->systemBlueprints[$type] ?? $this->systemBlueprints['default'];
}
if ($blueprint) {
@@ -43,7 +43,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable
public function scanBlueprints($uri)
{
if (!is_string($uri)) {
if (!\is_string($uri)) {
throw new \InvalidArgumentException('First parameter must be URI');
}
@@ -63,7 +63,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable
public function scanTemplates($uri)
{
if (!is_string($uri)) {
if (!\is_string($uri)) {
throw new \InvalidArgumentException('First parameter must be URI');
}
@@ -96,7 +96,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable
if (strpos($name, '/')) {
continue;
}
$list[$name] = ucfirst(strtr($name, '_', ' '));
$list[$name] = ucfirst(str_replace('_', ' ', $name));
}
ksort($list);
return $list;
@@ -109,7 +109,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable
if (strpos($name, 'modular/') !== 0) {
continue;
}
$list[$name] = trim(ucfirst(strtr(basename($name), '_', ' ')));
$list[$name] = ucfirst(trim(str_replace('_', ' ', basename($name))));
}
ksort($list);
return $list;