commerce_price_table.module | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commerce_price_table.module b/commerce_price_table.module index d4ab244..cbc66b0 100644 --- a/commerce_price_table.module +++ b/commerce_price_table.module @@ -53,6 +53,7 @@ function commerce_price_table_field_formatter_info() { 'price_label' => t('Price'), 'quantity_label' => t('Quantity'), 'table_orientation' => t('Orientation'), + 'sticky_header' => t('Sticky table header'), ), ), ); @@ -297,6 +298,11 @@ function commerce_price_table_field_formatter_settings_form($field, $instance, $ '#title' => t('Orientation of the price table'), '#default_value' => isset($settings['table_orientation']) ? $settings['table_orientation'] : COMMERCE_PRICE_TABLE_HORIZONTAL, ); + $element['sticky_header'] = array( + '#type' => 'checkbox', + '#title' => t('Sticky table header'), + '#default_value' => isset($settings['sticky_header']) ? $settings['sticky_header'] : TRUE, + ); } return $element; @@ -317,6 +323,7 @@ function commerce_price_table_field_formatter_settings_summary($field, $instance t('Quantity label: !quantity_label', array('!quantity_label' => isset($settings['quantity_label']) ? $settings['quantity_label'] : t('Quantity'))), t('Price label: !price_label', array('!price_label' => isset($settings['price_label']) ? $settings['price_label'] : t('Price'))), t('Orientation: !orientation', array('!orientation' => $orientation)), + t('Sticky table header: !sticky', array('!sticky' => $settings['sticky_header'] ? t('Enabled') : t('Disabled'))), ); } @@ -445,7 +452,10 @@ function commerce_price_table_field_formatter_view($entity_type, $entity, $field } $element[] = array( - '#markup' => theme('table', array('header' => $header, 'rows' => $rows)), + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + '#sticky' => $display['settings']['sticky_header'], ); }