Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
mahagr committed Nov 1, 2017
2 parents 3380577 + 0895b15 commit cd15055
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
1. [](#improved)
* Make it possible to include debug bar also into non-HTML responses

# v1.3.9
## xx/xx/2017

1. [](#new)
* Added `Medium::copy()` method to create a copy of a medium object
1. [](#bugfix)
* Dynamically added pages via `Pages::addPage()` were not firing `onPageProcessed()` event causing forms not to be processed
* Fixed `Page::active()` and `Page::activeChild()` to work with UTF-8 characters in the URL [#1727](https://github.com/getgrav/grav/issues/1727)
* Fixed typo in `modular.yaml` causing media to be ignored [#1725](https://github.com/getgrav/grav/issues/1725)

# v1.3.8
## 10/26/2017

Expand Down
2 changes: 1 addition & 1 deletion system/blueprints/pages/modular.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ form:
type: ignore
content:
type: ignore
header.media_orider:
header.media_order:
type: ignore

10 changes: 10 additions & 0 deletions system/src/Grav/Common/Page/Medium/Medium.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ public function __construct($items = [], Blueprint $blueprint = null)
$this->reset();
}

/**
* Create a copy of this media object
*
* @return Medium
*/
public function copy()
{
return clone($this);
}

/**
* Return just metadata from the Medium object
*
Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/Page/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,7 @@ public function currentPosition()
*/
public function active()
{
$uri_path = rtrim(Grav::instance()['uri']->path(), '/') ?: '/';
$uri_path = rtrim(urldecode(Grav::instance()['uri']->path()), '/') ?: '/';
$routes = Grav::instance()['pages']->routes();

if (isset($routes[$uri_path])) {
Expand All @@ -2318,7 +2318,7 @@ public function activeChild()
{
$uri = Grav::instance()['uri'];
$pages = Grav::instance()['pages'];
$uri_path = rtrim($uri->path(), '/');
$uri_path = rtrim(urldecode($uri->path()), '/');
$routes = Grav::instance()['pages']->routes();

if (isset($routes[$uri_path])) {
Expand Down
2 changes: 2 additions & 0 deletions system/src/Grav/Common/Page/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ public function addPage(Page $page, $route = null)
$this->children[$page->parent()->path()][$page->path()] = ['slug' => $page->slug()];
}
$this->routes[$route] = $page->path();

$this->grav->fireEvent('onPageProcessed', new Event(['page' => $page]));
}

/**
Expand Down
7 changes: 4 additions & 3 deletions system/src/Grav/Common/Processors/PagesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Grav\Common\Processors;

use Grav\Common\Page\Page;
use RocketTheme\Toolbox\Event\Event;

class PagesProcessor extends ProcessorBase implements ProcessorInterface
{
Expand All @@ -21,15 +22,15 @@ public function process()
$this->container['debugger']->addMessage($this->container['cache']->getCacheStatus());

$this->container['pages']->init();
$this->container->fireEvent('onPagesInitialized');
$this->container->fireEvent('onPageInitialized');
$this->container->fireEvent('onPagesInitialized', new Event(['pages' => $this->container['pages']]));
$this->container->fireEvent('onPageInitialized', new Event(['page' => $this->container['page']]));

/** @var Page $page */
$page = $this->container['page'];

if (!$page->routable()) {
// If no page found, fire event
$event = $this->container->fireEvent('onPageNotFound');
$event = $this->container->fireEvent('onPageNotFound', new Event(['page' => $page]));

if (isset($event->page)) {
unset ($this->container['page']);
Expand Down

0 comments on commit cd15055

Please sign in to comment.