You are here

function wsconfig_load_by_name in Web Service Data 7

Fetch a wsconfig object. Make sure that the wildcard you choose in the model entity definition fits the function name here.

Parameters

$name: Machine name of the wsconfig

$reset: A boolean indicating that the internal cache should be reset.

Return value

A fully-loaded $wsconfig object or FALSE if it cannot be loaded.

See also

wsconfig_load()

9 calls to wsconfig_load_by_name()
WsBean::form in modules/wsbeans/plugins/beans/wsbeans_wsbean.inc
Builds extra settings for the block edit form.
WsBean::view in modules/wsbeans/plugins/beans/wsbeans_wsbean.inc
Displays the bean.
wsconfig_context_wsconfig_convert in modules/wsconfig/plugins/contexts/wsconfig.inc
wsconfig_context_wsconfig_settings_form in modules/wsconfig/plugins/contexts/wsconfig.inc
wsfields_data_load in modules/wsfields/wsfields.module
Perform read service call

... See full list

File

modules/wsconfig/wsconfig.module, line 459
Main module for wsconfig

Code

function wsconfig_load_by_name($name, $reset = FALSE) {
  $id =& drupal_static(__FUNCTION__ . ':' . $name);
  if ($reset or !$id) {
    $query = new EntityFieldQuery();
    $result = $query
      ->entityCondition('entity_type', 'wsconfig')
      ->propertyCondition('name', $name)
      ->execute();

    // Check the results
    if (!isset($result['wsconfig']) or !is_array($result['wsconfig'])) {
      return FALSE;
    }
    $ids = array_keys($result['wsconfig']);
    $id = reset($ids);
  }

  // Load the entity
  return wsconfig_load($id, $reset);
}