private function _getBlockTypeInfoForInput(ElementInterface $element = null): array
    {
        $settings = $this->getSettings();

        $blockTypes = [];

        // Set a temporary namespace for these
        $originalNamespace = Craft::$app->getView()->getNamespace();
        $namespace = Craft::$app->getView()->namespaceInputName($this->handle . '[__BLOCK_ST__][fields]', $originalNamespace);
        Craft::$app->getView()->setNamespace($namespace);

        foreach ($this->getBlockTypes() as $blockType) {
            // Create a fake SuperTableBlock so the field types have a way to get at the owner element, if there is one
            $block = new SuperTableBlockElement();
            $block->fieldId = $this->id;
            $block->typeId = $blockType->id;

            if ($element) {
                $block->setOwner($element);
                $block->siteId = $element->siteId;
            }

            $fieldLayoutFields = $blockType->getFieldLayout()->getFields();

            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(true);
            }

            Craft::$app->getView()->startJsBuffer();

            $bodyHtml = Craft::$app->getView()->namespaceInputs(Craft::$app->getView()->renderTemplate('super-table/fields', [
                'namespace' => null,
                'fields' => $fieldLayoutFields,
                'element' => $block,
                'settings' => $settings,
                'staticField' => $this->staticField,
            ]));

            // Reset $_isFresh's
            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(null);
            }

            $footHtml = Craft::$app->getView()->clearJsBuffer();

            $blockTypes[] = [
                'type' => $blockType->id,
                'bodyHtml' => $bodyHtml,
                'footHtml' => $footHtml,
            ];
        }

        Craft::$app->getView()->setNamespace($originalNamespace);

        return $blockTypes;
    }
private function _getBlockTypeInfoForInput(ElementInterface $element = null): array
    {
        $settings = $this->getSettings();

        $blockTypes = [];

        // Set a temporary namespace for these
        $originalNamespace = Craft::$app->getView()->getNamespace();
        $namespace = Craft::$app->getView()->namespaceInputName($this->handle . '[__BLOCK_ST__][fields]', $originalNamespace);
        Craft::$app->getView()->setNamespace($namespace);

        foreach ($this->getBlockTypes() as $blockType) {
            // Create a fake SuperTableBlock so the field types have a way to get at the owner element, if there is one
            $block = new SuperTableBlockElement();
            $block->fieldId = $this->id;
            $block->typeId = $blockType->id;

            if ($element) {
                $block->setOwner($element);
                $block->siteId = $element->siteId;
            }

            $fieldLayoutFields = $blockType->getFieldLayout()->getFields();

            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(true);
            }

            Craft::$app->getView()->startJsBuffer();

            $bodyHtml = Craft::$app->getView()->namespaceInputs(Craft::$app->getView()->renderTemplate('super-table/fields', [
                'namespace' => null,
                'fields' => $fieldLayoutFields,
                'element' => $block,
                'settings' => $settings,
                'staticField' => $this->staticField,
            ]));

            // Reset $_isFresh's
            foreach ($fieldLayoutFields as $field) {
                $field->setIsFresh(null);
            }

            $footHtml = Craft::$app->getView()->clearJsBuffer();

            $blockTypes[] = [
                'type' => $blockType->id,
                'bodyHtml' => $bodyHtml,
                'footHtml' => $footHtml,
            ];
        }

        Craft::$app->getView()->setNamespace($originalNamespace);

        return $blockTypes;
    }
private function _getBlockTypeInfoForInput ( ElementInterface $ element = null ) : array { $ settings = $ this -> getSettings ( ) ; $ blockTypes = [ ] ; // Set a temporary namespace for these $ originalNamespace = Craft :: $ app -> getView ( ) -> getNamespace ( ) ; $ namespace = Craft :: $ app -> getView ( ) -> namespaceInputName ( $ this -> handle . '[__BLOCK_ST__][fields]' , $ originalNamespace ) ; Craft :: $ app -> getView ( ) -> setNamespace ( $ namespace ) ; foreach ( $ this -> getBlockTypes ( ) as $ blockType ) { // Create a fake SuperTableBlock so the field types have a way to get at the owner element, if there is one $ block = new SuperTableBlockElement ( ) ; $ block -> fieldId = $ this -> id ; $ block -> typeId = $ blockType -> id ; if ( $ element ) { $ block -> setOwner ( $ element ) ; $ block -> siteId = $ element -> siteId ; } $ fieldLayoutFields = $ blockType -> getFieldLayout ( ) -> getFields ( ) ; foreach ( $ fieldLayoutFields as $ field ) { $ field -> setIsFresh ( true ) ; } Craft :: $ app -> getView ( ) -> startJsBuffer ( ) ; $ bodyHtml = Craft :: $ app -> getView ( ) -> namespaceInputs ( Craft :: $ app -> getView ( ) -> renderTemplate ( 'super-table/fields' , [ 'namespace' => null , 'fields' => $ fieldLayoutFields , 'element' => $ block , 'settings' => $ settings , 'staticField' => $ this -> staticField , ] ) ) ; // Reset $_isFresh's foreach ( $ fieldLayoutFields as $ field ) { $ field -> setIsFresh ( null ) ; } $ footHtml = Craft :: $ app -> getView ( ) -> clearJsBuffer ( ) ; $ blockTypes [ ] = [ 'type' => $ blockType -> id , 'bodyHtml' => $ bodyHtml , 'footHtml' => $ footHtml , ] ; } Craft :: $ app -> getView ( ) -> setNamespace ( $ originalNamespace ) ; return $ blockTypes ; }
Returns info about each block type and their field types for the Super Table field input.

@param ElementInterface|null $element

@return array
Returns info about each block type and their field types for the Super Table field input .