See #2411143-3: Change LinkItem schema to store URIs rather than URLs/paths/routes.1.

Need to add description column (or otherwise handle description translation) on the link field, right now while it supports options/attributes there's no UI for them.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Issue summary: View changes
webchick’s picture

benjy’s picture

Status: Active » Needs review
FileSize
2.08 KB

I added it to the widget, did we want that? If so, do we want a setting to disable it similar to "Link text"?

hussainweb’s picture

FileSize
3.79 KB
5.58 KB

I added it to the widget, did we want that?

I think so.

If so, do we want a setting to disable it similar to "Link text"?

I agree. It doesn't make sense to have title optional but not description. I am implementing that in my patch.

I also attempted to use the description in the formatter to show up as the link's title attribute.

hussainweb’s picture

FileSize
1.34 KB
5.99 KB

Fixing minor misses. Basically, making the setting to disable link description actually work.

The last submitted patch, 4: 2413029-link-4.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2413029-link-5.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
7.96 KB
2.51 KB

Patch looks great to me. With this reroll, it should pass tests.

dawehner’s picture

  1. +++ b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php
    @@ -74,6 +78,11 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
    +        'description' => array(
    +          'description' => 'The link description.',
    +          'type' => 'varchar',
    +          'length' => 255,
    +        ),
    

    Are we sure 255 is enough? I could easilly expect this to be quite long ... but well, this is what menu_link_content is doing.

  2. +++ b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php
    @@ -112,6 +121,17 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
    +      '#title' => t('Allow link description'),
    +      '#default_value' => $this->getSetting('description'),
    ...
    +        DRUPAL_DISABLED => t('Disabled'),
    +        DRUPAL_OPTIONAL => t('Optional'),
    +        DRUPAL_REQUIRED => t('Required'),
    

    $this->t() is available from here ... so let's use it for new code.

Wim Leers’s picture

Actually, the Shortcut entity's patch to use the link field just landed (#2235457: Use link field for shortcut entity) and it continues to use its own (entity-level) title base field rather than using the link base field's title property.
A similar discussion is now going on for the MenuLinkContent entity at #2406749-17: Use a link field for custom menu link.

Which means that this description property would only ever be used by link fields used as configurable fields, and never by link fields used as base fields.

Does that mean that we don't have to do this issue since it doesn't change the upgrade path?

And does that mean that this issue is not worth doing at all?

hussainweb’s picture

Just for reference, this was the discussion that originally started the need for a description field.

Need to add description column (or otherwise handle description translation) on the link field, right now while it supports options/attributes there's no UI for them.

From #2407505-20: [meta] Finalize the menu links (and other user-entered paths) system

I am documenting it here because I had to trace this through a couple of issues. This should probably be in the issue summary.

joelpittet’s picture

@Wim Leers @dawehner re #9.1 Title attribute has a limit in IE of 512 charaters, maybe that would be a reasonable limit here, as it seems the description is often used for the link title?

https://msdn.microsoft.com/en-us/library/ie/ms534683%28v=vs.85%29.aspx

Gábor Hojtsy’s picture

Issue summary: View changes
Gábor Hojtsy’s picture

Updated the issue summary as per suggestion in #11. I am not sure how adding the description is required to support translatability? I mean if there is no description, there is no need to translate it either? We don't need to add it so we can translate it if we don't have it in the first place. Not sure what justifies this being critical?

Wim Leers’s picture

I raised similar concerns in #10, see the last two sentences.

dawehner’s picture

We (xjm, wim, tim, dawehner) discussed that a bit and decided that this is not critical.

a) Moving description later would be a pretty forward in terms of an upgrade path (just rename the column and be done)

b) We think description is not required to be changed, because the description is already part of menu link content and is working fine there.
It would just addition effort we would not strictly needed, especially if we decide that the title does not belong on the link item but rather the menu link content.

c) it makes things harder in terms of creating the UI, because a LinkWidget itself could be not mixed with some of the other fields.

Given that we don't think this would be required.

Wim Leers’s picture

Priority: Critical » Major

Per #16: downgrading to major.

Before closing this (also per #16), let's give some time for people to comment why we still do want to do this.

Wim Leers’s picture

Category: Task » Feature request

Clarifying further: this is not necessary for any of the menu links/routing work, so this is now solely a feature request for the link field. Note that even the D7 contrib link field didn't support this.

Wim Leers’s picture

Version: 8.0.x-dev » 8.1.x-dev

And hence this belongs in 8.1.

webchick’s picture

Status: Needs review » Postponed
Issue tags: -D8 upgrade path

Great!

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mac_Weber’s picture

Status: Postponed » Active

Reactivating, patch no longer applies

Mac_Weber’s picture

Status: Active » Needs work

needs work might be a better issue status

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.