Zend certified PHP/Magento developer

Modal display different data for different buttons used to open it

A Magento admin feature that I am developing consists of adding an array of Foo objects to Products. Each Foo is configured by clicking on a “Configure Foo” button, which opens a modal.

enter image description here

However, the modal opened is currently shared across Foo objects. If I configure one Foo, then closing the modal, then press “Configure Foo” for another object, then the same configuration opens.

How can I have separate configurations for each Foo?

The “Configure Foo” button is added via the following array in a Modifier’s modifyMeta() method:

'config' => [
    'title' => __('Configure Foo'),
    'formElement' => Container::NAME,
    'componentType' => Container::NAME,
    'component' => 'Magento_Ui/js/form/components/button',
    'actions' => [
        [
            'targetName' => 'ns=product_form, index=foos_modal',
            'actionName' => 'openModal',
        ],
    ],
    'sortOrder' => $sort_order,
],