Synopsis

This module adds an event dispatcher to the preprocess hook. This way your modules can subscribe to preprocess events to add extra functionality. This will advocate a more event driven development instead of the old hook function based development.

Requirements

None, except of course Drupal 8.x

None.

Roadmap

Add more events to the dispatcher beside the preprocess events.

Credits

ibuildings For sponsoring initial development.

None that I know off. Try to find it at the start, but I have found no similar projects.

Dependencies

Drupal 8.x

Restrictions

None.

Project page

https://www.drupal.org/sandbox/pdenooijer/2841877

Clone command

 git clone --branch 8.x-1.x https://git.drupal.org/sandbox/pdenooijer/2841877.git preprocess_event
cd preprocess_event 

Reviews

  1. https://www.drupal.org/node/2847434#comment-11902036
  2. https://www.drupal.org/node/2740823#comment-11902086
  3. https://www.drupal.org/node/2847546#comment-11902165

Extra reviews

  1. https://www.drupal.org/node/2847434#comment-11904406
  2. https://www.drupal.org/node/2847546#comment-11904452
  3. https://www.drupal.org/node/2847279#comment-11904506

pareview.sh

https://pareview.sh/node/879

CommentFileSizeAuthor
#22 coder-results.txt12.18 KBklausi

Comments

pdenooijer created an issue. See original summary.

pdenooijer’s picture

Issue summary: View changes
visabhishek’s picture

Issue summary: View changes
PA robot’s picture

Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2847414

Project 2: https://www.drupal.org/node/2628268

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

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

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.

pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
pdenooijer’s picture

Issue summary: View changes
mxh’s picture

Similar projects and how they are different

You might want to take a look at https://www.drupal.org/project/hook_event_dispatcher.
This module aims to solve the problem more horizontal, i.e. it aims to add event dispatchers to any hook where you might want to work with object-oriented events rather than functional hooks. You could work with the maintainers of this module to add preprocess hooks, if not yet available.

In the end, I wouldn't consider installing multiple modules with different approaches and (maybe event redundant) implementations for a single, development-only purpose. Having one module which solves the problem (at least almost) completely would be more considerable in general. Therefore I'd recommend to work with the maintainers of hook_event_dispatcher and try to bring this module further.

pdenooijer’s picture

Hook Event Dispatcher is not really extendible like my implementation. I have no problem putting some more work in to adding more events the same extendible way to other hook calls.

I see someone opened an issue, let's see if there is any reaction from the developer. It seems to me since October there has been no activity. I'll make an issue to see if the developer wants to extends his module with my preprocess implementation.

pdenooijer’s picture

Issue summary: View changes
zyyz’s picture

preprocess_event.services.yml : Deprecated use of @ on unquoted string. According to Yaml specification, unquoted strings cannot start with @.
PreprocessEventInterface.php : Undefined class AbstractEventVariables => use the full class name instead \Drupal\preprocess_event\Variables\AbstractEventVariables.
PreprocessEventFactoryInterface.php : return type undefined, AbstractPreprocessEvent. Use the full class instead Drupal\preprocess_event\Event\AbstractPreprocessEvent.
EckEntityEventVariables.php : return type undefined, EckEntity. Use the full class path for the paramaters
NodeEventVariables.php : return type ndefined class Node, use the right class even better the interface instead, \Drupal\node\NodeInterface.
ViewEventVariables.php : return type undefined, ViewExecutable. Use the right full class name instead.
ViewFieldEventVariables.php : The same thing for all return types. Use the right full class name.

zyyz’s picture

Status: Needs review » Needs work
pdenooijer’s picture

Thanks for the review zyosarian!

I fixed the unquoted strings in the YAML file and updated the php files you mentioned with the right return tags. Those @return tags where broken because originally I had use statements for those, but apparently the pareview does not agree with that practise, so I removed the use statements.

pdenooijer’s picture

Status: Needs work » Needs review

klausi credited klausi.

klausi’s picture

Status: Needs review » Fixed
StatusFileSize
new12.18 KB

Review of the 8.x-1.x branch (commit d7b547f):

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.

manual review:

  1. The Git commits are not connected to your user account. You need to specify an email address. See https://www.drupal.org/node/1022156 and https://www.drupal.org/node/1051722
  2. preprocess_event_preprocess(): the @inheritdoc tag is wrong here, that is used for methods. See https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...
  3. phpunit.xml: should be named phpunit.xml.dist so that users can have a local version.
  4. project page is a bit short. It should describe how this module can be used, see also https://www.drupal.org/node/997024
  5. Can you add the differences to existing projects such as https://www.drupal.org/project/hook_event_dispatcher to the project page?

Otherwise looks good to me.

Thanks for your contribution, Piet!

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.

mxh’s picture

Congratulations!

pdenooijer’s picture

Super thanks to all, I'm very happy about it :)!

Status: Fixed » Closed (fixed)

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