MetaModels\DcGeneral\Events\Table\InputScreenSortGroup\Subscriber::getAttrOptions PHP Method

getAttrOptions() public method

Provide options for attribute type selection.
public getAttrOptions ( ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent $event ) : void
$event ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent The event.
return void
    public function getAttrOptions(GetPropertyOptionsEvent $event)
    {
        if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_dca_sortgroup' || $event->getPropertyName() !== 'rendergroupattr' && $event->getPropertyName() !== 'rendersortattr') {
            return;
        }
        $result = array();
        $metaModel = $this->getMetaModel($event->getEnvironment());
        foreach ($metaModel->getAttributes() as $attribute) {
            $typeName = $attribute->get('type');
            $strSelectVal = $metaModel->getTableName() . '_' . $attribute->getColName();
            $result[$strSelectVal] = $attribute->getName() . ' [' . $typeName . ']';
        }
        $event->setOptions($result);
    }