-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
89 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,18 @@ | |
|
||
/** | ||
* Bootstrap 4 Active Field. | ||
* | ||
* | ||
* @author Basil Suter <[email protected]> | ||
*/ | ||
class ActiveField extends \yii\widgets\ActiveField | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
* @inheritdoc | ||
*/ | ||
public $hintOptions = ['class' => 'form-text text-muted']; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public $errorOptions = ['class' => 'form-control-feedback']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,32 +4,32 @@ | |
|
||
/** | ||
* Bootstrap 4 Active Form. | ||
* | ||
* | ||
* There are two types of layouts: | ||
* | ||
* | ||
* + default: Default layout with labels at the top of the fields. | ||
* + horizontal: Horizontal layout set the labels left to the fields. | ||
* | ||
* | ||
* @author Basil Suter <[email protected]> | ||
*/ | ||
class ActiveForm extends \yii\widgets\ActiveForm | ||
{ | ||
/** | ||
* @var string Using different style themes: | ||
* | ||
* + default: Default layout with labels at the top of the fields. | ||
* + horizontal: Horizontal layout set the labels left to the fields. | ||
*/ | ||
public $layout = 'default'; | ||
/** | ||
* @var string Using different style themes: | ||
* | ||
* + default: Default layout with labels at the top of the fields. | ||
* + horizontal: Horizontal layout set the labels left to the fields. | ||
*/ | ||
public $layout = 'default'; | ||
/** | ||
* @var string The error Summary alert class | ||
*/ | ||
public $errorSummaryCssClass = 'error-summary alert alert-danger'; | ||
/** | ||
* @inheritdoc | ||
*/ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public $fieldClass = 'luya\bootstrap4\ActiveField'; | ||
|
||
/** | ||
|
@@ -47,18 +47,18 @@ class ActiveForm extends \yii\widgets\ActiveForm | |
*/ | ||
public function init() | ||
{ | ||
if ($this->layout == 'horizontal') { | ||
$this->provideHorizontalLayout(); | ||
} | ||
parent::init(); | ||
if ($this->layout == 'horizontal') { | ||
$this->provideHorizontalLayout(); | ||
} | ||
parent::init(); | ||
} | ||
|
||
/** | ||
* Change the configuration of the active field and form based on the horizontal inputs. | ||
* | ||
* | ||
* Bootstrap 4 Example Output: | ||
* | ||
* | ||
* ```php | ||
* <div class="form-group row"> | ||
* <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> | ||
|
@@ -70,15 +70,15 @@ public function init() | |
*/ | ||
protected function provideHorizontalLayout() | ||
{ | ||
$this->options = ['class' => 'form-group row']; | ||
$this->fieldConfig = [ | ||
'options' => [ | ||
'class' => 'form-group row', | ||
], | ||
'labelOptions' => [ | ||
'class' => 'col-sm-2 col-form-label', | ||
], | ||
'template' => "{label}\n<div class=\"col-sm-10\">{input}\n{hint}\n{error}</div>", | ||
]; | ||
$this->options = ['class' => 'form-group row']; | ||
$this->fieldConfig = [ | ||
'options' => [ | ||
'class' => 'form-group row', | ||
], | ||
'labelOptions' => [ | ||
'class' => 'col-sm-2 col-form-label', | ||
], | ||
'template' => "{label}\n<div class=\"col-sm-10\">{input}\n{hint}\n{error}</div>", | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ class GridView extends \yii\grid\GridView | |
|
||
public $pager = ['class' => LinkPager::class]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters