Deprecated acfe/flexible/preview
-
Hi,
why is this deprecated? acfe/flexible/preview? can I use some other hook for the same purpose?
-
Hello,
Thanks for the feedback! The
acfe/flexible/previewhook has been deprecated since 0.8.6.7 version for code consistency purpose. If you want to do an action right before the Layout Template File is rendered, you should now use theacfe/flexible/render/before_templatehook.Here are the available hooks variations:
do_action("acfe/flexible/render/before_template", $field, $layout, $is_preview); do_action("acfe/flexible/render/before_template/name=my_flexible", $field, $layout, $is_preview); do_action("acfe/flexible/render/before_template/key=field_abc123", $field, $layout, $is_preview); do_action("acfe/flexible/render/before_template/layout=my_layout", $field, $layout, $is_preview); do_action("acfe/flexible/render/before_template/name=my_flexible&layout=my_layout", $field, $layout, $is_preview); do_action("acfe/flexible/render/before_template/key=field_abc123&layout=my_layout", $field, $layout, $is_preview);You can also do an action after the Template File render with the
acfe/flexible/render/after_templatehook.Same logic, here are the available hooks variations:
do_action("acfe/flexible/render/after_template", $field, $layout, $is_preview); do_action("acfe/flexible/render/after_template/name=my_flexible", $field, $layout, $is_preview); do_action("acfe/flexible/render/after_template/key=field_abc123", $field, $layout, $is_preview); do_action("acfe/flexible/render/after_template/layout=my_layout", $field, $layout, $is_preview); do_action("acfe/flexible/render/after_template/name=my_flexible&layout=my_layout", $field, $layout, $is_preview); do_action("acfe/flexible/render/after_template/key=field_abc123&layout=my_layout", $field, $layout, $is_preview);If you simply don’t want to render a specific Layout Template File programmatically, you can use the
acfe/flexible/render/templatefilter andreturn false(this hook is used betweenbefore_template&after_templatehooks).Here are the hooks variations:
apply_filters("acfe/flexible/render/template", $file, $field, $layout, $is_preview); apply_filters("acfe/flexible/render/template/name=my_flexible", $file, $field, $layout, $is_preview); apply_filters("acfe/flexible/render/template/key=field_abc123", $file, $field, $layout, $is_preview); apply_filters("acfe/flexible/render/template/layout=my_layout", $file, $field, $layout, $is_preview); apply_filters("acfe/flexible/render/template/name=my_flexible&layout=my_layout", $file, $field, $layout, $is_preview); apply_filters("acfe/flexible/render/template/key=field_abc123&layout=my_layout", $file, $field, $layout, $is_preview);Hope it helps!
Regards.
Works! Thanks!
Hello,
I’m glad to hear that you made it works!
Also, I updated the documentation and grouped all Flexible Content hooks in one page, you might be interested: https://www.acf-extended.com/features/fields/flexible-content/flexible-content-hooks
Have a nice day!
Regards.
The topic ‘Deprecated acfe/flexible/preview’ is closed to new replies.