Description

The Font Icon Select module provides an interface for font file management. It then uses those libraries to provide a new field type that allows icon selection on a fieldable entity.

Fonts can be uploaded in the admin. Every font requires .eot, .svg, .ttf, and .woff file types to help with browser compatibility. Once a font file is uploaded it becomes available as an option for the new Font Icon Select field type. The font's icon options can be restricted using a global interface or on a field by field basis.

The new font icon select field type allows icon selection to be added to any fieldable entity. On field creation a previously uploaded font library is selected so that the icons from the font can be exposed as options. The field admin has local black/whitelist capabilities with default icon selection that supports different cardinalities.

Once an icon has been selected it can be shown on the front end of the site using a simple render call. When the icon is rendered it ensures that the correct font library is available on the page by including the font files and a custom generated css file that applies the font library to the wrapping classes.

Resources

The project sandbox
Directions to clone the project
Set up the repo for the first time: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/wolffereast/2319993.git font_icon_select

Similar projects, and why this project is different

Font Awesome Icons is a project that allows font awesome icons to be used on the site. This project does not allow different font libraries to be uploaded.
Fontello allows integration with the fontello service in order to combine custom webfonts for your project. This project does not support an icon selection field.
Icon API provides integration for icon bundles and icon providers throughout Drupal. One of it's sub modules provides a field to allow icon selection on any fieldable entity. It allows library management, though it requires upload instead of providing an upload interface. The module does not allow restriction of available icons using either a black or white list option.

Manual reviews of other projects:

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxwolffereast2319993git

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.

wolffereast’s picture

Issue summary: View changes
wolffereast’s picture

Status: Needs work » Needs review

Reviewed and fixed issues found by the script pointed out by the PA robot.

darol100’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security

Automated Review

Pareview.sh is showing some warning - http://pareview.sh/pareview/httpgitdrupalorgsandboxwolffereast2319993git, No a blocker but it would be nice to be fix before the release.

Coder Review

font_icon_select.field.inc

  • (*)
        Line 291: Potential problem: form_set_error() and form_error() only accept filtered text, be sure all !placeholders for $variables in t() are fully sanitized using check_plain(), filter_xss() or similar. (Drupal Docs)
            form_error($element, t('!name field is required.', array('!name' => $element['#title'])));
    
  • Line 332: in most cases, replace the string function with the drupal_ equivalent string functions
                '#prefix' => '<span class="font-icon-select-' . $field['settings']['font'] . ' font-icon-select-' . $field['settings']['font'] . '-' . substr($item['value'], 1) . '">',

font_icon_select.admin.inc

  • Line 229: in most cases, replace the string function with the drupal_ equivalent string functions
        $key = substr($key, 1);
  • Line 332: When labelling buttons, make it clear what the button does, "Submit" is too generic.
        '#value' => t('Submit'),

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 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
No: Does not 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. (*)This project is vulnerable to xss and should pass through check plain. The field font_icon_select_font_library_form:font_title, I'm able to add javascript and execute once I click one of your tab UPLOADED FONT LIBRARIES. This is the same as the first complain from coder, I have manually test it.
  2. (+)If there are not any UPLOADED FONT LIBRARIES it would should a message that have a link wrong. Check the attached picture. That's seem like a bug you should make that into a link.
  3. It's unclear/confusing, which font format have to be upload it in a order until you try to upload a font and it show and error. The reason why is so confusing because does not have a field description. I think should should add a field description explain what the user needs to upload in each field.
  4. Adding the hook_help with some useful information it would be nice for site builders.

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.

darol100’s picture

StatusFileSize
new76.58 KB

Attached picture,

wolffereast’s picture

Issue summary: View changes
wolffereast’s picture

I fixed the issues that coder found and took care of the final elements found by the pareview.sh script.
Fixed the XSS vulnerability with the Font Title field. I also found and fixed a possible vulnerability created when the uploaded font files are parsed. I will look into this particular vector of attack more before I move this away from 'Needs work'.
Fixed the issue with the link in the message when there are no uploaded font libraries.
Fixed an issue with the names of the font file fields and added descriptions for good measure.
I will work on some content for hook_help() when I have some more time.

@darol100 Thank you for the quick review. It was extremely helpful and I appreciate the time that it took to complete!

ravi.khetri’s picture

Hi,

1. Use form Api of drupal instead of input tag.
Line no. 455 of font_icon_select.admin.inc

2. use t function in line 533 of of font_icon_select.admin.inc

wolffereast’s picture

Thanks for the review @ravi.khetri

Updated the input tag to use the form API.
Added the translate function to the error message on line 533.

I'm going to check out the rest of the theme work in the function near 455 to see if anything else can be moved to the form API.

wolffereast’s picture

Added basic hook_help(), beginning check of XSS via crafted svg

wolffereast’s picture

Issue summary: View changes
wolffereast’s picture

Issue summary: View changes
wolffereast’s picture

Status: Needs work » Needs review

Added additional testing/sanitation to the svg parse function to avoid injected js. Also fixed an issue where icons with values outside of the valid UTF8 range where being encoded and output incorrectly.

wolffereast’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
babusaheb.vikas’s picture

  1. First of all you need to add one parent class with some element in font_icon_select.css .
    eg:--
    div.label {
      display: table-cell;
      font-family: Arial, Helvetica, sans-serif;
      font-size: .9em;
    }

    It can override another label property.

  2. Then, It would be better if the *.info file look like this:

    name = Font Icon Select
    description = Provides font file management, font based icon select widget, and global/local black/whitelist options for font options.
    core = 7.x
    configure = admin/config/content/font_icon_select_options

    dependencies[] = file

wolffereast’s picture

Good catch in the css @babusaheb.vikas, thanks for the review.

added a more focused target to the mentioned css and re ordered the *.info file.

wolffereast’s picture

Status: Needs review » Needs work

Update that integrates with Drupal behaviors had some unintended admin side affects. moving to needs work pending admin fixes

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.