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

eliosh’s picture

CENSORED

eliosh’s picture

UPDATE:
if i prepend this code:

  $path = drupal_get_path("theme", "bootstrap");
  include_once "$path/theme/bootstrap/bootstrap-btn-dropdown.func.php";

it works.
But it doesn't seem the way it should....

markhalliwell’s picture

Status: Active » Closed (works as designed)

function_exists("theme_bootstrap_btn_dropdown") will not return TRUE 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:

  $variables = array(
    // Theme hook variables to pass.
  );
 print theme('bootstrap_btn_dropdown', $variables);
eliosh’s picture

Status: Closed (works as designed) » Active

Hi Mark,
I'm sorry to reopen this, but i tried your solution and it doesn't work.

I tried this:

  $variables = array(
    '#label' => "Activity",
    '#type' => 'info',
    '#links' => array(
      'comment' => array(
        'title' => "Comment",
        'href' => "/",
      ),
      'admin' => array(
        'title' => "Admin",
        'href' => "/admin",
      )
    )
  );
  return theme('bootstrap_btn_dropdown', $variables);

I tried also using a render array:

return array(
    '#theme' => 'bootstrap_btn_dropdown',
    '#label' => "Attività",
    '#type' => 'info',
    '#links' => array(
      'comment' => array(
        'title' => "Comment",
        'href' => "/",
      ),
      'admin' => array(
        'title' => "Admin",
        'href' => "/admin",
      )
    )
  );

But it doesn't work.
Is it because i use a subtheme?

markhalliwell’s picture

Title: Theme funcion btn_dropdown not found » bootstrap_btn_dropdown and bootstrap_link theme hooks are not found
Version: 7.x-3.0-rc2 » 7.x-3.x-dev
Category: Support request » Bug report
Priority: Major » Critical
Issue summary: View changes
Status: Active » Fixed

I've found the issue. With the registry alter redesign, these function needed to be prefixed with bootstrap_, not theme_. These conversions got overlooked.

Committed 39ff9b9 to 7.x-3.x:

Issue #2115045 by Mark Carver | eliosh: bootstrap_btn_dropdown and bootstrap_link theme hooks are not found

markhalliwell’s picture

Change notice (with examples) for the related issue: https://drupal.org/node/2215965

markhalliwell’s picture

Priority: Critical » Minor
Status: Fixed » Closed (fixed)

Changing status because this "fix" no longer applies.

  • Commit 39ff9b9 on 7.x-3.x, 8.x-3.x by Mark Carver:
    Issue #2115045 by Mark Carver | eliosh: bootstrap_btn_dropdown and...
ryan.armstrong’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Assigned: Unassigned » ryan.armstrong
Status: Closed (fixed) » Needs review

Moving 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.

  • Mark Carver committed 39ff9b9 on 8.x-3.x.x
    Issue #2115045 by Mark Carver | eliosh: bootstrap_btn_dropdown and...
markhalliwell’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Assigned: ryan.armstrong » Unassigned
Status: Needs review » Closed (fixed)

I'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.