MetaModels\DcGeneral\Events\Table\InputScreenCondition\Subscriber::getOptionsViaDcGeneral PHP Method

getOptionsViaDcGeneral() private method

Obtain the values of a property within a dc-general instance.
private getOptionsViaDcGeneral ( MetaModels\IMetaModel $metaModel, ContaoCommunityAlliance\DcGeneral\EnvironmentInterface $environment, MetaModels\Attribute\IAttribute $attribute ) : array
$metaModel MetaModels\IMetaModel The metamodel instance to obtain the values from.
$environment ContaoCommunityAlliance\DcGeneral\EnvironmentInterface The environment used in the input screen table dc-general.
$attribute MetaModels\Attribute\IAttribute The attribute to obtain the values for.
return array
    private function getOptionsViaDcGeneral($metaModel, $environment, $attribute)
    {
        $factory = new DcGeneralFactory();
        $dcGeneral = $factory->setContainerName($metaModel->getTableName())->setEventDispatcher($environment->getEventDispatcher())->setTranslator($environment->getTranslator())->createDcGeneral();
        $subEnv = $dcGeneral->getEnvironment();
        $optEv = new GetPropertyOptionsEvent($subEnv, $subEnv->getDataProvider()->getEmptyModel());
        $optEv->setPropertyName($attribute->getColName());
        $subEnv->getEventDispatcher()->dispatch(GetPropertyOptionsEvent::NAME, $optEv);
        $options = $optEv->getOptions();
        return $options;
    }