From a355bd74e6ce58f59b8bab939e79da458551aba5 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 2 Nov 2018 06:44:49 -0400 Subject: [PATCH] Add renderedExtras() hook to ProcessPageLister, plus make the finalSelector property modifiable if needed by hooks, per request from @renobird --- wire/modules/PagePathHistory.module | 7 +++-- .../ProcessPageLister.module | 31 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/wire/modules/PagePathHistory.module b/wire/modules/PagePathHistory.module index 055f5eb5..66e1eb27 100644 --- a/wire/modules/PagePathHistory.module +++ b/wire/modules/PagePathHistory.module @@ -449,8 +449,11 @@ class PagePathHistory extends WireData implements Module { // if parent change date is older than page change date, then we can skip it if(strtotime($parentPathInfo['date']) < $date) continue; - - // $path .= " $parentInfo[date] | $pathInfo[date]"; + + // if path is related to trash do not include it + if(strpos($path, '/trash/') === 0 || preg_match('!/\d+\.\d+\.\d+_[-_a-z0-9]+!', $path)) { + continue; + } // create verbose info for this entry $pathInfo = array( diff --git a/wire/modules/Process/ProcessPageLister/ProcessPageLister.module b/wire/modules/Process/ProcessPageLister/ProcessPageLister.module index 3d144d06..190ce634 100644 --- a/wire/modules/Process/ProcessPageLister/ProcessPageLister.module +++ b/wire/modules/Process/ProcessPageLister/ProcessPageLister.module @@ -72,7 +72,7 @@ * @method string executeConfig() ListerPro * @method string executeActions() ListerPro * @method string executeSave() ListerPro - * @method string renderExtraTabs() #pw-hooker + * @method string renderedExtras($markup) #pw-hooker * * * @todo make system fields hookable for output like markupValue is for custom fields @@ -513,10 +513,25 @@ class ProcessPageLister extends Process implements ConfigurableModule { return $this; } else if($key == 'parent' && !$value instanceof Page) { $value = $this->wire('pages')->get($value); + } else if($key === 'finalSelector') { + $this->finalSelector = $value; } return parent::set($key, $value); } + /** + * Get a Lister setting + * + * @param string $key + * @return mixed|string + * + */ + public function get($key) { + if($key === 'finalSelector') return $this->finalSelector; + return parent::get($key); + } + + /** * Set a Lister session variable * @@ -1833,22 +1848,23 @@ class ProcessPageLister extends Process implements ConfigurableModule { $resetLabel = $this->_('Reset filters and columns to default'); $out = "
"; $out .= "
"; - $out .= $this->renderExtraTabs(); + $out = $this->renderedExtras($out); return $out; } /** - * Optionally hook this if you want to add additional tabs + * Called when extra tabs markup has been rendered * - * See renderExtras() method above for examples. + * Optionally hook this if you want to modify or add additional tabs markup returned by renderExtras() * * #pw-hooker * - * @return string Markup for extra tabs + * @param string $markup Existing tab markup already rendered + * @return string Contents of the $markup variable optionally prepended/appended with additional tab markup * */ - public function ___renderExtraTabs() { - return ''; + public function ___renderedExtras($markup) { + return $markup; } /** @@ -2019,7 +2035,6 @@ class ProcessPageLister extends Process implements ConfigurableModule { return parent::___executeNavJSON($options); } - /**