Skip to content

NavBar class not easily extendable due to html in the init function #164

@yii-bot

Description

@yii-bot

This issue has originally been reported by @kanyuga at yiisoft/yii2#6689.
Moved here by @cebe.


The init function of the \yii\bootstrap\NavBar class has several lines of code that output html. Since every widget class should contain a call to parent::init(), this class cannot be easily extended since the html in the init function will also sent to the output. I encountered this problem while trying to extend the NavBar class to remove the div that wraps the individual menus.

A proposed solution is to move the bulk of the code in the init function into a separate function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions