Skip to content

Commit

Permalink
Fix issue processwire/processwire-issues#595 where horizontal separat…
Browse files Browse the repository at this point in the history
…or in dropdown nav wasn't quite right for the Page Add > Bookmarks option
  • Loading branch information
ryancramerdesign committed May 21, 2018
1 parent 76a15a2 commit 2ba8d29
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions wire/modules/Process/ProcessPageEdit/PageBookmarks.php
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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++;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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 ? "<i class='fa fa-fw fa-$item->_icon'></i> " : "";
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
*
*/
Expand All @@ -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) {
Expand Down

0 comments on commit 2ba8d29

Please sign in to comment.