diff --git a/src/Form/Type/Operator/StringOperatorType.php b/src/Form/Type/Operator/StringOperatorType.php new file mode 100644 index 0000000000..fe4e667304 --- /dev/null +++ b/src/Form/Type/Operator/StringOperatorType.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\AdminBundle\Form\Type\Operator; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType as FormChoiceType; +use Symfony\Component\OptionsResolver\OptionsResolver; + +final class StringOperatorType extends AbstractType +{ + public const TYPE_CONTAINS = 1; + public const TYPE_NOT_CONTAINS = 2; + public const TYPE_EQUAL = 3; + public const TYPE_STARTS_WITH = 4; + public const TYPE_ENDS_WITH = 5; + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'choice_translation_domain' => 'SonataAdminBundle', + 'choices' => [ + 'label_type_contains' => self::TYPE_CONTAINS, + 'label_type_not_contains' => self::TYPE_NOT_CONTAINS, + 'label_type_equals' => self::TYPE_EQUAL, + 'label_type_starts_with' => self::TYPE_STARTS_WITH, + 'label_type_ends_with' => self::TYPE_ENDS_WITH, + ], + ]); + } + + public function getParent() + { + return FormChoiceType::class; + } + + public function getBlockPrefix() + { + return 'sonata_type_operator_string'; + } +} diff --git a/src/Resources/translations/SonataAdminBundle.ar.xliff b/src/Resources/translations/SonataAdminBundle.ar.xliff index 0c2f437ab0..7ff200f54f 100644 --- a/src/Resources/translations/SonataAdminBundle.ar.xliff +++ b/src/Resources/translations/SonataAdminBundle.ar.xliff @@ -490,6 +490,14 @@ toggle_navigation تبديل التنقل + + label_type_starts_with + ابدا ب + + + label_type_ends_with + ينتهي بـ + diff --git a/src/Resources/translations/SonataAdminBundle.bg.xliff b/src/Resources/translations/SonataAdminBundle.bg.xliff index 32ee6fe5ea..2440a5b252 100644 --- a/src/Resources/translations/SonataAdminBundle.bg.xliff +++ b/src/Resources/translations/SonataAdminBundle.bg.xliff @@ -490,6 +490,14 @@ toggle_navigation Превключване на навигацията + + label_type_starts_with + започва с + + + label_type_ends_with + завършва със + diff --git a/src/Resources/translations/SonataAdminBundle.ca.xliff b/src/Resources/translations/SonataAdminBundle.ca.xliff index 634bf515ea..b232baa9c5 100644 --- a/src/Resources/translations/SonataAdminBundle.ca.xliff +++ b/src/Resources/translations/SonataAdminBundle.ca.xliff @@ -490,6 +490,14 @@ toggle_navigation Commuta la navegació + + label_type_starts_with + comença amb + + + label_type_ends_with + acaba amb + diff --git a/src/Resources/translations/SonataAdminBundle.cs.xliff b/src/Resources/translations/SonataAdminBundle.cs.xliff index 66f975cbbc..9465977609 100644 --- a/src/Resources/translations/SonataAdminBundle.cs.xliff +++ b/src/Resources/translations/SonataAdminBundle.cs.xliff @@ -490,6 +490,14 @@ toggle_navigation Přepnout navigaci + + label_type_starts_with + začíná s + + + label_type_ends_with + končí s + diff --git a/src/Resources/translations/SonataAdminBundle.de.xliff b/src/Resources/translations/SonataAdminBundle.de.xliff index 63679cf892..6e398ae059 100644 --- a/src/Resources/translations/SonataAdminBundle.de.xliff +++ b/src/Resources/translations/SonataAdminBundle.de.xliff @@ -490,6 +490,14 @@ toggle_navigation Navigation ein-/ausblenden + + label_type_starts_with + beginnt mit + + + label_type_ends_with + endet mit + diff --git a/src/Resources/translations/SonataAdminBundle.en.xliff b/src/Resources/translations/SonataAdminBundle.en.xliff index b9d401f62a..d98d87d373 100644 --- a/src/Resources/translations/SonataAdminBundle.en.xliff +++ b/src/Resources/translations/SonataAdminBundle.en.xliff @@ -490,6 +490,14 @@ toggle_navigation Toggle Navigation + + label_type_starts_with + starts with + + + label_type_ends_with + ends with + diff --git a/src/Resources/translations/SonataAdminBundle.es.xliff b/src/Resources/translations/SonataAdminBundle.es.xliff index 86967a3afd..35b500bb92 100644 --- a/src/Resources/translations/SonataAdminBundle.es.xliff +++ b/src/Resources/translations/SonataAdminBundle.es.xliff @@ -490,6 +490,14 @@ toggle_navigation Cambiar modo de navegación + + label_type_starts_with + comienza con + + + label_type_ends_with + termina con + diff --git a/src/Resources/translations/SonataAdminBundle.eu.xliff b/src/Resources/translations/SonataAdminBundle.eu.xliff index 1eee25df03..1394b49500 100644 --- a/src/Resources/translations/SonataAdminBundle.eu.xliff +++ b/src/Resources/translations/SonataAdminBundle.eu.xliff @@ -490,6 +490,14 @@ toggle_navigation Txandakatu nabigazioa + + label_type_starts_with + hasten da + + + label_type_ends_with + bukatzen da + diff --git a/src/Resources/translations/SonataAdminBundle.fa.xliff b/src/Resources/translations/SonataAdminBundle.fa.xliff index 1bc94dfcf5..7cc4799215 100644 --- a/src/Resources/translations/SonataAdminBundle.fa.xliff +++ b/src/Resources/translations/SonataAdminBundle.fa.xliff @@ -490,6 +490,14 @@ toggle_navigation تغییر مسیر ناوبری + + label_type_starts_with + شروع می شود با + + + label_type_ends_with + به پایان می رسد با + diff --git a/src/Resources/translations/SonataAdminBundle.fr.xliff b/src/Resources/translations/SonataAdminBundle.fr.xliff index 7ff13e461c..7be2e45fd0 100644 --- a/src/Resources/translations/SonataAdminBundle.fr.xliff +++ b/src/Resources/translations/SonataAdminBundle.fr.xliff @@ -490,6 +490,14 @@ toggle_navigation Basculer la navigation + + label_type_starts_with + commence par + + + label_type_ends_with + termine par + diff --git a/src/Resources/translations/SonataAdminBundle.hr.xliff b/src/Resources/translations/SonataAdminBundle.hr.xliff index 190d1b7431..528e229127 100644 --- a/src/Resources/translations/SonataAdminBundle.hr.xliff +++ b/src/Resources/translations/SonataAdminBundle.hr.xliff @@ -490,6 +490,14 @@ toggle_navigation Uključi navigaciju + + label_type_starts_with + počinje sa + + + label_type_ends_with + završava sa + diff --git a/src/Resources/translations/SonataAdminBundle.hu.xliff b/src/Resources/translations/SonataAdminBundle.hu.xliff index 09bfd932ea..81733a046e 100644 --- a/src/Resources/translations/SonataAdminBundle.hu.xliff +++ b/src/Resources/translations/SonataAdminBundle.hu.xliff @@ -490,6 +490,14 @@ toggle_navigation Váltás a navigációhoz + + label_type_starts_with + kezdődik + + + label_type_ends_with + végződik + diff --git a/src/Resources/translations/SonataAdminBundle.it.xliff b/src/Resources/translations/SonataAdminBundle.it.xliff index ca1f3b0919..785e2df904 100644 --- a/src/Resources/translations/SonataAdminBundle.it.xliff +++ b/src/Resources/translations/SonataAdminBundle.it.xliff @@ -490,6 +490,14 @@ toggle_navigation Attivare/disattivare la navigazione + + label_type_starts_with + inizia con + + + label_type_ends_with + finisce con + diff --git a/src/Resources/translations/SonataAdminBundle.ja.xliff b/src/Resources/translations/SonataAdminBundle.ja.xliff index 35bae2c1b2..cc880b2d5a 100644 --- a/src/Resources/translations/SonataAdminBundle.ja.xliff +++ b/src/Resources/translations/SonataAdminBundle.ja.xliff @@ -490,6 +490,14 @@ toggle_navigation ナビゲーションを切り替え + + label_type_starts_with + で始まる + + + label_type_ends_with + で終わる + diff --git a/src/Resources/translations/SonataAdminBundle.lb.xliff b/src/Resources/translations/SonataAdminBundle.lb.xliff index 85d859422d..03b6761c69 100644 --- a/src/Resources/translations/SonataAdminBundle.lb.xliff +++ b/src/Resources/translations/SonataAdminBundle.lb.xliff @@ -490,6 +490,14 @@ toggle_navigation Navigatioun an-/ausblenden + + label_type_starts_with + fänkt mat + + + label_type_ends_with + goung mat + diff --git a/src/Resources/translations/SonataAdminBundle.lt.xliff b/src/Resources/translations/SonataAdminBundle.lt.xliff index b125ce3788..c4c5ea907c 100644 --- a/src/Resources/translations/SonataAdminBundle.lt.xliff +++ b/src/Resources/translations/SonataAdminBundle.lt.xliff @@ -490,6 +490,14 @@ toggle_navigation Perjungti naršymą + + label_type_starts_with + prasideda su + + + label_type_ends_with + baigiasi su + diff --git a/src/Resources/translations/SonataAdminBundle.lv.xliff b/src/Resources/translations/SonataAdminBundle.lv.xliff index a1ac409701..68fbe99498 100644 --- a/src/Resources/translations/SonataAdminBundle.lv.xliff +++ b/src/Resources/translations/SonataAdminBundle.lv.xliff @@ -172,7 +172,9 @@ flash_lock_error - Cits lietotājs ir modificējis objektu "%name%". Lūdzu, %link_start%click here%link_end%, lai pārlādētu lapu un pielietotu izmaiņas vēlreiz. + Cits lietotājs ir modificējis objektu "%name%". Lūdzu, %link_start%click here%link_end%, lai + pārlādētu lapu un pielietotu izmaiņas vēlreiz. + flash_batch_delete_success @@ -486,6 +488,14 @@ read_less Aizvērt + + label_type_starts_with + sākas ar + + + label_type_ends_with + beidzas ar + toggle_navigation Pārslēgt navigāciju diff --git a/src/Resources/translations/SonataAdminBundle.nl.xliff b/src/Resources/translations/SonataAdminBundle.nl.xliff index 3b33e9e13a..0c701faa1b 100644 --- a/src/Resources/translations/SonataAdminBundle.nl.xliff +++ b/src/Resources/translations/SonataAdminBundle.nl.xliff @@ -490,6 +490,14 @@ toggle_navigation Navigatie weergeven of verbergen + + label_type_starts_with + begint met + + + label_type_ends_with + eindigt met + diff --git a/src/Resources/translations/SonataAdminBundle.no.xliff b/src/Resources/translations/SonataAdminBundle.no.xliff index 3a84c1d130..f8337e8174 100644 --- a/src/Resources/translations/SonataAdminBundle.no.xliff +++ b/src/Resources/translations/SonataAdminBundle.no.xliff @@ -491,6 +491,14 @@ toggle_navigation Bytt navigering + + label_type_starts_with + begynner med + + + label_type_ends_with + slutter med + diff --git a/src/Resources/translations/SonataAdminBundle.pl.xliff b/src/Resources/translations/SonataAdminBundle.pl.xliff index 0c2c1926fc..3fed8803e2 100644 --- a/src/Resources/translations/SonataAdminBundle.pl.xliff +++ b/src/Resources/translations/SonataAdminBundle.pl.xliff @@ -490,6 +490,14 @@ toggle_navigation Zwiń/rozwiń menu nawigacji + + label_type_starts_with + zaczyna się na + + + label_type_ends_with + kończy się na + diff --git a/src/Resources/translations/SonataAdminBundle.pt.xliff b/src/Resources/translations/SonataAdminBundle.pt.xliff index c3b8f79e5c..0550603d74 100644 --- a/src/Resources/translations/SonataAdminBundle.pt.xliff +++ b/src/Resources/translations/SonataAdminBundle.pt.xliff @@ -491,6 +491,14 @@ toggle_navigation Alternar de navegação + + label_type_starts_with + começa com + + + label_type_ends_with + termina com + diff --git a/src/Resources/translations/SonataAdminBundle.pt_BR.xliff b/src/Resources/translations/SonataAdminBundle.pt_BR.xliff index 838eb060de..47fcf9c4a6 100644 --- a/src/Resources/translations/SonataAdminBundle.pt_BR.xliff +++ b/src/Resources/translations/SonataAdminBundle.pt_BR.xliff @@ -490,6 +490,14 @@ toggle_navigation Alternar de navegação + + label_type_starts_with + começa com + + + label_type_ends_with + termina com + diff --git a/src/Resources/translations/SonataAdminBundle.ro.xliff b/src/Resources/translations/SonataAdminBundle.ro.xliff index d7ad040efd..12daac7857 100644 --- a/src/Resources/translations/SonataAdminBundle.ro.xliff +++ b/src/Resources/translations/SonataAdminBundle.ro.xliff @@ -490,6 +490,14 @@ toggle_navigation Comutare navigare + + label_type_starts_with + incepe cu + + + label_type_ends_with + se termină cu + diff --git a/src/Resources/translations/SonataAdminBundle.ru.xliff b/src/Resources/translations/SonataAdminBundle.ru.xliff index 119eb5d390..c27e997680 100644 --- a/src/Resources/translations/SonataAdminBundle.ru.xliff +++ b/src/Resources/translations/SonataAdminBundle.ru.xliff @@ -490,6 +490,14 @@ toggle_navigation Переключить навигацию + + label_type_starts_with + начинается с + + + label_type_ends_with + заканчивается + diff --git a/src/Resources/translations/SonataAdminBundle.sk.xliff b/src/Resources/translations/SonataAdminBundle.sk.xliff index e656ce0c31..f0d8e0a92d 100644 --- a/src/Resources/translations/SonataAdminBundle.sk.xliff +++ b/src/Resources/translations/SonataAdminBundle.sk.xliff @@ -490,6 +490,14 @@ toggle_navigation Prepnúť navigáciu + + label_type_starts_with + začína s + + + label_type_ends_with + končí na + diff --git a/src/Resources/translations/SonataAdminBundle.sl.xliff b/src/Resources/translations/SonataAdminBundle.sl.xliff index 10e0c3e3b0..ca12f2ce8d 100644 --- a/src/Resources/translations/SonataAdminBundle.sl.xliff +++ b/src/Resources/translations/SonataAdminBundle.sl.xliff @@ -490,6 +490,14 @@ toggle_navigation Preklopite navigacijo + + label_type_starts_with + se začne z + + + label_type_ends_with + konča z + diff --git a/src/Resources/translations/SonataAdminBundle.sv_SE.xliff b/src/Resources/translations/SonataAdminBundle.sv_SE.xliff index 0102e6c9d5..5d7b27c6d9 100644 --- a/src/Resources/translations/SonataAdminBundle.sv_SE.xliff +++ b/src/Resources/translations/SonataAdminBundle.sv_SE.xliff @@ -490,6 +490,14 @@ toggle_navigation Växla navigering + + label_type_starts_with + börjar med + + + label_type_ends_with + slutar med + diff --git a/src/Resources/translations/SonataAdminBundle.tr.xliff b/src/Resources/translations/SonataAdminBundle.tr.xliff index c41bf05bfa..aae91868bb 100644 --- a/src/Resources/translations/SonataAdminBundle.tr.xliff +++ b/src/Resources/translations/SonataAdminBundle.tr.xliff @@ -490,6 +490,14 @@ toggle_navigation Gezinmeyi aç / kapat + + label_type_starts_with + ile başlar + + + label_type_ends_with + ile biter + diff --git a/src/Resources/translations/SonataAdminBundle.uk.xliff b/src/Resources/translations/SonataAdminBundle.uk.xliff index cc9ac5982a..960e7b51fb 100644 --- a/src/Resources/translations/SonataAdminBundle.uk.xliff +++ b/src/Resources/translations/SonataAdminBundle.uk.xliff @@ -490,6 +490,14 @@ toggle_navigation Увімкнути навігацію + + label_type_starts_with + починається з + + + label_type_ends_with + закінчується на + diff --git a/src/Resources/translations/SonataAdminBundle.zh_CN.xliff b/src/Resources/translations/SonataAdminBundle.zh_CN.xliff index d90c2985fd..b4329d2bdb 100644 --- a/src/Resources/translations/SonataAdminBundle.zh_CN.xliff +++ b/src/Resources/translations/SonataAdminBundle.zh_CN.xliff @@ -490,6 +490,14 @@ toggle_navigation 切换导航 + + label_type_starts_with + 以。。开始 + + + label_type_ends_with + 以。。结束 + diff --git a/src/Resources/translations/SonataAdminBundle.zh_HK.xliff b/src/Resources/translations/SonataAdminBundle.zh_HK.xliff index 6fd66f730d..a48e845290 100644 --- a/src/Resources/translations/SonataAdminBundle.zh_HK.xliff +++ b/src/Resources/translations/SonataAdminBundle.zh_HK.xliff @@ -490,6 +490,14 @@ toggle_navigation 導覽選單開關 + + label_type_starts_with + 以。。開始 + + + label_type_ends_with + 以。。結束 + diff --git a/tests/Form/Type/Operator/StringOperatorTypeTest.php b/tests/Form/Type/Operator/StringOperatorTypeTest.php new file mode 100644 index 0000000000..92e85df7ec --- /dev/null +++ b/tests/Form/Type/Operator/StringOperatorTypeTest.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\AdminBundle\Tests\Form\Type\Operator; + +use Sonata\AdminBundle\Form\Type\Operator\StringOperatorType; +use Symfony\Component\Form\Test\TypeTestCase; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class StringOperatorTypeTest extends TypeTestCase +{ + public function testConfigureOptions() + { + $formType = new StringOperatorType(); + $optionsResolver = new OptionsResolver(); + $expected_choices = [ + 'label_type_contains' => StringOperatorType::TYPE_CONTAINS, + 'label_type_not_contains' => StringOperatorType::TYPE_NOT_CONTAINS, + 'label_type_equals' => StringOperatorType::TYPE_EQUAL, + 'label_type_starts_with' => StringOperatorType::TYPE_STARTS_WITH, + 'label_type_ends_with' => StringOperatorType::TYPE_ENDS_WITH, + ]; + $formType->configureOptions($optionsResolver); + $options = $optionsResolver->resolve([]); + $this->assertSame($expected_choices, $options['choices']); + $this->assertSame('SonataAdminBundle', $options['choice_translation_domain']); + } +}