You are here

function sharerich_set_load in Sharerich 7.3

Same name and namespace in other branches
  1. 7.2 sharerich.module \sharerich_set_load()

Load function.

Parameters

string $machinename:

Return value

object

3 calls to sharerich_set_load()
sharerich_block_view in ./sharerich.module
Implements hook_block_view().
sharerich_get_service_content in ./sharerich.module
Helper to get the service content from file or ctools object.
sharerich_node_view in ./sharerich.module
Implements hook_node_view().
1 string reference to 'sharerich_set_load'
sharerich_schema in ./sharerich.install
Implements hook_schema().

File

./sharerich.module, line 569

Code

function sharerich_set_load($machinename) {
  ctools_include('export');
  $sets =& drupal_static(__FUNCTION__, array());
  if (!isset($sets[$machinename])) {

    // Load the set.
    $result = ctools_export_load_object('sharerich_sets', 'names', array(
      $machinename,
    ));
    if (isset($result[$machinename])) {
      $set = $result[$machinename];
    }
    else {
      return NULL;
    }

    // Store the original set. This is used by the set edit form.
    $set->raw = clone $set;

    // Allow modules to alter the raw set object.
    drupal_alter('sharerich_set_load', $set);

    // Configure this set based on the defined settings.
    $set->wrapper_id = 'sharerich-set-' . $set->machinename . '-wrapper';
    $set->placeholder_id = 'sharerich-set-' . $set->machinename;

    // Allow modules to alter the fully-loaded set object.
    drupal_alter('sharerich_set', $set);

    // Statically cache the fully loaded set.
    $sets[$machinename] = $set;
  }
  else {

    // Use the statically cached set object.
    $set = $sets[$machinename];
  }
  return $set;
}