1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-22 06:13:57 +02:00

Add renderedExtras() hook to ProcessPageLister, plus make the finalSelector property modifiable if needed by hooks, per request from @renobird

This commit is contained in:
Ryan Cramer
2018-11-02 06:44:49 -04:00
parent a0192327e0
commit a355bd74e6
2 changed files with 28 additions and 10 deletions

View File

@@ -450,7 +450,10 @@ 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(

View File

@@ -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 = "<div id='ProcessListerRefreshTab' title='$refreshLabel' class='WireTab WireTabTip'></div>";
$out .= "<div id='ProcessListerResetTab' title='$resetLabel' class='WireTab WireTabTip'></div>";
$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;
}
/**
@@ -2021,7 +2037,6 @@ class ProcessPageLister extends Process implements ConfigurableModule {
}
/**
* Install Lister
*