News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom field cloning to trigger a plugin function

Started by balai, May 28, 2021, 12:45:28 PM

Previous topic - Next topic

balai

Seems like the custom field cloning, just a duplicates a record of the #__virtuemart_customs db table.

This is ignoring custom plugins using 3rd party tables to store part of their configuration/state.

I suggest triggering a plugin call, after the custom field cloning, so that 3rd party plugins can make use of it.

Suggestion:
In the file: administrator/components/com_virtuemart/models/custom.php
function createClone

After that code:
if (!$clone = $row->store()) {
            vmError('createClone failed for ' . $id);
        }


add:

elseif ($row->field_type == 'E') {
            JPluginHelper::importPlugin('vmcustom');
            $dispatcher = JDispatcher::getInstance();
            $result = $dispatcher->trigger('plgVmOnClonePluginTable', array($row));
        }


So far tested that in my plugins.