diff --git a/src/bundle/Controller/ContentTypeController.php b/src/bundle/Controller/ContentTypeController.php index ed09a35570..7f8c9945b6 100644 --- a/src/bundle/Controller/ContentTypeController.php +++ b/src/bundle/Controller/ContentTypeController.php @@ -18,6 +18,7 @@ use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\AdminUi\Form\SubmitHandler; use Ibexa\AdminUi\Form\Type\ContentType\ContentTypeUpdateType; +use Ibexa\AdminUi\Service\MetaFieldType\MetaFieldDefinitionServiceInterface; use Ibexa\AdminUi\Tab\ContentType\TranslationsTab; use Ibexa\AdminUi\UI\Module\FieldTypeToolbar\FieldTypeToolbarFactory; use Ibexa\AdminUi\View\ContentTypeCreateView; @@ -85,6 +86,8 @@ class ContentTypeController extends Controller /** @var \Ibexa\AdminUi\UI\Module\FieldTypeToolbar\FieldTypeToolbarFactory */ private $fieldTypeToolbarFactory; + private MetaFieldDefinitionServiceInterface $metaFieldDefinitionService; + public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, TranslatorInterface $translator, @@ -97,7 +100,8 @@ public function __construct( ContentTypeFormFactory $contentTypeFormFactory, ContentTypeDraftMapper $contentTypeDraftMapper, ConfigResolverInterface $configResolver, - FieldTypeToolbarFactory $fieldTypeToolbarFactory + FieldTypeToolbarFactory $fieldTypeToolbarFactory, + MetaFieldDefinitionServiceInterface $metaFieldDefinitionService ) { $this->notificationHandler = $notificationHandler; $this->translator = $translator; @@ -111,6 +115,7 @@ public function __construct( $this->contentTypeDraftMapper = $contentTypeDraftMapper; $this->configResolver = $configResolver; $this->fieldTypeToolbarFactory = $fieldTypeToolbarFactory; + $this->metaFieldDefinitionService = $metaFieldDefinitionService; } /** @@ -183,13 +188,17 @@ public function listAction(ContentTypeGroup $group, string $routeName, int $page public function addAction(ContentTypeGroup $group) { $this->denyAccessUnlessGranted(new Attribute('class', 'create')); - $languages = $this->configResolver->getParameter('languages'); - $mainLanguageCode = reset($languages); + $mainLanguageCode = $this->languageService->getDefaultLanguageCode(); $createStruct = $this->contentTypeService->newContentTypeCreateStruct('__new__' . md5((string)microtime(true))); $createStruct->mainLanguageCode = $mainLanguageCode; $createStruct->names = [$mainLanguageCode => 'New Content Type']; + $this->metaFieldDefinitionService->addMetaFieldDefinitions( + $createStruct, + $this->languageService->loadLanguage($mainLanguageCode) + ); + try { $contentTypeDraft = $this->contentTypeService->createContentType($createStruct, [$group]); } catch (NotFoundException $e) { @@ -375,8 +384,10 @@ public function editAction(Request $request, ContentTypeGroup $group, ContentTyp null, ['contentType' => $contentType] ); - $form->handleRequest($request); + $this->metaFieldDefinitionService->addMetaFieldDefinitions($contentTypeDraft); + + $form->handleRequest($request); if ($form->isSubmitted()) { $result = $this->submitHandler->handle($form, function (ContentTypeEditData $data) use ($contentTypeDraft) { $contentTypeGroup = $data->getContentTypeGroup(); @@ -719,6 +730,7 @@ public function createUpdateForm( Language $language = null, ?Language $baseLanguage = null ): FormInterface { + $this->metaFieldDefinitionService->addMetaFieldDefinitions($contentTypeDraft, $language); $contentTypeData = $this->contentTypeDraftMapper->mapToFormData( $contentTypeDraft, [ diff --git a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php index bc390aefa2..b58add3a4d 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php @@ -29,6 +29,11 @@ class AdminUiForms extends AbstractParser { public const FORM_TEMPLATES_PARAM = 'admin_ui_forms.content_edit_form_templates'; public const FIELD_TYPES_PARAM = 'admin_ui_forms.content_edit.fieldtypes'; + public const CONTENT_TYPE_FIELD_TYPES_PARAM = 'admin_ui_forms.content_type_edit.field_types'; + public const CONTENT_TYPE_DEFAULT_META_FIELD_TYPE_GROUP_PARAM = + 'admin_ui_forms.content_type_edit.default_meta_field_type_group'; + + private const GROUP_NAME_PATTERN = '/^[a-zA-Z0-9_][a-zA-Z0-9_\-:]*$/D'; /** * Adds semantic configuration definition. @@ -84,6 +89,48 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end() ->end() ->end() + ->arrayNode('content_type_edit') + ->info('Content Type Edit form configuration') + ->children() + ->scalarNode('default_meta_field_type_group') + ->info('Group name used to add meta field types') + ->beforeNormalization() + ->ifTrue( + static function (string $groupName): bool { + return + empty($groupName) + || !preg_match(self::GROUP_NAME_PATTERN, $groupName); + } + ) + ->thenInvalid('The group name "%s" contains illegal characters. Group names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").') + ->end() + ->end() + ->arrayNode('field_types') + ->info('Configuration for specific Field Types') + ->useAttributeAsKey('identifier') + ->arrayPrototype() + ->beforeNormalization() + ->ifTrue( + static function (array $config): bool { + $isMeta = $config['meta'] ?? false; + + return $isMeta && !isset($config['position']); + } + ) + ->thenInvalid('The "position" option is required for all Meta Field Types') + ->end() + ->children() + ->scalarNode('identifier')->end() + ->booleanNode('meta') + ->info('Make this field_type a part of Meta group') + ->defaultFalse() + ->end() + ->integerNode('position')->end() + ->end() + ->end() + ->end() + ->end() + ->end() ->end() ->end(); } @@ -104,20 +151,43 @@ public function mapConfig( } if (!empty($scopeSettings['admin_ui_forms']['content_edit']['fieldtypes'])) { - $scopeSettings['admin_ui_forms.content_edit.fieldtypes'] = $scopeSettings['admin_ui_forms']['content_edit']['fieldtypes']; + $scopeSettings['admin_ui_forms.content_edit.fieldtypes'] = + $scopeSettings['admin_ui_forms']['content_edit']['fieldtypes']; unset($scopeSettings['admin_ui_forms']['content_edit']['fieldtypes']); } + if (!empty($scopeSettings['admin_ui_forms']['content_type_edit']['field_types'])) { + $scopeSettings['admin_ui_forms.content_type_edit.field_types'] = + $scopeSettings['admin_ui_forms']['content_type_edit']['field_types']; + unset($scopeSettings['admin_ui_forms']['content_type_edit']['field_types']); + } + + if (!empty($scopeSettings['admin_ui_forms']['content_type_edit']['default_meta_field_type_group'])) { + $scopeSettings['admin_ui_forms.content_type_edit.default_meta_field_type_group'] = + $scopeSettings['admin_ui_forms']['content_type_edit']['default_meta_field_type_group']; + unset($scopeSettings['admin_ui_forms']['content_type_edit']['default_meta_field_type_group']); + } + $contextualizer->setContextualParameter( - static::FORM_TEMPLATES_PARAM, + self::FORM_TEMPLATES_PARAM, $currentScope, $scopeSettings['admin_ui_forms.content_edit_form_templates'] ?? [] ); $contextualizer->setContextualParameter( - static::FIELD_TYPES_PARAM, + self::FIELD_TYPES_PARAM, $currentScope, $scopeSettings['admin_ui_forms.content_edit.fieldtypes'] ?? [] ); + $contextualizer->setContextualParameter( + self::CONTENT_TYPE_FIELD_TYPES_PARAM, + $currentScope, + $scopeSettings['admin_ui_forms.content_type_edit.field_types'] ?? [] + ); + $contextualizer->setContextualParameter( + self::CONTENT_TYPE_DEFAULT_META_FIELD_TYPE_GROUP_PARAM, + $currentScope, + $scopeSettings['admin_ui_forms.content_type_edit.default_meta_field_type_group'] ?? null + ); } /** @@ -127,6 +197,8 @@ public function postMap(array $config, ContextualizerInterface $contextualizer) { $contextualizer->mapConfigArray('admin_ui_forms.content_edit_form_templates', $config); $contextualizer->mapConfigArray('admin_ui_forms.content_edit.fieldtypes', $config); + $contextualizer->mapConfigArray('admin_ui_forms.content_type_edit.field_types', $config); + $contextualizer->mapSetting('admin_ui_forms.content_type_edit.default_meta_field_type_group', $config); } /** diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index 85e50db3f4..70386de6ec 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -1,5 +1,6 @@ imports: - { resource: services/service_aliases.yaml } + - { resource: services/config.yaml } - { resource: services/controllers.yaml } - { resource: services/tabs.yaml } - { resource: services/menu.yaml } @@ -12,6 +13,7 @@ imports: - { resource: services/modules/field_type_toolbar.yaml } - { resource: services/form_processors.yaml } - { resource: services/validators.yaml } + - { resource: services/services.yaml } - { resource: services/siteaccess.yaml } - { resource: services/universal_discovery_widget.yaml } - { resource: services/utils.yaml } diff --git a/src/bundle/Resources/config/services/components.yaml b/src/bundle/Resources/config/services/components.yaml index 2287c5ea8c..6133d6f215 100644 --- a/src/bundle/Resources/config/services/components.yaml +++ b/src/bundle/Resources/config/services/components.yaml @@ -1,5 +1,6 @@ imports: - { resource: services/components/content/edit.yaml } + - { resource: services/components/content_type/edit.yaml } services: _defaults: diff --git a/src/bundle/Resources/config/services/components/content_type/edit.yaml b/src/bundle/Resources/config/services/components/content_type/edit.yaml new file mode 100644 index 0000000000..b90273054c --- /dev/null +++ b/src/bundle/Resources/config/services/components/content_type/edit.yaml @@ -0,0 +1,9 @@ +services: + _defaults: + public: false + autowire: true + autoconfigure: true + + Ibexa\AdminUi\Component\ContentType\ContentTypeEditMetaFieldsComponent: + tags: + - { name: ibexa.admin_ui.component, group: 'content-type-edit-sections' } diff --git a/src/bundle/Resources/config/services/config.yaml b/src/bundle/Resources/config/services/config.yaml new file mode 100644 index 0000000000..30033b54a6 --- /dev/null +++ b/src/bundle/Resources/config/services/config.yaml @@ -0,0 +1,10 @@ +services: + _defaults: + autoconfigure: true + autowire: true + public: false + + Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolver: ~ + + Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface: + '@Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolver' diff --git a/src/bundle/Resources/config/services/menu.yaml b/src/bundle/Resources/config/services/menu.yaml index fe6e12856c..a39c248dcc 100644 --- a/src/bundle/Resources/config/services/menu.yaml +++ b/src/bundle/Resources/config/services/menu.yaml @@ -135,6 +135,11 @@ services: tags: - { name: knp_menu.menu_builder, method: build, alias: ezplatform_admin_ui.menu.content_type_edit.sidebar_right } + Ibexa\AdminUi\Menu\ContentTypeEditAnchorMenuBuilder: + public: true + tags: + - { name: knp_menu.menu_builder, method: build, alias: ibexa.admin_ui.menu.content_type_edit.anchor_menu } + Ibexa\AdminUi\Menu\URLEditRightSidebarBuilder: public: true tags: diff --git a/src/bundle/Resources/config/services/modules/field_type_toolbar.yaml b/src/bundle/Resources/config/services/modules/field_type_toolbar.yaml index a374c6a89c..b56ba81d9f 100644 --- a/src/bundle/Resources/config/services/modules/field_type_toolbar.yaml +++ b/src/bundle/Resources/config/services/modules/field_type_toolbar.yaml @@ -6,5 +6,6 @@ services: Ibexa\AdminUi\UI\Module\FieldTypeToolbar\FieldTypeToolbarFactory: arguments: + - '@Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface' - '@Ibexa\Core\FieldType\FieldTypeRegistry' - '@translator' diff --git a/src/bundle/Resources/config/services/services.yaml b/src/bundle/Resources/config/services/services.yaml new file mode 100644 index 0000000000..258d80607e --- /dev/null +++ b/src/bundle/Resources/config/services/services.yaml @@ -0,0 +1,10 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + Ibexa\AdminUi\Service\MetaFieldType\MetaFieldDefinitionService: ~ + + Ibexa\AdminUi\Service\MetaFieldType\MetaFieldDefinitionServiceInterface: + '@Ibexa\AdminUi\Service\MetaFieldType\MetaFieldDefinitionService' diff --git a/src/bundle/Resources/public/scss/_anchor-navigation.scss b/src/bundle/Resources/public/scss/_anchor-navigation.scss index 5220be1455..03794c793a 100644 --- a/src/bundle/Resources/public/scss/_anchor-navigation.scss +++ b/src/bundle/Resources/public/scss/_anchor-navigation.scss @@ -33,9 +33,9 @@ } &__section-groups { - min-width: calculateRem(350px); - max-width: calculateRem(400px); - width: 25vw; + min-width: calculateRem(280px); + max-width: calculateRem(420px); + width: calc(25vw - #{calculateRem(50px)}); height: calculateRem(48px); &--list { diff --git a/src/bundle/Resources/public/scss/_content-type-edit.scss b/src/bundle/Resources/public/scss/_content-type-edit.scss index 2832ed9cc1..c4a532e3ce 100644 --- a/src/bundle/Resources/public/scss/_content-type-edit.scss +++ b/src/bundle/Resources/public/scss/_content-type-edit.scss @@ -15,10 +15,27 @@ padding: 0; } + .ibexa-edit-content__container--meta { + margin-top: calculateRem(-40px); + + .ibexa-content-type-edit { + &__section-column-header { + border-top: 1px solid $ibexa-color-light; + padding-top: calculateRem(16px); + margin-top: calculateRem(40px); + } + + &__section, + &__section-column { + margin-bottom: 0; + } + } + } + &__section { display: flex; flex-wrap: wrap; - margin: 0 0 calculateRem(50px) 0; + margin: 0 0 calculateRem(32px) 0; &--one-column-layout { .ibexa-content-type-edit__section-column { diff --git a/src/bundle/Resources/public/scss/_main-container.scss b/src/bundle/Resources/public/scss/_main-container.scss index 698738d5a5..64874f45bc 100644 --- a/src/bundle/Resources/public/scss/_main-container.scss +++ b/src/bundle/Resources/public/scss/_main-container.scss @@ -34,6 +34,16 @@ } &.ibexa-main-container { + &--with-anchor-menu-items { + .ibexa-main-container { + &__side-column { + min-width: calculateRem(330px); + max-width: calculateRem(470px); + width: 25vw; + } + } + } + &--no-border { padding: 0; diff --git a/src/bundle/Resources/translations/content_type.en.xliff b/src/bundle/Resources/translations/content_type.en.xliff index bf17917086..76222e06c6 100644 --- a/src/bundle/Resources/translations/content_type.en.xliff +++ b/src/bundle/Resources/translations/content_type.en.xliff @@ -481,6 +481,11 @@ Description key: field_definition.description + + Enabled + Enabled + key: field_definition.enabled + Default value Default value diff --git a/src/bundle/Resources/translations/menu.en.xliff b/src/bundle/Resources/translations/menu.en.xliff index 6463073288..ea55298d71 100644 --- a/src/bundle/Resources/translations/menu.en.xliff +++ b/src/bundle/Resources/translations/menu.en.xliff @@ -121,6 +121,16 @@ Create key: content_type_create__sidebar_right__save + + Field definitions + Field definitions + key: content_type_edit__anchor_menu__field_definitions + + + Global properties + Global properties + key: content_type_edit__anchor_menu__global_properties + Discard changes Discard changes diff --git a/src/bundle/Resources/translations/messages.en.xliff b/src/bundle/Resources/translations/messages.en.xliff index 3c8b120f5d..c4a36dac21 100644 --- a/src/bundle/Resources/translations/messages.en.xliff +++ b/src/bundle/Resources/translations/messages.en.xliff @@ -246,6 +246,11 @@ Search... key: content_type.view.edit.search + + SEO + SEO + key: content_type.view.edit.seo + Add new Add new @@ -538,6 +543,11 @@ I understand the consequences of this action. key: location_trash_form.confirm_label + + Enable %type% for this content type + Enable %type% for this content type + key: meta.enabled + Cancel Cancel diff --git a/src/bundle/Resources/views/themes/admin/content_type/components/meta_fields.html.twig b/src/bundle/Resources/views/themes/admin/content_type/components/meta_fields.html.twig new file mode 100644 index 0000000000..fb7cadc93c --- /dev/null +++ b/src/bundle/Resources/views/themes/admin/content_type/components/meta_fields.html.twig @@ -0,0 +1,5 @@ +{% extends '@ibexadesign/ui/component/anchor_navigation/section_group.html.twig' %} + +{% set data_id = 'ibexa-edit-content-type-sections-meta' %} + +{% block sections %}{% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/create.html.twig b/src/bundle/Resources/views/themes/admin/content_type/create.html.twig index 777a23143a..ffddc5427a 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/create.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/create.html.twig @@ -27,55 +27,62 @@ } }) }}
- {% block form_sections %} -
- {% embed "@ibexadesign/content_type/edit_section.html.twig" with { - section_id: '#Global-properties', - is_active: true, - one_column_layout: true, - } %} - {% block title %} - {{ 'content_type.view.edit.global_properties'|trans|desc('Global properties') }} - {% endblock %} +
+ {% block form_sections %} +
+ {% embed "@ibexadesign/content_type/edit_section.html.twig" with { + section_id: '#Global-properties', + is_active: true, + one_column_layout: true, + } %} + {% block title %} + {{ 'content_type.view.edit.global_properties'|trans|desc('Global properties') }} + {% endblock %} - {% block left_column %} - {{ form_row(form.name) }} - {{ form_row(form.identifier) }} - {{ form_row(form.description) }} - {{ form_row(form.nameSchema) }} - {{ form_row(form.urlAliasSchema) }} - {{ form_row(form.isContainer) }} - {{ form_row(form.defaultSortField) }} - {{ form_row(form.defaultSortOrder) }} - {{ form_row(form.defaultAlwaysAvailable) }} - {% endblock %} - {% endembed %} -
+ {% block left_column %} + {{ form_row(form.name) }} + {{ form_row(form.identifier) }} + {{ form_row(form.description) }} + {{ form_row(form.nameSchema) }} + {{ form_row(form.urlAliasSchema) }} + {{ form_row(form.isContainer) }} + {{ form_row(form.defaultSortField) }} + {{ form_row(form.defaultSortOrder) }} + {{ form_row(form.defaultAlwaysAvailable) }} + {% endblock %} + {% endembed %} +
-
- {% embed "@ibexadesign/content_type/edit_section.html.twig" with { - section_id: '#Field-definitions', - left_column_class: 'ibexa-content-type-edit__section-column--field-definitions' - } %} - {% block title %} - {{ 'content_type.view.edit.content_field_definitions'|trans|desc('Field definitions') }} - {% endblock %} +
+ {% embed "@ibexadesign/content_type/edit_section.html.twig" with { + section_id: '#Field-definitions', + left_column_class: 'ibexa-content-type-edit__section-column--field-definitions' + } %} + {% block title %} + {{ 'content_type.view.edit.content_field_definitions'|trans|desc('Field definitions') }} + {% endblock %} - {% block left_column %} - {{ include('@ibexadesign/content_type/field_definitions.html.twig', { grouped_field_defintions: form.fieldDefinitionsData }) }} - {% endblock %} + {% block left_column %} + {{ include('@ibexadesign/content_type/field_definitions.html.twig', { grouped_field_defintions: form.fieldDefinitionsData }) }} + {% endblock %} - {% block right_column %} - {{ include('@ibexadesign/content_type/available_field_types.html.twig') }} - {% endblock %} - {% endembed %} -
- {% endblock %} + {% block right_column %} + {{ include('@ibexadesign/content_type/available_field_types.html.twig') }} + {% endblock %} + {% endembed %} +
+ + {{form_row(form.metaFieldDefinitionsData)}} + {% endblock %} +
{{ form_widget(form.saveContentType, { attr: { hidden: 'hidden' }}) }} {{ form_widget(form.publishContentType, { attr: { class: 'ibexa-content-type-edit__publish-content-type', hidden: 'hidden' }}) }} diff --git a/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig b/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig index 28a855e262..311783b83d 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig @@ -34,59 +34,66 @@ {% endif %}
- {% block form_sections %} -
- {% embed "@ibexadesign/content_type/edit_section.html.twig" with { - section_id: '#Global-properties', - is_active: true, - one_column_layout: true, - } %} - {% block title %} - {{ 'content_type.view.edit.global_properties'|trans|desc('Global properties') }} - {% endblock %} +
+ {% block form_sections %} +
+ {% embed "@ibexadesign/content_type/edit_section.html.twig" with { + section_id: '#Global-properties', + is_active: true, + one_column_layout: true, + } %} + {% block title %} + {{ 'content_type.view.edit.global_properties'|trans|desc('Global properties') }} + {% endblock %} - {% block left_column %} - {{ form_row(form.name) }} - {{ form_row(form.identifier) }} - {{ form_row(form.description) }} - {{ form_row(form.nameSchema) }} - {{ form_row(form.urlAliasSchema) }} - {{ form_row(form.isContainer) }} - {{ form_row(form.defaultSortField) }} - {{ form_row(form.defaultSortOrder) }} - {{ form_row(form.defaultAlwaysAvailable) }} - {% endblock %} - {% endembed %} -
+ {% block left_column %} + {{ form_row(form.name) }} + {{ form_row(form.identifier) }} + {{ form_row(form.description) }} + {{ form_row(form.nameSchema) }} + {{ form_row(form.urlAliasSchema) }} + {{ form_row(form.isContainer) }} + {{ form_row(form.defaultSortField) }} + {{ form_row(form.defaultSortOrder) }} + {{ form_row(form.defaultAlwaysAvailable) }} + {% endblock %} + {% endembed %} +
-
- {% embed "@ibexadesign/content_type/edit_section.html.twig" with { - section_id: '#Field-definitions', - left_column_class: 'ibexa-content-type-edit__section-column--field-definitions', - right_column_class: 'ibexa-content-type-edit__section-column--available-fields' - } %} - {% block title %} - {{ 'content_type.view.edit.content_field_definitions'|trans|desc('Field definitions') }} - {% endblock %} +
+ {% embed "@ibexadesign/content_type/edit_section.html.twig" with { + section_id: '#Field-definitions', + left_column_class: 'ibexa-content-type-edit__section-column--field-definitions', + right_column_class: 'ibexa-content-type-edit__section-column--available-fields' + } %} + {% block title %} + {{ 'content_type.view.edit.content_field_definitions'|trans|desc('Field definitions') }} + {% endblock %} - {% block left_column %} - {{ include('@ibexadesign/content_type/field_definitions.html.twig', { - grouped_field_defintions: form.fieldDefinitionsData, - is_draggable - }) }} - {% endblock %} + {% block left_column %} + {{ include('@ibexadesign/content_type/field_definitions.html.twig', { + grouped_field_defintions: form.fieldDefinitionsData, + is_draggable + }) }} + {% endblock %} - {% block right_column %} - {{ include('@ibexadesign/content_type/available_field_types.html.twig', { is_draggable }) }} - {% endblock %} - {% endembed %} -
- {% endblock %} + {% block right_column %} + {{ include('@ibexadesign/content_type/available_field_types.html.twig', { is_draggable }) }} + {% endblock %} + {% endembed %} +
+ + {{form_row(form.metaFieldDefinitionsData)}} + {% endblock %} +
{{ form_widget(form.publishContentType, { attr: { class: 'ibexa-content-type-edit__publish-content-type', hidden: 'hidden' }}) }} @@ -95,3 +102,10 @@ {{ form_widget(form._token) }} {{ form_end(form, {'render_rest': false }) }} {% endblock %} + +{% block content_type_sections %} + {{ ibexa_render_component_group('content-type-edit-sections', { + 'form': form, + 'content_type': content_type, + }) }} +{% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig b/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig index 4a9f6e179e..f02e64c302 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/edit_base.html.twig @@ -15,8 +15,34 @@ {% block main_container_class %}{{ parent() }} ibexa-content-type-edit ibexa-main-container--with-anchor-menu-items{% endblock %} +{% block left_sidebar %} + {% set content_type_edit_anchor_menu = knp_menu_get('ibexa.admin_ui.menu.content_type_edit.anchor_menu', [], { + 'content_type': content_type, + }) %} + + {% embed '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %} + {% block navigation_menu_body %} + {% trans_default_domain 'menu' %} + + {% set items = [] %} + + {% if content_type_edit_anchor_menu|default([])|length > 1 %} + {% for item in content_type_edit_anchor_menu %} + {% set items = items|merge([{ + target_id: item.attributes['data-target-id'], + label: item.label is defined ? item.label|trans : item.name, + }]) %} + {% endfor %} + {% endif %} + + {{parent()}} + {% endblock %} + {% endembed %} +{% endblock %} + {% block content %} {% block form %}{% endblock %} + {% block content_type_sections %}{% endblock %} {% endblock %} {% block javascripts %} diff --git a/src/bundle/Resources/views/themes/admin/content_type/field_definition.html.twig b/src/bundle/Resources/views/themes/admin/content_type/field_definition.html.twig index 2f9762901f..b77ca74bbd 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/field_definition.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/field_definition.html.twig @@ -20,6 +20,9 @@ 'extra_actions': extra_actions } -%} {% block body_content %} + {% if field_definition.enabled is defined %} + {{ form_row(field_definition.enabled) }} + {% endif %} {{ form_row(field_definition.name) }} {{ form_row(field_definition.identifier) }} {{ form_row(field_definition.description) }} diff --git a/src/bundle/Resources/views/themes/admin/ui/anchor_navigation_menu.html.twig b/src/bundle/Resources/views/themes/admin/ui/anchor_navigation_menu.html.twig index de61726083..8342c49cb5 100644 --- a/src/bundle/Resources/views/themes/admin/ui/anchor_navigation_menu.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/anchor_navigation_menu.html.twig @@ -20,14 +20,16 @@ {% if items|default([])|length > 1 %}