Very bad, the limitation of the number of characters in the fields for entering tokens. Tokens are much more than the limit and an error is displayed and tokens are truncated. must be corrected. Remove this restriction for token input maxlength="255"

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ScorpionGhost created an issue. See original summary.

scorpionghost’s picture

Status: Fixed » Needs review
damienmckenna’s picture

Priority: Critical » Normal
Status: Needs review » Active
Related issues: +#3211848: Error due to field constraints

This may be a duplicate of #3211848: Error due to field constraints. Repeating what I wrote there:

I'm sorry you've ran into this problem. Unfortunately I don't quite understand the scenario that is causing this. Can you please post a screenshot of an example field that causes this error? Thank you.

BTW the appropriate status for a new issue is "active"; "fixed" is for when the problem has been fixed, "needs review" is for when someone provides a suggested fix (either a patch, a merge request, or maybe some documentation or suggestion on how to approach the problem) and that specific solution needs to be reviewed.

Thank you.

scorpionghost’s picture

I changed in the file web\modules\contrib\schema_metatag\src\Plugin\schema_metatag\PropertyTypeBase.php $form['#maxlength'] = 1024;

Everything was fine. 255 is very little. Perhaps 1024 will be small if there are a lot of tokens

Thank you.

damienmckenna’s picture

Can you please copy & paste the list of tokens you are using? There might be another way of doing it that avoids the problem.

scorpionghost’s picture

DamienMcKenna
No, there is no other way to avoid it. By only increasing the value $form['#maxlength'] =
I increased the value and the problem went away. The problem is that now every time you update the module, you will have to make changes.

damienmckenna’s picture

My point is that maybe you shouldn't need more than 255 characters for your token values, maybe there's a different way of managing the configuration that avoids it. Can you please show us what an example value looks like that ends up so long?

scorpionghost’s picture

DamienMcKenna
[node:field_season:entity:field_season] [node:field_locality:entity:field_city] [node:field_locality:entity:field_region] [node:field_tackle:entity:field_fishing_tackle] [node:field_type_fish:entity:field_type_fish] [node:field_fish:entity:field_fish] - [node:title]

damienmckenna’s picture

Do those all output at the same time? Or do different ones output for different content types?

scorpionghost’s picture

DamienMcKenna,
Yes of course. All at the same time. Maybe more. This is important for the SEO

ogwin’s picture

Hello, with Drupal 9 I could make a backup from Database only,

if I select =>entire site, I got the error message only:

=================================================================================
The website encountered an unexpected error. Please try again later.
Error: Call to a member function create() on null in Drupal\backup_migrate\Core\Source\MySQLiSource->exportToFile() (line 47 of modules/backup_migrate/src/Core/Source/MySQLiSource.php).
Drupal\backup_migrate\Core\Source\MySQLiSource->exportToFile() (Line: 51)
Drupal\backup_migrate\Drupal\Source\DrupalSiteArchiveSource->getFilesToBackup('/homepages/25/d373038367/htdocs/jenzig/') (Line: 62)
Drupal\backup_migrate\Core\Source\FileDirectorySource->exportToFile() (Line: 88)
Drupal\backup_migrate\Core\Main\BackupMigrate->backup('entire_site', 'download') (Line: 46)
backup_migrate_perform_backup('entire_site', 'download', Array) (Line: 77)
Drupal\backup_migrate\Form\BackupMigrateQuickBackupForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('backup_migrate_ui_manual_backup_quick', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
============================================================

How can I get a full backup of entire Site?
Regards, Joachim

damienmckenna’s picture

@ogwin: Sorry, that's unrelated to this discussion, please take a look at the Backup Migrate issue queue.

damienmckenna’s picture

Version: 8.x-2.2 » 8.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new573 bytes

@ScorpionGhost: Ok, thanks for clarifying. I only asked because I've ran into situations where people were stacking up tons of tokens because they didn't realize they could have different configurations for each content type.

This patch changes the maxlength from 255 to 512.

scorpionghost’s picture

DamienMcKenna, thank you. Not. I know exactly what I need. I put 1000 - that's enough for now. I don't want to just fix this error every time I update. Let it be better immediately in the module to be as much as possible. even 500, maybe not enough

piotr pakulski made their first commit to this issue’s fork.

piotr pakulski’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Assigned: Unassigned » piotr pakulski
Status: Needs review » Needs work
StatusFileSize
new143.77 KB
new253.65 KB
new259.42 KB

@damienmckenna I can see a lot of related issues with the same problem 255 Limit for PropertyTypeBase - I wonder why we still keep the limit that low?

I read that we should use tokens and they should not be that long - that's fine but I also have different scenario:
- I use schema.org Organization sub module
- the main fields as "name" and "description" are set in the default config to be the same across page and that fine
- the main default config values have translations and that is important and for one language the description field exceeded the 255 limit, sitll not a problem from the perspective of default configuration form
- the when editing the node the schema.org menu with the field for some reason is showing the default values, but when saved without changing them the node does not override the default with own value, also OK
- but because the node fields pre populated with default values the "description" field for one of the languages longer than 255; result: I can not save the node, error: description cannot be longer than 255 characters but is currently 297 characters long.
- I do not want to change the field value to shorter as then for the node it will overwrite the default value that is and should be longer in my case

I will prepare for and PR in next comment

piotr pakulski’s picture

Assigned: piotr pakulski » Unassigned
Status: Needs work » Needs review