You are here

function imageapi_optimize_pipeline_options in Image Optimize (or ImageAPI Optimize) 7.2

Same name and namespace in other branches
  1. 8.3 imageapi_optimize.module \imageapi_optimize_pipeline_options()
  2. 8.2 imageapi_optimize.module \imageapi_optimize_pipeline_options()
  3. 4.x imageapi_optimize.module \imageapi_optimize_pipeline_options()

Gets an array of image pipelines suitable for using as select list options.

Parameters

$include_empty: If TRUE a <none> option will be inserted in the options array.

$output: Optional flag determining how the options will be sanitized on output. Leave this at the default (CHECK_PLAIN) if you are using the output of this function directly in an HTML context, such as for checkbox or radio button labels, and do not plan to sanitize it on your own. If using the output of this function as select list options (its primary use case), you should instead set this flag to PASS_THROUGH to avoid double-escaping of the output (the form API sanitizes select list options by default).

Return value

Array of image pipelines with the machine name as key and the label as value.

2 calls to imageapi_optimize_pipeline_options()
imageapi_optimize_optimize_effect_form in ./imageapi_optimize.module
Image effect form for the ImageAPI Optimize effect.
imageapi_optimize_pipeline_delete_form in ./imageapi_optimize.admin.inc
Form builder; Form for deleting an image pipeline.

File

./imageapi_optimize.module, line 442

Code

function imageapi_optimize_pipeline_options($include_empty = TRUE, $output = CHECK_PLAIN) {
  $pipelines = imageapi_optimize_pipelines();
  $options = array();
  if ($include_empty && !empty($pipelines)) {
    $options[''] = t('<none>');
  }
  foreach ($pipelines as $name => $pipeline) {
    $options[$name] = $output == PASS_THROUGH ? $pipeline['label'] : check_plain($pipeline['label']);
  }
  if (empty($options)) {
    $options[''] = t('No defined pipelines');
  }
  return $options;
}