accept = $config['accept'] ?? null; $this->multiple = $config['multiple'] ?? false; $this->placeholder = $config['placeholder'] ?? null; $this->button = $config['button'] ?? null; $this->icon = $config['icon'] ?? null; $this->droppable = $config['droppable'] ?? true; $this->buttonOnly = $config['buttonOnly'] ?? false; $this->showDropTarget = $config['showDropTarget'] ?? false; $this->thumbnailSizeLimit = $config['thumbnailSizeLimit'] ?? 20; // Traits $this->initializeRequiredElement( array_merge( [ 'indicatorElement' => null ], $config ) ); // Initialization $this->addClasses( [ 'oo-ui-selectFileInputWidget' ] ); $this->input->setAttributes( [ 'type' => 'file' ] ); if ( $this->multiple ) { $this->input->setAttributes( [ 'multiple' => '' ] ); } if ( $this->accept ) { $this->input->setAttributes( [ 'accept' => implode( ',', $this->accept ) ] ); } } /** @inheritDoc */ public function getConfig( &$config ) { if ( $this->accept !== null ) { $config['accept'] = $this->accept; } if ( $this->multiple !== null ) { $config['multiple'] = $this->multiple; } if ( $this->placeholder !== null ) { $config['placeholder'] = $this->placeholder; } if ( $this->button !== null ) { $config['button'] = $this->button; } if ( $this->icon !== null ) { $config['icon'] = $this->icon; } if ( $this->droppable !== null ) { $config['droppable'] = $this->droppable; } if ( $this->buttonOnly !== null ) { $config['buttonOnly'] = $this->buttonOnly; } if ( $this->showDropTarget !== null ) { $config['showDropTarget'] = $this->showDropTarget; } if ( $this->thumbnailSizeLimit !== null ) { $config['thumbnailSizeLimit'] = $this->thumbnailSizeLimit; } return parent::getConfig( $config ); } }