Giter Site home page Giter Site logo

yiisoft / yii2-bootstrap Goto Github PK

View Code? Open in Web Editor NEW
185.0 50.0 194.0 10.1 MB

Yii 2 Bootstrap 3 Extension

Home Page: http://www.yiiframework.com

License: BSD 3-Clause "New" or "Revised" License

PHP 99.49% Makefile 0.51%
yii yii2 bootstrap css bootstrap3 hacktoberfest

yii2-bootstrap's Introduction

Twitter Bootstrap Extension for Yii 2


This is the Twitter Bootstrap extension for Yii framework 2.0. It encapsulates Bootstrap 3 components and plugins in terms of Yii widgets, and thus makes using Bootstrap components/plugins in Yii applications extremely easy.

For license information check the LICENSE-file.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-bootstrap

or add

"yiisoft/yii2-bootstrap": "~2.0.0"

to the require section of your composer.json file.

Usage

For example, the following single line of code in a view file would render a Bootstrap Progress plugin:

<?= yii\bootstrap\Progress::widget(['percent' => 60, 'label' => 'test']) ?>

yii2-bootstrap's People

Contributors

andersonamuller avatar bwoester avatar cebe avatar creocoder avatar crtlib avatar egorpromo avatar ext4yii avatar gevik avatar gonimar avatar kartik-v avatar klimov-paul avatar lancecoder avatar larryullman avatar lucianobaraglia avatar mohorev avatar nineinchnick avatar pana1990 avatar pmoust avatar qiangxue avatar ragazzo avatar resurtm avatar rinatio avatar samdark avatar schmunk42 avatar sensorario avatar slavcodev avatar softark avatar suralc avatar tarasio avatar tonydspaniard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-bootstrap's Issues

Upgrade to Bootstrap 3.5

I accidentally updated to Bootstrap 3.5 - due to using sass bootstrap - and noticed they did fix a series of bugs.
Do you intend to add '3.5' '3.3.5' to composer.json ?

Navbar lack of personalization

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


In a project I use Navbar extensively and I found that it should be more generic, for example:

  • we should be able to set the the only the classes that we want to use, but it append allwais the navbar class (ie. Html::addCssClass($this->options, 'navbar'); )
  • it's impossible to remove the toggle button (ie. echo $this->renderToggleButton();). In some layouts we may have the toggle button in a different local.

The Navbar is a great class and works like a charm in the default bootstrap theme, but in custom layouts it is not generic enough to do it job.

Keep the good working guys ;)

BootstrapPluginAsset should not depend on BootstrapAsset

The BootstrapAsset dependency is already defined in app\assets\AppAsset where it can be overriden with a customized Bootstrap stylesheet.

Adding dependency in BootstrapPluginAsset is not only redundant, it prevents us from overriding the default Bootstrap in AppAsset.

bootstrap widget não mapeado: labels

We can have a widget to bootstrap label?

THE place to write this, for example:

´´
http://getbootstrap.com/components/#labels
´´

Could Write this:

echo Label::widget( [ 'Order Open', 'default' ] );
echo Label::widget( [ 'BlackFriday Day', 'primary' ] );
echo Label::widget( [ 'Vip Client', 'success' ] );

or

echo Label::widget([
[ 'Order Open', 'default' ],
[ 'BlackFriday Day', 'primary' ],
[ 'Vip Client', 'success' ]
]);

AS advantages I see:

1 - encapsulate another native bootstrap component as widget, avoiding use native code html / css / js expalhados the views.

2 - Item 1 provides the safety switch to bootstrap 4, 5 ... 10 for example, over the years, ensuring that almost no or little html the views, even q markup change of a label, as in this incapsulada component widget bootstrap package, we can develop and build perfect miegação processes.

3 - It is elegant views with little or no text html and css and js own, some thought could be a target almost did not write html, css and js in views, using the maximum YII2.x widgets API

4 - Even with something as trivial, encpsular alone is already an advantage is for compatibility, migration, and code views of beauty or simply by providing a more complete API.

Autohide alerts widget, new propert autohide

Autohide alerts widget, new propert autohide

I think the alerts are ideas to display flash messages, and other uses.

Could have a autohide property of the type that receives a whole number in seconds. By default could do a jquery fade or on the property autohide be of type array, which receives: Time in seconds and effect (hide, slide, fade ...)

Let me know the opnion of the community please!

