You are here

function theme_jeditable_formatter_jeditable_datetime in jEditable inline content editing 7

Same name and namespace in other branches
  1. 6.2 jeditable.module \theme_jeditable_formatter_jeditable_datetime()
  2. 6 jeditable.module \theme_jeditable_formatter_jeditable_datetime()

Theme a CCK text field as a jeditable datepicker.

File

./jeditable.module, line 442
jeditable.module TODO: Provides integration between Drupal and the jEditable jquery plugin @todo: Datepicker support @todo: Ajax upload support @todo: Radioboxes/checkboxes support @todo: add required handler for date @todo: add compatibility for…

Code

function theme_jeditable_formatter_jeditable_datetime($variables) {
  $element = $variables['element'];
  $field = $variables['field'];
  $entity = $variables['entity'];
  $entity_type = $variables['entity_type'];
  $widget_type = $variables['widget_type'];
  $delta = $variables['delta'];
  if ($entity_type == 'node') {
    if (!node_access('update', $entity)) {
      return $element['value'];

      // make this formatted
    }
    $id = $entity->nid;
  }
  if (strpos($field['field_name'], 'field_') === 0) {
    $entity_type = 'field';
  }
  return '<span id="' . $entity_type . '-' . $id . '-' . $field['field_name'] . '-' . $widget_type . '-' . $variables['delta'] . '" class="jeditable jeditable-' . $widget_type . '">' . $element['value'] . '</span>';
}