I have two roles in Drupal 8 as Editor, Manager. An Editor can add nodes as unpublished and a Manager can review the nodes and approve/publish them in website.
For administration I am using default SEVEN theme for adding/editing nodes. How can I hide "Save and Publish" button to Editor role only?
Can it possibly by calling a template hook node_presave
? I tried below code but doesn't work.
function seven_node_presave($node) {
global $user;
if (in_array('editor',$user->roles)){
$node->status = FALSE;
}
}
Can anyone suggest a solution for this?
Maybe not the answer you are look are looking for but I found this really useful at my time:
Lightning Workflow - from Lightning distibution, stable and simple but if you already have started your project is less likely to fit in
Workflow - for D8 is still in beta but I have used it on D7, really powerful and manages things like your situation with no problems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.