本文整理匯總了PHP中yii\bootstrap\Tabs::counter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tabs::counter方法的具體用法?PHP Tabs::counter怎麽用?PHP Tabs::counter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\bootstrap\Tabs
的用法示例。
在下文中一共展示了Tabs::counter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIds
/**
* Each tab should have a corresponding unique ID
*
* @see https://github.com/yiisoft/yii2/issues/6150
*/
public function testIds()
{
Tabs::$counter = 0;
$out = Tabs::widget(['items' => [['label' => 'Page1', 'content' => 'Page1'], ['label' => 'Dropdown1', 'items' => [['label' => 'Page2', 'content' => 'Page2'], ['label' => 'Page3', 'content' => 'Page3']]], ['label' => 'Dropdown2', 'items' => [['label' => 'Page4', 'content' => 'Page4'], ['label' => 'Page5', 'content' => 'Page5']]]]]);
$page1 = 'w0-tab0';
$page2 = 'w0-dd1-tab0';
$page3 = 'w0-dd1-tab1';
$page4 = 'w0-dd2-tab0';
$page5 = 'w0-dd2-tab1';
$shouldContain = ['w0', "#{$page1}", 'w1', "{$page2}", "{$page3}", 'w2', "#{$page4}", "#{$page5}", "id=\"{$page1}\"", "id=\"{$page2}\"", "id=\"{$page3}\"", "id=\"{$page4}\"", "id=\"{$page5}\""];
foreach ($shouldContain as $string) {
$this->assertContains($string, $out);
}
}