Skip to content

Instantly share code, notes, and snippets.

@NateWr
Last active May 7, 2019 14:02
Show Gist options
  • Save NateWr/b728a9fc0c9ee5d5521a4a140071ef07 to your computer and use it in GitHub Desktop.
Save NateWr/b728a9fc0c9ee5d5521a4a140071ef07 to your computer and use it in GitHub Desktop.
Remove the publishingMode setting from the access form for everyone except the site admin.
<?php
/**
* Remove the publishingMode setting from the access form for
* everyone except the site admin
*/
HookRegistry::register('Form::config::before', function ($hookName, $form) {
if (!defined('FORM_ACCESS') || $form->id !== FORM_ACCESS) {
return;
}
if (/* user is not an admin */) {
$form->removeField('publishingMode');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment