-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-6276: Added removing content type draft when clicking cancel butt…
…on (#2107)
- Loading branch information
Showing
4 changed files
with
81 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformAdminUi\Menu\Admin\ContentType; | ||
|
||
use EzSystems\EzPlatformAdminUi\Menu\AbstractBuilder; | ||
use JMS\TranslationBundle\Translation\TranslationContainerInterface; | ||
use Knp\Menu\ItemInterface; | ||
|
||
abstract class AbstractContentTypeRightSidebarBuilder extends AbstractBuilder implements TranslationContainerInterface | ||
{ | ||
public function createStructure(array $options): ItemInterface | ||
{ | ||
/** @var \Symfony\Component\Form\FormView $contentTypeFormView */ | ||
$contentTypeFormView = $options['form_view']; | ||
|
||
/** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ | ||
$menu = $this->factory->createItem('root'); | ||
|
||
$itemSaveIdentifier = $this->getItemSaveIdentifier(); | ||
$itemCancelIdentifier = $this->getItemCancelIdentifier(); | ||
|
||
$menu->setChildren([ | ||
$itemSaveIdentifier => $this->createMenuItem( | ||
$itemSaveIdentifier, | ||
[ | ||
'attributes' => [ | ||
'class' => 'btn--trigger', | ||
'data-click' => sprintf('#%s', $contentTypeFormView['publishContentType']->vars['id']), | ||
], | ||
'extras' => ['icon' => 'save'], | ||
] | ||
), | ||
$itemCancelIdentifier => $this->createMenuItem( | ||
$itemCancelIdentifier, | ||
[ | ||
'attributes' => [ | ||
'class' => 'btn--trigger', | ||
'data-click' => sprintf('#%s', $contentTypeFormView['removeDraft']->vars['id']), | ||
], | ||
'extras' => ['icon' => 'circle-close'], | ||
] | ||
), | ||
]); | ||
|
||
return $menu; | ||
} | ||
|
||
abstract public function getItemSaveIdentifier(): string; | ||
|
||
abstract public function getItemCancelIdentifier(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters