Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bootstrap_horizontal_tabs
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
bootstrap_horizontal_tabs
Merge requests
!13
Issue
#3397732
: Configuration option to set which version of Bootstrap is being used
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Issue
#3397732
: Configuration option to set which version of Bootstrap is being used
bootstrap_horizontal_tabs-3397732-config
into
2.x
Overview
0
Commits
1
Pipelines
0
Changes
3
Closed
mmarler
requested to merge
bootstrap_horizontal_tabs-3397732-config
into
2.x
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Compare
2.x
2.x (base)
and
latest version
latest version
e52ee949
1 commit,
1 year ago
3 files
+
110
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/Form/BaseConfigurationForm.php
0 → 100644
+
98
−
0
Options
<?php
namespace
Drupal\bootstrap_horizontal_tabs\Form
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Entity\EntityTypeManager
;
use
Drupal\Core\Form\ConfigFormBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Configure settings for the utnews module.
*/
class
BaseConfigurationForm
extends
ConfigFormBase
{
/**
* The Config Factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected
$configFactory
;
/**
* The EntityTypeManager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
protected
$entityTypeManager
;
/**
* Class constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration object factory.
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* The entity type manager.
*/
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
EntityTypeManager
$entity_type_manager
)
{
parent
::
__construct
(
$config_factory
);
$this
->
entityTypeManager
=
$entity_type_manager
;
$this
->
configFactory
=
$config_factory
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'config.factory'
),
$container
->
get
(
'entity_type.manager'
)
);
}
/**
* {@inheritdoc}
*/
public
function
getFormId
()
{
return
'bootstrap_horizontal_tabs_general_config'
;
}
/**
* {@inheritdoc}
*/
protected
function
getEditableConfigNames
()
{
return
[];
}
/**
* {@inheritdoc}
*/
public
function
buildForm
(
array
$form
,
FormStateInterface
$form_state
)
{
$map
=
[
'3'
=>
'0'
,
'4'
=>
'1'
,
'5'
=>
'2'
];
$version
=
$this
->
config
(
'bootstrap_horizontal_tabs.settings'
)
->
get
(
'version'
);
$form
[
'intro'
][
'#markup'
]
=
$this
->
t
(
'<p>Please select your Bootstrap verion.</p>'
);
$form
[
'version'
]
=
[
'#title'
=>
''
,
'#type'
=>
'radios'
,
'#options'
=>
[
$this
->
t
(
'Bootstrap 3'
),
$this
->
t
(
'Bootstrap 4'
),
$this
->
t
(
'Bootstrap 5'
),
],
'#default_value'
=>
$map
[
$version
],
];
return
parent
::
buildForm
(
$form
,
$form_state
);
}
/**
* {@inheritdoc}
*/
public
function
submitForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
$map
=
[
'0'
=>
'3'
,
'1'
=>
'4'
,
'2'
=>
'5'
];
$config
=
$this
->
configFactory
->
getEditable
(
'bootstrap_horizontal_tabs.settings'
);
$config
->
set
(
'version'
,
$map
[
$form_state
->
getValue
(
'version'
)])
->
save
();
drupal_flush_all_caches
();
parent
::
submitForm
(
$form
,
$form_state
);
}
}
Loading