function uikit_form_search_form_alter

8.x-3.x alter.inc uikit_form_search_form_alter(&$form, FormStateInterface $form_state, $form_id)
8.x-2.x alter.inc uikit_form_search_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)

File

includes/alter.inc, line 25
Modify structured content arrays.

Code

function uikit_form_search_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // SearchPageForm assigns a class to the help link as a string instead of an
  // an array. Let's fix that first.
  if (!is_array($form ['help_link']['#options']['attributes']['class'])) {
    $help_link_classes = explode(' ', $form ['help_link']['#options']['attributes']['class']);
    $form ['help_link']['#options']['attributes']['class'] = $help_link_classes;
  }

  // Now add some classes to the help link for better spacing below the search
  // input.
  $form ['help_link']['#options']['attributes']['class'][] = 'uk-display-inline-block';
  $form ['help_link']['#options']['attributes']['class'][] = 'uk-margin-small-top';
}

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Log in