* @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\Form\ChoiceProvider; use PrestaShop\PrestaShop\Adapter\OrderMessage\OrderMessageProvider; use PrestaShop\PrestaShop\Core\Form\ConfigurableFormChoiceProviderInterface; /** * Selects order messages itself. */ final class CustomerServiceOrderMessagesChoiceProvider implements ConfigurableFormChoiceProviderInterface { /** * @var OrderMessageProvider */ private $orderMessageProvider; public function __construct(OrderMessageProvider $orderMessageProvider) { $this->orderMessageProvider = $orderMessageProvider; } /** * {@inheritdoc} */ public function getChoices(array $options): array { $result = []; foreach ($this->orderMessageProvider->getMessages($options['lang_id']) as $orderMessage) { $result[$orderMessage['id_order_message']] = $orderMessage['message']; } return $result; } }