Sandbox project page link:
https://drupal.org/sandbox/kari.kaariainen/1349570

Pareview results:
http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

To clone the project:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/kari.kaariainen/1349570.git selected_and_unselected_values_formatter

The default formatter for multiple values displays only those values that were selected in the node edit form. Sometimes it's useful to show all values and with some added markup indicate which values were selected.

This module provides a formatter that shows both unselected and selected values and lets you define markup to be printed before and after the value itself. It wraps the item in a span and lets you define the css class for that span, different one for the selected and unselected value.

For example, when you need to show what all of the choices are, this is one possible output of the formatter:

[ ] A (superior)
[ ] A-
[ ] B+
[X] B (good)
[ ] B-
[ ] C+
[ ] C (average)
[ ] C-
[ ] D+
[ ] D (poor)
[ ] F (failure)
[ ] I (incomplete)
[ ] PR (course in progress)
[ ] W (withdrew from course)
[ ] FF (failing in a pass/fail course)
[ ] PP (passing in a pass/fail course)
[ ] N/C (not for credit)

The output style can be freely defined.

Supports lists (float, int and text) and taxonomy. Supports i18n.

Reviews of other projects

Comments

kari.kaariainen’s picture

Title: Selected and unselected values formatter » [D7] Selected and unselected values formatter
Issue summary: View changes
kari.kaariainen’s picture

Issue summary: View changes
Status: Needs work » Needs review
phoang’s picture

Status: Needs review » Needs work

I found some errors on Parview. Please review and fix it.

http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

FILE: ...w/drupal-7-pareview/pareview_temp/selected_and_unselected_values.module
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AND 3 WARNING(S) AFFECTING 6 LINE(S)
--------------------------------------------------------------------------------
55 | ERROR | String concat is not required here; use a single string
| | instead
56 | ERROR | String concat is not required here; use a single string
| | instead
131 | WARNING | Line exceeds 80 characters; contains 101 characters
174 | WARNING | Line exceeds 80 characters; contains 82 characters
215 | WARNING | Line exceeds 80 characters; contains 82 characters
245 | ERROR | Case breaking statement indented incorrectly; expected 6
| | spaces, found 4
--------------------------------------------------------------------------------
kari.kaariainen’s picture

Status: Needs work » Needs review

Thanks! Fixed everything else but the string concats.

I'm not sure how to fix those without sacrificing readability too much. Made some changes there, two concat errors still remain.

phoang’s picture

Status: Needs review » Needs work

It would be better structure if you can moved all the markup in form instructions to a variable as below

  $form['instructions'] = array(
    '#markup' => '<p>' . t('<strong>Caution:</strong> the values in this form will be printed without sanitation.') . '</p>'
    . '<p>' . t('If you use this formatter, selected values and the wrapping markup will be printed in this order (without line breaks):') . '</p>'
    . '<p>' . t('&lt;span class="<strong>class for selected values</strong>"
      &gt;</br><strong>markup before selected values</strong></br>
      the actual value</br><strong>markup after selected values</strong></br>
      &lt;/span&gt;') . '</p>'
    . '<p>' . t('Similarly for unselected values.') . '</p>'
    . '<p>' . t('For markup, any html can be used, including img tags and style attributes. Nothing will be validated, such as img src paths, html etc.') . '</p>'
    . '<p>' . t('One possible way to get even width markup without resorting to images:') . '</p>'
    . '<p>' . t('[&lt;span style=\"color: black;\"&gt;x&lt;/span&gt;] for selected, and</br>
      [&lt;span style=\"color: white;\"&gt;x&lt;/span&gt;] for unselected.') . '</p>',
  );

For example:


$markup = '';
$markup .= 'some markup';
$markup .= 'some other markup';

$form['instructions'] = array(
    '#markup' => $markup,
);

kari.kaariainen’s picture

Status: Needs work » Needs review

Way better. Thanks. Now no errors at Parview except that version branch should be created.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

kari.kaariainen’s picture

7.x-1.x branch created.

kari.kaariainen’s picture

Issue summary: View changes
mas0h’s picture

Status: Needs review » Needs work

reviewed & tested by the community, found no major flaws.

mas0h’s picture

Status: Needs work » Reviewed & tested by the community
w01f’s picture

reviewed & tested by the community, found no major flaws.

stborchert’s picture

Had a quick look at the code and it looks ok.
One question, though: wouldn't it be much better to remove the general configuration form and use hook_field_formatter_settings_form?
Using this hook you could define the wrappers and classes on a per field (and view mode) base.

madhusudanmca’s picture

Status: Reviewed & tested by the community » Needs work

Hi kari.kaariainen,

Thanks for your contribution!!

Automated Review

Found some minor issues. Please see http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes. If "no", list security issues identified.
Coding style & Drupal API usage
  1. (*) Throws fatal error if i18n is not enabled. Please see below for reference:
    "Fatal error: Call to undefined function i18n_language_interface() in D:\xampp\htdocs\drupal\sites\all\modules\selected_and_unselected_values_formatter\selected_and_unselected_values.module on line 267"
  2. (*) You may use "global $language;" instead calling "i18n_language_interface()" to avoid above error

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)

Thanks Again!

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

kari.kaariainen’s picture

Status: Closed (won't fix) » Needs review

Fixed issues.

babusaheb.vikas’s picture

1) First of all you need to correct git clone command in Issue summary.
Correct git clone command for your project will be:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/kari.kaariainen/1349570.git selected_and_unselected_values_formatter

2) No need to put space between name and description in *.info file.

3) You should provide the hook_help to allow site builders to find information about your module using Drupal UI.

