private function getPrepareFieldLayout(array $fieldLayoutDef): array
    {
        $layoutFields = [];
        $requiredFields = [];

        foreach ($fieldLayoutDef as $fieldHandle => $required) {
            $field = Craft::$app->fields->getFieldByHandle($fieldHandle);
            if ($field instanceof Field) {
                $layoutFields[] = $field->id;

                if ($required) {
                    $requiredFields[] = $field->id;
                }
            }
        }

        return [
          'fields' => $layoutFields,
          'required' => $requiredFields,
        ];
    }
private function getPrepareFieldLayout(array $fieldLayoutDef): array
    {
        $layoutFields = [];
        $requiredFields = [];

        foreach ($fieldLayoutDef as $fieldHandle => $required) {
            $field = Craft::$app->fields->getFieldByHandle($fieldHandle);
            if ($field instanceof Field) {
                $layoutFields[] = $field->id;

                if ($required) {
                    $requiredFields[] = $field->id;
                }
            }
        }

        return [
          'fields' => $layoutFields,
          'required' => $requiredFields,
        ];
    }
private function getPrepareFieldLayout ( array $ fieldLayoutDef ) : array { $ layoutFields = [ ] ; $ requiredFields = [ ] ; foreach ( $ fieldLayoutDef as $ fieldHandle => $ required ) { $ field = Craft :: $ app -> fields -> getFieldByHandle ( $ fieldHandle ) ; if ( $ field instanceof Field ) { $ layoutFields [ ] = $ field -> id ; if ( $ required ) { $ requiredFields [ ] = $ field -> id ; } } } return [ 'fields' => $ layoutFields , 'required' => $ requiredFields , ] ; }
Get a prepared fieldLayout for the craft assembleLayout function.

@param array $fieldLayoutDef

@return array
Get a prepared fieldLayout for the craft assembleLayout function .