I have three entities Provision
, Gatekeeper
and Data
.
class Provision {
private Gatekeeper $keeper; // ManyToOne
private Collection $points; // ManyToMany
}
class Gatekeeper {
private int $id;
private string $name;
private bool $allowData;
}
class Data {
private int $value;
}
All entities have REST-CRUD logic implemented. In order to edit the Provision
entity I've added configurations to the sulu_admin.yaml
:
sulu_admin:
field_type_options:
selection:
data_selection:
default_type: 'list_overlay'
resource_key: 'data'
types:
list_overlay:
adapter: 'table'
list_key: 'data'
display_properties: ['value']
icon: 'su-plus'
label: 'app.data'
overlay_title: 'app.action.select.data'
single_selection:
single_gatekeeper_selection:
default_type: 'single_select'
resource_key: 'gatekeepers'
types:
single_select:
display_property: 'name'
id_property: 'id'
overlay_title: 'app.action.select.gatekeeper'
Now, in the form configuration file for Provision
entities, I want to include a visibleCondition
for the data list:
<form xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd">
<key>provision_details</key>
<properties>
<property name="gatekeeper" type="single_gatekeeper_selection" mandatory="true">
<meta>
<title>app.gatekeeper</title>
</meta>
</property>
<property name="data" type="data_selection" visibleCondition="!!gatekeeper && gatekeeper.allowData">
<meta>
<title>app.data</title>
</meta>
</property>
</properties>
</form>
Is there any possibility to implement this behaviour? I've already tried adding a custom ConditionDataProvider
, but the main problem is that the visibleCondition
is evaluated at Field
-level while the only place I could pull the required data from would be the ResourceListStore
in the SingleSelect
.