Bolt\Storage\ContentRequest\Edit::getUsedFieldtypes PHP Method

getUsedFieldtypes() private method

Create a list of fields types used in regular, template and virtual fields.
private getUsedFieldtypes ( Bolt\Storage\Mapping\ContentType $contentType, Content $content, array $has ) : array
$contentType Bolt\Storage\Mapping\ContentType
$content Bolt\Storage\Entity\Content
$has array
return array
    private function getUsedFieldtypes(ContentType $contentType, Content $content, array $has)
    {
        $fieldtypes = ['meta' => true];
        if ($content->getTemplatefields() instanceof TemplateFields) {
            $templateFields = $content->getTemplatefields()->getContenttype()->getFields() ?: [];
        } else {
            $templateFields = [];
        }
        foreach ([$contentType['fields'], $templateFields] as $fields) {
            foreach ($fields as $field) {
                $fieldtypes[$field['type']] = true;
            }
            if ($field['type'] === 'repeater') {
                foreach ($field['fields'] as $rfield) {
                    $fieldtypes[$rfield['type']] = true;
                }
            }
        }
        if ($has['relations'] || $has['incoming_relations']) {
            $fieldtypes['relationship'] = true;
        }
        if ($has['taxonomy'] || is_array($contentType['groups']) && in_array('taxonomy', $contentType['groups'])) {
            $fieldtypes['taxonomy'] = true;
        }
        if ($has['templatefields'] || is_array($contentType['groups']) && in_array('template', $contentType['groups'])) {
            $fieldtypes['template'] = true;
        }
        return array_keys($fieldtypes);
    }