58 lines
1.1 KiB
PHP
Executable File
58 lines
1.1 KiB
PHP
Executable File
<?php /**/
|
|
|
|
namespace Olegnax\MegaMenu\Model\Attribute;
|
|
|
|
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
|
|
|
|
class Duration extends AbstractSource
|
|
{
|
|
/**
|
|
* Retrieve option array
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getOptionArray()
|
|
{
|
|
$_options = [];
|
|
foreach ($this->getAllOptions() as $option) {
|
|
$_options[$option['value']] = $option['label'];
|
|
}
|
|
return $_options;
|
|
}
|
|
|
|
/**
|
|
* Retrieve all options array
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getAllOptions()
|
|
{
|
|
if ($this->_options === null) {
|
|
$this->_options = [
|
|
['label' => __('toggle'), 'value' => 'toggle'],
|
|
['label' => __('fade'), 'value' => 'fade'],
|
|
['label' => __('emersion'), 'value' => 'emersion'],
|
|
['label' => __('emersion vertical'), 'value' => 'emersion-vertical'],
|
|
];
|
|
}
|
|
return $this->_options;
|
|
}
|
|
|
|
/**
|
|
* Get a text for option value
|
|
*
|
|
* @param string|int $value
|
|
* @return string|false
|
|
*/
|
|
public function getOptionText($value)
|
|
{
|
|
$options = $this->getAllOptions();
|
|
foreach ($options as $option) {
|
|
if ($option['value'] == $value) {
|
|
return $option['label'];
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} |