You are here

function commerce_backoffice_product_form_field_ui_field_edit_form_alter in Commerce Backoffice 7

Implements hook_form_field_ui_field_edit_form_alter().

File

./commerce_backoffice_product.module, line 237

Code

function commerce_backoffice_product_form_field_ui_field_edit_form_alter(&$form) {

  // Only adds the checkbox for the term reference fields attached to the
  // product display types.
  if ($form['#field']['type'] == 'taxonomy_term_reference' && in_array($form['#instance']['bundle'], array_keys(commerce_product_reference_node_types()))) {
    $form['instance']['product_catalog'] = array(
      '#type' => 'checkbox',
      '#title' => t('Used for categorizing products'),
      '#default_value' => !isset($form['#instance']['product_catalog']) || $form['#instance']['product_catalog'] ? 1 : 0,
      '#description' => t('Places the field in the "Product catalog" vertical tab.'),
    );
  }
}