Development

Help Text for Link Field Columns

The Link module is the gold standard for adding link fields to a Drupal site. Here’s what the link field looks like with the default help text:

out-of-the-box help text
out-of-the-box help text

I wanted to add some helpful text under the “URL” [sub]field. First, I tried setting the “Help text” in the field’s settings:

using field setting's "help text" value
using field setting’s “help text” value

That isn’t quite what I was looking for. I needed to move that help text directly below the “URL” [sub]field. Looking at where the Title [sub]field help text is set (thanks to grep), I was able to determine which alter hook I ought to be using. hook_element_info_alter() is what I ended up using. Here’s how:

And here’s the result:

result
result

Leave a Reply

Your email address will not be published.