You are here

function node_kaltura_entry_form in Kaltura 6

Same name and namespace in other branches
  1. 5 plugins/node_kaltura_entry/node_kaltura_entry.module \node_kaltura_entry_form()
  2. 6.2 plugins/node_kaltura_entry/node_kaltura_entry.module \node_kaltura_entry_form()

Implementation of hook_form().

Determine how the "add node" form, of entry node, will look like

All we do is to set the fields available in edit mode and add mode

in add mode, the user only gets the contribution wizard each add entry that the CW is doing, is being reported to drupal via notification (straight from the CW) and a node is created using the notification by notification_handler

File

plugins/node_kaltura_entry/node_kaltura_entry.module, line 251

Code

function node_kaltura_entry_form(&$node, &$param) {
  global $user;

  // TODO: change this function for new CW (???)
  $type = node_get_types('type', $node);
  if ($node->nid) {
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => check_plain($type->title_label),
      '#required' => TRUE,
      '#default_value' => $node->title,
      '#weight' => -5,
    );
    $form['body_filter']['body'] = array(
      '#type' => 'textarea',
      '#title' => check_plain($type->body_label),
      '#default_value' => $node->body,
      '#rows' => 20,
      '#required' => FALSE,
    );
    $form['kaltura_tags'] = array(
      '#type' => 'hidden',
      '#title' => 'tags',
      '#required' => FALSE,
      '#default_value' => $node->tags,
    );
    $form['kaltura_entryId'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_entryId,
    );
    $form['media_preview'] = array(
      '#type' => 'item',
      '#title' => t('Media'),
      '#value' => kaltura_replace_tags(theme('node_kaltura_entry_entryId', $node, 0)),
    );
    $form['kaltura_admin_tags'] = array(
      '#type' => 'hidden',
      '#title' => 'admin tags',
      '#required' => FALSE,
      '#default_value' => $node->kaltura_admin_tags,
    );
    $form['kstatus'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kstatus,
    );
    $form['kaltura_total_rank'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_total_rank,
    );
    $form['kaltura_rank'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_rank,
    );
    $form['kaltura_votes'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_votes,
    );
    $form['kaltura_plays'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_plays,
    );
    $form['kaltura_views'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_views,
    );
    $form['kaltura_media_date'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_media_date,
    );
    $form['kaltura_download_url'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_download_url,
    );
    $form['kaltura_height'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_height,
    );
    $form['kaltura_width'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_width,
    );
    $form['kaltura_source_link'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_source_link,
    );
    $form['kaltura_source_id'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_source_id,
    );
    $form['kaltura_source'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_source,
    );
    $form['kaltura_partner_data'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_partner_data,
    );
    $form['kaltura_thumbnail_url'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_thumbnail_url,
    );
    $form['kaltura_duration'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_duration,
    );
    $form['kaltura_media_type'] = array(
      '#type' => 'hidden',
      '#default_value' => $node->kaltura_media_type,
    );
  }
  else {
    $partner_data = "user_id@" . $user->uid;
    $cw_vars = kaltura_format_cw_vars(array(
      'kshow_id' => -2,
      'partner_data' => $partner_data,
    ));
    $form["add_kaltura"] = array(
      "#prefix" => "<div class=\"add_video_to_node\"><script>jQuery(document).ready(function(){ kalturaInitModalBox('" . url("kaltura/contribution_wizard/" . $cw_vars) . "'); });</script>",
      "#type" => "item",
      "#value" => "",
      "#suffix" => "</div>",
    );
  }
  return $form;
}