1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-23 06:44:38 +02:00

Addition of a $page->numParents() method/property which reflects the number of parents the page has, aka depth in the tree. This commit also has several small adjustments and fixes, including a fix for the issue introduced last week that caused issues with WireArray in versions of PHP prior to 7.x

This commit is contained in:
Ryan Cramer
2018-10-26 12:18:46 -04:00
parent b964fd1a15
commit 7331bac132
11 changed files with 126 additions and 33 deletions

View File

@@ -1814,6 +1814,8 @@ class FieldtypeComments extends FieldtypeMulti {
$updatePropertyCounts = array();
$skipUpdateProperties = array('id', 'created_user', 'created_users_id');
if(!$comments) return null;
foreach($comments as $comment) {
if($comment->status == Comment::statusSpam) continue;
$key = $this->getCommentExportKey($comment);

View File

@@ -103,7 +103,7 @@ class SelectableOption extends WireData { // implements LanguagesValueInterface
* @return string
*
*/
protected function getProperty($property) {
public function getProperty($property) {
if($this->wire('languages')) {
$language = $this->wire('user')->language;
if($language->isDefault()) {

View File

@@ -89,9 +89,13 @@ class InputfieldCheckbox extends Inputfield {
$attrs = $this->getAttributes();
$attrs['value'] = $this->checkedValue;
if($this->getSetting('entityEncodeLabel') !== false) {
$label = $this->entityEncode($label);
}
$out =
"<label><input type='checkbox' " . $this->getAttributesString($attrs) . " />" .
"<span class='pw-no-select'>" . $this->entityEncode($label) . "</span></label>";
"<span class='pw-no-select'>$label</span></label>";
return $out;
}

View File

@@ -72,6 +72,7 @@
* @method string executeConfig() ListerPro
* @method string executeActions() ListerPro
* @method string executeSave() ListerPro
* @method string renderExtraTabs() #pw-hooker
*
*
* @todo make system fields hookable for output like markupValue is for custom fields
@@ -1823,7 +1824,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
/**
* Render additional tabs, setup so that descending classes can use as a template method
*
*
* @return string
*
*/
@@ -1832,9 +1833,24 @@ 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();
return $out;
}
/**
* Optionally hook this if you want to add additional tabs
*
* See renderExtras() method above for examples.
*
* #pw-hooker
*
* @return string Markup for extra tabs
*
*/
public function ___renderExtraTabs() {
return '';
}
/**
* Prepare the session values for external assets
*

View File

@@ -605,7 +605,13 @@ class ProcessPagesExportImport extends Process {
$path = rtrim($importParentPath . substr($path, strlen($missingParentPath)), '/') . '/';
}
}
if($path == $item['path']) $path = $importParentPath . trim($path, '/') . '/';
if($path == $item['path']) {
if(strpos($path, $importParentPath) === 0) {
// parent already present in path
} else {
$path = $importParentPath . trim($path, '/') . '/';
}
}
$a['pages'][$key]['path'] = $path;
}
}