true ], $config ); // Parent constructor parent::__construct( $config ); // Initialization $this->name = $name; $this->label = $config['label'] ?? null; $this->tabItemConfig = $config['tabItemConfig'] ?? []; $this->addClasses( [ 'oo-ui-tabPanelLayout' ] ); $this->setAttributes( [ 'role' => 'tabpanel', ] ); } public function getConfig( &$config ) { $config['name'] = $this->name; $config['label'] = $this->label; if ( !empty( $this->tabItemConfig ) ) { $config['tabItemConfig'] = $this->tabItemConfig; } // scrollable default has changed to true if ( !$this->hasClass( 'oo-ui-panelLayout-scrollable' ) ) { $config['scrollable'] = false; } else { unset( $config['scrollable'] ); } return parent::getConfig( $config ); } public function getName() { return $this->name; } public function getTabItemConfig() { return $this->tabItemConfig; } public function setTabItem( $tabItem ) { $this->tabItem = $tabItem; $this->setupTabItem(); return $this; } public function setupTabItem() { // TODO: Set aria-labelledby/aria-controls as in .js if ( $this->label ) { $this->tabItem->setLabel( $this->label ); } return $this; } public function getLabel() { return $this->label; } public function setActive( $active ) { $this->active = $active; $this->removeClasses( [ 'oo-ui-tabPanelLayout-active' ] ); if ( $active ) { $this->addClasses( [ 'oo-ui-tabPanelLayout-active' ] ); } } }