mirror of
https://github.com/processwire/processwire.git
synced 2025-08-07 23:38:29 +02:00
49 lines
881 B
PHP
49 lines
881 B
PHP
<?php namespace ProcessWire;
|
|
|
|
/**
|
|
* ProcessWire Fieldgroups Array
|
|
*
|
|
* WireArray of Fieldgroup instances as used by Fieldgroups class.
|
|
*
|
|
* ProcessWire 3.x, Copyright 2024 by Ryan Cramer
|
|
* https://processwire.com
|
|
*
|
|
*
|
|
*/
|
|
class FieldgroupsArray extends WireArray {
|
|
|
|
/**
|
|
* Per WireArray interface, this class only carries Fieldgroup instances
|
|
*
|
|
*/
|
|
public function isValidItem($item) {
|
|
return $item instanceof Fieldgroup;
|
|
}
|
|
|
|
/**
|
|
* Per WireArray interface, items are keyed by their ID
|
|
*
|
|
*/
|
|
public function getItemKey($item) {
|
|
/** @var Fieldgroup $item */
|
|
return $item->id;
|
|
}
|
|
|
|
/**
|
|
* Per WireArray interface, keys must be integers
|
|
*
|
|
*/
|
|
public function isValidKey($key) {
|
|
return is_int($key);
|
|
}
|
|
|
|
/**
|
|
* Per WireArray interface, return a blank Fieldgroup
|
|
*
|
|
*/
|
|
public function makeBlankItem() {
|
|
return $this->wire(new Fieldgroup());
|
|
}
|
|
|
|
}
|