I am trying to recreate the following paragraph in a custom Drupal form.
How do you create multiple selects in a single paragraph?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI am trying to recreate the following paragraph in a custom Drupal form.
How do you create multiple selects in a single paragraph?
You can try a combination of wrapping the whole form in a div, so:
form['#prefix]='<div class="form-wrapper">';
$form['markup1'] = array(
'#type' => 'markup',
'#markup' => 'Hello this is a pulldown '
);
$form['pulldown1'] = array(
'#type' => 'select',
'#required' => TRUE,
'#options' => array('option1', 'option2', 'option3'),
);
$form['markup2'] = array(
'#type' => 'markup',
'#markup' => ' and this is another pulldown '
);
$form['pulldown2'] = array(
'#type' => 'select',
'#required' => TRUE,
'#options' => array('option4', 'option5', 'option6')
);
form['#suffix]='</div>';
then use theme_form_element to remove the field wrapper divs that Drupal injects automatically around each field, see this post. Once these individual divs around each pulldown are removed then the pulldowns will render inline with the markup.