You are here

README.txt in Image Link Formatter 7

Non-displayable characters.

File

README.txt
View source
  1. This module is the result of the discussions around a requested feature to
  2. allow an image field to be displayed with a link to a custom URL:
  3. - Add a link option to an image field
  4. - #1570072: Ability to customize image links
  5. 1 - Implementation:
  6. The code is greatly inspired from the post:
  7. #1570072: Ability to customize image links where a patch has been proposed,
  8. against the Drupal 7 Core Image field.
  9. See: http://drupal.org/node/1570072#comment-6369564
  10. So this module is simply a copy of the Image core formatter functions, with
  11. the patch applied and a few more fixes, mostly to support field translation.
  12. It seems this function could also be achieved by using Custom Formatters
  13. (See module's tracker page for more information, image with custom link
  14. formatter is a recurring topic).
  15. Another solution would be to use the Linked Field module which pretty much
  16. allows linking any field to custom URL targets with Token patterns.
  17. In other words, almost the same functionality could be obtained with a little
  18. bit more complicated setup with the Linked Field module configured with Tokens
  19. (Main difference would be the handling of the Link field settings
  20. upon display of the formatter).
  21. But since this is a recurring request with such a simple and light
  22. implementation, it could be considered as a standalone module.
  23. 2 - Integration
  24. This module plays well and has been tested with:
  25. Bean, Field Collection and Entity Translation.
  26. A pretty cool and simple setup or application of this module would be,
  27. for example, to build a simple ads block, with an image linking to a
  28. custom URL in a block:
  29. Add a Bean block type with Image and Link fields. Then configure the display
  30. formatter of the image field in the bean block to display wrapped
  31. in the link (Image Link Formatter).
  32. On top of that, add Field Collection and Entity Translation to have multiple
  33. images with links, in multiple languages, which pretty much rounds this up
  34. (very flexible and granular configuration of blocks with image links).
  35. 3 - Installation and configuration:
  36. a. Prerequisite:
  37. Requires Link and Image (Drupal 7.x Core) field modules to be installed.
  38. b. Download the module and simply copy it into your contributed modules folder:
  39. [for example, your_drupal_path/sites/all/modules] and
  40. enable it from the modules administration/management page.
  41. More information at: Installing contributed modules (Drupal 7)
  42. [http://drupal.org/documentation/install/modules-themes/modules-7]
  43. c. Configuration:
  44. After successful installation, browse to the "Manage Display" settings page,
  45. for the entity (Node content type, for example) with an image and a link field,
  46. to configure the formatter (See attached screenshot).
  47. For example: the page content type:
  48. Home » Administration » Structure » Content types » Page » Manage display
  49. 4 - Important notes:
  50. a. Entity translation support:
  51. For field translation to work, both fields translation need to be enabled.
  52. If only one of the two fields has translation enabled (and not the other),
  53. the formatter will not work and the link will not be displayed properly
  54. on the image. Both image and link fields have to be translation enabled.
  55. b. Link field settings:
  56. Link field configuration settings will all be applied to the link wrapping the
  57. image. For example, if the field is configured to allow user to select to open
  58. the link URL in a new window, then this setting will also be applied
  59. to the image link.
  60. c. Multiple values:
  61. Multiple field instances will work based on field delta.
  62. For example: value 0 of field link will be wrapped around value 0 of field
  63. image. Value 1 of field link will be wrapped around value 1 of field image
  64. .... and so forth.
  65. 5 - Future developments:
  66. There are already plans to open a 2.x branch which should be based on the
  67. Field Formatter Settings (See: #945524: Field formatter settings hooks in core)
  68. module to allow altering core Image module formatter.
  69. This would reduce the amount of necessary code and increase compatibility with
  70. core module, but add a new dependency to Field formatter settings.
  71. 6 - Contributions are welcome!!
  72. Feel free to follow up in the issue queue for any contributions,
  73. bug reports, feature requests.
  74. Tests, feedback or comments in general are highly appreciated.