b868e3886fa7d96606029f7970ae88d16f4276c9
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / Components / Breadcrumbs / BreadcrumbTitle.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Setting\Components\Breadcrumbs;
4
5 use Drupal\bootstrap\Plugin\Setting\SettingBase;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * The "breadcrumb_title" theme setting.
11  *
12  * @ingroup plugins_setting
13  *
14  * @BootstrapSetting(
15  *   id = "breadcrumb_title",
16  *   type = "checkbox",
17  *   title = @Translation("Show current page title at end"),
18  *   description = @Translation("If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled."),
19  *   defaultValue = 1,
20  *   groups = {
21  *     "components" = @Translation("Components"),
22  *     "breadcrumbs" = @Translation("Breadcrumbs"),
23  *   },
24  * )
25  */
26 class BreadcrumbTitle extends SettingBase {
27
28   /**
29    * {@inheritdoc}
30    */
31   public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
32     $setting = $this->getSettingElement($form, $form_state);
33     $setting->setProperty('states', [
34       'invisible' => [
35         ':input[name="breadcrumb"]' => ['value' => 0],
36       ],
37     ]);
38   }
39
40 }