Tile visibility structure
Current structure:
$tiles['disciple_tools_plugin_starter_template'] = [
'label' => __( 'Plugin Starter Template', 'disciple-tools-plugin-starter-template' ),
'description' => __( 'This is a tile that is added by the plugin starter template.', 'disciple-tools-plugin-starter-template' ),
'hidden' => false,
'display_conditions' => [
'visibility' => 'visible', //hidden, custom, visible
'operator' => 'or', //and, or
'conditions' => [
'overall_status__active' => [ 'key' => 'overall_status', 'value' => 'active' ],
'overall_status__paused' => [ 'key' => 'overall_status', 'value' => 'paused' ],
'tags__tag1' => [ 'key' => 'tags', 'value' => 'tag1' ],
'tags__tag'2 => [ 'key' => 'tags', 'value' => 'tag2' ]
],
],
];
Desired Structure:
$tiles['disciple_tools_plugin_starter_template'] = [
'label' => __( 'Plugin Starter Template', 'disciple-tools-plugin-starter-template' ),
'description' => __( 'This is a tile that is added by the plugin starter template.', 'disciple-tools-plugin-starter-template' ),
'hidden' => false,
'display_conditions' => [
'visibility' => 'visible', //hidden, custom, visible
'operator' => 'or', //and, or
'conditions' => [
'overall_status' => [ 'active', 'paused' ],
'tags' = [ 'tag1', 'tag2' ],
]
],
];
Also add the ability to filter out:
'conditions' => [
'overall_status' => [ '-closed'],
]
Might need a settings migration to change structure
Also add restricting visibility by role
If you have both role and post/record conditions, would it make sense to separate those a bit in the structure? Something like...
'conditions' => [
'post' => [
'overall_status' => [ '-closed' ],
],
'user' => [
'role' => [ 'dt_admin', 'dispatcher' ],
],
]
This might allow more flexibility for other types of conditions in the future. I don't know what those others would be, but it might be a bit better than making a special case for a condition with key role. Who knows if someone might one day put a role field on contacts and want a condition on that.
Yeah, that looks like a better structure I'll revise by previous comment. In D.T we focus more and the permission instead of a role. This way a new role could be given access too. So we might do this instead:
'user ' => [
'permission' => [ 'see_all_contacts' ],
]
Can we have both roles and permissions available? If I have two different roles for digital responders and field multipliers that have the same permissions, I still want each of them to view different fields. I have fields specific for online vs those applicable to face-to-face.