knottm01 Posted September 6, 2022 Share Posted September 6, 2022 Hi I've viewed a number of forums posts, but couldn't find the answer I'm looking for really. I need to hide some/all of the buttons you see in the screenshot, but this needs to be done from within the module. Can it be done, and how? I did try good old js/css, but I think there's an issue doing that to affect something that doesn't exist within the module. Thanks Link to comment Share on other sites More sharing options...
ps8modules Posted September 16, 2022 Share Posted September 16, 2022 Hi. And please, what doesn't work for you via JavaScript? Link to comment Share on other sites More sharing options...
ps8modules Posted September 16, 2022 Share Posted September 16, 2022 (edited) Module: ... $this->registerHook('actionAdminControllerSetMedia'); public function hookActionAdminControllerSetMedia($params) { $modules = array('ps_facetedsearch', 'contactform', $this->name); if($this->context->controller->controller_name == 'AdminModules' && in_array(Tools::getValue('configure'), $modules)) { $jsDef = []; foreach ($modules as $module){ if ($module == 'ps_facetedsearch'){ $jsDef = [ 'button_back' => 'show', 'button_translate' => 'hide', 'button_update' => 'hide', 'button_hooks' => 'hide', ]; } if ($module == 'contactform'){ $jsDef = [ 'button_back' => 'hide', 'button_translate' => 'hide', 'button_update' => 'hide', 'button_hooks' => 'hide', ]; } if ($module == $this->name){ $jsDef = [ 'button_back' => 'show', 'button_translate' => 'show', 'button_update' => 'hide', 'button_hooks' => 'show', ]; } } Media::addJsDef($jsDef); $this->context->controller->addJS(_PS_MODULE_DIR_.$this->name.'/views/js/admin.js'); } } and javascript: $(document).ready(function(){ if (button_back == 'hide') { document.getElementById('desc-module-back').style.display = 'none'; }; if (button_translate == 'hide') { document.getElementById('desc-module-translate').style.display = 'none'; }; if (button_update == 'hide') { document.getElementById('desc-module-update').style.display = 'none'; }; if (button_hooks == 'hide') { document.getElementById('desc-module-hook').style.display = 'none'; }; }); Edited September 16, 2022 by 4you.software (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now