Distill

Distill is a Drupal module that enables other modules to extract and format data from Drupal entities in an organized way. It provides a simple class/method structure for defining extraction/formatting schemas.

How does Distill Work?

Distill contains 2 classes. 1) A class that defines the structure of a processor and 2) a distillation class that takes an entity, a processor class, and a list of fields that should be returned, executes the processor’s formatter methods, and returns an array of data. If the processor passed into the distillation class doesn't have a processor for a specific field type, then it will default to invoking the hook defined for that field type.

The project is located at https://www.drupal.org/sandbox/patrickocoffeyo/2346043 and contains more documentation and an example implementation of this module.

Installation

To install this module, clone it into the module's directory of a Drupal 7 installation, and enable the module:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/patrickocoffeyo/2346043.git distill

Comments

pcoffey’s picture

Issue summary: View changes
pcoffey’s picture

Issue summary: View changes
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/httpgitdrupalorgsandboxpatrickocoffeyo234604...

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.

pcoffey’s picture

Status: Needs work » Needs review

Modified code to adhere more closely to DCS. Bot will still throw error on README.md file.

skdrupal88’s picture

Hey, add please git clone command as it recomended in https://www.drupal.org/node/1011698 (5.4 point)

pcoffey’s picture

Issue summary: View changes

Adding git clone command and installation instructions.

sendinblue’s picture

Assigned: Unassigned » sendinblue
sendinblue’s picture

Automatic Review

Please fix following errors and warnings identified by pareview.

Git default branch is not set, see the documentation on setting a default branch.
Review of the 7.x-1.x branch (commit 497aa8b):

Coder Sniffer has found some issues with your code (please check the Drupal coding standards). See attachment.
DrupalPractice has found some issues with your code, but could be false positives.
FILE: /var/www/drupal-7-pareview/pareview_temp/distill.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | WARNING | There must be no blank line following an inline comment
--------------------------------------------------------------------------------

Time: 65ms; Memory: 5.5Mb

No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.


FILE: /var/www/drupal-7-pareview/pareview_temp/README.md
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 12 WARNINGS AFFECTING 12 LINES
--------------------------------------------------------------------------------
2 | WARNING | Line exceeds 80 characters; contains 172 characters
5 | WARNING | Line exceeds 80 characters; contains 300 characters
8 | WARNING | Line exceeds 80 characters; contains 317 characters
10 | WARNING | Line exceeds 80 characters; contains 383 characters
11 | WARNING | Line exceeds 80 characters; contains 117 characters
12 | WARNING | Line exceeds 80 characters; contains 131 characters
99 | WARNING | Line exceeds 80 characters; contains 450 characters
101 | WARNING | Line exceeds 80 characters; contains 163 characters
104 | WARNING | Line exceeds 80 characters; contains 293 characters
107 | WARNING | Line exceeds 80 characters; contains 298 characters
111 | WARNING | Line exceeds 80 characters; contains 104 characters
113 | WARNING | Line exceeds 80 characters; contains 118 characters
--------------------------------------------------------------------------------

FILE: /var/www/drupal-7-pareview/pareview_temp/distill.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | WARNING | There must be no blank line following an inline comment
--------------------------------------------------------------------------------

Time: 144ms; Memory: 7.25Mb

Source: http://pareview.sh/ - PAReview.sh online service

Manual Reviews

- Git clone
Please change git clone url into public
- README.txt/README.md
Please follow the guidelines for in-project documentation and/or the README Template.
- Coding style & Drupal API usage
(*) I can't see any hook system. Can you explain me the reason ?
(*) Remove the packaging lins from the .info. These will be added when the module is published.
(+) Please use t() function for plain text

sendinblue’s picture

Assigned: sendinblue » Unassigned
Status: Needs review » Needs work
fluxsauce’s picture

First of all, great work and great start! Can't wait to see this through to completion!

Git clone instructions on the review page should be used by anyone (currently, it's requiring username patrickocoffeyo). The instructions should be:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/patrickocoffeyo/2346043.git distill

README.md - please review the module documentation guidelines at https://www.drupal.org/node/161085 and adjust accordingly.

PHP exceptions should use the t function when throwing. See https://www.drupal.org/node/608166 for details.

Your comments can be simplified. For example, in distill_processor.class.inc:

   * @param int $index
   *   Integer representing the delta of the field being processed.
   * @param array $settings
   *   Variable for passing settings and context into processors.

could just be

   * @param int $index
   *   Delta of the field being processed.
   * @param array $settings
   *   Processor configuration.

Also, none of your methods in distill_processor.class.inc have phpdoc for return values.

Document that this module requires PHP 5.3 or higher.

Typo in distill_processor.class.inc

    // If no image stype is specified, return path to full image.

Regarding the feedback about hooks, I almost said ignore it, but actually there's a definite use case; allowing modules that define new field types to create their own processors. Most people could then just use a straight Distill class and only extend in extreme cases. Instead of implementing DistillProcessor as a class, why not a hookable system? The processors you've provided out of the box could then be re-implemented as hooks which will provide additional documentation and examples to others, along with an API.

pcoffey’s picture

Status: Needs work » Needs review

FluxSauce,
I've updated the codebase and now the Distill class incorporates hook-based formatters, as I discussed late last year, and as you specified in the above comment. I've also moved all of the sensible defaults into hook implementations. Code passes standards testing, and documentation has been updated to include the new hook system.

Thank you so much for your review! I'm submitting this back to the community for another pass :)

pcoffey’s picture

Issue summary: View changes

Updating project description

fluxsauce’s picture

Issue summary: View changes
vingborg’s picture

Status: Needs review » Reviewed & tested by the community

This is a go. If you need it, you need it bad. Otherwise it's kind of weird.

I can confirm that it works as described, that the code is crisp, clean and well documented, and that it's actually useful.

It's even quite clever :-)

As far as I can tell, the issues raised by previous reviews are all taken care of.

It still lacks a test suite, but I would use it anyway.

cweagans’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution!

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.

pcoffey’s picture

Thank you for updating my account! I'll read through the links you sent! :)

Status: Fixed » Closed (fixed)

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