I have 2 fields in a content type.

field_link and field_hoster

if in the hoster field youtube is selected the markup should embed the linked video.

can you guys give me a example of what i have to write in the markup field?

  • #markup is used to set HTML that will be output on the form in drupal – rfegade Sep 23 '15 at 10:51

use hook_form_alter()

$form['field_name'] = array(
  '#type' => 'markup',
  '#markup' => $form['field_name'][#value]

or you can use prefix or suffix

$form['field_name']['#prefix'] = '<div class="field-name"><label>'.$form['field_name']['#value'] .'</label>';
| improve this answer | |

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