Jump to content

Search the Community

Showing results for tags 'manipulate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. How can I change the NumChildren Label in the Tree? I am logged in as a custom user. I have an SitehelperModule where I hook in the "ProcessPageList::execute" and execute and custom Function like this which excludes all pages which the current user can't edit: And It works well, the current user gets only the Pages which he can edit, but the problem is, that the NumChridren shows that they are 5 Pages under the ParentPage and this is confusing for the customer. Can I manipulate that also? I am asking because since the PageListNumChildren is rendered by the ProcessPageList.js I dont know how to tell Processwire that it should only num the Pages which the current user can edit? if(!$this->user->isSuperuser()) $this->addHookAfter('ProcessPageList::execute', $this, 'HidePages'); public function HidePages(HookEvent $event){ // create an array with all id's of the page to exclude $uneditable_pages = new PageArray(); $the_pages = wire('pages')->find("template=activity|location|organiser|address|source|tipp"); foreach ($the_pages as $the_page) { if(!$the_page->editable()) { $uneditable_pages->add($the_page); } } $hidden = explode('|', $uneditable_pages); // make sure it's an ajax request if($this->config->ajax){ // manipulate the json returned and remove any pages found from array $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } This Code-Snippet is an mini-altered Version from Somas Code on Github
×
×
  • Create New...