added missing module fixer and updated imagecache_actions
This commit is contained in:
@@ -1,36 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @file Utility form, conversion and rendering functions for image processes
|
||||
* @file Utility form, conversion and rendering functions for image processes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare a subform for displaying positioning fields
|
||||
* Prepares a sub form for displaying positioning fields.
|
||||
*
|
||||
* Helper function to render a common element.
|
||||
* @param array $data
|
||||
* Effect data of the effect where this sub form will be integrated.
|
||||
*
|
||||
* @return array
|
||||
* The form definition for this sub form.
|
||||
*/
|
||||
function imagecache_actions_pos_form($action) {
|
||||
function imagecache_actions_pos_form(array $data) {
|
||||
$defaults = array(
|
||||
'xpos' => 'center',
|
||||
'ypos' => 'center',
|
||||
);
|
||||
$action = array_merge($defaults, (array) $action);
|
||||
$data = array_merge($defaults, (array) $data);
|
||||
|
||||
$description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>left</em>, <em>center</em>, or <em>right</em> wih an optional offset (e.g. center, right - 10%).');
|
||||
$description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>top</em>, <em>center</em>, or <em>bottom</em> wih an optional offset (e.g. center, bottom - 10%).');
|
||||
$form = array(
|
||||
#'#theme' => 'canvasactions_pos_form',
|
||||
'xpos' => array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('X offset'),
|
||||
'#default_value' => $action['xpos'],
|
||||
'#default_value' => $data['xpos'],
|
||||
'#size' => 6,
|
||||
'#description' => t('Enter an offset in pixels or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>.'),
|
||||
'#description' => $description1,
|
||||
'#element_validate' => array('imagecache_actions_validate_number'),
|
||||
),
|
||||
'ypos' => array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Y offset'),
|
||||
'#default_value' => $action['ypos'],
|
||||
'#default_value' => $data['ypos'],
|
||||
'#size' => 6,
|
||||
'#description' => t('Enter an offset in pixels or use a keyword: <em>top</em>, <em>center</em>, or <em>bottom</em>.'),
|
||||
'#description' => $description2,
|
||||
'#element_validate' => array('imagecache_actions_validate_number'),
|
||||
),
|
||||
);
|
||||
@@ -38,9 +43,10 @@ function imagecache_actions_pos_form($action) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the numbers are valid.
|
||||
* Form element validator that checks for a valid number.
|
||||
*
|
||||
* Set blanks to zero, just so the status summary doesn't get odd blanks
|
||||
* @param array $element
|
||||
* @param $form_state
|
||||
*/
|
||||
function imagecache_actions_validate_number(&$element, &$form_state) {
|
||||
if (empty($element['#value'])) {
|
||||
@@ -49,12 +55,12 @@ function imagecache_actions_validate_number(&$element, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Please document this function.
|
||||
* @see http://drupal.org/node/1354
|
||||
* Form element validator that checks a transparency percentage value.
|
||||
*
|
||||
* @param array $element
|
||||
*/
|
||||
function imagecache_actions_validate_alpha(&$element, &$form_status) {
|
||||
function imagecache_actions_validate_alpha(&$element/*, &$form_status*/) {
|
||||
if (!is_numeric($element['#value']) || $element['#value'] < 1 || $element['#value'] > 100) {
|
||||
form_set_error(join('][', $element['#parents']), t('Opacity must be a number between 1 and 100.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user