target->addClasses( array( 'oo-ui-iconElement-icon' ) ); $this->setIcon( isset( $config['icon'] ) ? $config['icon'] : null ); } /** * Set icon name. * * @param string|null $icon Symbolic icon name * @chainable */ public function setIcon( $icon = null ) { if ( $this->icon !== null ) { $this->target->removeClasses( array( 'oo-ui-icon-' . $this->icon ) ); } if ( $icon !== null ) { $this->target->addClasses( array( 'oo-ui-icon-' . $icon ) ); } $this->icon = $icon; $this->element->toggleClasses( array( 'oo-ui-iconElement' ), (bool)$this->icon ); return $this; } /** * Get icon name. * * @return string Icon name */ public function getIcon() { return $this->icon; } public function getConfig( &$config ) { if ( $this->icon !== null ) { $config['icon'] = $this->icon; } return parent::getConfig( $config ); } }