You are here

function shs_json_callbacks in Simple hierarchical select 7

Get a list of supported JSON callbacks.

Return value

array List of valid callbacks with the following structure:

  • [name of callback]

    • 'callback': function to call
    • 'arguments'
      • [name of argument]: [validation function] (FALSE for no validation)
1 call to shs_json_callbacks()
shs_json in ./shs.module
Menu callback to get data in JSON format.

File

./shs.module, line 81
Provides an additional widget for term fields to create hierarchical selects.

Code

function shs_json_callbacks() {
  $callbacks = array(
    'shs_json_term_get_children' => array(
      'callback' => 'shs_json_term_get_children',
      'arguments' => array(
        'vid' => 'shs_json_validation_vocabulary_identifier',
        'parent' => 'is_array',
        'settings' => 'is_array',
        'field' => 'is_string',
      ),
    ),
    'shs_json_term_add' => array(
      'callback' => 'shs_json_term_add',
      'arguments' => array(
        'token' => array(
          'callback' => 'shs_json_valid_token',
          'arguments' => array(
            'field_name' => '@field',
          ),
        ),
        'vid' => 'shs_json_validation_vocabulary_identifier',
        'parent' => 'is_numeric',
        'name' => 'is_string',
        'field' => 'is_string',
      ),
    ),
  );

  // Let other modules add some more callbacks and alter the existing.
  drupal_alter('shs_json_callbacks', $callbacks);
  return $callbacks;
}