Global

Methods

_entity_index_local_storage_delete(path)

An internal function used to delete an entity_index from local storage.
Parameters:
Name Type Description
path String
Source:

_entity_index_local_storage_load(entity_type, path, options) → {Object}

An internal function used by entity_index() to attempt loading a specific query's results from local storage.
Parameters:
Name Type Description
entity_type String
path String The URL path used by entity_index(), used as the cache key.
options Object
Source:
Returns:
Type
Object

_entity_index_local_storage_save(entity_type, path, result)

An internal function used to save an entity_index result entity ids to local storage.
Parameters:
Name Type Description
entity_type String
path String
result Object
Source:

_entity_local_storage_delete(entity_type, entity_id)

An internal function used to delete an entity from local storage.
Parameters:
Name Type Description
entity_type String
entity_id Number
Source:

_entity_local_storage_load(entity_type, entity_id, options) → {Object}

An internal function used by entity_load() to attempt loading an entity from local storage.
Parameters:
Name Type Description
entity_type String
entity_id Number
options Object
Source:
Returns:
Type
Object

_entity_local_storage_save(entity_type, entity_id, entity)

An internal function used to save an entity to local storage.
Parameters:
Name Type Description
entity_type String
entity_id Number
entity Object
Source:

_entity_set_expiration_time(entity_type, entity)

An internal function used to set the expiration time onto a given entity.
Parameters:
Name Type Description
entity_type String The entity type.
entity Object The entity object.
Source:

_entity_wrap(entity_type, entity) → {String}

Wraps an entity in a JSON object, keyed by its type.
Parameters:
Name Type Description
entity_type String
entity Object
Source:
Returns:
Type
String

_services_queue_add_to_queue(service, resource, entity_id)

Adds an entity id to the service resource queue.
Parameters:
Name Type Description
service String
resource String
entity_id Number
Source:

_services_queue_already_queued(service, resource, entity_id, callback_type) → {Boolean}

Returns true if the entity_id is already queued for the service resource, false otherwise.
Parameters:
Name Type Description
service String
resource String
entity_id Number
callback_type String
Source:
Returns:
Type
Boolean

_services_queue_callback_add(service, resource, entity_id, callback_type, callback)

Adds a callback function to the service resource queue.
Parameters:
Name Type Description
service String
resource String
entity_id Number
callback_type String
callback function
Source:

_services_queue_callback_count(service, resource, entity_id, callback_type) → {Number}

Returns the number of callback functions for the service resource queue.
Parameters:
Name Type Description
service String
resource String
entity_id Number
callback_type String
Source:
Returns:
Type
Number

_services_queue_remove_from_queue(service, resource, entity_id)

Removes an entity id from the service resource queue.
Parameters:
Name Type Description
service String
resource String
entity_id Number
Source:

comment_create(comment, options)

Creates a comment.
Parameters:
Name Type Description
comment Object
options Object
Source:

comment_delete(cid, options)

Delete a comment.
Parameters:
Name Type Description
cid Number
options Object
Source:

comment_index(query, options)

Perform a comment index.
Parameters:
Name Type Description
query Object
options Object
Source:

comment_load(cid, options)

Loads a comment.
Parameters:
Name Type Description
cid Number
options Object
Source:

comment_retrieve(ids, options)

Retrieves a comment.
Parameters:
Name Type Description
ids Number
options Object
Source:

comment_save(comment, options)

Saves a comment.
Parameters:
Name Type Description
comment Object
options Object
Source:

comment_update(comment, options)

Update a comment.
Parameters:
Name Type Description
comment Object
options Object
Source:

date(format) → {String}

Equivalent to PHP's date function. You may optionally pass in a second int timestamp argument (number of milliseconds since epoch, not the number of seconds since the epoch) to format that particular time, otherwise it'll default to the current time.
Parameters:
Name Type Description
format String The format of the outputted date string.
Source:
See:
Returns:
Type
String

dpm(data)

Given a JSON object or string, this will print it to the console. It accepts an optional boolean as second argument, if it is false the output sent to the console will not use pretty printing in a Chrome/Ripple environment.
Parameters:
Name Type Description
data Object
Source:

