manne-hoffmann
New Member
Hello there at FABRIK,
I am just starting to get into FABRIK and am currently trying to write some "all-purpose" PHP-form-plugins.
The idea is to use them in all forms of the application I am trying to build. In order to access and/or manipulate form-fields I must use the notation 'table name___element'. As my PHP-plugins are meant to run for many forms I need a way to dynamically get the table name of the current form.
Currently I use a rather weird way, because I did not (yet ?) find a smart object-property to get the current 'db_table_name'. If I dump out(print_r) the current objects I can actually see the property 'db_table_name' populated with the current table name, but this property is "nested" deep inside the "object-tree", so all of my current attempts to retrieve it have failed. Maybe it is not even accessible from outside??
In case there is really no way of getting this info in a smart way ... here's my current "weird" solution:
PLUGIN used at 'onBeforeProcess'
PLUGIN used at 'onLoad'
Looking forward to your answers
So long,
Manfred.
I am just starting to get into FABRIK and am currently trying to write some "all-purpose" PHP-form-plugins.
The idea is to use them in all forms of the application I am trying to build. In order to access and/or manipulate form-fields I must use the notation 'table name___element'. As my PHP-plugins are meant to run for many forms I need a way to dynamically get the table name of the current form.
Currently I use a rather weird way, because I did not (yet ?) find a smart object-property to get the current 'db_table_name'. If I dump out(print_r) the current objects I can actually see the property 'db_table_name' populated with the current table name, but this property is "nested" deep inside the "object-tree", so all of my current attempts to retrieve it have failed. Maybe it is not even accessible from outside??
In case there is really no way of getting this info in a smart way ... here's my current "weird" solution:
PLUGIN used at 'onBeforeProcess'
PHP:
$tmp_form_data_keys = array_keys($this->data);
$tmp_table_name = explode('___', $tmp_form_data_keys[0]);
$my_current_table = $tmp_table_name[0];
PLUGIN used at 'onLoad'
PHP:
$tmp_form_data_keys = array_keys($formModel->data);
$tmp_table_name = explode('___', $tmp_form_data_keys[0]);
$my_current_table = $tmp_table_name[0];
Looking forward to your answers
So long,
Manfred.