public function getElementalTypes()
    {
        $config = $this->owner->config();

        if (is_array($config->get('allowed_elements'))) {
            if ($config->get('stop_element_inheritance')) {
                $availableClasses = $config->get('allowed_elements', Config::UNINHERITED);
            } else {
                $availableClasses = $config->get('allowed_elements');
            }
        } else {
            $availableClasses = ClassInfo::subclassesFor(BaseElement::class);
        }

        if ($config->get('stop_element_inheritance')) {
            $disallowedElements = (array) $config->get('disallowed_elements', Config::UNINHERITED);
        } else {
            $disallowedElements = (array) $config->get('disallowed_elements');
        }
        $list = [];

        foreach ($availableClasses as $availableClass) {
            /** @var BaseElement $inst */
            $inst = singleton($availableClass);

            if (!in_array($availableClass, $disallowedElements) && $inst->canCreate()) {
                if ($inst->hasMethod('canCreateElement') && !$inst->canCreateElement()) {
                    continue;
                }

                $list[$availableClass] = $inst->getType();
            }
        }

        if ($config->get('sort_types_alphabetically') !== false) {
            asort($list);
        }

        if (isset($list[BaseElement::class])) {
            unset($list[BaseElement::class]);
        }

        $class = get_class($this->owner);
        $this->owner->invokeWithExtensions('updateAvailableTypesForClass', $class, $list);

        return $list;
    }
public function getElementalTypes()
    {
        $config = $this->owner->config();

        if (is_array($config->get('allowed_elements'))) {
            if ($config->get('stop_element_inheritance')) {
                $availableClasses = $config->get('allowed_elements', Config::UNINHERITED);
            } else {
                $availableClasses = $config->get('allowed_elements');
            }
        } else {
            $availableClasses = ClassInfo::subclassesFor(BaseElement::class);
        }

        if ($config->get('stop_element_inheritance')) {
            $disallowedElements = (array) $config->get('disallowed_elements', Config::UNINHERITED);
        } else {
            $disallowedElements = (array) $config->get('disallowed_elements');
        }
        $list = [];

        foreach ($availableClasses as $availableClass) {
            /** @var BaseElement $inst */
            $inst = singleton($availableClass);

            if (!in_array($availableClass, $disallowedElements) && $inst->canCreate()) {
                if ($inst->hasMethod('canCreateElement') && !$inst->canCreateElement()) {
                    continue;
                }

                $list[$availableClass] = $inst->getType();
            }
        }

        if ($config->get('sort_types_alphabetically') !== false) {
            asort($list);
        }

        if (isset($list[BaseElement::class])) {
            unset($list[BaseElement::class]);
        }

        $class = get_class($this->owner);
        $this->owner->invokeWithExtensions('updateAvailableTypesForClass', $class, $list);

        return $list;
    }
public function getElementalTypes ( ) { $ config = $ this -> owner -> config ( ) ; if ( is_array ( $ config -> get ( 'allowed_elements' ) ) ) { if ( $ config -> get ( 'stop_element_inheritance' ) ) { $ availableClasses = $ config -> get ( 'allowed_elements' , Config :: UNINHERITED ) ; } else { $ availableClasses = $ config -> get ( 'allowed_elements' ) ; } } else { $ availableClasses = ClassInfo :: subclassesFor ( BaseElement :: class ) ; } if ( $ config -> get ( 'stop_element_inheritance' ) ) { $ disallowedElements = ( array ) $ config -> get ( 'disallowed_elements' , Config :: UNINHERITED ) ; } else { $ disallowedElements = ( array ) $ config -> get ( 'disallowed_elements' ) ; } $ list = [ ] ; foreach ( $ availableClasses as $ availableClass ) { /** @var BaseElement $inst */ $ inst = singleton ( $ availableClass ) ; if ( ! in_array ( $ availableClass , $ disallowedElements ) && $ inst -> canCreate ( ) ) { if ( $ inst -> hasMethod ( 'canCreateElement' ) && ! $ inst -> canCreateElement ( ) ) { continue ; } $ list [ $ availableClass ] = $ inst -> getType ( ) ; } } if ( $ config -> get ( 'sort_types_alphabetically' ) !== false ) { asort ( $ list ) ; } if ( isset ( $ list [ BaseElement :: class ] ) ) { unset ( $ list [ BaseElement :: class ] ) ; } $ class = get_class ( $ this -> owner ) ; $ this -> owner -> invokeWithExtensions ( 'updateAvailableTypesForClass' , $ class , $ list ) ; return $ list ; }
Get the available element types for this page type,

Uses allowed_elements, stop_element_inheritance, disallowed_elements in
order to get to correct list.

@return array
Get the available element types for this page type