On the petition form, there is a signatures table which is currently put together by salsa_advocacy_build_signatures_table(). It's kinda annoying to override the theming of that table using form alter. So that function should at least become a theme function. That way overrides are much easier.

Comments

s_leu’s picture

Status: Active » Needs review
StatusFileSize
new3.75 KB

Here's a first patch.

LukyLuke_ch’s picture

Status: Needs review » Reviewed & tested by the community

This looks good for me.

berdir’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/salsa_advocacy/salsa_advocacy.module
    @@ -156,6 +156,12 @@ function salsa_advocacy_theme() {
    +    'salsa_advocacy_signatures_table' => array(
    +      'signatures' => NULL,
    +      'supporters' => NULL,
    +      'supporter_action_comments' => NULL,
    +      'number' => NULL,
    +    ),
    

    This is not correctly defined, should have variables => array(...) with the arguments, not directly on the form element?

  2. +++ b/salsa_advocacy/salsa_advocacy.module
    @@ -292,7 +298,12 @@ function salsa_advocacy_petition_form($form, &$form_state, $action) {
           $form['Signatures'] = array(
             '#type' => 'item',
    -        '#markup' => salsa_advocacy_build_signatures_table($signatures, $supporters, $supporter_action_comments, $number),
    +        '#markup' => theme('salsa_advocacy_signatures_table', array(
    +          'signatures' => $signatures,
    +          'supporters' => $supporters,
    +          'supporter_action_comments' => $supporter_action_comments,
    +          'number' => $number)
    +        ),
    

    Let's switch to #theme => 'salsa_advocacy_signatures_table' then instead of calling theme() yourself, and pass the argument to it with #signatures and so on.

s_leu’s picture

Status: Needs work » Needs review
StatusFileSize
new4.54 KB
new4.81 KB

Reroll with the improvements as suggested. I also added a limit parameter to limit the amount of displayed signatures.

berdir’s picture

Status: Needs review » Fixed

Thanks, committed.

  • Berdir committed 342d9a1 on 7.x-1.x authored by s_leu
    Issue #2238749 by s_leu: Add theme function for signatures table
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.