2016-06-19 197 views
0

我想以不同方式设置我的webform复选框和单选按钮。为此,我想将span元素插入到标签中,并使用它代替原始复选框。如何将span标签添加到Drupal webform元素标签中?

找到这个模块:https://www.drupal.org/project/webform_optionsmarkup,但列出的选项中没有出现在我的webform字段设置中。

是否有任何机构知道解决此问题的好方法?

function bigdaddy_preprocess_webform_element(&$variables) { 
    if ($variables['element']['#type'] == 'textfield' || $variables['element']['#type'] == 'textarea') { 
    $variables['element']['#title_display'] = 'after'; 
    } 
    if ($variables['element']['#type'] == 'checkboxes') { 
    foreach ($variables['element']['#options'] as $key => $one) { 
     $variables['element']['#options'][$key] = "<span>jpnas</span>" . $one; 
    } 

}

回答

0

我的回答可能看起来傻傻的,但是你能不能做到这一点所有的CSS只? 通过使用类似于

input[type='checkbox'] { ... } 
input[type='radio'] { ... }