Hugs You!

Bootstrap dropdown should have options for second level nav

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


The Bootstrap dropdown widget allows rendering multi-level navs, but hides them by default because the dropdown-menu class is added to sub menus, inherited from the parent options property. Although the docs mention adding your own styling to display them as you wish, they should not have this class, as it is inappropriate in this situation.

Either the dropdown widget should only allow one level of menu (not preferred in my opinion) or options should be available for sub menus.

We could either have a submenuOptions property that affects all sub menus, and/or a submenuOptions property in each items array to specify them individually for each sub menu. I can see pros and cons to both, but the second way is what the old class CMenu did, so it might be more consistent.

Static form controls

Migrated from yiisoft/yii2#1344

In case of so deep integration with Bootstrap 3 maybe it has sense to add support of form static controls because they are very close by markup to the regular form fields except the paragraph is used instead of the input? It should be useful when some attribute should be rendered as non-editable value.

add active class into li > dropdown

Yii2 don't added the class active into li > dropdown ....

don't add this active class when a children of the dropdown is active,
if some children of the dropdown is active, into dropdown Yii2 must to added this class, but don't work, i added this class how you can see at pic

screenshot_3

itemOptions doesn't work

This code works if I use yii\widgets\ActiveForm instead of yii\bootstrap\ActiveForm

    <?= $form->field($model, 'type')->radioList(Customer::getTypes(), [
        'itemOptions' => [
            'data-attribute' => 'test'
        ]
    ]) ?>

Installing composer dependencies for testing fails

I admit that I'm new to yii2 testing. So if I'm missing some documentation, please let me know.

I tried to get startet with unit testing for yii2-bootstrap. So I just cloned the forked repository and tried to install the required composer packages:

$ git clone [email protected]:mikehaertl/yii2-bootstrap.git
$ cd yii2-bootstrap
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package bower-asset/bootstrap could not be found in any version, there may be a typo in the package name.
  Problem 2
    - Installation request for yiisoft/yii2-bootstrap 2.0.x-dev -> satisfiable by yiisoft/yii2-bootstrap[2.0.x-dev].
    - yiisoft/yii2-bootstrap 2.0.x-dev requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> no matching package found.
  Problem 3
    - yiisoft/yii2 2.0.3 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.2 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.1 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 * -> satisfiable by yiisoft/yii2[2.0.0, 2.0.1, 2.0.2, 2.0.3].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Am I doing something wrong?

allow to set bower-asset/bootstrap specific version

since bower-asset/bootstrap v3.3.5, I have those weird warnings

Failed to decode downloaded font: /assets/edae1c82/fonts/glyphicons-halflings-regular.woff2
Failed to decode downloaded font: /assets/edae1c82/fonts/glyphicons-halflings-regular.woff
Failed to decode downloaded font: /assets/edae1c82/fonts/glyphicons-halflings-regular.ttf

turn out it involves some political issue which affects lot of people out there

twbs/bootstrap#16708
twbs/bootstrap#16359
twbs/bootstrap#16663

I really dont know how to make yii2-bootstrap use bower-asset/bootstrap v3.3.4, or even better, use the original bootstrap package twbs/bootstrap

for Collapse, tabs and other widgets that require label, let the key on the $items property be the label by default

For example:

echo Collapse::widget([
    'items' => [
        'Introduction' => 'This is the first collapsable menu',
        'Second panel' => [
            'content' => 'This is the second collapsable menu',
        ],
    ]   
])

would be the equivalent of

echo Collapse::widget([
    'items' => [
        [
            'label' => 'Introduction',
            'content' => 'This is the first collapsable menu',
        ],
        [
            'lable' => 'Second panel',
            'content' => 'This is the second collapsable menu',
        ],
    ]   
])

The patch is actually very simple, for example for the Tabs widget you only need to change the lines https://github.com/yiisoft/yii2-bootstrap/blob/master/Tabs.php#L155-159 to

            if (!is_string($key) && !array_key_exists('label', $item)) {
                throw new InvalidConfigException(
                    "The 'label' option is required."
                );
            }
            if (is_string($item)) {
                $item = ['content' => $item];
            }

            $label = is_string($key) ? $key : $item['label'];
            $encodeLabel = isset($item['encode'])
                ? $item['encode']
                : $this->encodeLabels;
            $label = $encodeLabel
                ? Html::encode($label)
                : $label;

