* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Grid\Action; use PrestaShop\PrestaShop\Core\Grid\Collection\AbstractCollection; /** * Class PanelActionCollection is responsible for holding single grid actions. * * @property GridActionInterface[] $items */ final class GridActionCollection extends AbstractCollection implements GridActionCollectionInterface { /** * {@inheritdoc} */ public function add(GridActionInterface $action) { $this->items[$action->getId()] = $action; return $this; } /** * {@inheritdoc} */ public function toArray() { $actionsArray = []; foreach ($this->items as $action) { $actionsArray[] = [ 'id' => $action->getId(), 'name' => $action->getName(), 'icon' => $action->getIcon(), 'type' => $action->getType(), 'options' => $action->getOptions(), ]; } return $actionsArray; } }