@param FieldLayout $fieldLayout

@return array
358838
public function exportRequiredFields($fieldLayout) {
        $requiredFieldsObj = [];
        $tabs = $fieldLayout->getTabs();
        usort($tabs, function($a, $b) {
            return $a->sortOrder > $b->sortOrder;
        });
        foreach ($tabs as $tab) {
            foreach ($tab->getFields() as $field) {
                /** @var Field $field */
                if (boolval($field->required)) {
                    array_push($requiredFieldsObj, $field->handle);
                }
            }
        }
        return $requiredFieldsObj;
    }
390264
public function getField($fieldname) {
        $i = $this->findFieldInArray($fieldname);
        if ($i !== null) {
            return $this->fields[$i];
        }
        return null;
    }
726790
public function getFieldLayout(array $fieldLayoutDef): FieldLayout
    {
        $layoutFields = [];
        $requiredFields = [];

        if (array_key_exists('tabs', $fieldLayoutDef)) {
            foreach ($fieldLayoutDef['tabs'] as $tabName => $tabDef) {
                $layoutTabFields = $this->getPrepareFieldLayout($tabDef);
                $requiredFields = array_merge($requiredFields, $layoutTabFields['required']);
                $layoutFields[$tabName] = $layoutTabFields['fields'];
            }
        } elseif (array_key_exists('fields', $fieldLayoutDef)) {
            $layoutTabFields = $this->getPrepareFieldLayout($fieldLayoutDef);
            $requiredFields = $layoutTabFields['required'];
            $layoutFields = $layoutTabFields['fields'];
        }

        $fieldLayout = Craft::$app->fields->assembleLayout($layoutFields, $requiredFields);

        if (array_key_exists('type', $fieldLayoutDef)) {
            $fieldLayout->type = $fieldLayoutDef['type'];
        } else {
            $fieldLayout->type = Entry::class;
        }

        return $fieldLayout;
    }
907602
protected function getFieldsetElements(ElementInterface $element, FieldsetInterface $fieldset)
    {
        $elementName = $this->normalizeElementName($element->getName());

        if ($fieldset->has($elementName) && $fieldset->get($elementName) === $element) {
            return array_merge($fieldset->getElements(), $fieldset->getFieldsets());
        }

        if ($fieldset instanceof Element\Collection && (
            ($elements = $this->getFieldsetElements($element, $fieldset->getTargetElement())) ||
            (($template = $fieldset->getTemplateElement()) &&
                ($elements = $this->getFieldsetElements($element, $template)))
        )) {
            return $elements;
        }

        foreach ($fieldset->getFieldsets() as $fieldsetElement) {
            if ($elements = $this->getFieldsetElements($element, $fieldsetElement)) {
                return $elements;
            }
        }

        return [];
    }
1144127
public static function fieldsOfType(ElementInterface $element, string $fieldType): array
    {
        $foundFields = [];

        $layout = $element->getFieldLayout();
        if ($layout === null) {
            return [];
        }
        $fields = $layout->getFields();
        /** @var  $field BaseField */
        foreach ($fields as $field) {
            if ($field instanceof $fieldType) {
                $foundFields[] = $field->handle;
            }
        }

        return $foundFields;
    }
1053641
public function layout(): array
    {
        if ($this->layout && count($this->layout)) {
            return $this->layout;
        }

        return array_keys($this->fields);
    }
999891
public function onCollectLayout(CollectLayoutEvent $event)
    {
        if (!$this->siteManager->hasContext()) {
            return;
        }

        $layoutIds  = [];
        $context    = $event->getContext();
        $site       = $this->siteManager->getContext();
        $theme      = $site->getTheme();
        $storage    = $context->getLayoutStorage();

        /*
         * Collect site layout
         */

        $siteLayoutIds = $this
            ->database
            ->query(
                "select id from {layout} where site_id = ? and node_id is null",
                [$site->getId()]
            )
            ->fetchCol()
        ;

        if (!$siteLayoutIds) {
            // Automatically create regions for site
            foreach (RegionConfig::getSiteRegionList($theme) as $region) {
                $layoutIds[] = $storage->create(['site_id' => $site->getId(), 'region' => $region])->getId();
            }
        } else {
            $layoutIds = array_merge($layoutIds, $siteLayoutIds);
        }

        /*
         * Collect current node layouts, if any
         */

        if (arg(0) === 'node' && !arg(2) && ($node = menu_get_object())) {

            $nodeLayoutIds = $this
                ->database
                ->query(
                    "select id from {layout} where node_id = ? and site_id = ?",
                    [$node->nid, $site->getId()]
                )
                ->fetchCol()
            ;

            if (!$nodeLayoutIds) {
                // Automatically creates new layout for node if none exist
                foreach (RegionConfig::getPageRegionList($theme) as $region) {
                    $layoutIds[] = $storage->create(['node_id' => $node->nid, 'site_id' => $site->getId(), 'region' => $region])->getId();
                }
            } else {
                $layoutIds = array_merge($layoutIds, $nodeLayoutIds);
            }
        }

        if ($layoutIds) {
            $event->addLayoutList($layoutIds);
        }
    }
