MetaModels\DcGeneral\Events\Table\InputScreenCondition\Subscriber::getValueOptions PHP Метод

getValueOptions() публичный Метод

The values get prefixed with 'value_' to ensure numeric values are kept intact.
public getValueOptions ( ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent $event ) : void
$event ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent The event.
Результат void
    public function getValueOptions(GetPropertyOptionsEvent $event)
    {
        if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_dcasetting_condition' || $event->getPropertyName() !== 'value') {
            return;
        }
        $model = $event->getModel();
        $metaModel = $this->getMetaModel($event->getEnvironment());
        $attribute = $metaModel->getAttributeById($model->getProperty('attr_id'));
        if ($attribute) {
            $options = $this->getOptionsViaDcGeneral($metaModel, $event->getEnvironment(), $attribute);
            $mangled = array();
            foreach ((array) $options as $key => $option) {
                $mangled['value_' . $key] = $option;
            }
            $event->setOptions($mangled);
        }
    }