Skip to content

Instantly share code, notes, and snippets.

@oksana-c
Forked from robdecker/any.php
Created August 20, 2018 17:24
Show Gist options
  • Save oksana-c/7cf34a51cfc54ef8b202126bc4fef7dd to your computer and use it in GitHub Desktop.
Save oksana-c/7cf34a51cfc54ef8b202126bc4fef7dd to your computer and use it in GitHub Desktop.
Drupal 7: Link l() function with attributes.
l(
t('<span></span>Link Title'),
'link_path',
array(
'attributes' => array(
'class' => array('menu-link'),
'id' =>'faq-page',
),
'html' => TRUE,
),
);
l(
t('Link Title'),
'link_path',
array(
'attributes' => array(
'class' => array(
'menu-link',
'another-class',
),
'id' =>'faq-page',
),
'query' => array(
'foo' => 'bar',
),
'fragment' => 'refresh',
'html' => TRUE,
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment