Skip to content

yii\bootstrap5\Navbar collapseOptions #312

@paulstorre

Description

@paulstorre

What steps will reproduce the problem?

NavBar::begin([
     'collapseOptions'=> false
]);

// content

NavBar::end();

What's expected?

Expecting rendered Bootstrap 5 navigation bar

What do you get instead?

yii\base\ErrorException

vendor/yiisoft/yii2-bootstrap5/src/NavBar.php at line 219

if ($this->offcanvasOptions !== false) {
    $bsData = ['bs-toggle' => 'offcanvas', 'bs-target' => '#' . $this->offcanvasOptions['id']];
    $aria = $this->offcanvasOptions['id'];
} else {
    // Trying to access array offset on false
    $bsData = ['bs-toggle' => 'collapse', 'bs-target' => '#' . $this->collapseOptions['id']];
    $aria = $this->collapseOptions['id'];
}

Additional info

Q A
Yii version 2.0.49.3
PHP version 8.3.2
Operating system macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions