View source
<?php
module_load_include('inc', 'nice_imagefield_widget', 'nice_imagefield_widget.field');
function nice_imagefield_widget_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
if (($library = libraries_detect('flip')) && !empty($library['installed'])) {
$requirements['nice_imagefield_widget_library'] = array(
'title' => t('jQuery Flip plugin'),
'value' => t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['nice_imagefield_widget_library'] = array(
'title' => t('jQuery Flip plugin'),
'value' => t('Not installed'),
'description' => t('<em>Nice ImageField Widget</em> module requires <a href="@jquery_flip">jQuery Flip</a> plugin.', array(
'@jquery_flip' => $library['vendor url'],
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
function nice_imagefield_widget_libraries_info() {
$libraries['flip'] = array(
'name' => 'jQuery Flip',
'vendor url' => 'http://nnattawat.github.io/flip/',
'download url' => 'https://github.com/nnattawat/flip',
'version arguments' => array(
'file' => 'dist/jquery.flip.min.js',
'pattern' => '/flip - v(\\d+\\.+\\d+)/',
'lines' => 1,
),
'files' => array(
'js' => array(
'dist/jquery.flip.min.js',
),
),
'integration files' => array(
'nice_imagefield_widget' => array(
'js' => array(
'js/nice_imagefield_widget.js',
),
'css' => array(
'css/nice_imagefield_widget.css',
),
),
),
);
return $libraries;
}
function nice_imagefield_widget_library() {
$module_path = drupal_get_path('module', 'nice_imagefield_widget');
$library_path = libraries_get_path('flip');
$libraries['flip'] = array(
'title' => 'jQuery Flip',
'website' => 'http://nnattawat.github.io/flip/',
'version' => '1.0',
'js' => array(
$library_path . '/dist/jquery.flip.min.js' => array(),
$module_path . '/js/nice_imagefield_widget.js' => array(),
),
'css' => array(
$module_path . '/css/nice_imagefield_widget.css' => array(
'type' => 'file',
'media' => 'screen',
),
),
);
return $libraries;
}
function nice_imagefield_widget_theme() {
$default = array(
'render element' => 'element',
'file' => 'nice_imagefield_widget.theme.inc',
);
return array(
'nice_imagefield_widget_multiple' => $default,
'nice_imagefield_widget_image' => $default,
);
}
function nice_imagefield_widget_image_default_styles() {
return array(
'nice_image' => array(
'label' => 'Nice Image (288x180)',
'effects' => array(
array(
'name' => 'image_scale_and_crop',
'data' => array(
'width' => 288,
'height' => 180,
),
),
),
),
);
}