|
@@ -41,7 +41,16 @@ class Modal extends Widget
|
|
|
* @var string
|
|
|
*/
|
|
|
protected $size = '';
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $centered = '';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $scrollable = '';
|
|
|
/**
|
|
|
* @var array
|
|
|
*/
|
|
@@ -71,7 +80,29 @@ class Modal extends Widget
|
|
|
|
|
|
$this->class('modal fade');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置弹窗垂直居中.
|
|
|
+ *
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function centered()
|
|
|
+ {
|
|
|
+ $this->centered = 'modal-dialog-centered';
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置弹窗内容滚动
|
|
|
+ *
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function scrollable()
|
|
|
+ {
|
|
|
+ $this->scrollable = 'modal-dialog-scrollable';
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
/**
|
|
|
* 设置弹窗尺寸.
|
|
|
*
|
|
@@ -347,7 +378,7 @@ JS
|
|
|
{
|
|
|
return <<<HTML
|
|
|
<div {$this->formatHtmlAttributes()} role="dialog">
|
|
|
- <div class="modal-dialog modal-{$this->size}">
|
|
|
+ <div class="modal-dialog {$this->centered} {$this->scrollable} modal-{$this->size}">
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header">
|
|
|
<h4 class="modal-title">{$this->renderTitle()}</h4>
|