diff --git a/composer.json b/composer.json
index 2dd4eb5372..2f9516b846 100644
--- a/composer.json
+++ b/composer.json
@@ -29,6 +29,7 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
+ "symfony/deprecation-contracts": "^2.5",
"symfony/http-foundation": "^5.0",
"symfony/security-core": "^5.0",
"symfony/security-http": "^5.0",
diff --git a/src/bundle/Resources/config/services/translation.yaml b/src/bundle/Resources/config/services/translation.yaml
index aa7c079481..51a9ec1ba6 100644
--- a/src/bundle/Resources/config/services/translation.yaml
+++ b/src/bundle/Resources/config/services/translation.yaml
@@ -9,6 +9,7 @@ services:
- { name: jms_translation.file_visitor }
Ibexa\AdminUi\Translation\Extractor\PolicyTranslationExtractor:
+ deprecated: 'Since ibexa/admin-ui 4.4: The "%service_id%" service is deprecated, will be removed in 5.0'
arguments:
- '%ibexa.api.role.policy_map%'
tags:
@@ -19,6 +20,7 @@ services:
- { name: jms_translation.extractor, alias: ez_location_sorting }
Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor:
+ deprecated: 'Since ibexa/admin-ui 4.4: The "%service_id%" service is deprecated, will be removed in 5.0'
arguments:
- '%ibexa.api.role.policy_map%'
tags:
diff --git a/src/bundle/Resources/translations/forms.en.xliff b/src/bundle/Resources/translations/forms.en.xliff
index 72263827b1..c148f57980 100644
--- a/src/bundle/Resources/translations/forms.en.xliff
+++ b/src/bundle/Resources/translations/forms.en.xliff
@@ -161,861 +161,11 @@
All modules / All functions
key: role.policy.all_modules_all_functions
-
-
- Catalog
- key: role.policy.catalog
-
-
-
- Catalog / All functions
- key: role.policy.catalog.all_functions
-
-
-
- Catalog / Create
- key: role.policy.catalog.create
-
-
-
- Catalog / Delete
- key: role.policy.catalog.delete
-
-
-
- Catalog / Edit
- key: role.policy.catalog.edit
-
-
-
- Catalog / View
- key: role.policy.catalog.view
-
-
-
- Content Type
- key: role.policy.class
-
-
-
- Content Type / All functions
- key: role.policy.class.all_functions
-
-
-
- Content Type / Create
- key: role.policy.class.create
-
-
-
- Content Type / Delete
- key: role.policy.class.delete
-
-
-
- Content Type / Update
- key: role.policy.class.update
-
-
-
- Commerce
- key: role.policy.commerce
-
-
-
- Commerce / All functions
- key: role.policy.commerce.all_functions
-
-
-
- Commerce / Currency
- key: role.policy.commerce.currency
-
-
-
- Commerce / Region
- key: role.policy.commerce.region
-
-
-
- Comparison
- key: role.policy.comparison
-
-
-
- Comparison / All functions
- key: role.policy.comparison.all_functions
-
-
-
- Comparison / View
- key: role.policy.comparison.view
-
-
-
- Content
- key: role.policy.content
-
-
-
- Content / All functions
- key: role.policy.content.all_functions
-
-
-
- Content / Cleantrash
- key: role.policy.content.cleantrash
-
-
-
- Content / Create
- key: role.policy.content.create
-
-
-
- Content / Diff
- key: role.policy.content.diff
-
-
-
- Content / Edit
- key: role.policy.content.edit
-
-
-
- Content / Hide
- key: role.policy.content.hide
-
-
-
- Content / Manage locations
- key: role.policy.content.manage_locations
-
-
-
- Content / Pendinglist
- key: role.policy.content.pendinglist
-
-
-
- Content / Publish
- key: role.policy.content.publish
-
-
-
- Content / Read
- key: role.policy.content.read
-
-
-
- Content / Remove
- key: role.policy.content.remove
-
-
-
- Content / Restore
- key: role.policy.content.restore
-
-
-
- Content / Reverserelatedlist
- key: role.policy.content.reverserelatedlist
-
-
-
- Content / Translate
- key: role.policy.content.translate
-
-
-
- Content / Translations
- key: role.policy.content.translations
-
-
-
- Content / Unlock
- key: role.policy.content.unlock
-
-
-
- Content / Urltranslator
- key: role.policy.content.urltranslator
-
-
-
- Content / Versionread
- key: role.policy.content.versionread
-
-
-
- Content / Versionremove
- key: role.policy.content.versionremove
-
-
-
- Content / View embed
- key: role.policy.content.view_embed
-
-
-
- Customer group
- key: role.policy.customer_group
-
-
-
- Customer group / All functions
- key: role.policy.customer_group.all_functions
-
-
-
- Customer group / Create
- key: role.policy.customer_group.create
-
-
-
- Customer group / Delete
- key: role.policy.customer_group.delete
-
-
-
- Customer group / Edit
- key: role.policy.customer_group.edit
-
-
-
- Customer group / View
- key: role.policy.customer_group.view
-
-
-
- Personalization
- key: role.policy.personalization
-
-
-
- Personalization / All functions
- key: role.policy.personalization.all_functions
-
-
-
- Personalization / Edit
- key: role.policy.personalization.edit
-
-
-
- Personalization / View
- key: role.policy.personalization.view
-
-
-
- Product
- key: role.policy.product
-
-
-
- Product / All functions
- key: role.policy.product.all_functions
-
-
-
- Product / Create
- key: role.policy.product.create
-
-
-
- Product / Delete
- key: role.policy.product.delete
-
-
-
- Product / Edit
- key: role.policy.product.edit
-
-
-
- Product / View
- key: role.policy.product.view
-
-
-
- Product type
- key: role.policy.product_type
-
-
-
- Product type / All functions
- key: role.policy.product_type.all_functions
-
-
-
- Product type / Create
- key: role.policy.product_type.create
-
-
-
- Product type / Delete
- key: role.policy.product_type.delete
-
-
-
- Product type / Edit
- key: role.policy.product_type.edit
-
-
-
- Product type / View
- key: role.policy.product_type.view
-
-
-
- Role
- key: role.policy.role
-
-
-
- Role / All functions
- key: role.policy.role.all_functions
-
-
-
- Role / Assign
- key: role.policy.role.assign
-
-
-
- Role / Create
- key: role.policy.role.create
-
-
-
- Role / Delete
- key: role.policy.role.delete
-
-
-
- Role / Read
- key: role.policy.role.read
-
-
-
- Role / Update
- key: role.policy.role.update
-
-
-
- Section
- key: role.policy.section
-
-
-
- Section / All functions
- key: role.policy.section.all_functions
-
-
-
- Section / Assign
- key: role.policy.section.assign
-
-
-
- Section / Edit
- key: role.policy.section.edit
-
-
-
- Section / View
- key: role.policy.section.view
-
-
-
- Segment
- key: role.policy.segment
-
-
-
- Segment / All functions
- key: role.policy.segment.all_functions
-
-
-
- Segment / Assign to user
- key: role.policy.segment.assign_to_user
-
-
-
- Segment / Create
- key: role.policy.segment.create
-
-
-
- Segment / Read
- key: role.policy.segment.read
-
-
-
- Segment / Remove
- key: role.policy.segment.remove
-
-
-
- Segment / Update
- key: role.policy.segment.update
-
-
-
- Segment / View user segment list
- key: role.policy.segment.view_user_segment_list
-
-
-
- Segment group
- key: role.policy.segment_group
-
-
-
- Segment group / All functions
- key: role.policy.segment_group.all_functions
-
-
-
- Segment group / Create
- key: role.policy.segment_group.create
-
-
-
- Segment group / Read
- key: role.policy.segment_group.read
-
-
-
- Segment group / Remove
- key: role.policy.segment_group.remove
-
-
-
- Segment group / Update
- key: role.policy.segment_group.update
-
-
-
- Setting
- key: role.policy.setting
-
-
-
- Setting / All functions
- key: role.policy.setting.all_functions
-
-
-
- Setting / Create
- key: role.policy.setting.create
-
-
-
- Setting / Remove
- key: role.policy.setting.remove
-
-
-
- Setting / Update
- key: role.policy.setting.update
-
-
-
- Setup
- key: role.policy.setup
-
-
-
- Setup / Administrate
- key: role.policy.setup.administrate
-
-
-
- Setup / All functions
- key: role.policy.setup.all_functions
-
-
-
- Setup / Install
- key: role.policy.setup.install
-
-
-
- Setup / Setup
- key: role.policy.setup.setup
-
-
-
- Setup / System info
- key: role.policy.setup.system_info
-
-
-
- Siso control center
- key: role.policy.siso_control_center
-
-
-
- Siso control center / All functions
- key: role.policy.siso_control_center.all_functions
-
-
-
- Siso control center / Api econtent
- key: role.policy.siso_control_center.api_econtent
-
-
-
- Siso control center / Api erp
- key: role.policy.siso_control_center.api_erp
-
-
-
- Siso control center / Api jobs
- key: role.policy.siso_control_center.api_jobs
-
-
-
- Siso control center / Manage emails
- key: role.policy.siso_control_center.manage_emails
-
-
-
- Siso control center / Manage erp
- key: role.policy.siso_control_center.manage_erp
-
-
-
- Siso control center / Manage erp logs
- key: role.policy.siso_control_center.manage_erp_logs
-
-
-
- Siso control center / Manage exports
- key: role.policy.siso_control_center.manage_exports
-
-
-
- Siso control center / Manage imports
- key: role.policy.siso_control_center.manage_imports
-
-
-
- Siso control center / Manage jobs
- key: role.policy.siso_control_center.manage_jobs
-
-
-
- Siso policy
- key: role.policy.siso_policy
-
-
-
- Siso policy / All functions
- key: role.policy.siso_policy.all_functions
-
-
-
- Siso policy / Checkout
- key: role.policy.siso_policy.checkout
-
-
-
- Siso policy / Configuration list
- key: role.policy.siso_policy.configuration_list
-
-
-
- Siso policy / Dashboard view
- key: role.policy.siso_policy.dashboard_view
-
-
-
- Siso policy / Delegate
- key: role.policy.siso_policy.delegate
-
-
-
- Siso policy / Edit delivery
- key: role.policy.siso_policy.edit_delivery
-
-
-
- Siso policy / Edit invoice
- key: role.policy.siso_policy.edit_invoice
-
-
-
- Siso policy / Forms profile edit
- key: role.policy.siso_policy.forms_profile_edit
-
-
-
- Siso policy / Lostorder list
- key: role.policy.siso_policy.lostorder_list
-
-
-
- Siso policy / Lostorder manage
- key: role.policy.siso_policy.lostorder_manage
-
-
-
- Siso policy / Lostorder process
- key: role.policy.siso_policy.lostorder_process
-
-
-
- Siso policy / Manage config
- key: role.policy.siso_policy.manage_config
-
-
-
- Siso policy / Manage orders
- key: role.policy.siso_policy.manage_orders
-
-
-
- Siso policy / Manage prices
- key: role.policy.siso_policy.manage_prices
-
-
-
- Siso policy / Manage rating
- key: role.policy.siso_policy.manage_rating
-
-
-
- Siso policy / Manage shipping costs
- key: role.policy.siso_policy.manage_shipping_costs
-
-
-
- Siso policy / Manage stock
- key: role.policy.siso_policy.manage_stock
-
-
-
- Siso policy / Order list
- key: role.policy.siso_policy.order_list
-
-
-
- Siso policy / Orderhistory view
- key: role.policy.siso_policy.orderhistory_view
-
-
-
- Siso policy / Quickorder
- key: role.policy.siso_policy.quickorder
-
-
-
- Siso policy / Rating review
- key: role.policy.siso_policy.rating_review
-
-
-
- Siso policy / Read basket
- key: role.policy.siso_policy.read_basket
-
-
-
- Siso policy / Read customers and orders
- key: role.policy.siso_policy.read_customers_and_orders
-
-
-
- Siso policy / See product price
- key: role.policy.siso_policy.see_product_price
-
-
-
- Siso policy / Translations
- key: role.policy.siso_policy.translations
-
-
-
- Siso policy / Update exchange rates
- key: role.policy.siso_policy.update_exchange_rates
-
-
-
- Siso policy / Write basket
- key: role.policy.siso_policy.write_basket
-
-
-
- Site
- key: role.policy.site
-
-
-
- Site / All functions
- key: role.policy.site.all_functions
-
-
-
- Site / Change status
- key: role.policy.site.change_status
-
-
-
- Site / Create
- key: role.policy.site.create
-
-
-
- Site / Delete
- key: role.policy.site.delete
-
-
-
- Site / Edit
- key: role.policy.site.edit
-
-
-
- Site / View
- key: role.policy.site.view
-
-
-
- State
- key: role.policy.state
-
-
-
- State / Administrate
- key: role.policy.state.administrate
-
-
-
- State / All functions
- key: role.policy.state.all_functions
-
-
-
- State / Assign
- key: role.policy.state.assign
-
-
-
- Taxonomy
- key: role.policy.taxonomy
-
-
-
- Taxonomy / All functions
- key: role.policy.taxonomy.all_functions
-
-
-
- Taxonomy / Assign
- key: role.policy.taxonomy.assign
-
-
-
- Taxonomy / Manage
- key: role.policy.taxonomy.manage
-
-
-
- Taxonomy / Read
- key: role.policy.taxonomy.read
-
-
-
- Policy
- key: role.policy.type
-
Choose a Policy
key: role.policy.type.choose
-
-
- Url
- key: role.policy.url
-
-
-
- Url / All functions
- key: role.policy.url.all_functions
-
-
-
- Url / Update
- key: role.policy.url.update
-
-
-
- Url / View
- key: role.policy.url.view
-
-
-
- User
- key: role.policy.user
-
-
-
- User / Activation
- key: role.policy.user.activation
-
-
-
- User / All functions
- key: role.policy.user.all_functions
-
-
-
- User / Invite
- key: role.policy.user.invite
-
-
-
- User / Login
- key: role.policy.user.login
-
-
-
- User / Password
- key: role.policy.user.password
-
-
-
- User / Preferences
- key: role.policy.user.preferences
-
-
-
- User / Register
- key: role.policy.user.register
-
-
-
- User / Selfedit
- key: role.policy.user.selfedit
-
-
-
- Workflow
- key: role.policy.workflow
-
-
-
- Workflow / All functions
- key: role.policy.workflow.all_functions
-
-
-
- Workflow / Change stage
- key: role.policy.workflow.change_stage
-
Delete
diff --git a/src/lib/Form/Type/Policy/PolicyChoiceType.php b/src/lib/Form/Type/Policy/PolicyChoiceType.php
index a58eaa2dff..1246680c83 100644
--- a/src/lib/Form/Type/Policy/PolicyChoiceType.php
+++ b/src/lib/Form/Type/Policy/PolicyChoiceType.php
@@ -8,7 +8,6 @@
namespace Ibexa\AdminUi\Form\Type\Policy;
-use Ibexa\AdminUi\Translation\Extractor\PolicyTranslationExtractor;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -18,6 +17,12 @@
class PolicyChoiceType extends AbstractType
{
+ public const MESSAGE_DOMAIN = 'forms';
+ public const MESSAGE_ID_PREFIX = 'role.policy.';
+ public const ALL_MODULES = 'all_modules';
+ public const ALL_FUNCTIONS = 'all_functions';
+ public const ALL_MODULES_ALL_FUNCTIONS = 'all_modules_all_functions';
+
/** @var array */
private $policyChoices;
@@ -94,20 +99,20 @@ public function getParent(): ?string
private function buildPolicyChoicesFromMap(array $policyMap): array
{
$policyChoices = [
- PolicyTranslationExtractor::MESSAGE_ID_PREFIX . PolicyTranslationExtractor::ALL_MODULES => [
- PolicyTranslationExtractor::MESSAGE_ID_PREFIX . PolicyTranslationExtractor::ALL_MODULES_ALL_FUNCTIONS => '*|*',
+ self::MESSAGE_ID_PREFIX . self::ALL_MODULES => [
+ self::MESSAGE_ID_PREFIX . self::ALL_MODULES_ALL_FUNCTIONS => '*|*',
],
];
foreach ($policyMap as $module => $functionList) {
- $moduleKey = PolicyTranslationExtractor::MESSAGE_ID_PREFIX . $module;
+ $moduleKey = self::MESSAGE_ID_PREFIX . $module;
// For each module, add possibility to grant access to all functions.
$policyChoices[$moduleKey] = [
- $moduleKey . '.' . PolicyTranslationExtractor::ALL_FUNCTIONS => "$module|*",
+ $moduleKey . '.' . self::ALL_FUNCTIONS => "$module|*",
];
foreach ($functionList as $function => $limitationList) {
- $moduleFunctionKey = PolicyTranslationExtractor::MESSAGE_ID_PREFIX . "{$module}.{$function}";
+ $moduleFunctionKey = self::MESSAGE_ID_PREFIX . "{$module}.{$function}";
$policyChoices[$moduleKey][$moduleFunctionKey] = "$module|$function";
}
}
diff --git a/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php b/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php
index 322efc202a..3cb68fe08d 100644
--- a/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php
+++ b/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php
@@ -10,9 +10,9 @@
use Ibexa\AdminUi\Limitation\LimitationFormMapperInterface;
use Ibexa\AdminUi\Limitation\LimitationValueMapperInterface;
-use Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ChangeOwnerLimitation;
+use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -43,7 +43,7 @@ public function mapLimitationForm(FormInterface $form, Limitation $data): void
'multiple' => true,
'expanded' => false,
'required' => false,
- 'label' => LimitationTranslationExtractor::identifierToLabel($data->getIdentifier()),
+ 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()),
'choices' => array_flip($this->getSelectionChoices()),
];
diff --git a/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php b/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php
index d7b3f59e43..58a9ad5da9 100644
--- a/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php
+++ b/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php
@@ -7,8 +7,8 @@
namespace Ibexa\AdminUi\Limitation\Mapper;
use Ibexa\AdminUi\Limitation\LimitationFormMapperInterface;
-use Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
+use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
@@ -28,7 +28,7 @@ public function mapLimitationForm(FormInterface $form, Limitation $data)
{
$options = $this->getChoiceFieldOptions() + [
'multiple' => true,
- 'label' => LimitationTranslationExtractor::identifierToLabel($data->getIdentifier()),
+ 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()),
'required' => false,
];
$choices = $this->getSelectionChoices();
diff --git a/src/lib/Limitation/Mapper/UDWBasedMapper.php b/src/lib/Limitation/Mapper/UDWBasedMapper.php
index c7052982a0..66adf16865 100755
--- a/src/lib/Limitation/Mapper/UDWBasedMapper.php
+++ b/src/lib/Limitation/Mapper/UDWBasedMapper.php
@@ -10,13 +10,13 @@
use Ibexa\AdminUi\Form\DataTransformer\UDWBasedValueViewTransformer;
use Ibexa\AdminUi\Limitation\LimitationFormMapperInterface;
use Ibexa\AdminUi\Limitation\LimitationValueMapperInterface;
-use Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor;
use Ibexa\Contracts\Core\Repository\LocationService;
use Ibexa\Contracts\Core\Repository\SearchService;
use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Location\Path;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
+use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormInterface;
@@ -71,7 +71,7 @@ public function mapLimitationForm(FormInterface $form, Limitation $data)
->createBuilder()
->create('limitationValues', HiddenType::class, [
'required' => false,
- 'label' => LimitationTranslationExtractor::identifierToLabel($data->getIdentifier()),
+ 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()),
])
->addViewTransformer(new UDWBasedValueViewTransformer($this->locationService))
->addModelTransformer(new UDWBasedValueModelTransformer($this->locationService))
diff --git a/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php b/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php
index b9a0d7084d..554ba52dfd 100644
--- a/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php
+++ b/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php
@@ -10,12 +10,12 @@
use Ibexa\AdminUi\Limitation\LimitationFormMapperInterface;
use Ibexa\AdminUi\Limitation\LimitationValueMapperInterface;
-use Ibexa\AdminUi\Translation\Extractor\LimitationTranslationExtractor;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\RoleService;
use Ibexa\Contracts\Core\Repository\SearchService;
use Ibexa\Contracts\Core\Repository\UserService;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
+use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
use Ibexa\User\Form\ChoiceList\Loader\UserGroupsChoiceLoader;
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -55,7 +55,9 @@ public function mapLimitationForm(FormInterface $form, Limitation $data)
->create(
'limitationValues',
FormType::class,
- ['label' => LimitationTranslationExtractor::identifierToLabel($data->getIdentifier())]
+ [
+ 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()),
+ ]
)
->setAutoInitialize(false)
->getForm();
diff --git a/src/lib/Translation/Extractor/LimitationTranslationExtractor.php b/src/lib/Translation/Extractor/LimitationTranslationExtractor.php
index 5b426c2181..8dabba762e 100644
--- a/src/lib/Translation/Extractor/LimitationTranslationExtractor.php
+++ b/src/lib/Translation/Extractor/LimitationTranslationExtractor.php
@@ -8,17 +8,20 @@
namespace Ibexa\AdminUi\Translation\Extractor;
+use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter;
use JMS\TranslationBundle\Model\Message;
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\ExtractorInterface;
/**
* Generates translation strings for limitation types.
+ *
+ * @deprecated Since ibexa/admin-ui 4.4: The "LimitationTranslationExtractor" class is deprecated, will be removed in 5.0.
*/
class LimitationTranslationExtractor implements ExtractorInterface
{
public const MESSAGE_DOMAIN = 'ezplatform_content_forms_policies';
- public const MESSAGE_ID_PREFIX = 'policy.limitation.identifier.';
+ public const MESSAGE_ID_PREFIX = LimitationIdentifierToLabelConverter::MESSAGE_ID_PREFIX;
/**
* @var array
@@ -33,8 +36,13 @@ public function __construct(array $policyMap)
$this->policyMap = $policyMap;
}
+ /**
+ * @deprecated Since ibexa/admin-ui 4.4: The method "LimitationTranslationExtractor::extract()" method is deprecated, will be removed in 5.0.
+ */
public function extract()
{
+ trigger_deprecation('ibexa/admin', '4.4', 'The %s() method is deprecated, will be removed in 5.0.', __METHOD__);
+
$catalogue = new MessageCatalogue();
foreach ($this->getLimitationTypes() as $limitationType) {
@@ -56,11 +64,15 @@ public function extract()
/**
* @param string $limitationIdentifier
*
+ * @deprecated Since ibexa/admin-ui 4.4: The method "LimitationTranslationExtractor::identifierToLabel()" method is deprecated, will be removed in 5.0. Use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter::convert() instead.
+ *
* @return string
*/
public static function identifierToLabel(string $limitationIdentifier): string
{
- return self::MESSAGE_ID_PREFIX . strtolower($limitationIdentifier);
+ trigger_deprecation('ibexa/admin', '4.4', 'The %s() method is deprecated, will be removed in 5.0. Use %s::convert() instead.', __METHOD__, LimitationIdentifierToLabelConverter::class);
+
+ return LimitationIdentifierToLabelConverter::convert($limitationIdentifier);
}
/**
diff --git a/src/lib/Translation/Extractor/PolicyTranslationExtractor.php b/src/lib/Translation/Extractor/PolicyTranslationExtractor.php
index 1d9c2e3e14..9f47c7f3cc 100644
--- a/src/lib/Translation/Extractor/PolicyTranslationExtractor.php
+++ b/src/lib/Translation/Extractor/PolicyTranslationExtractor.php
@@ -8,20 +8,23 @@
namespace Ibexa\AdminUi\Translation\Extractor;
+use Ibexa\AdminUi\Form\Type\Policy\PolicyChoiceType;
use JMS\TranslationBundle\Model\Message\XliffMessage;
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\ExtractorInterface;
/**
* Generates translation strings for limitation types.
+ *
+ * @deprecated Since ibexa/admin-ui 4.4: The "PolicyTranslationExtractor" class is deprecated, will be removed in 5.0.
*/
class PolicyTranslationExtractor implements ExtractorInterface
{
- public const MESSAGE_DOMAIN = 'forms';
- public const MESSAGE_ID_PREFIX = 'role.policy.';
- public const ALL_MODULES = 'all_modules';
- public const ALL_FUNCTIONS = 'all_functions';
- public const ALL_MODULES_ALL_FUNCTIONS = 'all_modules_all_functions';
+ public const MESSAGE_DOMAIN = PolicyChoiceType::MESSAGE_DOMAIN;
+ public const MESSAGE_ID_PREFIX = PolicyChoiceType::MESSAGE_ID_PREFIX;
+ public const ALL_MODULES = PolicyChoiceType::ALL_MODULES;
+ public const ALL_FUNCTIONS = PolicyChoiceType::ALL_FUNCTIONS;
+ public const ALL_MODULES_ALL_FUNCTIONS = PolicyChoiceType::ALL_MODULES_ALL_FUNCTIONS;
/** @var array */
private $policyMap;
@@ -36,9 +39,13 @@ public function __construct(array $policyMap)
/**
* @return \JMS\TranslationBundle\Model\MessageCatalogue
+ *
+ * @deprecated Since ibexa/admin-ui 4.4: The method "PolicyTranslationExtractor::extract()" method is deprecated, will be removed in 5.0.
*/
public function extract(): MessageCatalogue
{
+ trigger_deprecation('ibexa/admin', '4.4', 'The %s() method is deprecated, will be removed in 5.0.', __METHOD__);
+
$catalogue = new MessageCatalogue();
$catalogue->add($this->createMessage(self::ALL_MODULES, 'All modules'));