XF 2.2 Usage of xf:delete

TheAge

New member
Hi,

I know the official way of XF is to check the source code and copy paste it on good luck till it works and than you maybe understand it. But this time this isn't enough.

I'm trying to use a xf:delete element. That's how I'm using it:
HTML:
<xf:delete href="{{ link('module/delete', $rule) }}" />

It gets to the desired function, but $params is empty. This is the function:
PHP:
    public function actionDelete(ParameterBag $params)
    {
        $rule = $this->assertRuleExists($params->rule_id);

        /** @var \XF\ControllerPlugin\Delete $plugin */
        $plugin = $this->plugin('XF:Delete');
        return $plugin->actionDelete(
            $rule,
            $this->buildLink('module/delete', $rule),
            $this->buildLink('module/edit', $rule),
            $this->buildLink('module'),
            $rule->name
        );
    }

I just copied the code of one of the many files that are using the same code. How do I get the rule_id into $params?
Yes, $rule inside the template is filled (I'm showing the other data without any problems).
Yes, I named the "title" attribute "name".
 

asprin

Active member
Glad that you were able to sort it out. And thanks to you, I now know about xf:delete tag. You learn something new everyday. Thanks for that.
 
Top