4 changed files with 81 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||||
|
mobile_facets.settings: |
||||||
|
path: '/admin/config/mobile_facets/settings' |
||||||
|
defaults: |
||||||
|
_form: '\Drupal\mobile_facets\Form\SettingsForm' |
||||||
|
_title: 'Mobile Facets Settings' |
||||||
|
requirements: |
||||||
|
_permission: 'administer site configuration' |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace Drupal\mobile_facets\Form; |
||||||
|
|
||||||
|
use Drupal\Core\Form\ConfigFormBase; |
||||||
|
use Drupal\Core\Form\FormStateInterface; |
||||||
|
|
||||||
|
/** |
||||||
|
* Configure Mobile Facets settings. |
||||||
|
*/ |
||||||
|
class SettingsForm extends ConfigFormBase { |
||||||
|
|
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
protected function getEditableConfigNames() { |
||||||
|
return ['mobile_facets.settings']; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function getFormId() { |
||||||
|
return 'mobile_facets_settings_form'; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* {@inheritdoc} |
||||||
|
*/ |
||||||
|
public function buildForm(array $form, FormStateInterface $form_state) { |
||||||
|
$config = $this->config('mobile_facets.settings'); |
||||||
|
|
||||||
|
$form['color'] = [ |
||||||
|
'#type' => 'color', |
||||||
|
'#title' => $this->t('Custom Color'), |
||||||
|
'#default_value' => $config->get('color') ?? '#000000', // Default to black if not set. |
||||||
|
'#description' => $this->t('Enter a hex color code for your module (e.g., #FF0000 for red).'), |
||||||
|
]; |
||||||
|
|
||||||
|
return parent::buildForm($form, $form_state); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue