0

I am making a theme using semantic ui framework in drupal. I want to apply semantic ui select box effect to my theme but i was not able to do this. Here is the link for semantic ui select box http://semantic-ui.com/collections/form.html.

They used this for markup select box.

<div class="ui selection dropdown" style="display: inline-block;">
      <input type="hidden" name="gender">
      <div class="default text">Gender</div>
      <i class="dropdown icon"></i>
      <div class="menu ui transition hidden">
        <div class="item" data-value="male">Male</div>
        <div class="item" data-value="female">Female</div>
      </div>
</div>

But the standard markup for select box is:

<select id="edit-date-month" name="date[month]" class="form-select">
<option value="1" selected="selected">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
</select>

How can i apply semantic ui select effect to my drupal theme. Any help would be appreciated.

1 Answer 1

2

You need to override theme_select(), which you can do in your theme's template.php file:

function MYTHEME_select($vars) {
  // Your code to produce the markup you need. You can find all pertinent data in $vars.
  // The original form element is at $vars['element'], so the options array is at 
  // $vars['element']['#options'].
}
2
  • is this possible to add semantic ui select box effect to select box in drupal by using this hook.
    – Mukeysh
    Commented Jan 21, 2014 at 16:41
  • 1
    I don't know - we can help you with Drupal-specific questions here (like the one you've asked and I answered above), but we can't tell you how to fully integrate a 3rd party script into your site. That's not what our Q+A format is for, to be honest if you really don't have a clue how to do it you need to be looking to hire a developer. Or, work out the steps you need to take yourself, then ask Drupal-Specific questions about them here. Make sure you search Google and this site first, though, I'm certain anything you could ask about this has been covered several times before
    – Clive
    Commented Jan 21, 2014 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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