You are here

function cmis_field_field_widget_form in CMIS API 7.2

Same name and namespace in other branches
  1. 7 cmis_field/cmis_field.module \cmis_field_field_widget_form()

Implementation of hook_field_widget_form()

Parameters

$element - the form element array:

$edit -:

$form_state - form state array:

$form - form array:

Return value

array - form element

File

cmis_field/cmis_field.module, line 98

Code

function cmis_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $title = isset($items[$delta]['title']) ? $items[$delta]['title'] : '';
  $path = isset($items[$delta]['path']) ? $items[$delta]['path'] : '';
  $element += array(
    '#delta' => $delta,
  );
  $element['path'] = array();
  $element['title'] = array();
  $element['title'] += array(
    '#type' => 'textfield',
    '#default_value' => $title,
    '#attributes' => array(
      'class' => array(
        'edit-field-cmis-field',
      ),
    ),
    '#title_display' => 'before',
    '#title' => check_plain($instance['label']),
  );
  $element['path'] += array(
    '#type' => 'hidden',
    '#attributes' => array(
      'class' => array(
        'edit-field-cmis-path',
        'search-form',
      ),
    ),
    '#default_value' => $path,
  );
  $element['#attached']['js'] = array(
    array(
      'data' => drupal_get_path('module', 'cmis_field') . '/js/cmis_field.js',
    ),
    array(
      'data' => array(
        'cmispath' => $instance['settings']['cmis_field_rootFolderPath'],
      ),
      'type' => 'setting',
    ),
  );
  return $element;
}