Craft\NeoService::getBlockTypesByFieldId PHP Method

getBlockTypesByFieldId() public method

Returns a list of block types associated with a field.
public getBlockTypesByFieldId ( $fieldId, string | null $indexBy = null ) : array
$fieldId
$indexBy string | null
return array
    public function getBlockTypesByFieldId($fieldId, $indexBy = null)
    {
        if (empty($this->_fetchedAllBlockTypesForFieldId[$fieldId])) {
            $this->_blockTypesByFieldId[$fieldId] = [];
            $results = $this->_createBlockTypeQuery()->where('fieldId = :fieldId', [':fieldId' => $fieldId])->queryAll();
            foreach ($results as $result) {
                $blockType = new Neo_BlockTypeModel($result);
                $this->_blockTypesById[$blockType->id] = $blockType;
                $this->_blockTypesByFieldId[$fieldId][] = $blockType;
            }
            $this->_fetchedAllBlockTypesForFieldId[$fieldId] = true;
        }
        if ($indexBy) {
            return $this->_indexBy($this->_blockTypesByFieldId[$fieldId], $indexBy);
        }
        return $this->_blockTypesByFieldId[$fieldId];
    }