Posibillity of set the buttons position thought administration adding one setting on commerce_extra settings page to allow select the position of the +/- buttons.

CommentFileSizeAuthor
#1 buttonsposition-1480230-1.patch5.44 KBtoleillo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

toleillo’s picture

Status: Active » Needs review
FileSize
5.44 KB

I attach the patch to allow set the position of buttons though admin pages and make some changes in the code to allow and pass the Code Sniffer validation (http://drupal.org/project/drupalcs).

Thanks.

klonos’s picture

Title: Posibility of set the buttons position thought administration. » Allow setting the quantity +/- buttons position (both left/both right/each on one side) thought the administration UI.

Great feature! Thanx Juan ;)

iMiksu’s picture

Status: Needs review » Needs work

I've just implemented and committed an feature for handling each feature configuration as centralized way. This was needed as I've implemented feature for quantity cardinality.

Each feature may implement an configuration form, validation callback and submission callback.

Implementing configuration form

/**
 * CALLBACK_commerce_extra_configure()
 */
function CALLBACK_commerce_extra_configure() {
  // Example from commerce_extra_quantity feature
  $form = array();
  $form['commerce_extra_quantity_cardinality'] = array(
    '#type' => 'textfield',
    '#title' => t('Quantity cardinality'),
    '#description' => t('You can change quantity cardinality for quantity widget.'),
    '#size' => 3,
    '#default_value' => variable_get('commerce_extra_quantity_cardinality', '1'),
  );
  return $form;
}

Validation callback

/**
 * CALLBACK_commerce_extra_configure_validate()
 */
function CALLBACK_commerce_extra_configure_validate(&$form, &$form_state) {
  // Example from commerce_extra_quantity feature
  if (!is_numeric($form_state['values']['commerce_extra_quantity_cardinality'])) {
    form_set_error('commerce_extra_quantity_cardinality', t('Field @field_name must be numeric value.', array('@field_name' => t('Quantity cardinality'))));
  }
}

Submission callback

/**
 * CALLBACK_commerce_extra_configure_submit()
 */
function CALLBACK_commerce_extra_configure_submit(&$form, &$form_state) {
  // Example from commerce_extra_quantity feature
  variable_set('commerce_extra_quantity_cardinality', $form_state['values']['commerce_extra_quantity_cardinality']);
}

So, what about this feature request?

I'm sorry I haven't been active on this issue, I knew that this centralized configuration was needed so I waited for me implement it first before commenting on this.

This feature was requested before by drupalina in #1399390: + and - buttons to be vertically stacked and I waited for more support. Now it seems that it really is needed, so I decided that will be a feature included by to Commerce Extra.

Can we do a patch against current dev version?

5n00py’s picture

Yes, I can do this, but I need to do some review.
This is my first day as maintainer, so I need some time.

klonos’s picture

We got a new maintainer! Yay!!!

@5n00py: thank you Daniel for undertaking the task of maintaining the module and for taking a look at this request here. Take all the time you need ...hopefully that won't be too long though ;)

5n00py’s picture

I leave issue in "Needs work" until next problems are resolved.

  • update patch to proper directory. Use --relative[=<path>] option for git diff
  • Tasks from #3
  • Remove variables on hook_uninstall
  • Use constants for this numbers.
    1 => t('Default (+ on left and - on right)'),
    2 => t('Both on left'),
    3 => t('Both on right'),