You are here

function node_kaltura_mix_form_alter in Kaltura 6.2

Same name and namespace in other branches
  1. 5 plugins/node_kaltura_mix/node_kaltura_mix.module \node_kaltura_mix_form_alter()
  2. 6 plugins/node_kaltura_mix/node_kaltura_mix.module \node_kaltura_mix_form_alter()

Implementation of hook_form_alter().

change the node's add/edit form

In add mode, we want to hide some fields and settings that are not relevant to that mode or can't be gathered at this point

In edit mode we do not change the form

File

plugins/node_kaltura_mix/node_kaltura_mix.module, line 692

Code

function node_kaltura_mix_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($_REQUEST["entries"]) && $form_id == 'kaltura_mix_node_form' && !empty($form['kaltura_entryId']['#default_value'])) {
    $arrEntries = explode(',', $_REQUEST['entries']);
    $kaltura_client = KalturaHelpers::getKalturaClient($admin);
    foreach ($arrEntries as $index => $entryId) {
      if (!empty($entryId)) {
        $kaltura_client->mixing
          ->appendMediaEntry($form['kaltura_entryId']['#default_value'], $entryId);
      }
    }
  }
  if ($form_id == 'kaltura_mix_node_form' && !$form['nid']['#value']) {
    if (isset($form["type"]) && $form["type"]["#value"] . "_node_form" == $form_id) {
      unset($form['buttons']['submit']);
      unset($form['buttons']['preview']);
      unset($form['menu']);
      unset($form["log"]);
      unset($form["author"]);
      unset($form["taxonomy"]);
      unset($form["revision_information"]);

      //unset($form['comment_settings']);

      //unset($form['attachments']);

      //unset($form["body_filter"]["kaltura"]);

      //unset($form["options"]);
      $form_state['storage']['continue'] = TRUE;

      /*$form['buttons']['continue'] = array(
          "#type" => "button",
          "#value" => "Continue",
          "#weight" => 40
        );*/
    }
  }
}