mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +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
|
* Rewind to beginning
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function rewind() {
|
public function rewind() {
|
||||||
$this->pagesPosition = 0;
|
$this->pagesPosition = 0;
|
||||||
$this->position = 0;
|
$this->position = 0;
|
||||||
@@ -149,6 +150,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
|||||||
* @return Page
|
* @return Page
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function current() {
|
public function current() {
|
||||||
return $this->pages[$this->pagesPosition];
|
return $this->pages[$this->pagesPosition];
|
||||||
}
|
}
|
||||||
@@ -159,6 +161,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
|||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function key() {
|
public function key() {
|
||||||
return $this->position;
|
return $this->position;
|
||||||
}
|
}
|
||||||
@@ -167,6 +170,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
|||||||
* Update current position to next
|
* Update current position to next
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function next() {
|
public function next() {
|
||||||
$this->pagesPosition++;
|
$this->pagesPosition++;
|
||||||
$this->position++;
|
$this->position++;
|
||||||
@@ -178,6 +182,7 @@ class PageArrayIterator extends Wire implements \Iterator {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function valid() {
|
public function valid() {
|
||||||
if($this->position === 0 || $this->pagesPosition >= $this->pagesCount) {
|
if($this->position === 0 || $this->pagesPosition >= $this->pagesCount) {
|
||||||
// If we have just been rewound or if we have reached the end of the buffer,
|
// 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) {
|
foreach($page->template->fieldgroup as $field) {
|
||||||
if($page->isLoaded($field->name)) continue; // value already set
|
if($page->isLoaded($field->name)) continue; // value already set
|
||||||
if(!$page->hasField($field)) continue; // field not valid for page
|
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 {
|
try {
|
||||||
$blankValue = $field->type->getBlankValue($page, $field);
|
$blankValue = $field->type->getBlankValue($page, $field);
|
||||||
if(is_object($blankValue) || is_array($blankValue)) continue; // we don't currently handle complex types
|
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()
|
* @see Pages::count()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function count($selectorString = '', array $options = array()) {
|
public function count($selectorString = '', array $options = array()) {
|
||||||
if(empty($selectorString) && empty($options) && count($this->parents) == 1) {
|
if(empty($selectorString) && empty($options) && count($this->parents) == 1) {
|
||||||
return $this->getParent()->numChildren();
|
return $this->getParent()->numChildren();
|
||||||
|
@@ -266,7 +266,7 @@ class WireDateTime extends Wire {
|
|||||||
public function formatDate($value, $format) {
|
public function formatDate($value, $format) {
|
||||||
|
|
||||||
if(!$value) return '';
|
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 = '';
|
$relativeStr = '';
|
||||||
|
|
||||||
if(strpos($format, '!') !== false) {
|
if(strpos($format, '!') !== false) {
|
||||||
|
@@ -504,7 +504,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
if(in_array('disableFilters', $this->toggles)) {
|
if(in_array('disableFilters', $this->toggles)) {
|
||||||
$s->attr('disabled', 'disabled');
|
$s->attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
$selector = $this->sessionGet('selector');
|
$selector = (string) $this->sessionGet('selector');
|
||||||
if($this->initSelector) {
|
if($this->initSelector) {
|
||||||
if(strpos($selector, $this->initSelector) !== false) {
|
if(strpos($selector, $this->initSelector) !== false) {
|
||||||
$selector = str_replace($this->initSelector, '', $selector); // ensure that $selector does not contain initSelector
|
$selector = str_replace($this->initSelector, '', $selector); // ensure that $selector does not contain initSelector
|
||||||
|
Reference in New Issue
Block a user