You are here

function _video_get_resolution_selected_option in Video 6.2

Same name and namespace in other branches
  1. 5 video.module \_video_get_resolution_selected_option()
  2. 6 video.module \_video_get_resolution_selected_option()

Get the selected resolution id from the videox and videoy fields

1 call to _video_get_resolution_selected_option()
video_form in ./video.module
Hook, displays the contents of the node form page for creating and editing nodes.

File

./video.module, line 1516
video.module

Code

function _video_get_resolution_selected_option($node) {
  if (!isset($node->nid)) {

    // do not assign a default value if we are creating a new node
    return NULL;
  }
  $value = $node->videox . "x" . $node->videoy;
  $i = 1;
  while ($i <= 4) {
    if (variable_get('video_resolution_' . $i . '_value', '') == $value) {
      return $i;
    }
    $i++;
  }

  // we did not find the value in the presets fields
  // let's consider it as a manually set resolution (if the user have permissions)
  if (user_access('manually set video resolution')) {
    return VIDEO_MANUALLY_SET_VIDEO_RESOLUTION_SELECT_ID;
  }
}