/** * Get options * * @return array */ public function toOptionArray() { if (null === self::$options) { $availableOptions = $this->teaserItem->getAvailableStatuses(); self::$options = []; foreach ($availableOptions as $key => $value) { self::$options[] = ['label' => $value, 'value' => $key]; } } return self::$options; }
/** * Delete teaserItem. * * @param Data\TeaserItemInterface $teaserItem * * @return bool true on success * * @throws CouldNotDeleteException */ public function delete(Data\TeaserItemInterface $teaserItem) { if (false === $teaserItem instanceof AbstractModel) { throw new CouldNotDeleteException(__('Invalid Model')); } /** @var AbstractModel $teaserItem */ try { $this->resource->delete($teaserItem); } catch (\Exception $exception) { throw new CouldNotDeleteException(__($exception->getMessage())); } return true; }