Warning: You are browsing the documentation for PrestaShop 8, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated 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]
),
]),
],
],
])