file Search.php

Namespace

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

Classes

Name Description
Search Processes the "search" element.