1. webstar
  2. RO CSVI
  3. Thursday, 10 March 2022
  4.  Subscribe via email
Hi, Ive run into a problem wrigin a custom rule - I think its user error but I cannot fathom the issue.
Ive taken a copy of the skip rule to get me started and Ive renamed everything as appropriate. But the rule is being triggered from elsewhere. What I mean is If I try to echo out the $plugin value within the run rule its not giving the expected value - its "csvimultireplace" instead of my custom name "csviscswap"

I'm not sure why its getting csvimultireplace as the rule I copied was actually the 'skip' rule.

so this new rule I'm trying to write is actualy triggering on Another field instead of the one its assigned to. weird

Just to clarify...


public function runRule($plugin, $settings, $field, $fields)
{
echo $this->id;
echo $plugin;

jexit();



returns

csviscswap & csvimultireplace... 2 different names



Ah - User Error. I see that the plugins run all the time? therefore I was trying to get the values of $plugin in the wrong place. ie outside the if statement when My actual plugin was called.

so should have been


public function runRule($plugin, $settings, $field, $fields)
{



if ($plugin === $this->id && !empty($settings))
{
echo $this->id;
echo $plugin;

jexit();

}}
Accepted Answer Pending Moderation
Hello,
Thats correct, you need a check in the plugin to run the specific code for rule. Glad to know that you figured it yourself.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!