Reputation: 41
How do I modify hooks of child theme? I use classic theme as parent.
This is theme.yml of child theme:
parent: classic
name: steel
display_name: steel
version: 1.0.0
assets:
use_parent_assets: false
global_settings:
hooks:
modules_to_hook:
newHook:
- ps_languageselector
image_types:
cart_default:
width: 125
height: 125
scope: [products]
small_default:
width: 98
height: 98
scope: [products, categories, manufacturers, suppliers]
medium_default:
width: 452
height: 452
scope: [products, manufacturers, suppliers]
home_default:
width: 250
height: 250
scope: [products]
large_default:
width: 800
height: 800
scope: [products, manufacturers, suppliers]
category_default:
width: 141
height: 180
scope: [categories]
stores_default:
width: 170
height: 115
scope: [stores]
As you see, I have overwritten hooks array of parent theme - removed all default and added new one I created. I also added hook tag to tpl file - {hook h='newHook'}
. (By the way, I also had to copy image_types array, otherwise there was error - do I also have to copy it? It's a little redundant)
The problem is - template doesn't change at all. In "positions" page in admin panel there are also all old hooks listed.
I tried to set shop to classic template and then set it back to child one to "reload" it - didn't help. I also used Reset to defaults
button.
I tried to also modify theme.yml of parent theme, also didn't changed anything.
Actualization:
I checked ps_hook db table and new hook is there. But as you see in config above, language selector should appear inside it. But it does not. It also appears on position admin page, but only when I check "Display non-positionable hooks".
And also - it won't work on parent theme - any modules assigned to new hook won't appear. Modifying old hooks works fine.
Upvotes: 0
Views: 1792
Reputation: 41
I found solution.
It seems that every hook displayed on frontend, needs to have name starting with display
. Mine wasnt like that.
Upvotes: 1