How to add a placeholder to a form element using a twig template override I enabled twig debug and realized I needed to add block--search.html.twig to my theme.
Then I used dump(content) to see if I could add a placeholder to search input field

{% extends "core/modules/block/templates/block.html.twig" %}
{% block content %}
  {{ dump(content) }}
  {{ content }}
{% endblock %}


How can I change the content array and add a new '#placeholder'=>'bla' to the search input?

dump(content) returns something like this:

array (size=23)
  '#action' =&gt; string '/search/node' (length=24)
  '#method' =&gt; string 'get' (length=3)
  'keys' =&gt; 
    array (size=26)
      '#type' =&gt; string 'search' (length=6)
      '#title' =&gt; string 'Search' (length=6)
      ...
Altering forms in Drupal 8 is the same as in Drupal 7 - you have:


hook_form_alter()


  Perform alterations before a form is rendered.

hook_form_FORM_ID_alter()


  Provide a form-specific alteration instead of the global hook_form_alter().



Always use an alter/preprocess hook to change variables before they get to the template file, it's bad practice to change them once you're in the template file itself.