I'd like to see a new content type called "hyperlink" that generates two fields on the node form, one for the url and one for the name of the hyperlink. When displayed, the content type would generate the appropriate <a> tags to display a hyperlink in the node.
My reason for this suggestion is plain urls can be very ugly looking, especially if they are long. And, yes, I realize you could use a plain textfield and type in the html to create the hyperlink. But the whole purpose of using a CMS is to avoid doing the dirty work. Why not let the computer do the typing for you?
Comments
Comment #1
Steve Dondley commentedOK, here is a hyperlink field module I created.
One thing I could not figure out how to do is get the field(s) or the form_group to show in red if there was an error. Not sure if there is a way to do that built into Drupal.
Comment #2
jonbob commentedFeel free to commit this to CVS is the contrib/modules/flexinode_field/ directory. That's where third-party field types should go.
Comment #3
wheat commentedI tried this code with 4.6. It throws an error on lines 87 and 87 (call to undefined function for drupal_specialchars(). Comment those lines out and it works fine. Here are lines 79-89, to clarify the context (with the fix in place):
Comment #4
mobaid commentedworks
Comment #5
mdubose commentedHow do you go about testing this code? I created a content type called hyperlink. When I go to create content/hyperlink, how to I implement the field_hyperlink.inc module? I greatly appreciate you assistance. This is a severe question. Thanks.