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