data-method not recognized in Nav(X) widget

Hi,

I want to include a logout button within the main menu as submenu beneath the menu entry <username>. So I added




            ['label' => $userName, 'url' => ['/user/'.$id], 'options' => ['title' => yii::t('app', 'User's name')],

                'items' => [

                    ['label' => yii::t('app', 'Logout'),

                        'url' => '/user/security/logout',

                        'options' => ['title' => yii::t('app', 'Logging out from the application')],

                        'template' => '<a href="{url}" data-method="post" title="{title}">{label}</a>'],

                ],



So at runtime it throws an error "Method Not Allowed. This url can only handle the following request methods: POST." which works well in a menu not created by the Nav nor the NavX widget. Looking at the created HTML I see that the


data-method="post"

not has been created, instead the created HTML looks like this:


<a href="/user/security/logout" tabindex="-1">Logout</a>

What has to be done to put the


data-method="post"

into the generated HTML?

Thanks for any help.