Nav widget的activateParents需要优化(谁帮忙翻译?)

代码如下:

$menuLeftItems = [
        [
            'label' => '控制台',
            //注意,这儿没有url这个键名
            'items' => [
                [
                    'label' => '概要', 'url' => ['/site/index']
                ],
                [
                    'label' => '个人设置', 'url' => ['/site/profile']
                ],
                [
                    'label' => '插件', 'url' => ['/plugin']
                ],
                [
                    'label' => '外观', 'url' => ['/theme']
                ],
            ]
        ],
];
echo Nav::widget([
        'options' => [
            'activateParents' => true,
            'class' => 'navbar-nav navbar-left'
        ],
        'items' => $menuLeftItems,
    ]);

当父级没有url这个键名,设置了activateParents也没有用,需要加一个url=>[],但是url只能指定众多子节点的其中一个,所以选中其它子节点父级也没法高亮

Bootstrap/Tabs: remember active tabs

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


Just a feature request: config option to "remember" active tab in Tabs widget (to activate last opened tab after reloading the page).
It is not so hard to implement with application JS, but can be a feature of widget. We need to register just two event handlers:

  1. Set location.hash on tab click:
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
    location.hash = e.target.hash;
});

We need this because of https://github.com/twbs/bootstrap/blob/master/js/tab.js#L126
2. On document ready activate the tab:

$(document).ready(function() {
    if (location.hash.length) {
        $('[data-toggle="tab"], [data-toggle="pill"]').filter('[href="' + location.hash + '"]').tab('show');
    }
}

Documentation is not in sync with latest release

The class documentation is obviously created from the latest development branch of this extension. This leads to some confusion. For example I've read about the visible feature for yii\bootstrap\Tabs here:

http://www.yiiframework.com/doc-2.0/yii-bootstrap-tabs.html#$items-detail

So:

  1. Documentation should be for the latest stable release
  2. The above visible feature should get a note like "since 2.0.5" or similar.

On a sidenote I wonder, when the next release of this extension is planned.

suggest for yii\bootstrap\Nav

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


Nav is a great Widget!

i want to improve function isItemActive(),
then can support "range page" property, you can use:

Nav::widget([
    'items' => ['label' => 'Product', 'url' => ['product/index'], 'rangepage' => [['product/view']]],
])

and the improved function isItemActive():

protected function isItemActive($item)
{
    if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
        $route = $item['url'][0];
        if ($route[0] !== '/' && Yii::$app->controller) {
            $route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
        }

        if (!isset($item['rangepage'])) {
            if (ltrim($route, '/') !== $this->route) {
                return false;
            }
            unset($item['url']['#']);
            if (count($item['url']) > 1) {
                foreach (array_splice($item['url'], 1) as $name => $value) {
                    if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
                        return false;
                    }
                }
            }
        } else {
            if (ltrim($route, '/') == $this->route) {
                unset($item['url']['#']);
                if (count($item['url']) > 1) {
                    $_m = true;
                    foreach (array_splice($item['url'], 1) as $name => $value) {
                        if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
                            $_m = false;
                            break;
                        }
                    }
                    if ($_m) {
                        return true;
                    }
                } else {
                    return true;
                }
            }


            foreach ($item['rangepage'] as $rpitem) {
                $rproute = $rpitem[0];
                if ($rproute[0] !== '/' && Yii::$app->controller) {
                    $rproute = Yii::$app->controller->module->getUniqueId() . '/' . $rproute;
                }
                if (ltrim($rproute, '/') !== $this->route) {
                    continue;
                }

                $range_matched = true;
                foreach (array_splice($rpitem, 1) as $name => $value) {
                    if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
                        $range_matched = false;
                        break;
                    }
                }
                if ($range_matched) {
                    return true;
                }
            }

            return false;
        }

        return true;
    }

    return false;
}

Navbar brandLabel custom html

yii\bootstrap\Navbar R120

if ($this->brandLabel !== false) {
    Html::addCssClass($this->brandOptions, ['widget' => 'navbar-brand']);
    echo Html::a($this->brandLabel, $this->brandUrl === false ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions);
}

Is it possible to add an option to just print the brandLabel?
Now I can render a view with custom html

NavBar::begin([
    'options'    => [
        'class' => 'navbar navbar-default',
        'id'    => 'nav-first',
    ],
    'brandLabel' => Yii::$app->view->render('_brandLabel'),
]);

