Created
July 21, 2015 18:37
-
-
Save nickgs/2cddb29576e9343be9b5 to your computer and use it in GitHub Desktop.
Example of building a link from an text field.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//example of building a link from an text field. | |
$nid = 1; | |
$node = node_load($nid); | |
$field = field_get_items('node', $node, 'field_link'); | |
$link = array( | |
'#theme' => 'link', | |
'#text' => $field[0]['safe_value'], | |
'#path' => $field[0]['safe_value'], | |
'#options' => array( | |
'attributes' => array('class'=>array('awesmome')), | |
'html'=>false, | |
), | |
); | |
dpm(drupal_render($link)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment