-2

I have created a sub-theme using a purchased theme. While creating sub-theme I followed these steps as mentioned in the documentation:

  1. I have created subtheme.info.yml and subtheme.libraries.yml files.
  2. I have also copied regions to subtheme.info.yml file from basetheme.info.yml.
  3. Then created context as it was there on base theme.

Now everything is working fine but main navigation and footer links are not showing. I also confirmed the position of each block in "Block layout".

I am new to drupal so not getting how to solve this issue. I am using drupal 8.6.1

EDIT 1

Here are some images get idea about the issue:

Headers

enter image description here Above screenshot is from parent theme as a default.

enter image description here Above screenshot is from sub-theme. Here you can see the nav links and logo text link is missing

Same with footers:

enter image description here Footer parent theme

enter image description here Footer sub-theme. Links/Blocks missing.

yml files

Subtheme: https://pastebin.com/KmhD2BSh

Parent Theme: https://pastebin.com/T1XQq8T8

EDIT 2

subtheme.theme

(I picked it from official resource but added after the subtheme was set as default)

/**
 * Implements hook_theme_suggestions_HOOK_alter for blocks.
 */
function subtheme_theme_suggestions_block_alter(&$suggestions, $variables) {

  // Load theme suggestions for blocks from parent theme.
  foreach ($suggestions as &$suggestion) {
    $suggestion = str_replace('subtheme', 'virgor', $suggestion);
  }
}

EDIT 3

I noticed all the links on navigation bar including logo text link is showing on other pages like contact, blog but the styling is not getting applied to them. And getting this error inside console:

js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2062 Uncaught Error: Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="node/5/uid/en/teaser"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="node/5"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.
    at processField (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2062)
    at HTMLSpanElement.<anonymous> (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2179)
    at Function.each (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2)
    at r.fn.init.each (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2)
    at Object.attach (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:2178)
    at js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:62
    at Array.forEach (<anonymous>)
    at Object.Drupal.attachBehaviors (js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:59)
    at js_XPobW92vm-QdWeFPYokxAO-5aOHsW7b5uAqFwCBjrZM.js:244
    at HTMLDocument.t (js_BKcMdIbOMdbTdLn9dkUq3KCJfIKKo2SvKoQ1AnB8D-g.js:4)

EDIT 4

I enabled template debug and found that main navigation block was not automatically placed as it is in parent so I place it but still site_branding block is not placed by default and there is no region to place it.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Clive Oct 15 '18 at 10:29
  • Have you find any solution – Naveen Oct 15 '18 at 10:35
  • Why downvotes when nobody had a clue about what could be the problem? This question follows the community guidelines and this issue could be faced by many newbie drupal theme developer. – Sagar Guhe Oct 14 at 13:07
2
+25

Here are some suggestions:

  1. Check that you added the same theme regions in your child theme as the parent theme
  2. Check the documentation of the parent theme for Drupal version compatibility. Usually purchased themes come with a demo that contains a Drupal installation. Try working with that first.
  3. Try disabling JS related core modules: BigPipe, Contextual Links, QuickEdit
  4. Try disabling JS aggregation from /admin/config/development/performance
  • thanks for your answer! but I have added the same regions as parent theme, I have added the pastebin links too, Parent theme is compatible with the version I am working on as Parent theme works perfectly. I have disabled JS aggregation cleared cache but no effect. – Sagar Guhe Oct 11 '18 at 16:45
0

After searching for longtime, waiting for an answer and many hair pulling events I finally found the solution...

  • Initially I was trying to compare admin/structure/context for sub-theme (enabled) homepage with parent theme (enabled) homepage and those conditions and reactions matched perfectly.
  • Then as Ismail Cherri mentioned in his answer I did all the checks but no avail.
  • Enabled twig template debug as @cchen mentioned in a comment. (It helped me lot to know how blocks and templates working).
  • Checked if all the blocks are enabled from admin/structure/Block Layout

Solution: Finally I got to know that parent theme had those missing blocks by default present that is why comparing homepage context with parent theme homepage made me confused. So adding them in a proper region solved the issue.

I still didn't get why those block were present on parent theme even when they were not placed in context. I will update my answer when I will get the explanation to that and will also check if this is the behaviour with this theme only or every themes reacts the same.

Update 1

I still didn't get why those block were present on parent theme even when they were not placed in context

So there was a context named "Global" which had condition current_theme and in reaction all the blocks that theme was providing was there. But when I created sub-theme and set it as default all those default contexts duplicated with no reaction and condition. So this was the main reason why Main Navigation and Footer Menu was missing in sub-theme and not in Parent theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.