Font.php 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Captcha image model
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Captcha\Model\Config;
  12. class Font implements \Magento\Framework\Option\ArrayInterface
  13. {
  14. /**
  15. * Captcha data
  16. *
  17. * @var \Magento\Captcha\Helper\Data
  18. */
  19. protected $_captchaData = null;
  20. /**
  21. * @param \Magento\Captcha\Helper\Data $captchaData
  22. */
  23. public function __construct(\Magento\Captcha\Helper\Data $captchaData)
  24. {
  25. $this->_captchaData = $captchaData;
  26. }
  27. /**
  28. * Get options for font selection field
  29. *
  30. * @return array
  31. */
  32. public function toOptionArray()
  33. {
  34. $optionArray = [];
  35. foreach ($this->_captchaData->getFonts() as $fontName => $fontData) {
  36. $optionArray[] = ['label' => $fontData['label'], 'value' => $fontName];
  37. }
  38. return $optionArray;
  39. }
  40. }