Debian Codegraph @

vendor/oojs/oojs-ui/php/mixins/GroupWidget.php

raw
1 <?php
2
3 namespace OOUI;
4
5 /**
6 * Use together with ItemWidget to make disabled state inheritable.
7 *
8 * @abstract
9 *
10 * @method Widget[] getItems()
11 */
12 trait GroupWidget {
13 use GroupElement;
14
15 /**
16 * @param bool $disabled
17 */
18 public function setDisabled( $disabled ) {
19 // @phan-suppress-next-line PhanTraitParentReference
20 parent::setDisabled( $disabled );
21 $modifiedItems = [];
22 $items = $this->getItems();
23 /** @var Widget $item */
24 foreach ( $items as $item ) {
25 $modifiedItems[] = $item->setDisabled( $disabled );
26 }
27 $this->clearItems();
28 $this->addItems( $modifiedItems );
29 }
30 }