function imageapi_optimize_pipeline_load in Image Optimize (or ImageAPI Optimize) 7.2
Loads a pipeline by pipeline name or ID.
May be used as a loader for menu items.
Parameters
$name: The name of the pipeline.
$isid: Optional. The numeric id of a pipeline if the name is not known.
$include: If set, this loader will restrict to a specific type of image pipeline, may be one of the defined Image pipeline storage constants.
Return value
An image pipeline array containing the following keys:
- "isid": The unique image pipeline ID.
- "name": The unique image pipeline name.
- "processors": An array of image processors within this image pipeline.
If the image pipeline name or ID is not valid, an empty array is returned.
See also
image_processor_load()
11 calls to imageapi_optimize_pipeline_load()
- drush_imageapi_optimize_validate in ./
imageapi_optimize.drush.inc - Validation for the imageapi optimize Drush command.
- imageapi_optimize_features_export in ./
imageapi_optimize.features.inc - Implements hook_features_export().
- imageapi_optimize_features_export_render in ./
imageapi_optimize.features.inc - Implements hook_features_export_render().
- imageapi_optimize_features_revert in ./
imageapi_optimize.features.inc - Implements hook_features_revert().
- imageapi_optimize_optimize_effect in ./
imageapi_optimize.module - Image effect callback for image optimize.
2 string references to 'imageapi_optimize_pipeline_load'
- imageapi_optimize_pipeline_add_form in ./
imageapi_optimize.admin.inc - Form builder; Form for adding a new image pipeline.
- imageapi_optimize_pipeline_form in ./
imageapi_optimize.admin.inc - Form builder; Edit an image pipeline name and effects order.
File
- ./
imageapi_optimize.module, line 302
Code
function imageapi_optimize_pipeline_load($name = NULL, $isid = NULL, $include = NULL) {
$pipelines = imageapi_optimize_pipelines();
// If retrieving by name.
if (isset($name) && isset($pipelines[$name])) {
$pipeline = $pipelines[$name];
}
// If retrieving by image pipeline id.
if (!isset($name) && isset($isid)) {
foreach ($pipelines as $name => $database_pipeline) {
if (isset($database_pipeline['isid']) && $database_pipeline['isid'] == $isid) {
$pipeline = $database_pipeline;
break;
}
}
}
// Restrict to the specific type of flag. This bitwise operation basically
// states "if the storage is X, then allow".
if (isset($pipeline) && (!isset($include) || $pipeline['storage'] & (int) $include)) {
return $pipeline;
}
// Otherwise the pipeline was not found.
return FALSE;
}