Jump to content

If user has permission to see the edit tabs...


blad
 Share

Recommended Posts

The module: 

<?php

class AdminHelperHooks extends WireData implements Module {

public static function getModuleInfo() {
        return array(
            'title' => 'HideTabs ProccesPageEdit',
            'summary' => 'Hide the tabs Childrens, Configuration, Delete, View', 
            'version' => 1,
            'singular' => true,
            'autoload' => true
            );
    }

    public function init(){
        $this->addHookAfter("ProcessPageEdit::buildForm", $this, "buildFormHook");    
    }

    public function buildFormHook(HookEvent $event){
     
        if(wire("user")->hasRole("superuser")) return;
        
            $form = $event->return;

            $fieldset = $form->find("id=ProcessPageEditSettings")->first();
            $form->remove($fieldset);
            
            $fieldset = $form->find("id=ProcessPageEditDelete")->first();
            $form->remove($fieldset);
            
            $fieldset = $form->find("id=ProcessPageEditChildren")->first();
            $form->remove($fieldset); 

            $fieldset = $form->find("id=ProcessPageEditView")->first();
            $form->remove($fieldset);

    } 
}

Based on https://processwire.com/talk/topic/4680-block-access-to-settings-delete-and-view-tabs-for-page/ by Soma

  • Like 1
Link to comment
Share on other sites

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

×
×
  • Create New...