Replies: 4 comments 1 reply
-
|
@mjauvin would you be able to take a look? |
Beta Was this translation helpful? Give feedback.
-
|
@goldmont if you could submit a PR to the Winter.Test plugin's User/UserRolePivot models to demonstrate this, that would help move this forward for investigation. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
@goldmont you cannot use the Pivot Model for filterFields, use |
Beta Was this translation helpful? Give feedback.
-
Hi, As you said, I've managed to alter pivot form using I had to dynamically access the field using the following syntax: public function filterFields($fields, $context = null)
{
$fields->{'pivot[my_field]'}->hidden = true;
}By the way, I'm still unable to get the value of a dropdown |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Winter CMS Build
dev-develop
PHP Version
8.1
Database engine
MySQL/MariaDB
Plugins installed
None
Issue description
Hi there.
I have the following scenario:
I have many
Devicesthat could be related to manyDashboards. Thepivottable has also additional attributes set via apivotform. There is apivotModelthat extendsWinter\Storm\Database\Pivot. From theDashboardform, I can link many devices and, every time I choose a device, thepivotform is displayed to allow me to enterpivotadditional attributes.I'm trying to manipulate
pivotform viafilterFieldsmethod but I noticed that this last not called onpivotModelbut onDevice::class. FromDevice::classI'm unable to accesspivotform fields. HoweverAccessorsandMutatorsare correctly called onpivotModel.Steps to replicate
Dashboardmodel:I tried to implement
relationExtendPivotWidget($widget, $field, $model)method into theDashboardscontroller and I'm able to manipulate thepivotform. By the way$widget->model->pivotdata is an empty array unless thecontextisupdate.Like this:
Workaround
I've also noticed that if I call manually the method
$widget->getSaveData()insiderelationExtendPivotWidget($widget, $field, $model)I can getpivotform data sent via AJAX request.Like this:
By the way, for some reason, after calling
$widget->getSaveData();, the line$widget->fields['pivot[my_field]']['hidden'] = true;has no effect.Beta Was this translation helpful? Give feedback.
All reactions