You are here

function backup_migrate_crud_type_load in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 includes/crud.inc \backup_migrate_crud_type_load()
  2. 8.3 includes/crud.inc \backup_migrate_crud_type_load()
  3. 6.2 includes/crud.inc \backup_migrate_crud_type_load()
  4. 7.3 includes/crud.inc \backup_migrate_crud_type_load()
  5. 7.2 includes/crud.inc \backup_migrate_crud_type_load()

Get a generic object of the given type to be used for static-like functions.

I'm not using actual static method calls since they don't work on variables prior to PHP 5.3.0

11 calls to backup_migrate_crud_type_load()
backup_migrate_crud_create in includes/crud.inc
Page callback to create a new item.
backup_migrate_crud_create_from_import in includes/crud.inc
Create an object from the exported object.
backup_migrate_crud_create_item in includes/crud.inc
Create a new item of the given type.
backup_migrate_crud_get_item in includes/crud.inc
Get an item of the specified type.
backup_migrate_crud_get_items in includes/crud.inc
Get all items of the given type.

... See full list

File

includes/crud.inc, line 92
CRUD functions for backup and migrate types (schedules, profiles etc.).

Code

function backup_migrate_crud_type_load($type, $subtype = NULL) {
  $out = $info = NULL;
  if ($subtype) {
    $info = backup_migrate_crud_subtype_info($type, $subtype);
  }
  else {
    $info = backup_migrate_crud_type_info($type);
  }
  if (!empty($info)) {
    if (!empty($info['include'])) {
      backup_migrate_include($info['include']);
    }
    if (!empty($info['file'])) {
      include_once './' . (isset($info['path']) ? $info['path'] : '') . $info['file'];
    }
    if (class_exists($info['class'])) {
      $out = new $info['class']();
      $out = $out
        ->create(array(
        'subtype' => $subtype,
      ));
    }
  }
  return $out;
}