-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-2000: Added search into URL Wildcard tab (#2042)
* IBX-2000: Added search into URL Wildcard tab * added search form to url wildcards, added translations * corrected indentation, added getters/setters to DTO URLWildcardListData, corrected CS * Removed unused function and translation * Added implements TranslationContainerInterface * changed URLWildcardListData to using getters/setters, corrected pagination * Removed fluent setters * Corrected CS * Added Desc to trans, corrected translation source * Corrected Desc Co-authored-by: Mateusz Dębiński <[email protected]>
- Loading branch information
1 parent
0e7cda7
commit d382edf
Showing
8 changed files
with
294 additions
and
42 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
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
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,51 @@ | ||
<?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 Ibexa\AdminUi\Form\Data\URLWildcard; | ||
|
||
final class URLWildcardListData | ||
{ | ||
/** @var string|null */ | ||
public $searchQuery; | ||
|
||
/** @var bool|null */ | ||
public $type; | ||
|
||
/** @var int */ | ||
public $limit; | ||
|
||
public function getSearchQuery(): ?string | ||
{ | ||
return $this->searchQuery; | ||
} | ||
|
||
public function setSearchQuery(?string $searchQuery): void | ||
{ | ||
$this->searchQuery = $searchQuery; | ||
} | ||
|
||
public function getType(): ?bool | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function setType(?bool $type): void | ||
{ | ||
$this->type = $type; | ||
} | ||
|
||
public function getLimit(): int | ||
{ | ||
return $this->limit; | ||
} | ||
|
||
public function setLimit(int $limit): void | ||
{ | ||
$this->limit = $limit; | ||
} | ||
} |
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,64 @@ | ||
<?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 Ibexa\AdminUi\Form\Type\URLWildcard; | ||
|
||
use Ibexa\AdminUi\Form\Data\URLWildcard\URLWildcardListData; | ||
use JMS\TranslationBundle\Model\Message; | ||
use JMS\TranslationBundle\Translation\TranslationContainerInterface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | ||
use Symfony\Component\Form\Extension\Core\Type\SearchType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
final class URLWildcardListType extends AbstractType implements TranslationContainerInterface | ||
{ | ||
private const TYPE_DIRECT = 'url_wildcard.type.direct'; | ||
private const TYPE_FORWARD = 'url_wildcard.type.forward'; | ||
private const PLACEHOLDER = 'url_wildcard.type.all'; | ||
|
||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder->add('type', ChoiceType::class, [ | ||
'choices' => [ | ||
self::TYPE_DIRECT => true, | ||
self::TYPE_FORWARD => false, | ||
], | ||
'placeholder' => self::PLACEHOLDER, | ||
'required' => false, | ||
]); | ||
|
||
$builder->add('searchQuery', SearchType::class, [ | ||
'required' => false, | ||
]); | ||
|
||
$builder->add('limit', HiddenType::class); | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'data_class' => URLWildcardListData::class, | ||
'translation_domain' => 'ezplatform_url_wildcard', | ||
]); | ||
} | ||
|
||
/** | ||
* @return array<\JMS\TranslationBundle\Model\Message> | ||
*/ | ||
public static function getTranslationMessages(): array | ||
{ | ||
return [ | ||
(new Message(self::TYPE_DIRECT, 'ezplatform_url_wildcard'))->setDesc('Direct'), | ||
(new Message(self::TYPE_FORWARD, 'ezplatform_url_wildcard'))->setDesc('Forward'), | ||
(new Message(self::PLACEHOLDER, 'ezplatform_url_wildcard'))->setDesc('All'), | ||
]; | ||
} | ||
} |
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
Oops, something went wrong.