Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Calling unknown method: kartik\detail\DetailView::initBsVersion() #187

Closed
2 of 10 tasks
strtob opened this issue Jan 9, 2022 · 6 comments
Closed
2 of 10 tasks
Labels

Comments

@strtob
Copy link

strtob commented Jan 9, 2022

Prerequisites

  • [ x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [ ]x The issue still exists against the latest master branch of yii2-detail-view.
  • [ ]x This is not an usage question. I confirm having gone through and read the documentation and demos.
  • [ x] This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • [ x] I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

  1. Install current dev-master version
  2. use detailview

Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting...

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • [ x] Linux
  • Mobile

Libraries

  • jQuery version:
  • yii2-detail-view version: dev-master

Isolating the problem

  • This bug happens on the demos page
  • [ x] The bug happens consistently across all tested browsers
  • This bug happens when using yii2-detail-view without other plugins.

I get the following error:

<pre>Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: kartik\detail\DetailView::initBsVersion()' 

in /opt/work/assetor/vendor/yiisoft/yii2/base/Component.php:300

Stack trace:
#0 /opt/work/assetor/vendor/kartik-v/yii2-detail-view/src/DetailView.php(816): yii\base\Component-&gt;__call()
#1 /opt/work/assetor/vendor/kartik-v/yii2-detail-view/src/DetailView.php(794): kartik\detail\DetailView-&gt;initWidget()
#2 /opt/work/assetor/vendor/yiisoft/yii2/base/BaseObject.php(109): kartik\detail\DetailView-&gt;init()
#3 [internal function]: yii\base\BaseObject-&gt;__construct()
#4 /opt/work/assetor/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass-&gt;newInstanceArgs()

I've taken a look into

protected function initWidget()

protected function initWidget()
    {
        $this->_msgCat = 'kvdetail';
        $this->pluginName = 'kvDetailView';
        $this->initBsVersion();
        $notBs3 = !$this->isBs(3);
        if ($notBs3) {
            Html::addCssClass($this->container, 'kv-container-bs4');
        }

and as far is I've understood, this must be definded in the interface

https://github.com/kartik-v/yii2-krajee-base/blob/master/src/BootstrapInterface.php

but it doesnt' :-/

@kartik-v
Copy link
Owner

kartik-v commented Jan 10, 2022

You need to update your packages via composer with all dependencies. You do not seem to have the latest release of dependencies like yii2-krajee-base which includes the various traits containing these methods which are shown on your app as missing.

@strtob
Copy link
Author

strtob commented Jan 10, 2022

Thanks a lot kartik!

I've tried to reinstall, incl. deps, also have installed manually via composer require "kartik-v/yii2-krajee-base": "dev-master" - without success :-/

@strtob
Copy link
Author

strtob commented Jan 10, 2022

...I've insert it here:

class DetailView extends YiiDetailView implements BootstrapInterface
{
    use WidgetTrait;
    use TranslationTrait;

    /**
     * @var string view mode for the detail view
     */
    const MODE_VIEW = 'view';

after translationTrait (use kartik\base\BootstrapTrait) which fix the problem...

@chmoth-yii
Copy link

chmoth-yii commented Jan 10, 2022

I am also encountering same issue. tried adding "BootstrapTrait" like @strtob suggested and the error is gone. attaching reference code.

class DetailView extends YiiDetailView implements BootstrapInterface
{
    use WidgetTrait;
    use TranslationTrait;
    use BootstrapTrait; <---Manually added. this is Missing in latest version dev-master (1.8.5) thus causing the error

@kartik-v But will you be making an official fix for this soon? or are we doing something wrong?

By the way, Hats Off to you for all the effort in making all these wonderful widgets and plugins! Much Appreciated! Cant Thank you Enough.

@kartik-v kartik-v added the bug label Jan 11, 2022
@kartik-v
Copy link
Owner

Thanks this will be updated.

@chmoth-yii
Copy link

Thankyou very much for this Quick Reponse!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants