Set edit button disabled when parent record has certain state

Hi, 

I want to create a dependency that sets the edit button to readonly when the parent case has a certain state. I came up with the following but it doesn't seem to work. Any idea's?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$dependencies['Documents']['DisableEditModeIfCaseClosed'] = array(
'hooks' => array("view"),
//Optional, the trigger for the dependency. Defaults to 'true'.
'trigger' => 'and(equal(related($cases,"status"),"Closed"),equal(related($cases,"type"),"Behandelen Verzoek Sport"))',
'triggerFields' => array("edit_button"),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'ReadOnly',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'edit_button', //edit button name
//id of the label to add the required symbol to
'label' => 'LBL_EDIT_BUTTON_LABEL',
//Set required if the status is closed
'value' => 'true' // base on selected value button will be ReadOnly
)
),
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

for the time being I 'fixed' it with a controller.js customisation but that isn't really the way I would like to solve it