You are here

function video_params_nodeapi in Video 5

Same name and namespace in other branches
  1. 6 plugins/video_params/video_params.module \video_params_nodeapi()
  2. 6.2 plugins/video_params/video_params.module \video_params_nodeapi()

Implementation of hook_nodeapi()

File

plugins/video_params/video_params.module, line 68
Enable addition of params to object generated by video module

Code

function video_params_nodeapi(&$node, $op, $teaser) {
  if ($node->type == 'video') {
    switch ($op) {
      case 'submit':

        //Process the data in the object_parameters textarea.
        if ($node->object_parameters != '') {

          //Make sure the textarea was not empty.
          $lines = explode("\r\n", $node->object_parameters);

          //Make an array of each line from the textarea.
          foreach ($lines as $line) {

            //Loop through each line.
            $array = explode('=', $line);

            //Break apart at the "=" sign. $line should be in format param=value
            $node->serial_data['object_parameters'][$array[0]] = $array[1];

            //Assign the "param" as the key and "value" as the value.
          }
        }
        break;
    }
  }
}