You are here

function _node_field_node_field_page_field_form in Node Field 7.2

Form elements for single node field.

1 call to _node_field_node_field_page_field_form()
_node_field_node_field_page_fields_form in includes/node_field.form.node_field.inc
Fields form.

File

includes/node_field.form.node_field.inc, line 99
Node fields forms.

Code

function _node_field_node_field_page_field_form(&$form_state, $node_field) {

  // Building node field form.
  $form = [
    '#type' => 'fieldset',
    '#title' => filter_xss($node_field['title']),
  ];
  $form['id'] = [
    '#type' => 'value',
    '#value' => $node_field['id'],
  ];
  $form['nid'] = [
    '#type' => 'value',
    '#value' => $node_field['nid'],
    '#access' => FALSE,
  ];
  $form['title'] = [
    '#markup' => filter_xss_admin($node_field['title']),
    '#title' => t('Title'),
    '#title_display' => 'invisible',
  ];
  $form['weight'] = [
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#title_display' => 'invisible',
    '#default_value' => $node_field['weight'],
    '#delta' => $form_state['delta_max'],
  ];
  $form['type'] = [
    '#markup' => filter_xss_admin($node_field['type']),
    '#title' => t('Type'),
    '#title_display' => 'invisible',
  ];
  $form['operations'] = [
    '#type' => 'container',
    '#title' => 'operations',
  ];
  $destination = drupal_get_destination();
  $link_attributes = [
    'query' => [
      'destination' => $destination['destination'],
    ],
  ];
  $operations = [];
  $attributes = [
    'class' => [
      'edit',
    ],
  ];
  $link_attributes['attributes'] = $attributes;
  $operations[] = l(t('edit'), 'node/' . $form['nid']['#value'] . '/node-field/' . $node_field['id'] . '/edit', $link_attributes);
  $attributes = [
    'class' => [
      'delete',
    ],
  ];
  $link_attributes['attributes'] = $attributes;
  $operations[] = l(t('delete'), 'node/' . $form['nid']['#value'] . '/node-field/' . $node_field['id'] . '/delete', $link_attributes);
  $form['operations']['op'] = [
    '#markup' => theme('item_list', [
      'items' => $operations,
    ]),
  ];
  return $form;
}