diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /vendor/oojs/oojs-ui/php/layouts/PanelLayout.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'vendor/oojs/oojs-ui/php/layouts/PanelLayout.php')
-rw-r--r-- | vendor/oojs/oojs-ui/php/layouts/PanelLayout.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/oojs/oojs-ui/php/layouts/PanelLayout.php b/vendor/oojs/oojs-ui/php/layouts/PanelLayout.php new file mode 100644 index 00000000..64931374 --- /dev/null +++ b/vendor/oojs/oojs-ui/php/layouts/PanelLayout.php @@ -0,0 +1,61 @@ +<?php + +namespace OOUI; + +/** + * Layout that expands to cover the entire area of its parent, with optional scrolling and padding. + */ +class PanelLayout extends Layout { + /** + * @param array $config Configuration options + * @param boolean $config['scrollable'] Allow vertical scrolling (default: false) + * @param boolean $config['padded'] Pad the content from the edges (default: false) + * @param boolean $config['expanded'] Expand size to fill the entire parent element + * (default: true) + * @param boolean $config['framed'] Wrap in a frame to visually separate from outside content + * (default: false) + */ + public function __construct( array $config = array() ) { + // Config initialization + $config = array_merge( array( + 'scrollable' => false, + 'padded' => false, + 'expanded' => true, + 'framed' => false, + ), $config ); + + // Parent constructor + parent::__construct( $config ); + + // Initialization + $this->addClasses( array( 'oo-ui-panelLayout' ) ); + if ( $config['scrollable'] ) { + $this->addClasses( array( 'oo-ui-panelLayout-scrollable' ) ); + } + if ( $config['padded'] ) { + $this->addClasses( array( 'oo-ui-panelLayout-padded' ) ); + } + if ( $config['expanded'] ) { + $this->addClasses( array( 'oo-ui-panelLayout-expanded' ) ); + } + if ( $config['framed'] ) { + $this->addClasses( array( 'oo-ui-panelLayout-framed' ) ); + } + } + public function getConfig( &$config ) { + if ( $this->hasClass( 'oo-ui-panelLayout-scrollable' ) ) { + $config['scrollable'] = true; + } + if ( $this->hasClass( 'oo-ui-panelLayout-padded' ) ) { + $config['padded'] = true; + } + if ( !$this->hasClass( 'oo-ui-panelLayout-expanded' ) ) { + $config['expanded'] = false; + } + if ( $this->hasClass( 'oo-ui-panelLayout-framed' ) ) { + $config['framed'] = true; + } + $config['content'] = $this->content; + return parent::getConfig( $config ); + } +} |