74280
function listLayout(): array
    {
        if(!$this->layoutBuilt) {
            $this->buildListLayout();
            $this->layoutBuilt = true;
        }

        return collect($this->columns)->map(function(EntityListLayoutColumn $column) {
            return $column->toArray();
        })->all();
    }
83743
public function getFieldLayoutId()
    {
        $fieldLayoutId = $this->getAttribute('fieldLayoutId');
        if (null === $fieldLayoutId && null !== $this->fieldLayout) {
            $fieldLayoutId = $this->fieldLayoutId = $this->fieldLayout->id;
        }

        return $fieldLayoutId;
    }
673042
protected function initializeLayout(FieldsBuilder $layout, $args = [])
    {
        $layout->setGroupConfig('name', $layout->getName());
        $layout->setGroupConfig('display', 'block');

        foreach ($args as $key => $value) {
            $layout->setGroupConfig($key, $value);
        }

        $layout->setParentContext($this);

        return $layout;
    }
569601
public function getLayouts(): array
    {
        $layouts = [];

        foreach ($this->config->get('layouts') as $layout) {
            $layout->setParentKey($this->getKey());

            $layouts[] = $layout->toArray();
        }

        return $layouts;
    }
805565
public static function getField($arrayList, $fieldName = 'id'): array
    {
        $result = [];

        if (!empty($arrayList) && is_array($arrayList)) {
            foreach ($arrayList as $option) {
                if (is_array($option)) {
                    $result[] = $option[$fieldName];
                } elseif (is_object($option)) {
                    if (isset($option->{$fieldName})) {
                        $result[] = $option->{$fieldName};
                    }
                }
            }
        }

        return $result;
    }
886854
public function beforeLayout(Event $event, $layoutFile)
    {
        $pluginEvent = Plugin::getData('Core', 'View.beforeLayout');
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.beforeLayout')) {
            call_user_func_array($pluginEvent->find(0), [$this->_View, $event, $layoutFile]);
        }
    }
1005510
private function parseSolrFieldQuery($fieldQuery)
    {
        $fieldNameParts = explode(':', $fieldQuery);
        $fieldName = $fieldNameParts[0];
        unset($fieldNameParts[0]);
        $fieldValue = implode(':', $fieldNameParts);

        // change > and <
        if ($fieldValue[0] == '<') {
            $fieldValue = '[* TO '.substr($fieldValue, 1).']';
        } elseif ($fieldValue[0] == '>') {
            $fieldValue = '['.substr($fieldValue, 1).' TO *]';
        } else {
            $fieldValue = $this->getSingleTerm($fieldValue);
        }

        return $fieldName.':'.$fieldValue;
    }
374687
private function transformLayout($layout)
    {
        $layoutTransform = new Transform\FlexibleContentLayout($this);
        $namespaceTransform = new Transform\NamespaceFieldKey($this);

        return
            $namespaceTransform->transform(
                $layoutTransform->transform($layout)
            );
    }
401714
protected function getInternalFieldConstraints($fieldName)
    {
        return parent::getInternalFieldConstraints($fieldName)
            ->append(ArrayList::of([$this->getFieldType($fieldName)]));
    }
938360
public function getLayoutPlaceHolderNames()
	{
		$layout = $this->getLayout();

		if ($layout === null) {
			return null;
		}

		return $this->getLayoutProcessor()
				->getPlaces($layout->getFileName());
	}