array( 'description' => 'Store presets for imageflow instances.', 'fields' => array( 'name' => array( 'description' => 'The machine-readable preset name.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, ), 'title' => array( 'description' => 'The human-readable title for this preset.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, ), 'imagestyle' => array( 'description' => 'The imagestyle to use for this preset.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'medium', ), 'lightbox' => array( 'description' => 'Stores the lightbox opening function option.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'normal', ), 'options' => array( 'description' => 'The options array.', 'type' => 'blob', 'size' => 'big', 'serialize' => TRUE, ), ), 'primary key' => array('name'), ), ); } /** * Implements hook_install(). * * Adds a 'default' preset for fresh installs. */ function imageflow_install() { $preset = array( 'name' => 'default', 'title' => 'Default', 'options' => array( 'buttons' => TRUE, ), ); if (module_exists('imagecache_reflect')) { $preset['imagestyle'] = 'imageflow_reflect'; } imageflow_preset_save($preset, TRUE); variable_set('imageflow_library_variant', 'source'); } /** * Implements hook_requirements. */ function imageflow_requirements($phase) { $requirements = array(); if ($phase == 'install' || $phase == 'runtime') { if ($phase == 'install') { $imageflow = drupal_get_path('module', 'imageflow'); require_once $imageflow . '/imageflow.module'; } $library = libraries_detect('imageflow'); // Library is cached, so we must look at path to see if something got lost. $path = $library['library path']; $t = get_t(); if (!$path) { $requirements['imageflow'] = array( 'title' => $t('Imageflow library'), 'severity' => REQUIREMENT_ERROR, 'value' => $t('Library required for Imageflow'), 'description' => $t('You need to install the Imageflow library. The js file should be readable at sites/*/libraries/imageflow/imageflow.js. You can find the library at !url.', array('!url' => l($t('http://finnrudolph.de/ImageFlow/Download'), 'http://finnrudolph.de/ImageFlow/Download', array('attributes' => array('target' => '_blank'))))), ); } else { $options = $library['version arguments']; $version = libraries_get_version($library, $options); $requirements['imageflow'] = array( 'value' => $version, 'severity' => REQUIREMENT_OK, ); } $requirements['imageflow']['title'] = $t('Imageflow library'); } return $requirements; } /** * Implements hook_uninstall(). */ function imageflow_uninstall() { variable_del('imageflow_library_variant'); } /** * Implements hook_update. */ function imageflow_update_7000() { $presets = imageflow_presets(); foreach ($presets as $preset) { if (module_exists('imagecache_reflect')) { if (isset($preset['options']['reflections'])) { if ($preset['options']['reflections'] == TRUE) { $preset['imagestyle'] = 'imageflow_reflect'; } } } $reflections = array('reflections', 'reflectionP', 'reflectionPNG'); foreach ($reflections as $option_key) { if (isset($preset['options'][$option_key])) { unset($preset['options'][$option_key]); } } imageflow_preset_save($preset); } if (!module_exists('imagecache_reflect')) { return t('Install the imagecache reflect module for imageflow reflections.'); } else { return t('Imageflow presets updated.'); } } /** * Implements hook_update. */ function imageflow_update_7001() { variable_set('imageflow_library_variant', 'source'); return t('Imageflow library variants are now selectable at admin/config/media/imageflow/library.'); }