public function registerElement($elementClass)
    {
        $singleton = singleton($elementClass);

        if (!$singleton instanceof BaseElement) {
            throw new LogicException('Only elements that extend ' . BaseElement::class . ' can be registered');
        }

        // Get the GraphQL type name
        $typeName = StaticSchema::inst()->typeNameForDataObject($elementClass);

        $this->elementTypes[] = [
            'icon' => $singleton::config()->get('icon'),
            'name' => $typeName,
            'class' => $elementClass,
            'title' => $singleton->getType(),
            'inlineEditable' => $singleton->inlineEditable(),
            'editTabs' => $this->getTabProvider()->getTabsForElement($elementClass),
            // Cast to object as React prop-types expects it.
            'config' => (object) $singleton::getBlockConfig(),
        ];

        return $this;
    }
public function registerElement($elementClass)
    {
        $singleton = singleton($elementClass);

        if (!$singleton instanceof BaseElement) {
            throw new LogicException('Only elements that extend ' . BaseElement::class . ' can be registered');
        }

        // Get the GraphQL type name
        $typeName = StaticSchema::inst()->typeNameForDataObject($elementClass);

        $this->elementTypes[] = [
            'icon' => $singleton::config()->get('icon'),
            'name' => $typeName,
            'class' => $elementClass,
            'title' => $singleton->getType(),
            'inlineEditable' => $singleton->inlineEditable(),
            'editTabs' => $this->getTabProvider()->getTabsForElement($elementClass),
            // Cast to object as React prop-types expects it.
            'config' => (object) $singleton::getBlockConfig(),
        ];

        return $this;
    }
public function registerElement ( $ elementClass ) { $ singleton = singleton ( $ elementClass ) ; if ( ! $ singleton instanceof BaseElement ) { throw new LogicException ( 'Only elements that extend ' . BaseElement :: class . ' can be registered' ) ; } // Get the GraphQL type name $ typeName = StaticSchema :: inst ( ) -> typeNameForDataObject ( $ elementClass ) ; $ this -> elementTypes [ ] = [ 'icon' => $ singleton :: config ( ) -> get ( 'icon' ) , 'name' => $ typeName , 'class' => $ elementClass , 'title' => $ singleton -> getType ( ) , 'inlineEditable' => $ singleton -> inlineEditable ( ) , 'editTabs' => $ this -> getTabProvider ( ) -> getTabsForElement ( $ elementClass ) , // Cast to object as React prop-types expects it. 'config' => ( object ) $ singleton :: getBlockConfig ( ) , ] ; return $ this ; }
Register an element type with this registry

@param string $elementClass
@return $this
Register an element type with this registry