drupal_init()

Initializes the Drupal JSON object.
Source:

drupal_user_defaults() → {Object}

Returns a default JSON object representing an anonymous Drupal user account.
Source:
Returns:
Type
Object

empty(value) → {Boolean}

Returns true if given value is empty. A generic way to test for emptiness.
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

entity_caching_enabled() → {Boolean}

Returns true or false depending on whether caching is enabled or not. You may optionally pass in an entity type as the first argument, and optionally pass in a bundle name as a second argument to see if that particular cache is enabled.
Source:
Returns:
Type
Boolean

entity_clean_local_storage()

Looks for expired entities and remove them from local storage.
Source:

entity_create(entity_type, bundle, entity, options)

Creates an entity.
Parameters:
Name Type Description
entity_type String
bundle String
entity Object
options Object
Source:

entity_delete(entity_type, entity_id, options)

Deletes an entity.
Parameters:
Name Type Description
entity_type String
entity_id Number
options Object
Source:

entity_delete(entity_type, ids, options)

Delete an entity.
Parameters:
Name Type Description
entity_type String
ids Number
options Object
Source:

entity_get_bundle(entity_type, entity) → {*}

Given an entity type and entity, this will return the bundle name as a string for the given entity, or null if the bundle is N/A.
Parameters:
Name Type Description
entity_type String The entity type.
entity Object The entity JSON object.
Source:
Returns:
Type
*

entity_has_expired(entity_type, entity)

Parameters:
Name Type Description
entity_type
entity
Source:

entity_id_parse(entity_id) → {Number}

Parses an entity id and returns it as an integer (not a string).
Parameters:
Name Type Description
entity_id *
Source:
Returns:
Type
Number

entity_index(entity_type, query, options)

Performs an entity index.
Parameters:
Name Type Description
entity_type String
query String
options Object
Source:

entity_index_build_query_string(query) → {String}

Builds a query string from a query object for an entity index resource.
Parameters:
Name Type Description
query Object
Source:
Returns:
Type
String

entity_index_local_storage_key(path) → {String}

A placeholder function used to provide a local storage key for entity index queries.
Parameters:
Name Type Description
path String
Source:
Returns:
Type
String

entity_load(entity_type, ids, options)

Loads an entity.
Parameters:
Name Type Description
entity_type String
ids Number | Array
options Object
Source:

entity_local_storage_key(entity_type, id) → {String}

Given an entity type and the entity id, this will return the local storage key to be used when saving/loading the entity from local storage.
Parameters:
Name Type Description
entity_type String
id Number
Source:
Returns:
Type
String

entity_primary_key(entity_type) → {String}

Returns an entity type's primary key.
Parameters:
Name Type Description
entity_type String
Source:
Returns:
Type
String

entity_retrieve(entity_type, ids, options)

Retrieves an entity.
Parameters:
Name Type Description
entity_type String
ids Number
options Object
Source:

entity_save(entity_type, bundle, entity, options)

Saves an entity.
Parameters:
Name Type Description
entity_type String
bundle String
entity Object
options Object
Source:

entity_types() → {Array}

Returns an array of entity type names.
Source:
Returns:
Type
Array

entity_update(entity_type, bundle, entity, options)

Updates an entity.
Parameters:
Name Type Description
entity_type String
bundle String
entity Object
options Object
Source:

file_create(file, options)

Creates a file.
Parameters:
Name Type Description
file Object
options Object
Source:

file_delete(fid, options)

Delete a file.
Parameters:
Name Type Description
fid Number
options Object
Source:

file_load(fid, options)

Loads a file, given a file id.
Parameters:
Name Type Description
fid Number
options Object
Source:

file_retrieve(ids, options)

Retrieves a file.
Parameters:
Name Type Description
ids Number
options Object
Source:

file_save(file, options)

Saves a file.
Parameters:
Name Type Description
file Object
options Object
Source:

function_exists(name) → {Boolean}

Given a JS function name, this returns true if the function exists in the scope, false otherwise.
Parameters:
Name Type Description
name String
Source:
Returns:
Type
Boolean

