mikrobi / babel

Babel is an Extra for MODx Revolution that creates linked documents across different contexts. The easy way for your multilingual site!
https://mikrobi.github.io/babel
GNU General Public License v2.0
59 stars 38 forks source link

Use modResource->duplicate instead of manually creating a copy in Babel->duplicateResource to support CRCs #151

Closed Mark-H closed 5 months ago

Mark-H commented 7 years ago

This code handles duplicating the resources for translation, however that causes issues with custom resource classes like SimpleCart.

SimpleCart stores some of its information (product code, price and image etc) in a separate table, and its custom resource class has an extended duplicate() method that takes care of copying that information across. Unfortunately, because Babel doesn't call the duplicate() method, users need to re-enter the product information on a translation.

Understandably Babel may do more with the resource copy than modResource->duplicate allows out of the box, but as that method returns the new resource I think it should still be possible to handle Babel stuff after a call to duplicate().

[Note to self: modmore support email 10888/10457/11220]

Mark-H commented 7 years ago

Alternatively perhaps Babel could fire a plugin event that CRCs can hook into to copy across their own stuff, that could also work.

JoshuaLuckers commented 2 years ago

@Mark-H Babel provides 3 events: