src/CoreBundle/EventListener/DcGeneral/Table/Attribute/GetAttributeTypeListener.php
public function getOptions(GetPropertyOptionsEvent $event)
    {
        if (!$this->wantToHandle($event)) {
            return;
        }

        $translator   = $event->getEnvironment()->getTranslator();
        $objMetaModel = $this->getMetaModelByModelPid($event->getModel());
        $flags        = IAttributeFactory::FLAG_ALL_UNTRANSLATED;

        if ($objMetaModel->isTranslated()) {
            $flags |= IAttributeFactory::FLAG_INCLUDE_TRANSLATED;
        }

        $options      = [];
        $optionsTrans = [];
        foreach ($this->attributeFactory->getTypeNames($flags) as $attributeType) {
            // Differentiate translated and simple.
            if ($this->attributeFactory->getTypeFactory($attributeType)->isTranslatedType()) {
                $optionsTrans[$attributeType] = $translator->translate(
                    'typeOptions.' . $attributeType,
                    'tl_metamodel_attribute'
                );
            } else {
                $options[$attributeType] = $translator->translate(
                    'typeOptions.' . $attributeType,
                    'tl_metamodel_attribute'
                );
            }
        }
        asort($options);

        // Add translated attributes.
        if ($objMetaModel->isTranslated()) {
            asort($optionsTrans);
            $options = array_merge($options, $optionsTrans);
        }

        $event->setOptions($options);
    }
public function getOptions(GetPropertyOptionsEvent $event)
    {
        if (!$this->wantToHandle($event)) {
            return;
        }

        $translator   = $event->getEnvironment()->getTranslator();
        $objMetaModel = $this->getMetaModelByModelPid($event->getModel());
        $flags        = IAttributeFactory::FLAG_ALL_UNTRANSLATED;

        if ($objMetaModel->isTranslated()) {
            $flags |= IAttributeFactory::FLAG_INCLUDE_TRANSLATED;
        }

        $options      = [];
        $optionsTrans = [];
        foreach ($this->attributeFactory->getTypeNames($flags) as $attributeType) {
            // Differentiate translated and simple.
            if ($this->attributeFactory->getTypeFactory($attributeType)->isTranslatedType()) {
                $optionsTrans[$attributeType] = $translator->translate(
                    'typeOptions.' . $attributeType,
                    'tl_metamodel_attribute'
                );
            } else {
                $options[$attributeType] = $translator->translate(
                    'typeOptions.' . $attributeType,
                    'tl_metamodel_attribute'
                );
            }
        }
        asort($options);

        // Add translated attributes.
        if ($objMetaModel->isTranslated()) {
            asort($optionsTrans);
            $options = array_merge($options, $optionsTrans);
        }

        $event->setOptions($options);
    }
Provide options for attribute type selection.

@param GetPropertyOptionsEvent $event The event.

@return void