michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
339 stars 71 forks source link

Bug | Image upload on Widgets #263

Closed heldervilela closed 5 years ago

heldervilela commented 7 years ago

Hello, I want to report 2 bugs.

They are both related to widgets on customizer.

Thanks for the fantastic framework.

michaeluno commented 7 years ago

Hi,

So you are talking about Customizer. I could confirm the problem. Thanks for the report.

I remembered it was working a while back so just tried it with different WordPress versions. And It seems the problem occurs in WordPress 4.6, 4.5, and 4.4 and does not occur in WordPress 4.3. (edited)

Since you say widgets, can you check whether it occurs in widgets.php (Dashboard -> Appearance -> Widgets)?

heldervilela commented 7 years ago

Hello This just happens in the customizer, on the widgets.php page works fine. Can you give me some direction to try fix it?

michaeluno commented 7 years ago

For widgets to support the Selective Refresh mechanism of Customizer, its handling logic must be introduced.

Admin Page Framework lets each field type define what scripts and styles to load. The image field type in particular defines its script in the getScripts() method.

Also, although this is rather a user-side approach, when you instantiate an APF widget class, you may want to set the customize_selective_refresh argument.

new APF_Widget_Example( 
    'Widget Title',  // widget tite
    array(
        'description' => 'This is a widget description.',    // description
        'customize_selective_refresh' => true, // <--- this one
    ),
);
heldervilela commented 7 years ago

Thank you. I'll give it a try.