array('label' => 'Markup'), ); } /** * Implementation of hook_field_settings(). */ function markup_field_settings($op, $field) { switch ($op) { case 'form': $form = array(); $form['markup'] = array( '#type' => 'textarea', '#title' => t('Markup'), '#default_value' => isset($field['markup']) ? $field['markup'] : '', '#required' => TRUE, '#rows' => 15, '#description' => t('The markup to be displayed. Any HTML is legal here, so be careful not to break your page layout.'), ); $form['instructions'] = array( '#type' => 'markup', '#value' => htmlentities(t('This is a special field. It will output the markup below, unfiltered by the system, on the node/edit form for this content type. Consider wrapping any visible output in
to follow form standards.')), '#weight' => -1, ); return $form; case 'validate': break; case 'save': return array('markup'); } } /** * Implementation of hook_widget_info(). */ function markup_widget_info() { return array( 'markup' => array( 'label' => 'Markup', 'field types' => array('markup'), ), ); } /** * Implementation of hook_widget(). */ function markup_widget($op, &$node, $field, &$node_field) { switch ($op) { case 'form': $form = array(); $form[$field['field_name']] = array( '#type' => 'markup', '#value' => $field['markup'], '#weight' => $field['widget']['weight'], ); return $form; } } /** * Implementation of hook_form_alter(). */ function markup_form_alter($form_id, &$form) { if ($form_id == '_content_admin_field' && $form['module']['#value'] == 'markup') { $form['widget']['label']['#description'] = t('This label is for internal use. If you would like to put a headline on your form markup, you should put HTML for that in the markup area itself.'); // Remove non-applicable fields on the widget settings form. unset($form['widget']['description']); unset($form['field']['required']); unset($form['field']['multiple']); unset($form['field']['#description']); } }