mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
Additional updates for processwire/processwire-issues#1467
This commit is contained in:
@@ -135,6 +135,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
||||
* Rewind to beginning
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind() {
|
||||
$this->pagesPosition = 0;
|
||||
$this->position = 0;
|
||||
@@ -149,6 +150,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
||||
* @return Page
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current() {
|
||||
return $this->pages[$this->pagesPosition];
|
||||
}
|
||||
@@ -159,6 +161,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key() {
|
||||
return $this->position;
|
||||
}
|
||||
@@ -167,6 +170,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
||||
* Update current position to next
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next() {
|
||||
$this->pagesPosition++;
|
||||
$this->position++;
|
||||
@@ -178,6 +182,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function valid() {
|
||||
if($this->position === 0 || $this->pagesPosition >= $this->pagesCount) {
|
||||
// If we have just been rewound or if we have reached the end of the buffer,
|
||||
|
@@ -369,7 +369,7 @@ class PagesEditor extends Wire {
|
||||
foreach($page->template->fieldgroup as $field) {
|
||||
if($page->isLoaded($field->name)) continue; // value already set
|
||||
if(!$page->hasField($field)) continue; // field not valid for page
|
||||
if(!strlen($field->defaultValue)) continue; // no defaultValue property defined with Fieldtype config inputfields
|
||||
if(!strlen("$field->defaultValue")) continue; // no defaultValue property defined with Fieldtype config inputfields
|
||||
try {
|
||||
$blankValue = $field->type->getBlankValue($page, $field);
|
||||
if(is_object($blankValue) || is_array($blankValue)) continue; // we don't currently handle complex types
|
||||
|
@@ -622,6 +622,7 @@ class PagesType extends Wire implements \IteratorAggregate, \Countable {
|
||||
* @see Pages::count()
|
||||
*
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count($selectorString = '', array $options = array()) {
|
||||
if(empty($selectorString) && empty($options) && count($this->parents) == 1) {
|
||||
return $this->getParent()->numChildren();
|
||||
|
@@ -266,7 +266,7 @@ class WireDateTime extends Wire {
|
||||
public function formatDate($value, $format) {
|
||||
|
||||
if(!$value) return '';
|
||||
if(!strlen($format) || $format == 'U' || $format == '%s') return (int) $value; // unix timestamp
|
||||
if(!strlen("$format") || $format === 'U' || $format === '%s') return (int) $value; // unix timestamp
|
||||
$relativeStr = '';
|
||||
|
||||
if(strpos($format, '!') !== false) {
|
||||
|
@@ -504,7 +504,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
||||
if(in_array('disableFilters', $this->toggles)) {
|
||||
$s->attr('disabled', 'disabled');
|
||||
}
|
||||
$selector = $this->sessionGet('selector');
|
||||
$selector = (string) $this->sessionGet('selector');
|
||||
if($this->initSelector) {
|
||||
if(strpos($selector, $this->initSelector) !== false) {
|
||||
$selector = str_replace($this->initSelector, '', $selector); // ensure that $selector does not contain initSelector
|
||||
|
Reference in New Issue
Block a user