I'm working on predefined lists related to Drupal commerce. Just product types for now, but probably others in due course as they're needed.

Would you like this as a patch, or is it best put in a separate project?

Comments

mrfelton’s picture

Payment methods too.

mrfelton’s picture

This was very easy in a custom module:

/**
 * Implements hook_list_option_info().
 */
function sac_commerce_list_option_info() {
  $info['commerce_payment_methods'] = array(
    'label' => t('Commerce: payment methods'),
    'callback' => 'sac_commerce_list_option_payment_methods',
  );
  return $info;
}

/**
 * Returns an option list that includes all enabled Commerce payment methods.
 */
function sac_commerce_list_option_payment_methods() {
  $options = array();
  $payment_methods = commerce_payment_methods();
  foreach ($payment_methods as $method_id => $payment_method) {
    $options[$method_id] = $payment_method['title'];
  }
  return $options;
}

joachim’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Closing as won'tfix, since this would be an entity reference now.

Sorry, past version of me.