Bootstrap : display label in inline form

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


Actually if I want to display a label in an inline form, I have to do this :

<?php $form = ActiveForm::begin(['layout' => 'inline']); ?>
    <?= $form->field($model, 'field')->label(null,  ['class' => '']) ?>
<?php ActiveForm::end(); ?>

https://github.com/yiisoft/yii2-bootstrap/blob/2.0.5/ActiveField.php#L379

There should be a proper way to do this (same for enableError), no ?

NavBar Widget Toggle Button Doesn't Work

With the NavBar Widget in the NavBar::begin if you give it a class => ['navbar-inverse navbar-fixed-top']
the toggle button works on smaller screen for each label. But if you remove the class in the NavBar::begin the toggle button still appears but when you press it no action occurs when inspecting the element in google chrome you can see it is a button but you can't click on it to view your nav buttons.

yii\bootstrap\Nav makes dropdown for sub items even if there is no subitems

Code in view

<?= \yii\bootstrap\Nav::widget([
            'items' => $this->context->menu
        ]); ?>

menu:

[
    0 => [
        'label' => 'Test'
        'url' => '/portalpage/page/default?user_id=13&id=1'
        'items' => []
        'options' => [
            'class' => 'menu-item'
            'target' => '_self'
        ]
    ]
    1 => [
        'label' => 'За на�'
        'url' => '/portalpage/page/default?user_id=13&id=2'
        'items' => []
        'options' => [
            'class' => 'menu-item'
            'target' => '_self'
        ]
    ]
]

HTML

<ul id="w2" class="nav">
<li class="menu-item dropdown open" target="_self"><a class="dropdown-toggle" href="/portalpage/page/default?user_id=13&amp;id=1" data-toggle="dropdown" aria-expanded="true">Test <b class="caret"></b></a>
<ul id="w3" class="dropdown-menu"></ul></li>
<li class="menu-item dropdown" target="_self"><a class="dropdown-toggle" href="/portalpage/page/default?user_id=13&amp;id=2" data-toggle="dropdown">За нас <b class="caret"></b></a><ul id="w4" class="dropdown-menu"></ul></li>
</ul>

As you can see there are redundant dropdowns for empty subitems array

I think that in yii\bootstrap\Nav at line 185 the code should be

 if (is_array($items) && !empty($items)) {
...
}

instead of

 if (is_array($items)) {
....
}

Navbar Options Confusion

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


The way the options in the navbar is currently setup is very confusing. I have been working on modifying these containers just now and those options did my head in for a moment.

'containerOptions' => [ ],
'innerContainerOptions' => [ ],
'renderInnerContainer' => true,

As you can see in the image below the innerContainer is outside of container. I propose the containerOptions be changed to something like itemContainerOptions or something that separates it from that outer container that is actually innerContainer.

capture

Bootstrap Nav add options variable to sub items

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


Please add options to subitems so we could add class to sub ul tag.

if ($items !== null) {
            $linkOptions['data-toggle'] = 'dropdown';
            Html::addCssClass($options, 'dropdown');
            Html::addCssClass($linkOptions, 'dropdown-toggle');
            $label .= ' ' . Html::tag('b', '', ['class' => 'caret']);
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = Dropdown::widget([
                    'items' => $items,
                    'encodeLabels' => $this->encodeLabels,
                    'clientOptions' => false,
                    'options' => $options,
                    'view' => $this->getView(),
                ]);
            }
 }

Add submenuOptions property to `Dropdown`

Extracted from yiisoft/yii2#7427

A submenu options array adds flexibility to the dropdown, allowing custom attributes to be added to submenus.

The submenu should not have the class dropdown-menu. Having this class is incorrect as far as Bootstrap is concerned.

Bootstrap Collapse widget ignores parent option passed to clientOptions

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


According to the Bootstrap docs here the parent option is used to determine whether to hide others when some panel is opened. However, setting this with clientOptions would not give the expected behavior, because of the line 133 on widget.

'data-parent' => '#' . $this->options['id']

This is important specially if you want to stop panels collapsing when you expand others. Simply when you want to keep two or more panels opened.

More options for the Nav widget (and similar ones)

I focus on the Nav widget for being the more used, other widgets that can benefit from this are Carousel, Tabs, etc.

Currently Nav::$items is an array of items, I propose to have Nav::$itemConfig which will contain a default configuration for each item or several properties like Nav::$itemOptions, Nav::$linkOptions, Nav::$labelOptions etc.

