I want to increase the length of existed link title field. As matter of fact already have data in that field and don't want to lose.

Any suggestion? How can I do that nicely in Drupal 8. thanks


What you can do is this:

  1. Create new link field
  2. Update configs, like form display, views etc to use new field.
  3. Migrate all the data to the new field, in an update hook. Example code could look like this (Assuming link field is on a node)

    $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['type' => 'node_type');
    foreach ($nodes as $node) {
      $node->new_field = $node->old_field;
  4. Delete old field.

  5. Done

Alternately you can update field field, manually update the SQL tables etc, but this is quite tricky to do properly. If you want to go down this road you should take a look at the entityDefinitionUpdateManager.


Because you have already added data in that field, Drupal won't let you modify the length. So, I would suggest you to go directly into your database and change the length from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.