Skip to content

Commit

Permalink
Merge branch 'release/5.4.32'
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Jan 2, 2020
2 parents e3d8b47 + 42d1611 commit 6d5c71f
Show file tree
Hide file tree
Showing 22 changed files with 330 additions and 173 deletions.
30 changes: 25 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# 5.4.32
## 01/02/2020

1. [Common](#common)
1. [](#new)
- Added support for custom menu item link attributes (#2575, thanks @thexmanxyz)
1. [](#bugfix)
- Fixed missing `rel="noopener noreferrer"` in social particle when opening link into a new tab (#2581)
1. [Joomla](#joomla)
1. [](#bugfix)
- Fixed missing `rel` attribute in menu items with double value detection (#2573, thanks @thexmanxyz)
1. [WordPress](#wordpress)
1. [](#improved)
- Added a `Global` rule for assignments per taxonomy / category (#2045, thanks @nikola3244)
1. [Grav](#grav)
1. [](#bugfix)
- Fixed assignments for `Pages` not showing in Grav 1.7.0-rc.1 (#2557)
- Fixed menu editor having no menu items in Grav 1.7.0-rc.1
- Fixed broken `Configure` link in admin (#2570)

# 5.4.31
## 10/04/2019

Expand Down Expand Up @@ -52,7 +72,7 @@
- Updated Timber to v1.9.2 (later versions have Twig conflict with current version of WPML)
1. [](#bugfix)
- Fixed `Gantry 5 Particle` widget inactive Save button (#2211)
- Regression: Fixed pagination in `WordPress Posts` particle (#2480)
- Regression: Fixed pagination in `WordPress Posts` particle (#2480)
1. [Grav](#grav)
1. [](#bugfix)
- Fixed compatibility issue with Grav 1.7.0-beta.1
Expand All @@ -66,7 +86,7 @@
- Added `webp` to supported image types for image picker (#2450)
1. [](#improved)
- Logo particle: Added logo image max height (#2424)
1. [](#bugfix)
1. [](#bugfix)
- Social particle: Improved link target handling (#2214)
- Helium Copyright particle: fixed missing link (#2214)
- Fixed `mkdir(...)` race condition
Expand All @@ -81,15 +101,15 @@
- Updated Timber to v1.9.1
1. [](#bugfix)
- Fixed potential query conflicts in `WordPress Posts` particle

# 5.4.27
## 12/14/2018

1. [Common](#common)
1. [](#new)
- Added Section Variation field for Layout sections.
1. [](#improved)
- Updated Lightcase version.
- Updated Lightcase version.
1. [](#bugfix)
- Fixed fatal error on PHP 5.4 (#2378)
- Fixed `Folder::doDelete($folder, false)` removing symlink when it should not (#2396)
Expand All @@ -103,7 +123,7 @@
1. [WordPress](#wordpress)
1. [](#new)
- Updated Timber to v1.8.3

# 5.4.26
## 09/11/2018

Expand Down
39 changes: 32 additions & 7 deletions engines/common/nucleus/particles/menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,45 @@
{% set dropdown = item.level == 1 ? ' g-' ~ item.getDropdown() %}
{% set parent = item.children ? ' g-parent' %}
{% set target = (item.target != '_self' or context.particle.forceTarget) ? ' target="' ~ item.target|e ~ '"' %}
{% set rel = item.rel ? ' rel="' ~ item.rel|e ~ '"' %}
{% set attributes = '' %}
{% if item.attributes %}
{% for attribute in item.attributes %}
{% set rel = item.rel %}

{% if item.target == '_blank' %}
{% if 'noopener' not in rel %}
{% set rel = rel ? rel ~ ' ' : rel %}
{% set rel = rel ~ 'noopener' %}
{% endif %}
{% if 'noreferrer' not in rel %}
{% set rel = rel ? rel ~ ' ' : rel %}
{% set rel = rel ~ 'noreferrer' %}
{% endif %}
{% endif %}

{% set listAttributes = item.attributes|attribute_array %}
{% set linkAttributes = '' %}

{% if item.link_attributes %}
{% for attribute in item.link_attributes %}
{% for key, value in attribute %}
{% set attributes = attributes ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}
{% if key == 'rel' %}
{% for hVal in value|split(' ') %}
{% if hVal not in rel %}
{% set rel = rel ? rel ~ ' ' : rel %}
{% set rel = rel ~ hVal %}
{% endif %}
{% endfor %}
{% else %}
{% set linkAttributes = linkAttributes ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}

{% set rel = rel ? ' rel="' ~ rel|e('html_attr') ~ '"' %}

<li class="g-menu-item g-menu-item-type-{{ item.type }} g-menu-item-{{ item.id }}{% if not item.dropdown_hide %}{{ parent }}{% endif %}{{ active }}{{ dropdown }} {% if item.url and item.children %}{% if not item.dropdown_hide %}g-menu-item-link-parent{% endif %}{% endif %} {{ item.class|default('') }}"
{{- self.getCustomWidth(item, menu, 'item', dropdown) }}
{%- if context.particle.renderTitles|default(0) %} title="{{ item.title }}"{% endif %}{{attributes|raw}}>
{% if item.url %}<a class="g-menu-item-container{{ item.anchor_class ? ' ' ~ item.anchor_class }}" href="{{ item.url }}{{ item.hash }}"{{ (title ~ label ~ target ~ rel)|raw }}>
{%- if context.particle.renderTitles|default(0) %} title="{{ item.title }}"{% endif %}{{listAttributes|raw}}>
{% if item.url %}<a class="g-menu-item-container{{ item.anchor_class ? ' ' ~ item.anchor_class }}" href="{{ item.url }}{{ item.hash }}"{{ (title ~ label ~ target ~ rel ~ linkAttributes)|raw }}>
{% else %}<div class="g-menu-item-container{{ item.anchor_class ? ' ' ~ item.anchor_class }}" data-g-menuparent=""{{ label|raw }}>{% endif %}
{% if item.image %}
<img src="{{ url(item.image) }}" alt="{{ item.title }}" />
Expand Down
4 changes: 2 additions & 2 deletions engines/common/nucleus/particles/social.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% if particle.target %}
{% set targetAttrib = ' target="' ~ particle.target|e ~ '"' %}
{% set targetAttrib = (target == '_blank') ? targetAttrib ~ ' rel="noopener noreferrer"' : targetAttrib %}
{% set targetAttrib = (particle.target == '_blank') ? targetAttrib ~ ' rel="noopener noreferrer"' : targetAttrib %}
{% endif %}

{% block particle %}
Expand All @@ -17,4 +17,4 @@
</a>
{% endfor %}
</div>
{% endblock %}
{% endblock %}
19 changes: 16 additions & 3 deletions platforms/common/blueprints/menu/menuitem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,27 @@ form:
.link:
type: input.text
label: Link

.rel:
type: input.text
label: Link Rel Attribute
disabled: true

.attributes:
type: collection.keyvalue
label: Tag Attributes
description: Additional attributes for the menu item.
label: List Tag Attributes
description: Additional attributes for the menu item list tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['class', 'style', 'title']

.link_attributes:
type: collection.keyvalue
label: Link Tag Attributes
description: Additional attributes for the menu item link tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['id', 'class']
exclude: ['class', 'href', 'title', 'aria-label', 'target']

.hash:
type: input.text
Expand Down
19 changes: 16 additions & 3 deletions platforms/grav/gantry5/admin/blueprints/menu/menuitem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ form:
type: input.text
label: Link
disabled: true

.rel:
type: input.text
label: Link Rel Attribute
disabled: true

.attributes:
type: collection.keyvalue
label: Tag Attributes
description: Additional attributes for the menu item.
label: List Tag Attributes
description: Additional attributes for the menu item list tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['class', 'style', 'title']

.link_attributes:
type: collection.keyvalue
label: Link Tag Attributes
description: Additional attributes for the menu item link tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['id', 'class']
exclude: ['class', 'href', 'title', 'aria-label', 'target']

.hash:
type: input.text
Expand Down
19 changes: 16 additions & 3 deletions platforms/joomla/com_gantry5/admin/blueprints/menu/menuitem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ form:
type: input.text
label: Link
disabled: true

.rel:
type: input.text
label: Link Rel Attribute
disabled: true

.attributes:
type: collection.keyvalue
label: Tag Attributes
description: Additional attributes for the menu item.
label: List Tag Attributes
description: Additional attributes for the menu item list tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['class', 'style', 'title']

.link_attributes:
type: collection.keyvalue
label: Link Tag Attributes
description: Additional attributes for the menu item link tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['id', 'class']
exclude: ['class', 'href', 'title', 'aria-label', 'target']

.hash:
type: input.text
Expand Down
19 changes: 16 additions & 3 deletions platforms/wordpress/gantry5/admin/blueprints/menu/menuitem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,27 @@ form:
type: input.text
label: Link
disabled: true

.rel:
type: input.text
label: Link Rel Attribute
disabled: true

.attributes:
type: collection.keyvalue
label: Tag Attributes
description: Additional attributes for the menu item.
label: List Tag Attributes
description: Additional attributes for the menu item list tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['class', 'style', 'title']

.link_attributes:
type: collection.keyvalue
label: Link Tag Attributes
description: Additional attributes for the menu item link tag.
key_placeholder: Key (e.g. style, name, ...)
value_placeholder: Value
exclude: ['id', 'class']
exclude: ['class', 'href', 'title', 'aria-label', 'target']

.hash:
type: input.text
Expand Down
2 changes: 1 addition & 1 deletion platforms/wordpress/gantry5/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: gantry
Author URI: http://gantry.org
Tags: gantry, gantry5, framework, template, theme, yaml, twig, timber, scss, html5, css3, bourbon, layout, builder, widgets, flexible, extensible, configurable, flex, grid, columns, powerful, buddypress, woocommerce, bbpress
Requires at least: 4.2
Tested up to: 5.2.3
Tested up to: 5.3
Requires PHP: 5.6
Stable tag: @version@

Expand Down
7 changes: 6 additions & 1 deletion src/platforms/grav/classes/Gantry/Admin/EventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

use Gantry\Component\Filesystem\Folder;
use Gantry\Framework\Gantry;
use Gantry\Prime\Pages;
use Grav\Common\Grav;
use Grav\Common\Page\Page;
use Grav\Common\Page\Pages;
use RocketTheme\Toolbox\Event\Event;
use RocketTheme\Toolbox\Event\EventSubscriberInterface;
use RocketTheme\Toolbox\File\YamlFile;
Expand Down Expand Up @@ -110,6 +110,11 @@ public function onMenusSave(Event $event)
/** @var Pages $pages */
$pages = $grav['pages'];

// Initialize pages; in Grav 1.7 admin, pages are not initialized by default.
if (method_exists($pages, 'enablePages')) {
$pages->enablePages();
}

// Initialize pages.
$visible = $pages->all()->nonModular();
$all = [];
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/grav/classes/Gantry/Admin/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function boot()

// Figure out the action we want to make.
$this->method = $request->getMethod();
$this->path = $parts ?: ($theme ? ['configurations', true] : ['themes']);
$this->path = $parts ?: ($theme ? ['configurations', 'default', 'styles'] : ['themes']);
$this->resource = array_shift($this->path);
$this->format = $uri->extension('html');
$ajax = ($this->format === 'json');
Expand Down
23 changes: 21 additions & 2 deletions src/platforms/grav/classes/Gantry/Framework/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Gantry\Component\Menu\Item;
use Grav\Common\Grav;
use Grav\Common\Page\Page as GravPage;
use Grav\Common\Page\Pages;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;

class Menu extends AbstractMenu
Expand Down Expand Up @@ -77,8 +78,16 @@ public function getGroupedItems()

$grav = Grav::instance();

/** @var Pages $pages */
$pages = $grav['pages'];

// Initialize pages; in Grav 1.7 admin, pages are not initialized by default.
if (method_exists($pages, 'enablePages')) {
$pages->enablePages();
}

// Get the menu items.
$pages = $grav['pages']->all()->nonModular();
$pages = $pages->all()->nonModular();

// Initialize the group.
$groups['mainmenu'] = array();
Expand Down Expand Up @@ -166,8 +175,16 @@ protected function getItemsFromPlatform($levels)
{
$grav = Grav::instance();

/** @var Pages $pages */
$pages = $grav['pages'];

// Initialize pages; in Grav 1.7 admin, pages are not initialized by default.
if (method_exists($pages, 'enablePages')) {
$pages->enablePages();
}

// Initialize pages.
$pages = $grav['pages']->all()->nonModular();
$pages = $pages->all()->nonModular();

// Return flat list of routes.
$list = [];
Expand Down Expand Up @@ -196,6 +213,8 @@ protected function getItemsFromPlatform($levels)
'parent_id' => $parent_id,
'layout' => 'list',
'target' => '_self',
// TODO: Grav is missing rel support
'rel' => '',
'dropdown' => '',
'icon' => '',
'image' => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Gantry\Component\Assignments\AssignmentsInterface;
use Grav\Common\Grav;
use Grav\Common\Page\Page;
use Grav\Common\Page\Pages;
use Grav\Common\Uri;

class AssignmentsPage implements AssignmentsInterface
Expand Down Expand Up @@ -60,14 +61,21 @@ protected function getItems()
{
$grav = Grav::instance();

// Initialize pages.
$pages = $grav['pages']->all()->routable();
/** @var Pages $pages */
$pages = $grav['pages'];

// Initialize pages; in Grav 1.7 admin, pages are not initialized by default.
if (method_exists($pages, 'enablePages')) {
$pages->enablePages();
}

$pages = $pages->all()->routable();

$items = [];

/** @var Page $page */
foreach ($pages as $page) {
$route = trim($page->route(), '/');
$route = trim($page->rawRoute(), '/');
$items[] = [
'name' => $route,
'disabled' => !$page->isPage(),
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/grav/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"symfony/yaml": "~3.4",
"twig/twig": "~1.34",
"pimple/pimple": "~3.0",
"filp/whoops": "~2.0",
"filp/whoops": "~2.5",
"rockettheme/toolbox": "~1.3",
"erusev/parsedown-extra": "~0.7",
"phpunit/phpunit": "3.7.*"
Expand Down
Loading

0 comments on commit 6d5c71f

Please sign in to comment.