You are here

function _opening_hours_get_instance_from_request in Opening hours 7

Same name and namespace in other branches
  1. 6 includes/opening_hours.pages.inc \_opening_hours_get_instance_from_request()

Helper function to get and sanitise instance from request input.

2 calls to _opening_hours_get_instance_from_request()
opening_hours_crud_api_page in includes/opening_hours.pages.inc
The CRUD API for communication with Backbone.
opening_hours_instance_id_api_page in includes/opening_hours.pages.inc
The CRUD API for a specific instance ID.

File

includes/opening_hours.pages.inc, line 137
Page callbacks for the opening hours module.

Code

function _opening_hours_get_instance_from_request() {
  $instance = json_decode(file_get_contents("php://input"));

  // At the very least, we must have nid, date, start_time and end_time set.
  if (empty($instance->nid) || empty($instance->date) || empty($instance->start_time) || empty($instance->end_time)) {
    return;
  }
  return $instance;
}