4) Only one error on Pareview. Please review and fix it.
http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

kari.kaariainen’s picture

Issue summary: View changes
kari.kaariainen’s picture

Thank you! Did those.

kari.kaariainen’s picture

Thanks, @stBorchert Yes, being able to define the wrappers and classes per field and per view mode would be good. Now there is only one global set of settings. It's not great, but a good start. I may look into this later.

smakisog’s picture

Automated Review

No errors found: http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.

Manual Review

Individual user account
Yes: Follows
No duplication
Yes: Does not cause
Master Branch
Yes: Follows
Licensing
Yes: Follows
3rd party assets/code
Yes: Follows
README.txt/README.md
Yes: Follows
Code long/complex enough for review
Yes: Follows
Secure code
Yes: Meets the security requirements
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. (*) Major finding, needs work
  2. (+) Release blocker

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

smakisog’s picture

Default behavior warning when no data available on site.
For example on default site installation with empty tags vocabulary:
Undefined variable: new_items in selected_and_unselected_values_field_formatter_prepare_view() (line 237 of sites/all/modules/custom/selected_and_unselected_values_formatte/selected_and_unselected_values.module).
and as a consequence
Invalid argument supplied for foreach() in taxonomy_field_formatter_prepare_view() (line 1677 of /modules/taxonomy/taxonomy.module).
Proposed solution
$items[$nid] = isset($new_items[$nid]) ? $new_items[$nid] : array();

kari.kaariainen’s picture

Thanks. Took care of the situations where allowed values list or taxonomy tree would be empty.

I added if ($tree) { structure instead of what you proposed.

kari.kaariainen’s picture

Issue summary: View changes
kari.kaariainen’s picture

Added .install file containing hook_uninstall so that the module doesn't leave unused variables behind.

sudhakar dhanapalan’s picture

Status: Needs review » Needs work
StatusFileSize
new27.84 KB

I found some errors on Parview. Please review and fix it.

http://pareview.sh/pareview/httpgitdrupalorgsandboxkarikaariainen1349570git

Pareview

kari.kaariainen’s picture

Status: Needs work » Needs review

Thanks. Fixed.

marcvangend’s picture

Looks like a useful module, thank you for contributing.

One thing: IMHO you should reconsider your answer in #20 regarding the suggestion in #13. First of all, per-instance and per-viewmode settings are really useful. Second, I think site builders expect the settings to be tied to the formatter, so you're improving UX. Third, it's easier for you to do it now; if you add it later, you will have to provide an upgrade path for existing users. Last but not least: it's really not that hard, trust me. I'd be happy to help if needed.

kari.kaariainen’s picture

Thanks for your offer to help. This module is in production in three places that I know of, so I'm thinking maybe I should make version 2 with per-instance and per-viewmode settings.

soumyadas’s picture

Assigned: Unassigned » soumyadas
Issue tags: ++PAReview: review bonus

Typo error found on module page.

soumyadas’s picture

Assigned: soumyadas » Unassigned
Issue tags: -+PAReview: review bonus +PAreview: review bonus
StatusFileSize
new670 bytes

Added patch for the issue #30

soumyadas’s picture

Issue tags: -PAreview: review bonus

Mistakenly I had added this tag, so removing it.

phoehne’s picture

Status: Needs review » Reviewed & tested by the community

Automated Review

no issues

Manual Review

Individual user account
[Yes: Follows] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause] module duplication and/or fragmentation.
Master Branch
[Yes: Follows] the guidelines for master branch.
Licensing
[Yes: Follows] the licensing requirements.
3rd party assets/code
[Yes: Follows] the guidelines for 3rd party assets/code.
README.txt/README.md
[Yes: Follows] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[Yes: Follows] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements. ]
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:]

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

This review uses the Project Application Review Template.

I did not found any problems.

kattekrab’s picture

@kari.kaariainen congratulations - looks like this has been thoroughly reviewed and is now RTBC!

To expedite approval of this module you might like to review some modules from other contributors in order to get the review bonus. Once you've done so, add links in the summary to your reviews, and add the PAReview: review bonus tag.

Well done! And thanks for your contribution!

kattekrab’s picture

Priority: Normal » Critical

Bumping to Critical.

kari.kaariainen’s picture

Issue summary: View changes
kattekrab’s picture

Issue summary: View changes
kattekrab’s picture

Issue summary: View changes
stborchert’s picture

Status: Reviewed & tested by the community » Fixed

No objections for a long time so thanks for your contribution, Kari!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

kari.kaariainen’s picture

Issue summary: View changes
kari.kaariainen’s picture

Thank you @SoumyaDas for your patch. Applied and committed.

Status: Fixed » Closed (fixed)

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