Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31651: Injected edit form into search view #1400

Merged
merged 3 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"ezsystems/ezplatform-user": "^2.0@dev",
"ezsystems/ezplatform-richtext": "^2.0@dev",
"ezsystems/ezplatform-rest": "^1.0@dev",
"ezsystems/ezplatform-search": "^1.0@dev",
"babdev/pagerfanta-bundle": "^2.1",
"knplabs/knp-menu-bundle": "^3.0",
"mck89/peast": "^1.9",
Expand Down
171 changes: 0 additions & 171 deletions src/bundle/Controller/SearchController.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/bundle/Resources/config/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,6 @@ ezplatform.content.draft.create:
options:
expose: true

#
# Search
#

ezplatform.search:
path: /search
methods: ['GET']
defaults:
_controller: 'EzSystems\EzPlatformAdminUiBundle\Controller\SearchController::searchAction'

#
# Link manager
#
Expand Down
6 changes: 6 additions & 0 deletions src/bundle/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ services:

EzSystems\EzPlatformAdminUi\UI\Service\DateTimeFormatter: ~
EzSystems\EzPlatformAdminUi\UI\Service\DateTimeFormatterInterface: '@EzSystems\EzPlatformAdminUi\UI\Service\DateTimeFormatter'

EzSystems\EzPlatformAdminUi\EventListener\EditFormSearchListViewFilterParametersListener:
arguments:
$formFactory: '@form.factory'
tags:
- {name: kernel.event_subscriber}
10 changes: 0 additions & 10 deletions src/bundle/Resources/config/services/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ services:
tags:
- controller.service_arguments

EzSystems\EzPlatformAdminUiBundle\Controller\SearchController:
parent: EzSystems\EzPlatformAdminUiBundle\Controller\Controller
autowire: true
lazy: true
arguments:
$searchQueryType: '@EzSystems\EzPlatformAdminUi\QueryType\SearchQueryType'
$configResolver: '@ezpublish.config.resolver'
tags:
- controller.service_arguments

EzSystems\EzPlatformAdminUiBundle\Controller\User\UserDeleteController:
parent: EzSystems\EzPlatformAdminUiBundle\Controller\Controller
autowire: true
Expand Down
6 changes: 6 additions & 0 deletions src/bundle/Resources/config/views.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ system:
match:
Identifier: [full_datetime_format, short_datetime_format]

search_list_view:
full:
ezplatform_admin_ui:
template: '@ezdesign/ui/search/index.html.twig'
match: true

default:
fielddefinition_edit_templates:
- { template: '@ezdesign/content_type/field_types.html.twig', priority: 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\EzPlatformAdminUi\EventListener;

use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
use eZ\Publish\Core\MVC\Symfony\View\ViewEvents;
use EzSystems\EzPlatformAdminUi\Form\Data\Content\Draft\ContentEditData;
use EzSystems\EzPlatformAdminUi\Form\Type\Content\Draft\ContentEditType;
use Ibexa\Platform\Search\View\SearchListView;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormFactoryInterface;

final class EditFormSearchListViewFilterParametersListener implements EventSubscriberInterface
{
/** @var \Symfony\Component\Form\FormFactoryInterface */
private $formFactory;

public function __construct(
FormFactoryInterface $formFactory
) {
$this->formFactory = $formFactory;
}

public static function getSubscribedEvents(): array
{
return [
ViewEvents::FILTER_VIEW_PARAMETERS => ['onFilterViewParameters', 10],
];
}

public function onFilterViewParameters(FilterViewParametersEvent $event)
{
$view = $event->getView();

if (!$view instanceof SearchListView) {
return;
}

$editForm = $this->formFactory->create(
ContentEditType::class,
new ContentEditData(),
);

$event->getParameterBag()->add([
'form_edit' => $editForm->createView(),
]);
}
}