You are here

function markup_field_widget_form in Markup 7

Implements hook_field_widget_form().

File

./markup.module, line 121
Defines a field type for displaying markup on the node/edit form.

Code

function markup_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  // Setting default field value if it is not set yet.
  if (!isset($field['settings']['markup']['value'])) {
    $field['settings']['markup']['value'] = '';
  }
  if (in_array($instance['display']['default']['type'], array(
    'markup_view',
    'markup_default',
  ))) {

    // Add to display form in 'Always visible' and 'Edit form only' formatter.
    $element += array(
      'markup' => array(
        '#markup' => markup_translate_instance($field, $instance),
      ),
    );
  }
  return $element;
}