Jump to content

How to add a "favorite" to PageListActions


Leftfield
 Share

Recommended Posts

Hi @All

I am trying to add an link to field "favorite" (checkbox) in the backend in the row "Edit, New, View... Favorite", A link should imitate the field favorite and when you click on it, it should check/uncheck field without editing the page.
I assume there is a solution on the forum, but after wide search, couldn't find it. Tried to add it in "List of fields to display in the admin Page List" but you cant check it without editing the page.

PW: 3.0.146
PHP: 7.3.5

Capture.PNG

Link to comment
Share on other sites

I've never tried to add a custom page list action myself, but it definitely seems possible, since it's hookable. I've found a few forum threads that could get you on the right track:

https://processwire.com/talk/topic/10254-custom-page-actions/

https://processwire.com/talk/topic/2203-right-hook-right-after-the-pagelistactions/

https://processwire.com/talk/topic/14235-added-custom-action-but-it-doesnt-do-nothing/

 

  • Like 1
Link to comment
Share on other sites

Hi,

here is ProcessPageToggle module and it is almost the same like @dragan post link to another forum thread, or what can be found inside Processwire Copy/Clone module.
This is basic variant and need to be configured inside file, as example:
 

// ProcessPageToggle.module

// set action button label
protected $actionLabel = 'Favorite';
// set page template(s)   
protected $templates = array('blog');
// set page checkbox field name    
protected $targetField = 'favorite';

toggle.thumb.gif.4bcc44b5674d25972517e1e5d4a2b726.gif

Download, edit, and install like any other PW module.

ProcessPageToggle.module

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...