Concrete5 Link Attribute - Make It Clickable

The following little code is a handy way to create a new attribute type in Concrete5 that becomes a link.  We used this code to create an attribute that we called 'Website' for a client that wanted a linking URL to their retailers website include on their Product Detail pages.  Enjoy!  Code was compliments of Ryan at Concrete5.  Many thanks to him! 


First create the following folders: /models/attribute/types/text_link

Then in the text_link folder create a new controller.php file with this code:

defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('attribute/types/text/controller');
class TextLinkAttributeTypeController extends TextAttributeTypeController  {
   public function getDisplayValue() {
      return ".$this->getValue().">view site;      
   }
}"
?>
That would be a system-wide attribute type that should be available to install in 
dashboard > sitewide settings > attributes.create the folder:
/models/attribute/types/text_link




Please add a comment

Posted by Jim Smith on
Thanks for posting this. This code will come in very handy for a C5 project I am working on.
Leave a Reply



(Your email will not be publicly displayed.)





For more information about this blog or Concrete5 please contact Jamie Johnson.