hook_csrf_token_preprocess()

Implements hook_csrf_token_preprocess().
Source:

hook_services_postprocess(options, result)

Postprocess a service call.
Parameters:
Name Type Description
options Object
result Object
Source:

hook_services_preprocess(options)

Preprocess a service call.
Parameters:
Name Type Description
options Object
Source:

hook_services_request_postprocess_alter(options, result)

Alter the result data of a service call, after its success function.
Parameters:
Name Type Description
options object
result Object
Source:

hook_services_request_pre_postprocess_alter(options, result)

Alter the result data of a service call, before its success function.
Parameters:
Name Type Description
options object
result Object
Source:

http_status_code_title(status) → {String}

Given an integer http status code, this will return the title of it.
Parameters:
Name Type Description
status Number
Source:
Returns:
title
Type
String

in_array(needle, haystack) → {Boolean}

Checks if the needle string, is in the haystack array. Returns true if it is found, false otherwise. Credit: http://stackoverflow.com/a/15276975/763010
Parameters:
Name Type Description
needle String | Number
haystack Array
Source:
Returns:
Type
Boolean

is_array(obj) → {boolean}

Given something, this will return true if it's an array, false otherwise.
Parameters:
Name Type Description
obj *
Source:
See:
Returns:
Type
boolean

is_int(n) → {Boolean}

Given an argument, this will return true if it is an int, false otherwise.
Parameters:
Name Type Description
n Number
Source:
Returns:
Type
Boolean

language_default() → {String}

Get the default language from Drupal.settings.
Source:
Returns:
Type
String

module_exists(name) → {Boolean}

Given a module name, this returns true if the module is enabled, false otherwise.
Parameters:
Name Type Description
name String The name of the module
Source:
Returns:
Type
Boolean

module_implements(hook) → {Array}

Determines which modules are implementing a hook. Returns an array with the names of the modules which are implementing this hook. If no modules implement the hook, it returns false.
Parameters:
Name Type Description
hook String
Source:
Returns:
Type
Array

module_invoke(module, hook) → {*}

Given a module name and a hook name, this will invoke that module's hook.
Parameters:
Name Type Description
module String
hook String
Source:
Returns:
Type
*

module_invoke_all(hook) → {Array}

Given a hook name, this will invoke all modules that implement the hook.
Parameters:
Name Type Description
hook String
Source:
Returns:
Type
Array

module_load(name) → {Object|Boolean}

Given a module name, this will return the module inside Drupal.modules, or false if it fails to find it.
Parameters:
Name Type Description
name String
Source:
Returns:
Type
Object | Boolean

module_object_template(name) → {Object}

Initializes and returns a JSON object template that all modules should use when declaring themselves.
Parameters:
Name Type Description
name String
Source:
Returns:
Type
Object

module_types() → {Array}

Returns an array of module type names.
Source:
Returns:
Type
Array

node_create(node, options)

Creates a node.
Parameters:
Name Type Description
node Object
options Object
Source:

node_delete(nid, options)

Delete a node.
Parameters:
Name Type Description
nid Number
options Object
Source:

node_index(query, options)

Perform a node index.
Parameters:
Name Type Description
query Object
options Object
Source:

node_load(nid, options)

Loads a node.
Parameters:
Name Type Description
nid Number
options Object
Source:

node_retrieve(ids, options)

Retrieves a node.
Parameters:
Name Type Description
ids Number
options Object
Source:

node_save(node, options)

Saves a node.
Parameters:
Name Type Description
node Object
options Object
Source:

node_update(node, options)

Update a node.
Parameters:
Name Type Description
node Object
options Object
Source:

services_get_csrf_token(options)

Gets the CSRF token from Services.
Parameters:
Name Type Description
options Object
Source:

services_ready() → {Boolean}

Checks if we're ready to make a Services call.
Source:
Returns:
Type
Boolean

services_resource_defaults(options, service, resource)

Given the options for a service call, the service name and the resource name, this will attach the names and their values as properties on the options.
Parameters:
Name Type Description
options Object
service String
resource String
Source:

