You are here

function theme_imageapi_optimize_pipeline_list in Image Optimize (or ImageAPI Optimize) 7.2

Returns HTML for the page containing the list of image pipelines.

Parameters

$variables: An associative array containing:

  • pipelines: An array of all the image pipelines returned by image_get_pipelines().

See also

image_get_pipelines()

1 theme call to theme_imageapi_optimize_pipeline_list()
imageapi_optimize_pipeline_list in ./imageapi_optimize.admin.inc
Menu callback; Listing of all current image pipelines.

File

./imageapi_optimize.admin.inc, line 496

Code

function theme_imageapi_optimize_pipeline_list($variables) {
  $pipelines = $variables['pipelines'];
  $header = array(
    t('Pipeline name'),
    t('Settings'),
    array(
      'data' => t('Operations'),
      'colspan' => 3,
    ),
  );
  $rows = array();
  foreach ($pipelines as $pipeline) {
    $row = array();
    $row[] = l($pipeline['label'], 'admin/config/media/imageapi-optimize/edit/' . $pipeline['name']);
    $link_attributes = array(
      'attributes' => array(
        'class' => array(
          'image-style-link',
        ),
      ),
    );
    if ($pipeline['storage'] == IMAGEAPI_OPTIMIZE_STORAGE_NORMAL) {
      $row[] = t('Custom');
      $row[] = l(t('edit'), 'admin/config/media/imageapi-optimize/edit/' . $pipeline['name'], $link_attributes);
      $row[] = l(t('delete'), 'admin/config/media/imageapi-optimize/delete/' . $pipeline['name'], $link_attributes);
    }
    elseif ($pipeline['storage'] == IMAGEAPI_OPTIMIZE_STORAGE_OVERRIDE) {
      $row[] = t('Overridden');
      $row[] = l(t('edit'), 'admin/config/media/imageapi-optimize/edit/' . $pipeline['name'], $link_attributes);
      $row[] = l(t('revert'), 'admin/config/media/imageapi-optimize/revert/' . $pipeline['name'], $link_attributes);
    }
    else {
      $row[] = t('Default');
      $row[] = l(t('edit'), 'admin/config/media/imageapi-optimize/edit/' . $pipeline['name'], $link_attributes);
      $row[] = '';
    }
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'colspan' => 4,
        'data' => t('There are currently no pipelines. <a href="!url">Add a new one</a>.', array(
          '!url' => url('admin/config/media/imageapi-optimize/add'),
        )),
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}