public function getBlockTypesByFieldId(int $fieldId): array
    {
        if (!empty($this->_fetchedAllBlockTypesForFieldId[$fieldId])) {
            return $this->_blockTypesByFieldId[$fieldId];
        }

        $this->_blockTypesByFieldId[$fieldId] = [];

        $results = $this->_createBlockTypeQuery()
            ->where(['fieldId' => $fieldId])
            ->all();

        foreach ($results as $result) {
            $blockType = new SuperTableBlockTypeModel($result);
            $this->_blockTypesById[$blockType->id] = $blockType;
            $this->_blockTypesByFieldId[$fieldId][] = $blockType;
        }

        $this->_fetchedAllBlockTypesForFieldId[$fieldId] = true;

        return $this->_blockTypesByFieldId[$fieldId];
    }
public function getBlockTypesByFieldId(int $fieldId): array
    {
        if (!empty($this->_fetchedAllBlockTypesForFieldId[$fieldId])) {
            return $this->_blockTypesByFieldId[$fieldId];
        }

        $this->_blockTypesByFieldId[$fieldId] = [];

        $results = $this->_createBlockTypeQuery()
            ->where(['fieldId' => $fieldId])
            ->all();

        foreach ($results as $result) {
            $blockType = new SuperTableBlockTypeModel($result);
            $this->_blockTypesById[$blockType->id] = $blockType;
            $this->_blockTypesByFieldId[$fieldId][] = $blockType;
        }

        $this->_fetchedAllBlockTypesForFieldId[$fieldId] = true;

        return $this->_blockTypesByFieldId[$fieldId];
    }
public function getBlockTypesByFieldId ( int $ fieldId ) : array { if ( ! empty ( $ this -> _fetchedAllBlockTypesForFieldId [ $ fieldId ] ) ) { return $ this -> _blockTypesByFieldId [ $ fieldId ] ; } $ this -> _blockTypesByFieldId [ $ fieldId ] = [ ] ; $ results = $ this -> _createBlockTypeQuery ( ) -> where ( [ 'fieldId' => $ fieldId ] ) -> all ( ) ; foreach ( $ results as $ result ) { $ blockType = new SuperTableBlockTypeModel ( $ result ) ; $ this -> _blockTypesById [ $ blockType -> id ] = $ blockType ; $ this -> _blockTypesByFieldId [ $ fieldId ] [ ] = $ blockType ; } $ this -> _fetchedAllBlockTypesForFieldId [ $ fieldId ] = true ; return $ this -> _blockTypesByFieldId [ $ fieldId ] ; }
Returns the block types for a given Super Table field.

@param int $fieldId The Super Table field ID.

@return SuperTableBlockType[] An array of block types.
Returns the block types for a given Super Table field .