PHP Class macgyer\yii2materializecss\widgets\Modal

The following example will show the content enclosed between the \yii\base\Widget::begin()-detail) and \yii\base\Widget::end()-detail) calls within the modal window: php Modal::begin([ 'closeButton' => [ 'label' => 'Close modal', 'tag' => 'span' ], 'toggleButton' => [ 'label' => 'Open modal' ], 'modalType' => Modal::TYPE_BOTTOM_SHEET, ]); echo 'Say hello...'; Modal::end();
See also: http://materializecss.com/modals.html
Author: Christoph Erdmann ([email protected])
Inheritance: extends macgyer\yii2materializecss\lib\BaseWidget
显示文件 Open project: macgyer/yii2-materializecss

Public Properties

Property Type Description
$closeButton the options for rendering the close button tag. The close button is displayed in the header of the modal window. Clicking on the button will hide the modal window. If this is false, no close button will be rendered. The following special options are supported: - tag: string, the tag name of the button. Defaults to 'button'. - label: string, the label of the button. Defaults to '×'. The rest of the options will be rendered as the HTML attributes of the button tag. Please refer to the Modal plugin help for the supported HTML attributes.
$closeButtonPosition the position of the close button. The following options are supported: - beforeContent, right before the content, inside the container ".modal-content" - afterContent, right after the content, inside the container ".modal-content" - beforeFooter, right before the footer content, inside the container ".modal-footer" - afterFooter, right before the footer content, inside the container ".modal-footer" - precedeContainer, directly before the container ".modal-content" opens - succeedContainer, directly after the container ".modal-content" closes Defaults to "beforeContent".
$footer the content of the footer.
$footerOptions the optional HTML attributes for the footer container.
$modalType the different modal types. The following options are supported - lean (default) - fixedFooter - bottomSheet
$options the HTML attributes for the widget container tag. These special options are recognized: - tag: string, defaults to "div", the name of the container tag.
$toggleButton the options for rendering the toggle button tag. The toggle button is used to toggle the visibility of the modal window. If this property is false, no toggle button will be rendered. The following special options are supported: - tag: string, the tag name of the button. Defaults to 'button'. - label: string, the label of the button. Defaults to 'Show'. The rest of the options will be rendered as the HTML attributes of the button tag. Please refer to the Modal plugin help for the supported HTML attributes.

Public Methods

Method Description
init ( ) Initializes the widget.
run ( ) : string Executes the widget.

Protected Methods

Method Description
initDefaults ( ) Set inital default options.
renderCloseButton ( ) : null | string Renders the close button.
renderFooter ( ) : string Renders the Modal footer.
renderToggleButton ( ) : null | string Renders the Modal's toggle button.

Method Details

init() public method

Initializes the widget.
public init ( )

initDefaults() protected method

Set inital default options.
protected initDefaults ( )

renderCloseButton() protected method

Renders the close button.
See also: closeButton
protected renderCloseButton ( ) : null | string
return null | string the rendered result.

renderFooter() protected method

Renders the Modal footer.
protected renderFooter ( ) : string
return string the rendered markup of the footer.

renderToggleButton() protected method

Renders the Modal's toggle button.
See also: toggleButton
protected renderToggleButton ( ) : null | string
return null | string the rendered result.

run() public method

Executes the widget.
public run ( ) : string
return string the result of widget execution to be outputted.

Property Details

$closeButton public_oe property

the options for rendering the close button tag. The close button is displayed in the header of the modal window. Clicking on the button will hide the modal window. If this is false, no close button will be rendered. The following special options are supported: - tag: string, the tag name of the button. Defaults to 'button'. - label: string, the label of the button. Defaults to '×'. The rest of the options will be rendered as the HTML attributes of the button tag. Please refer to the Modal plugin help for the supported HTML attributes.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $closeButton

$closeButtonPosition public_oe property

the position of the close button. The following options are supported: - beforeContent, right before the content, inside the container ".modal-content" - afterContent, right after the content, inside the container ".modal-content" - beforeFooter, right before the footer content, inside the container ".modal-footer" - afterFooter, right before the footer content, inside the container ".modal-footer" - precedeContainer, directly before the container ".modal-content" opens - succeedContainer, directly after the container ".modal-content" closes Defaults to "beforeContent".
public $closeButtonPosition

$footerOptions public_oe property

the optional HTML attributes for the footer container.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $footerOptions

$modalType public_oe property

the different modal types. The following options are supported - lean (default) - fixedFooter - bottomSheet
See also: http://materializecss.com/modals.html
public $modalType

$options public_oe property

the HTML attributes for the widget container tag. These special options are recognized: - tag: string, defaults to "div", the name of the container tag.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $options

$toggleButton public_oe property

the options for rendering the toggle button tag. The toggle button is used to toggle the visibility of the modal window. If this property is false, no toggle button will be rendered. The following special options are supported: - tag: string, the tag name of the button. Defaults to 'button'. - label: string, the label of the button. Defaults to 'Show'. The rest of the options will be rendered as the HTML attributes of the button tag. Please refer to the Modal plugin help for the supported HTML attributes.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $toggleButton