This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Troiscent
Troiscent

Hello,

I have a model defined like that :

  • A product has many references
  • A reference belong to a product

I manage my references on the product form thanks to the relation manager.

The next step is to alter the references to dynamically add some columns and fields based on some configuration.

I could add columns thanks to the relationExtendViewWidget method.

My problem is that this method have a $widget, $field, and $model variables

  • $widget represent the whole widget object that define the relation manager
  • $field is just the name as a string of the field
  • $model is the parent model (so my product)

My problem is that I don't know how can I access my references model from here. For example, I added a column like that :

$widget->addColumns([
    'property_1' => [
    'label' => 'Property 1',
    'default' => ???????,
    ]
]);

How can I access that new "property_1" column with a value defined in my $reference model ?

Thank you for your help

Alex

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.