Back to RouterView class

Method detachRule

public bool
detachRule
(\Joomla\CMS\Component\Router\Rules\RulesInterface $rule)
Remove a build rule
Parameters
  • \Joomla\CMS\Component\Router\Rules\RulesInterface $rule The rule to be removed.
Returns
  • bool Was a rule removed?
Since
  • 3.5
Class: RouterView
Project: Joomla

Method detachRule - Source code

/**
 * Remove a build rule
 *
 * @param   RulesInterface  $rule  The rule to be removed.
 *
 * @return   boolean  Was a rule removed?
 *
 * @since   3.5
 */
public function detachRule(RulesInterface $rule)
{
    foreach ($this->rules as $id => $r) {
        if ($r == $rule) {
            unset($this->rules[$id]);
            return true;
        }
    }
    return false;
}