_node_resource_validate_type

  1. services
    1. 7.3
    2. 6.3
Versions
6.3 – 7.3 _node_resource_validate_type($node)

▾ 2 functions call _node_resource_validate_type()

_node_resource_create in resources/node_resource.inc
Creates a new node based on submitted values.
_node_resource_update in resources/node_resource.inc
Updates a new node based on submitted values.

Code

resources/node_resource.inc, line 274

<?php
function _node_resource_validate_type($node) {
  if (!isset($node['type'])) {
    return services_error(t('Missing node type'), 406);
  }
  // Wanted to return a graceful error instead of a blank nid, this should
  // allow for that.
  $types = node_type_get_types();
  $node_type = $node['type'];
  if (!isset($types[$node_type])) {
    return services_error(t('Node type @type does not exist.', array('@type' => $node_type)), 406);
  }
  $allowed_node_types = variable_get('services_allowed_create_content_types', $types);
  if (!isset($allowed_node_types[$node_type])) {
    return services_error(t("This node type @type can't be processed via services", array('@type' => $node_type)), 406);
  }
}
?>