I've tried to set $variable['title'] in MYMODULE_preprocess_page_title and it works only for the page title but not the browser title (in the title bar).

  • I don't see how is this the same question or I cannot understand the answer. I want to set the title in the title bar and the supposed duplication question is asking about caching when setting the view title. – Bishoy Nov 13 '17 at 14:24
  • You have to start with the question, there you'll find the hook you need to use. Caching is only if the title depends on other data as described in the answer. However, if this isn't the case, this means the title is static, then this is simply something you can set it in the views configuration, either in UI or in code (by modifying the views config entity or importing a YAML file). – 4k4 Nov 13 '17 at 15:03
  • Here you go, now you are answering my question :) Can you elaborate? Can you unmark the question as duplicate and answer me with example code or links to articles that explain what to do? Or at least mark as duplicate to another question that can have answers to my question? I understand guys you are experts and my questions are very silly and straight forward from your point of view, but that's why I put the questions here to learn right? – Bishoy Nov 14 '17 at 3:04
  • I got my answer from here: drupal.stackexchange.com/a/227583/54260 If interested, set that question to the duplicate. – Bishoy Nov 14 '17 at 3:27
  • Yes, this question (not only the one answer) is a good resource for the page title in general, though you asked specific about a view. – 4k4 Nov 14 '17 at 7:28

Browse other questions tagged or ask your own question.