MIGX CMP: Fields render wrong path

Hej,
i updated a site from MODX 2.8.6 to 3.0.4. Everything works fine. I use the CMP from MIGX 3.0.2-beta1 to edit data from a custom database. The schema for this is updated to MODX3.

Now i only see three tabs and no fields when adding/editing items in the MIGX modal. So i discovered the code that in core/components/migx/model/migx/migx.class.php the getRenderDirectories() doesn’t get the right path for MODX3 TV fields. I added this path on line 2005 and it works now:

Here are the paths (absolute paths, striped at the begining for security reason) without my fix:

array(2) {
    [0]=> "/core/components/migx/elements/tv/input/"
    [9]=> "/core/components/redactor/elements/tvs/input/"
}

Is this a Bug from my Package, MODX or MIGX? Anyone discovered a similiar problem? Maybe @bruno17 have a solution :smiley:

When I test this on MODX 3, the path
.../core/src/Revolution/Processors/Element/TemplateVar/Renders/mgr/input/
gets correctly added to the list in the MODX function getRenderDirectories()


I don’t think it’s necessary to update the schema for existing custom packages.
Only when you want to parse the schema with MIGX in MODX 3, the schema has to be in version="3.0".

When I test this on MODX 3, the path
.../core/src/Revolution/Processors/Element/TemplateVar/Renders/mgr/input/
gets correctly added to the list in the MODX function getRenderDirectories()

Thank you @halftrainedharry. Is it a fresh Install or an upgrade from 2.x?

I don’t think it’s necessary to update the schema for existing custom packages.
Only when you want to parse the schema with MIGX in MODX 3, the schema has to be in version="3.0".

We use MIGX CMP to add the custom database fields – so it is necessary :smile_cat:

It’s a fresh installation, but this shouldn’t make a difference.
The MIGX code is the same for MODX 2.x and 3, and it runs the getRenderDirectories() function from the TV class (modTemplateVar) of the currently installed MODX version.

So I tested the upgrade, but couldn’t reproduce any issues:

  • I installed MODX 2.8.7
  • Created a custom package in MIGX with a custom table and the corresponding CMP to manage the data.
  • Upgraded to MODX 3.0.5 (using the extra “UpgradeMODX”) → The CMP for the custom table still works | getRenderDirectories() returns the correct paths.
  • Recreated the package in MIGX with the updated schema for MODX 3 → The custom CMP still works correctly.

Hej @halftrainedharry,
thanks a lot for your testing and help.

When i dump $renderDirectories in getRenderDirectories() i also get a wrong path. When dump $this->xpdo->getOption('processors_path') i get the old MODX 2.x path to the processors directory. So i looked in the config.inc.php and see that $modx_processors_path is wrong.

Changing $modx_processors_path = "core/src/Revolution/Processors/"; solved it.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.