Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.
You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page
It is used to add a field with a recommended input length counter to the form.
Option | Type | Default value | Description |
---|---|---|---|
recommended_length | int |
Component | Description |
---|---|
TextWithRecommendedLengthCounter | Adds a recommended length counter to the input |
$builder->add('meta_description', TranslatableType::class, [
'label' => $this->trans('Meta description', 'Admin.Global'),
'type' => TextWithRecommendedLengthType::class,
'help' => $invalidCharsText,
'required' => false,
'options' => [
'recommended_length' => self::RECOMMENDED_DESCRIPTION_LENGTH,
'attr' => [
'maxlength' => self::META_DESCRIPTION_MAX_CHARS,
],
'constraints' => [
new TypedRegex([
'type' => 'generic_name',
]),
new Length([
'max' => self::META_DESCRIPTION_MAX_CHARS,
'maxMessage' => $this->trans(
'This field cannot be longer than %limit% characters',
'Admin.Notifications.Error',
['%limit%' => self::META_DESCRIPTION_MAX_CHARS]
),
]),
],
],
])