Bootstrap ButtonGroup clientEvent not being assigned properly.

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


Hello

As stated here: http://getbootstrap.com/javascript/#dropdowns-events

All dropdown events are fired at the .dropdown-menu's parent element.

But parent container for widget is being rendered via Html::beginTag and we cannot assign any events to it with 'clientEvents' option.

        return implode("\n", [
            Html::beginTag($tag, $this->containerOptions),

Setting `active` to `false` has no effect in a Nav dropdown item

As title says, it is not possible to eliminate a dropdown item from being active. You have to specify an absolute url. Documentation is not clear on the active attribute in this scenario, and it IS possible to set active to true.

echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
    'activateParents' => true,
    'items' => [
        [
            'label' => 'Demo User',
            'url' => false,
            'visible' => !Yii::$app->user->isGuest,
            'items' => [
                [
                    'label' => 'My account',
                    'url' => ['account/overview'],
                    'active' => $controllerId == 'account', // This works
                ],
                [
                    'label' => 'Send feedback',
                    'url' => ['help/support/index'],
                    'active' => false, // This doesn't
                ],
                [
                    'label' => 'Logout',
                    'url' => ['login/logout']
                ],
            ],
        ],
    ],
]);

Icons feature

Can you provide simple way to insert a bootstrap glyphicon?

Putting long string "" in label is very unprofessional.

Take a look at these code:

            <?= Html::a('<span class="glyphicon glyphicon-print"></span> ' . Yii::t('app', 'Print'), ['print'], ['class' => 'btn']); ?>
            <?= ButtonDropdown::widget([
                'label' => '<span class="glyphicon glyphicon-print"></span> ' . Yii::t('app', 'Print'),
                'encodeLabel' => false,
                'dropdown' => [
                    'items' => [
                        ['label' => Yii::t('app', 'User')],
                        ['label' => '<span class="glyphicon glyphicon-envelope"></span> ' . Yii::t('app', 'Emails'), 'url' => ['print-emails']],
                        ['label' => '<span class="glyphicon glyphicon-home"></span> ' . Yii::t('app', 'Addresses'), 'url' => ['print-addresses']],
                        ['label' => '<span class="glyphicon glyphicon-earphone"></span> ' . Yii::t('app', 'Telephones'), 'url' => ['print-telephones']],
                    ],
                ],
                'options' => [
                    'class' => 'btn btn-info',
                ],
            ]); ?>

Dropdown Sub-menu /extensions/bootstrap/Nav

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


How do we disbale dropdown menu by this code:

if ($items !== null) {
            $linkOptions['data-toggle'] = 'dropdown';
            Html::addCssClass($options, 'dropdown');
            Html::addCssClass($linkOptions, 'dropdown-toggle');
            $label .= ' ' . Html::tag('b', '', ['class' => 'caret']);
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = Dropdown::widget([
                    'items' => $items,
                    'encodeLabels' => $this->encodeLabels,
                    'clientOptions' => false,
                    'view' => $this->getView(),
                ]);
            }
        }

And set the class for ul tag?

yii\bootstrap\Modal should render the modal HTML at the end of the page body

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


Scenario : I'm in a form (A), and I use yii\bootstrap\Modal to open a new form (B) used to add a new option in my dropDownList() located in A. (see attached screenshot for better understanding)

I want the modal toggle button to be displayed near the dropDownList(), so I go ahead and do :

echo $form->field($model, 'project_id')->dropDownList(ArrayHelper::map(Project::find()->all(), 'id', 'label'), ['prompt' => Yii::t('app', 'Select a project')]);
Modal::begin([
     'header' => '<b>' . Yii::t('app', 'Create new project') . '</b>',
     'toggleButton' => ['label' => '+', 'href' => Url::to(['/Bcontroller/ajaxCreate'])],
]);
Modal::end();

Problem : when generated, the B form will be nested in the A form, which brakes things.

Possible solution : a possible solution would be to render the toggleButton right away, as it is done now, but delay all the modal markup & content to View::EVENT_END_BODY, to make sure that if the modal contains a form, it won't be nested in an other one.

I'd cook a patch but I'm not sure how the modal content should be captured with Yii development guidelines. Please advise if a patch like this would be acceptable.

screen shot 2015-02-06 at 11 59 21 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.