Problem/Motivation

The title module provides links to the original content but quite frequently other fields are the intended destination.

Proposed resolution

If the link module is enabled, use link fields to link title fields to.

Remaining tasks

User interface changes

Additional options to link title to:

API changes

Data model changes

n/a

Original Reporter:

I was looking for integration of the module Title and link, but I couldn't find the correct solution. I think this integration is useful to many.

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neomen’s picture

I've made a simple patch for this integration.

joelpittet’s picture

Status: Active » Needs review
joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

This patch may allow me to remove a linked_field module that is only being used for this purpose! Thank you @neomen!

joelpittet’s picture

Issue summary: View changes
FileSize
40.58 KB
plach’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for your contribution, overall this is looking good, but the patch has some issues:

  1. +++ b/title.field.inc
    @@ -20,6 +20,20 @@ function title_field_formatter_info() {
    + * Helper function return array of link fields
    

    Missing trailing dot.

  2. +++ b/title.field.inc
    @@ -47,6 +61,9 @@ function title_field_formatter_settings_form($field, $instance, $view_mode, $for
    +  if (module_exists('link')) {
    +    $link_types = array_merge($link_types, _title_get_link_fields($instance));
    +  }
    
    @@ -79,9 +96,12 @@ function title_field_formatter_settings_summary($field, $instance, $view_mode) {
    +  if (module_exists('link')) {
    +    $link_types = array_merge($link_types, _title_get_link_fields($instance));
    +  }
    

    Can we move this check into the _title_get_link_fields() function?

  3. +++ b/title.field.inc
    @@ -105,7 +125,17 @@ function title_field_formatter_view($entity_type, $entity, $field, $instance, $l
    +      //check if link empty
    

    The wording of this comment needs some work (and coding standard compliance :)

  4. +++ b/title.field.inc
    @@ -105,7 +125,17 @@ function title_field_formatter_view($entity_type, $entity, $field, $instance, $l
    +        $uri = entity_uri($entity_type, $entity);
    +        $output = l($output, $uri['path'], array('html' => TRUE));
    

    This is duplicating the code above, it would be good to rearrange this so that is just reused.