0

I'm using the Multi-Step Registration module to have a wizard in my user registration. The wizard works fine. You can also select a wizard trail to see in which step you are.

enter image description here

As you can see it displays that you can customize it by theming ctools_wizard_trail__step. Now the html code of the wizard is like this:

<div class="wizard-trail">
    <span class="wizard-trail-previous">Register</span> » 
    <span class="wizard-trail-previous">Geslacht</span> » 
    <span class="wizard-trail-previous">Politiek actief</span>
    .......
</div>

This is what I've done so far in the function:

function mytheme_ctools_wizard_trail__step($html) {
    $wizard = $html['trail'];
    $steps = ['', 'geslacht', 'politiek_actief', 'beroep', 'vakgebied', 'berichten_ontvangen', 'nicknames', 'other'];
    for($i = 0; $i < count($steps); $i++)
    {
        $step_name = (string)$steps[$i];
        $wizard_html = (string)$wizard[$i];
        $wizard[$i] = "<a href='/user/register/" . $step_name . "'>" . $wizard_html . "</a>";
    }
    $html['trail'] = $wizard;
}

When I dump the $html variable on the first line of the function (before any operations) I get this result:

array (size=1)
    'trail' =>
       array (size=8)
          0 => string '<span class="wizard-trail-previous">Register</span>' (length=51)
          1 => string '<span class="wizard-trail-previous">Geslacht</span>' (length=51)
          2 => string '<span class="wizard-trail-previous">Politiek actief</span>' (length=58)
          3 => string '<span class="wizard-trail-previous">Beroep</span>' (length=49)
          4 => string '<span class="wizard-trail-previous">Vakgebied</span>' (length=52)
          5 => string '<span class="wizard-trail-current">Berichten ontvangen</span>' (length=61)
          6 => string '<span class="wizard-trail-next">Nicknames</span>' (length=48)
          7 => string '<span class="wizard-trail-next">Other</span>' (length=44)

When I dump the $html variable on my last rule of the function I get this:

array (size=1)
   'trail' =>
      array (size=8)
         0 => string '<a href='/user/register/'><span class="wizard-trail-previous">Register</span></a>' (length=81)
         1 => string '<a href='/user/register/geslacht'><span class="wizard-trail-previous">Geslacht</span></a>' (length=89)
         2 => string '<a href='/user/register/politiek_actief'><span class="wizard-trail-previous">Politiek actief</span></a>' (length=103)
         3 => string '<a href='/user/register/beroep'><span class="wizard-trail-previous">Beroep</span></a>' (length=85)
         4 => string '<a href='/user/register/vakgebied'><span class="wizard-trail-previous">Vakgebied</span></a>' (length=91)
         5 => string '<a href='/user/register/berichten_ontvangen'><span class="wizard-trail-current">Berichten ontvangen</span></a>' (length=110)
         6 => string '<a href='/user/register/nicknames'><span class="wizard-trail-next">Nicknames</span></a>' (length=87)
         7 => string '<a href='/user/register/other'><span class="wizard-trail-next">Other</span></a>' (length=79)

It looks the same but my wizard is gone ... . It's not added to my html.. . What could be the problem of this?

  • You're not returning any markup from the theme function. – Andy Jul 10 '14 at 13:53
  • What do you mean? Could you clarify your answer – nielsv Jul 10 '14 at 14:11
  • Sure. The purpose of a theme function is to optionally accept some arguments and return markup. In your Q mytheme_ctools_wizard_trail__step() doesn't return any markup. Here's an example of a theme function returning markup. – Andy Jul 10 '14 at 14:27
1

You're not returning any markup from the theme function. The purpose of a theme function is to optionally accept some arguments and return markup. Here's an example of a theme function returning markup.

For more information see Overriding themable output.

Not the answer you're looking for? Browse other questions tagged or ask your own question.