From 2ba8d29ce29b9a26630948a17ef59236cbc7e3d1 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Mon, 21 May 2018 08:47:04 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#595 where horizontal separator in dropdown nav wasn't quite right for the Page Add > Bookmarks option --- .../Process/ProcessPageEdit/PageBookmarks.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wire/modules/Process/ProcessPageEdit/PageBookmarks.php b/wire/modules/Process/ProcessPageEdit/PageBookmarks.php index fcbe22907..76f82d390 100644 --- a/wire/modules/Process/ProcessPageEdit/PageBookmarks.php +++ b/wire/modules/Process/ProcessPageEdit/PageBookmarks.php @@ -43,8 +43,6 @@ public function __construct(Process $process) { */ public function initNavJSON(array $options = array()) { - $page = $this->wire('page'); - $templatesArray = array(); $bookmarkFields = array(); $bookmarksArray = array(); $rolesArray = array(); @@ -67,7 +65,6 @@ public function initNavJSON(array $options = array()) { $n = 0; foreach($bookmarkFields as $name => $bookmarkIDs) { $bookmarks = count($bookmarkIDs) ? $this->wire('pages')->getById($bookmarkIDs) : array(); - // $className = "separator"; $role = isset($rolesArray[$name]) ? $rolesArray[$name] : null; foreach($bookmarks as $page) { if($this->process == 'ProcessPageEdit' && !$page->editable()) continue; @@ -77,9 +74,7 @@ public function initNavJSON(array $options = array()) { $icon = $page->template->getIcon(); if(!$icon) $icon = $options['defaultIcon']; $page->setQuietly($iconKey, $icon); - // $page->setQuietly($classKey, $className); $page->setQuietly('_roleName', $role ? $role->name : $this->labels['all']); - $className = ''; $bookmarksArray[$page->id] = $page; } $n++; @@ -98,7 +93,7 @@ public function initNavJSON(array $options = array()) { $add->set('_icon', 'bookmark-o'); $add->set('title', $this->labels['bookmarks']); $add->set('id', 'bookmark'); - $add->set($classKey, 'highlight separator'); + $add->set($classKey, 'separator'); array_unshift($bookmarksArray, $add); } @@ -135,6 +130,7 @@ public function listBookmarks() { $noneHeadline = $this->_('There are currently no bookmarks defined'); foreach($options['items'] as $item) { + /** @var WireData $item */ if($item->id == 'bookmark') continue; $url = str_replace('{id}', $item->id, $options['edit']); $icon = $item->_icon ? " " : ""; @@ -167,7 +163,7 @@ public function listBookmarks() { * Provides the editor for bookmarks and returns InputfieldForm * * @return InputfieldForm - * @throws WirePermissionException + * @throws WirePermissionException|WireException * */ public function editBookmarksForm() { @@ -274,7 +270,6 @@ public function editBookmarks() { /** * Check and update the given process page for hidden/visible status depending on useBookmarks setting * - * @param Process $process * @param Page $page * */ @@ -295,7 +290,6 @@ public function checkProcessPage(Page $page) { * Populate any configuration inputfields to the given $inputfields wrapper for $process * * @param InputfieldWrapper $inputfields - * @param Process $process * */ public function addConfigInputfields(InputfieldWrapper $inputfields) {