Description:

This module allows you to alter HTML output using a specific filter. It is based on the QueryPath library and requires the QueryPath module.
This filter is customisable through "QueryPath rules" that can be enabled/disabled and weighted.

The rules work with syntax similar to jQuery. The rule edition form works with a Selector/Action/Value pattern wich will then be translated into QueryPath syntax (quite straightforward).

Why this module ?

The QueryPath library lets you use PHP to alter HTML strings. The idea is to provide the ability to use this library in an input filter without PHP knowledge and without granting PHP filter access to users.

Technical information:

More thoughts:

  • This module is in a quite simple state for now, I'd like to hear community ideas and needs to decide if and how it should be enhanced
  • This is my first contrib module. I'm new to Git and use TortoiseGit. I think I must create a branch for this module. Where can I find guidelines?

Similar/related projects:

  • QueryPath module
  • Custom filter: lets you create multiple filters and use regular expressions to alter HTML output.
    I think it could be useful to add multiple filters to QueryPath filter module too, but this will be considered with community's feedback.

Personal background:

I work as a web developer for more than 4 years now, and with Drupal for almost 4 years.
I've made lots of Drupal sites 20+ (Drupal 5/6/7) and build custom modules for some time.
I've a good understanding of Drupal APIs and how it works under the hood (maybe not at lower levels).

Comments

patrickd’s picture

Status: Needs review » Needs work

welcome,

You are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.

Also have a look at the tips for a great project pageand the guidelines for in-project documentation.

An automated review of your project has found some issues with your code; As coding standards make sure projects are coded in a consistent style we please you to have a look at the report and try to fix them. Anyway, note that issues found are possibly false positives and fixing all issues is not a requirement for getting through the application process.
Report: http://ventral.org/pareview/httpgitdrupalorgsandboxdolu1706658git

We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.

Everything you need to know about projects and maintainership can be found in the documentation and it's subpages:
http://drupal.org/contribute/development

regards

ludo.r’s picture

Status: Needs work » Needs review

Hi!

I've created a 7.x-1.x branch on Git and cleaned up the code review with coding standards:
http://ventral.org/pareview/httpgitdrupalorgsandboxdolu1706658git

I do not want to change the last remaining error reported for better readability.

I think I should now retag this issue with "needs review"?

serjas’s picture

# in .install, there is hook_install but no hook_uninstall , this should be there to uninstall schema
# "querypath_filter_encoding" this variable are set by this module? if so it should be deleted in hoo_uninstall

patrickd’s picture

There is no need to install or uninstall schemas in drupal 7, that happens automatically

serjas’s picture

@patrickd , thanks , but to remove variable , we need to include hook_uninstall , right?

patrickd’s picture

yes, variables still need to be uninstalled.

ludo.r’s picture

Actually, I've set this variable for further development, to remember to handle the encoding.

But you're right, I still can implement hook_uninstall() to delte variables.

This has been commited.

dwieeb’s picture

Status: Needs review » Needs work

I really like your idea and I find this very useful.
That being said, I'd like to try reviewing your module, if you don't mind.

PAReview still has one complaint about coding standards: http://ventral.org/pareview/httpgitdrupalorgsandboxdolu1706658git-7x-1x

There is still a master branch, though you are not using it. You can remove it with these commands after setting the default branch to 7.x-1.x if you haven't already done so:

git branch -D master
git push origin :master

You should use $form['#attached'] here instead of drupal_add_css() and drupal_add_js(). This way, other modules can manipulate the attached css & js if they need to copy the form or alter it. As a note, for adding files you don't need to include the second parameter in drupal_add_ functions.

function querypath_filter_admin_rule_form($form, &$form_state, $rule = NULL) {
  // Add css and js files for this form.
  drupal_add_js(drupal_get_path('module', 'querypath_filter') . '/querypath_filter.js', 'file');
  drupal_add_css(drupal_get_path('module', 'querypath_filter') . '/querypath_filter.css', 'file');
  • I think you should add a description to admin/config/content/querypath_filter, as every other menu entry in admin/config does.
  • I think you should change the package from "Filters" to "QueryPath", as you are extending a large, multi-module package. http://drupal.org/node/542202#package
  • It would be nice if you could wrap the "Add new rule" link in an unordered list with class action-links to remain consistent with the Drupal admin pages. Check out admin/structure/block for an example.
  • Consider adding an API so other modules can create QueryPath filters by code.
  • Consider adding a quick drupal_alter() to _querypath_filter_get_actions() so other modules can extend functionality.
  • Consider advising the user that the order of filters matters. In a filtered HTML setting, QueryPath filter should run before the HTML filter, otherwise you may have disallowed HTML tags in your content due to this module's ability to insert HTML.
  • Consider allowing different rules to be enabled per text format via filter settings.
  • Do finish those filter tips. =) Something that just mentions all enabled rules will be applied would be nice.

I've tested this thoroughly and this module is safe and stable. After these minor changes, I think we can move it up to RTBC. =)

ludo.r’s picture

Status: Needs work » Needs review

Hi!

Thank you for reviewing this module!

Here is an update of what I've just commited :

  • PAReview : as I said, there is one "error" left, but I keep it like this for better readability
  • Master branch has been removed
  • drupal_add_js() and drupal_add_css() have been replaced by $form['#attached']. (Thanks for the tip, I didn't know this one! :-) )
  • Description has been added for admin/config/content/querypath_filter
  • The module package has been changed to QueryPath
  • The link "Add a new rule" has been added as a local action thus added as an item of links in action-links
  • API : I had started creating a new hook to let other modules adding rules, but it isn't so simple as the order of the rules matters. I would better take care of that in a second phase, when the module is released, that people start using it and provide new needs/ideas
  • drupal_alter() has been added to let other modules extend available actions
  • A small advice has been added in querypath_filter_filter_info(). But, as this module is intended to be used by Drupal builders and themers, I think they should know what they're doing.
  • Different rules per text format : Actually, I would go for giving users the ability to create multiple filters that they could enable for specific text formats, but this will be for a second phase
  • Tips : The description of each enabeld rule is now displayed as filter tips. This could be as well enhanced in a second phase (e.g. letting the site bulder/themer setting their own text)

Thanks for your help!

dwieeb’s picture

Status: Needs review » Reviewed & tested by the community

Sweet. This is rockin'.

If a few weeks pass without any attention from an administrator, you can participate in the review bonus program like I did.

Great job on this module!

ludo.r’s picture

@dwieeb

Thank you for reviewing this module and for the tips! :-)

sreynen’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, dolu!

I updated your account to let you 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 get 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 reviewers as well.

ludo.r’s picture

Thank you all for reviewing this module! ;)

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Adding personal background.