Open the plugin Fields - List and add some options:
Then create a field of list type in an article for example:
Now go and create a new article, look at the Field Tab to see the field.
According to the code in FieldsListPlugin.php at line#73:
`public function getOptionsFromField($field)
{
$data = array();
// Fetch the options from the plugin
$params = clone $this->params;
$params->merge($field->fieldparams);
foreach ($params->get('options', array()) as $option)
{
$op = (object) $option;
$data[$op->value] = $op->name;
}
return $data;
}`
It should merge the parameters from the plugin settings and in the field, right? Unless, I am reading the code wrong, am I?
The list options/params I set in the plugin settings: One and Two should be merged into the options I added in the Field edit.
The list field only pull options from the field edit.
Labels |
Added:
No Code Attached Yet
|
This is expected. The field overwrites the plugin defaults.
Status | New | ⇒ | Expected Behaviour |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-04-18 15:50:04 |
Closed_By | ⇒ | richard67 |
Closing as expected behaviour due to reasons mentioned in previous comments.
I see, understand now but there should be a text/description in the plugin parameters that the default values defined will be overwritten if values are defined in the field parameters.
I don't think it needs a text. The behavior is the same as in every other place. Default parameters get overwritten, not merged.
You just happend to have wrong expections in this case because you had your use case. If your use case would have been different, you wouldn't have expected this behavior at all.
Hello, this is Vara Prasad I've gone through the error and related code, and I saw that the error is occurring due to the merge method that you've used in line 73(according to the new code).