Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Process / Search.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Process\Search.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Process;
8
9 use Drupal\bootstrap\Annotation\BootstrapProcess;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\Core\Form\FormStateInterface;
12
13 /**
14  * Processes the "search" element.
15  *
16  * @ingroup plugins_process
17  *
18  * @BootstrapProcess("search")
19  */
20 class Search extends ProcessBase implements ProcessInterface {
21
22   /**
23    * {@inheritdoc}
24    */
25   public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
26     $element->setProperty('title_display', 'invisible');
27     $element->setAttribute('placeholder', $element->getProperty('placeholder', $element->getProperty('title', t('Search'))));
28     if (!$element->hasProperty('description')) {
29       $element->setProperty('description', t('Enter the terms you wish to search for.'));
30     }
31   }
32
33 }