v8powerage Posted February 20, 2020 Share Posted February 20, 2020 function theme_user_badge($badge) { $image = theme('image', $badge->image, $badge->name, $badge->name); if ($badge->href != "") { return l($image, $badge->href, array('html' => TRUE)); } else { return $image; } } How to add class to the link so it appears like <a href="/link" class="popups">? Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/ Share on other sites More sharing options...
requinix Posted February 20, 2020 Share Posted February 20, 2020 When in doubt, check the documentation. Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/#findComment-1574688 Share on other sites More sharing options...
Psycho Posted February 20, 2020 Share Posted February 20, 2020 (edited) I see no "link" in your code. I assume that the function l() is creating the links. You could find that function and modify it to take an additional (optional) parameter for the class. Then modify the code to insert that optional parameter value as the class. EDIT: Or do what @requinix said. Edited February 20, 2020 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/#findComment-1574689 Share on other sites More sharing options...
v8powerage Posted February 20, 2020 Author Share Posted February 20, 2020 So nobody knows then Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/#findComment-1574695 Share on other sites More sharing options...
requinix Posted February 20, 2020 Share Posted February 20, 2020 I know. Psycho knows. api.drupal.org knows. Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/#findComment-1574699 Share on other sites More sharing options...
ginerjm Posted February 21, 2020 Share Posted February 21, 2020 You have a function that does not much but call another function which apparently returns this link of yours. What a waste of two functions. Why not just write the link in your code and remove those two functions? Or Show Us This 'L' function's code? (what a horrible name for a function!) Quote Link to comment https://forums.phpfreaks.com/topic/310092-how-to-add-class-to-a-link/#findComment-1574707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.