You are here

function imagefield_crop_variants_load_multiple in Imagefield Crop 7.3

Helper function imagefield_crop_variants_load_multiple(). Used to load multiple variants.

Parameters

$pids:

Return value

mixed

4 calls to imagefield_crop_variants_load_multiple()
imagefield_crop_field_delete in ./imagefield_crop.module
Implements hook_field_delete().
imagefield_crop_field_formatter_view in ./imagefield_crop.module
Implementation hook__field_formatter_view().
imagefield_crop_field_load in ./imagefield_crop.module
Implements hook_field_load().
imagefield_crop_field_update in ./imagefield_crop.module
Implements hook_field_update().

File

./imagefield_crop.module, line 1237

Code

function imagefield_crop_variants_load_multiple($fid = '', $vid = '', $pids = array()) {
  $query = db_select('imagefield_crop_variants', 'icv')
    ->fields('icv');
  if (!empty($fid)) {
    $query
      ->condition('source_fid', $fid);
  }
  if (!empty($pids)) {
    $query
      ->condition('pid', $pids);
  }
  if (!empty($vid)) {
    $query
      ->condition('vid', $vid);
  }
  $args = func_num_args();
  if (!$args) {
    $result = $query
      ->execute()
      ->fetchAllAssoc('cvid');
  }
  else {
    $result = $query
      ->execute()
      ->fetchAllAssoc('pid');
  }
  foreach ($result as &$variant) {
    $variant->data = unserialize($variant->data);
  }
  return $result;
}