Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use build_file callback #634

Open
nakedsushi opened this issue Nov 6, 2018 · 5 comments
Open

How to use build_file callback #634

nakedsushi opened this issue Nov 6, 2018 · 5 comments

Comments

@nakedsushi
Copy link

According to this page, there's a build_file callback:
https://github.com/movabletype/movabletype/blob/f02afa4e1ed554ebc3c265d3856fb09e1666eb00/lib/MT/Callback.pod

When writing an MT plugin that is triggered by that callback, how should the callback be used? For example, this in my config.yaml doesn't seem to work:

callbacks:
 build_file: $MyPlugin::MyPlugin::method_to_call_after_build_file

Is this a bug? When I create an entry and publish it, it doesn't seem to call my plugin. Same for updated and editing an existing entry.

@ghost
Copy link

ghost commented Nov 6, 2018

@nakedsushi
Your code looks good to me. I checked that build_file callback had been called in the following plugin on MT r.4208.

https://gist.github.com/miniuchi/4b0a2703a088b33c515be2f6fdc8189e

Please check the followings.

  • ’$MyPlugin::MyPlugin::method_to_call_after_build_file’ has wrong name (package name, subroutine name, etc.)
  • You are using ‘Dynamic Publishing’
  • There is no archive mapping for entry. (this may occur when you are using ‘Mont-Blanc’ theme)

@ghost
Copy link

ghost commented Nov 6, 2018

I checked that build_file callback had been called when creating an entry via Data API.

@nakedsushi
Copy link
Author

Oh interesting, I didn't know that it only gets called when the entry page is set to "Dynamic Publishing." We have it configured to static publishing, so that may be why build_page never gets called. Thanks!

@nakedsushi
Copy link
Author

If we have our configuration set up to statically publish, with archive mapping turned ON, is there a way to use that callback? Or my bigger question is, is there a callback I can use to trigger a plugin's method after an entry's archive mapping is created in the file system?

@ghost
Copy link

ghost commented Nov 7, 2018

@nakedsushi

Please check the followings.

Sorry, this is a check list of wrong conditions. You can use build_file callback when using “Static Publishing”.

Oh interesting, I didn't know that it only gets called when the entry page is set to "Dynamic Publishing." We have it configured to static publishing, so that may be why build_page never gets called. Thanks!

Are you using build_page callback, not build_file callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant