You are here

function commerce_price_table_field_formatter_settings_form in Commerce Price Table 7

Implements hook_field_formatter_settings_form().

File

./commerce_price_table.module, line 297

Code

function commerce_price_table_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  if ($display['type'] == 'commerce_multiprice_default') {
    $element['price_label'] = array(
      '#type' => 'textfield',
      '#title' => t('Price label for the price table'),
      '#default_value' => isset($settings['price_label']) ? $settings['price_label'] : t('Price'),
    );
    $element['quantity_label'] = array(
      '#type' => 'textfield',
      '#title' => t('Quantity label for the price table'),
      '#default_value' => isset($settings['quantity_label']) ? $settings['quantity_label'] : t('Quantity'),
    );
    $element['table_orientation'] = array(
      '#type' => 'radios',
      '#options' => array(
        COMMERCE_PRICE_TABLE_HORIZONTAL => t('Horizontal'),
        COMMERCE_PRICE_TABLE_VERTICAL => t('Vertical'),
      ),
      '#title' => t('Orientation of the price table'),
      '#default_value' => isset($settings['table_orientation']) ? $settings['table_orientation'] : COMMERCE_PRICE_TABLE_HORIZONTAL,
    );
  }
  return $element;
}