I needed a simple solution for EVO 3 to hide fields for editors.
I created a plugin for myself and wanted to ask if I could use it like that (it works for me!)
Just for your information: I know that it also works with "templatesedit3"... but I don't want to use it!
... and i am not a dev!!!
Plugin-Name: hideforeditor
System-Events: OnDocFormRender
Properties:
{
"role": [
{
"label": "Admin",
"type": "text",
"value": "2",
"default": "2",
"desc": "Role-ID"
}
],
"hide": [
{
"label": "Hide Fields",
"type": "textarea",
"value": "tr:has(input[name=\"link_attributes\"]), tr:has(input[name=\"tv5\"])\n",
"default": "tr:has(input[name=\"link_attributes\"]), tr:has(input[name=\"tv5\"])\n",
"desc": "Field-Name or your TV-ID"
}
]
}
in Css is also possible: tr:has(textarea[name="tv13"]), tr:has(#tv14)
Plugin:
$e = $modx->event;
$user = $modx->userLoggedIn();
$data = $modx->getUserInfo($user['id']);
if ($e->name == 'OnDocFormRender') {
if ($data['role'] == $role)
if(isset($hide))
echo "<style>$hide{display:none!important;}</style>";
}
I would be happy to receive other suggestions!