shuffle(array) → {Array}

Shuffle an array.
Parameters:
Name Type Description
array Array
Source:
See:
Returns:
Type
Array

system_connect(options)

System connect call.
Parameters:
Name Type Description
options Object
Source:

taxonomy_get_tree()

Source:
See:

taxonomy_term_create(taxonomy_term, options)

Creates a taxonomy term.
Parameters:
Name Type Description
taxonomy_term Object
options Object
Source:

taxonomy_term_delete(tid, options)

Delete a taxonomy term.
Parameters:
Name Type Description
tid Number
options Object
Source:

taxonomy_term_index(query, options)

Perform a taxonomy_term index.
Parameters:
Name Type Description
query Object
options Object
Source:

taxonomy_term_load(tid, options)

Loads a taxonomy term.
Parameters:
Name Type Description
tid Number
options Object
Source:

taxonomy_term_retrieve(ids, options)

Retrieves a taxonomy term.
Parameters:
Name Type Description
ids Number
options Object
Source:

taxonomy_term_save(taxonomy_term, options)

Saves a taxonomy term.
Parameters:
Name Type Description
taxonomy_term Object
options Object
Source:

taxonomy_term_update(taxonomy_term, options)

Update a taxonomy term.
Parameters:
Name Type Description
taxonomy_term Object
options Object
Source:

taxonomy_vocabulary_create(taxonomy_vocabulary, options)

Creates a taxonomy vocabulary.
Parameters:
Name Type Description
taxonomy_vocabulary Object
options Object
Source:

taxonomy_vocabulary_delete(vid, options)

Delete a taxonomy vocabulary.
Parameters:
Name Type Description
vid Number
options Object
Source:

taxonomy_vocabulary_index(query, options)

Perform a taxonomy_vocabulary index.
Parameters:
Name Type Description
query Object
options Object
Source:

taxonomy_vocabulary_load(vid, options)

Loads a taxonomy vocabulary.
Parameters:
Name Type Description
vid Number
options Object
Source:

taxonomy_vocabulary_retrieve(ids, options)

Retrieves a comment.
Parameters:
Name Type Description
ids Number
options Object
Source:

taxonomy_vocabulary_save(taxonomy_vocabulary, options)

Saves a taxonomy vocabulary.
Parameters:
Name Type Description
taxonomy_vocabulary Object
options Object
Source:

taxonomy_vocabulary_update(taxonomy_vocabulary, options)

Update a taxonomy vocabulary.
Parameters:
Name Type Description
taxonomy_vocabulary Object
options Object
Source:

time() → {Number}

Javascript equivalent of php's time() function.
Source:
Returns:
Type
Number

ucfirst(str) → {String}

Given a string, this will change the first character to upper case and return the new string.
Parameters:
Name Type Description
str String
Source:
Returns:
Type
String

user_create(account, options)

Creates a user.
Parameters:
Name Type Description
account Object
options Object
Source:

user_delete(uid, options)

Delete a user.
Parameters:
Name Type Description
uid Number
options Object
Source:

user_index(query, options)

Perform a user index.
Parameters:
Name Type Description
query Object
options Object
Source:

user_load(uid, options)

Loads a user account.
Parameters:
Name Type Description
uid Number
options Object
Source:

user_login(name, pass, options)

Login user.
Parameters:
Name Type Description
name String
pass String
options Object
Source:

user_logout(options)

Logout current user.
Parameters:
Name Type Description
options Object
Source:

user_password() → {String}

Generates a random user password.
Source:
Returns:
Type
String

user_register(account, options)

Registers a user.
Parameters:
Name Type Description
account Object
options Object
Source:

user_request_new_password(name, options)

The "request_new_password" service resource.
Parameters:
Name Type Description
name String User name or e-mail address.
options Object
Source:

user_retrieve(ids, options)

Retrieves a user.
Parameters:
Name Type Description
ids Number
options Object
Source:

user_save(account, options)

Saves a user account.
Parameters:
Name Type Description
account Object
options Object
Source:

user_update(account, options)

Updates a user.
Parameters:
Name Type Description
account Object
options Object
Source: