Hy there dev101,Hussard thanks for feedback.
Regarding issues :
a.
Custom fields will prevent items to be inserted.
Indeed ,plugin does not check for "meta" param (in this version of the plugin ) .
Problem is required fields from various plugins .
This fields are added by hooks and processed by each plugin internally .
Did any of you imagine a way to gather all fields for item post form in a single entry point ?
lets have a look into custom attributes plugin
public function pre_item_post() {
$fields = Params::getParam('fields');
if (!empty($fields) && is_array($fields)) {
foreach ($fields as $id) {
$field = Attributes::newInstance()->getField($id);
$type = $field['s_type'];
$name = 'field_' . $id;
$value = Params::getParam($name);
if ($type == 'checkbox' && empty($value)) {
$value = 'unchecked';
}
Session::newInstance()->_setForm($name, $value);
Session::newInstance()->_keepForm($name);
}
}
}
maybe some osclass core changes will help us gathering all fields into single entry point .
Session::newInstance()->_setItemForm($id_item ,$name, $value,$required);
or something similar to check all item fields in 1 place ,required or not
Workarround : drop ItemAction and do the validation inside the lorem plugin . This will bypass required fields and insert Item with no custom required fields .
b.
Would be nice to be able to fill custom plugin data
same as above. how do we gather all item fields related with the procesed item ?
from
Session::newInstance()->_keepForm($name);
?
from osc_run_hook('post_item'); ? (Item controller )
from ItemActions ?
osc_run_hook('pre_item_add', $aItem);
?
how do we validate those fields?
We can add some optional fields where admin can add some custom fields name and then look for them ?
You are programers , you can look inside other plugins,etc, but there are admins that do not know what to look and where inside plugins .
That's my ideas at 11.24 with no coffee at breakfast
c.
Can we create items for registered users too?
I'll include this option in next plugin versions .
Admin to choose between registered,Lorem users.
.............................................................................
Plugin is on github ,so let's improve it .
Some ideas will push us forward !
Thanks !