Updated: Comment #64
The contrib link modules Link, URL Field and CKEditor Link supports both internal and external URLs and a lot of people use the module for internal links. Right now, the storage for the core link field data and the default widget only supports external URLs.
Implement plan C, described below.
User interface changes
A new option appears in the link field instance edit page. See screenshot from comment #64.
- both internal and external URLs can be stored (and edited in the default widget) by the link field
- the field type plugin receives its own interface (LinkItemInterface), which contains an
isExternal() helper method
Original report by @Dave Reid
Current summary fromwhich was filed against the URL module issue queue:
- Decide we only want to support external URLs in the widget and change nothing. Leave internal URL widget for contrib.
- Pros: Lowest complexity
- Cons: Users may find out-of-the-box solution limiting.
- Rename the current widget from 'URL field' to 'External URL field' and add a new 'Internal URL field' widget.
- Pros: we support both, not too much extra code
- Cons: this makes a specific instance only able to use one or the other and not mix.
- Add an option on the field instance to have the administrator say if this field supports internal only, external only, or both. The default widget will change it's validation based on the options.
- Pros: Able to mix/match. Seems better as a field instance setting, not a widget setting.
- Cons: Most amount of complexity to add. Widget will not be able to support HTML5 'url' FAPI type if option is not 'external only' since the url field by nature only supports external fields.
- Always use the FAPI 'url' type, and attempt to resolve what are 'local' URLs to un-aliased internal Drupal URLs.
- Pros: Simplicity. We are able to handle both types with the same widget and use the new HTML5 FAPI type always.
- Cons: Medium complexity.
- How does this work for sites that have multiple domains (multisite or domain access) or SSL? Would we still want to add additional logic for 'Allow the following types of URLs: [X] Internal [X] External'?