Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using a subtheme of bootstrap 3.0_rc2 and i'd link to render node links as button dropdown.
I tried various ways, but it doesn't work.
Finally i tried to implement the simplest metod at all: using a test page with a test callback.
This is the code of menu callback:
function MODULE_pagecallback(){
$data = array();
$data[] = (function_exists("theme_bootstrap_btn_dropdown")?"YES":"NO");
return print_r($data, true);
}
And this is the result:
Array
(
[0] => NO
)
Where is the problem ?
Comments
Comment #1
elioshCENSOREDComment #2
elioshUPDATE:
if i prepend this code:
it works.
But it doesn't seem the way it should....
Comment #3
markhalliwellfunction_exists("theme_bootstrap_btn_dropdown")
will not returnTRUE
at all (unless that file is already loaded).Please read the RC1 release notes.
These files are not loaded until it is actually necessary (for performance reasons and they're automatically included via the theme system). As a side effect, this also prevents people from calling the name of the function directly. This kind of function invocation is actually very bad practice. This prevents other module/theme could alter or replace the theme hook.
You should instead use the theme() function:
Comment #4
elioshHi Mark,
I'm sorry to reopen this, but i tried your solution and it doesn't work.
I tried this:
I tried also using a render array:
But it doesn't work.
Is it because i use a subtheme?
Comment #5
markhalliwellI've found the issue. With the registry alter redesign, these function needed to be prefixed with
bootstrap_
, nottheme_
. These conversions got overlooked.Committed 39ff9b9 to 7.x-3.x:
Comment #6
markhalliwellChange notice (with examples) for the related issue: https://drupal.org/node/2215965
Comment #7
markhalliwellChanging status because this "fix" no longer applies.
Comment #9
ryan.armstrong CreditAttribution: ryan.armstrong commentedMoving this to the 8.x-3.x branch as it has been committed to that branch. Making sure the fix gets tested in the Drupal 8 release.
Comment #11
markhalliwellI'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.