You are here

function _node_resource_validate_node_type_field_name in Services 7.3

Helper function to validate data.

Parameters

$op: Array representing the attributes a node edit form would submit.

$args: Resource arguments passed through from the original request (node_type, field_name).

Return value

bool TRUE/FALSE based on access.

1 call to _node_resource_validate_node_type_field_name()
_node_resource_attach_file in resources/node_resource.inc
Attaches or overwrites file(s) to an existing node.

File

resources/node_resource.inc, line 796

Code

function _node_resource_validate_node_type_field_name($op = 'create', $args = array()) {
  $node_type = $args[0];
  $field_name = $args[1];
  $temp_node = array(
    'type' => $node_type,
  );

  // An invalid node type throws an exception, and stops before the return below.
  _node_resource_validate_type($temp_node);
  if (!field_info_instance('node', $field_name, $node_type)) {
    return services_error(t('Field name \'@field_name\' not found on node type \'@node_type\'', array(
      '@field_name' => $field_name,
      '@node_type' => $node_type,
    )), 406);
  }
  return TRUE;
}