by
KK » Wed Aug 21, 2019 5:27 pm
@brunosa, you are right; unlike most other editable regions, RR does not lend its render routine to overriding.
Also, the fact that <cms:repeatable> tag internally calls a a hidden editable region named '__repeatable' also complicates things a little.
That said, there are always way to get around things. Please try the following -
Place the following code in your 'addons/kfunctions.php' file:
- Code: Select all
$FUNCS->add_event_listener( 'init', function(){
global $FUNCS;
$FUNCS->udfs['__repeatable']['handler']='MyRepeatable';
});
class MyRepeatable extends Repeatable{
function _render( $input_name, $input_id, $extra='', $dynamic_insertion=0 ){
global $FUNCS, $CTX, $AUTH;
$html = parent::_render( $input_name, $input_id, $extra='', $dynamic_insertion );
return $html;
}
}
As you can see, we have defined our own class 'MyRepeatable' that extends the core 'Repeatable' class.
We are only interested in the _render() function - in the code above the function is simply calling the original core routine of its parent so should work exactly the same as before. You can instead, now copy/paste here the original code and tweak it to your liking.
This will keep all your changes isolated to your own class without needing to modify any core file.
Hope this helps.