php - How to create form in Drupal 7 -
i want create form in drupal 7 similar in following link : https://bmicalculator.cc/?gclid=cirvnaxv1mqcfqwnjgodvwgalq
form should start text "bmi calculator", 2 columns similar in link , note text similar "bmi can inaccurate people..."
i know little bit drupal form api can create form how display text @ top, how create form in 2 columns , again text after form.
i new drupal , hence don't have deep understanding of how drupal works.
to display text @ top, use #markup item in form render array. can embed html need in markup.
for 2 columns, use #container type in form render array. allows wrap <div>
around child elements. can float div needed.
so example be
$form = array( /* * ... form header info here */ 'header' => array( '#markup'=>'<h1> bmi calc </h1>', ), 'col1'=>array( '#type'=>'container', 'subitema'=>array( //some stuff ), 'subitemb'=>array( //some stuff ), '#attributes' => array( 'class' => array('class-name'), //use css float left //alternatively float left using style in area ), ), 'col2'=>array( '#type'=>'container', 'subitema'=>array( //some stuff ), 'subitemb'=>array( //some stuff ), '#attributes' => array( 'class' => array('class-name'), //use css float left //alternatively float left using style in area //note: still float left, divs align 2 columns unless //screen space small, stack responsively. ), ), );
hope helps.
Comments
Post a Comment