Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a JavaScriptHooks module to the core for modules to depend on#323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
poljpocket wants to merge6 commits intoprocesswire:dev
base:dev
Choose a base branch
Loading
frompoljpocket:js-hooks-core

Conversation

@poljpocket
Copy link
Contributor

@poljpocketpoljpocket commentedAug 19, 2025
edited
Loading

This is a draft PR which adds JavaScript hooks to the core. Based on#322.

For more details about what this is trying to achieve, seehttps://processwire.com/talk/topic/30365-lets-bring-hooks-to-javascript/

This includes a small example for InputfieldDateTime which exposes two example hooks for when a date is selected and when the datepicker is closed.

Comment on lines +38 to +39
onSelect:___selected,
onClose:___closed,
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@BernhardBaumrock am I doing this correctly here? Or what would the correct callback be for it to be hookable?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looking at it again, I think, I need to do something like this:

// assume $thisobject is the InputfieldDatetimeDatepicker objectonSelect:function(datetime,$datepicker){$thisobject.selected(datetime,$datepicker);}onClose:function(datetime,$datepicker){$thisobject.closed(datetime,$datepicker);}

// init datepickers present when document is ready
$("input.InputfieldDatetimeDatepicker:not(.InputfieldDatetimeDatepicker3):not(.initDatepicker)").each(function(n){
InputfieldDatetimeDatepicker($(this));
ProcessWire.wire(InputfieldDatetimeDatepicker($(this)));
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

InputfieldDatetimeDatepicker might need to be a class or return itself at the end...

// init datepicker that should appear on focus (3) of text input, that wasn't present at document.ready
$(document).on('focus','input.InputfieldDatetimeDatepicker3:not(.hasDatepicker)',function(){
InputfieldDatetimeDatepicker($(this));
ProcessWire.wire(InputfieldDatetimeDatepicker($(this)));
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

InputfieldDatetimeDatepicker might need to be a class or return itself at the end...

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@poljpocket@BernhardBaumrock

[8]ページ先頭

©2009-2025 Movatter.jp