0

I am really not sure how to create the block class Pmm\PmmLayout\Block\Head , function of which $block->getAllPagesJSContent() should be called inside my phtml file pmm_head.phtml

   <referenceBlock name="head.additional">
        <block class="Perfectmirrors\PmmLayout\Block\Head" name=""pmm_head" before="-" template="Pmm_Pmmlayout::pmm_head.phtml"/>
    </referenceBlock>

In the phtml file pmm_head.phtml, I should be able to do something like below to read the contents from a JS file.

$block->getAllPagesJSContent() to output the contents.
  • So where is the actual question ? are you asking how to achieve this on a cleaner way like described above ? Are you able to modify both JS files, or just custom-1.js ? – Ekk4rd May 11 at 15:48
  • thanks for the comment. I edited the question a I moved further in the design. My only question now is whether one should do this under app/code or app/design? – CodeForGood May 11 at 19:01
0

Replace this line :

<block class="Perfectmirrors\PmmLayout\Block\Head" name=""pmm_head" before="-" template="Pmm_Pmmlayout::pmm_head.phtml"/>

By

<block class="Perfectmirrors\PmmLayout\Block\Head" name="pmm_head" before="-" template="Perfectmirrors_Pmmlayout::pmm_head.phtml"/>

If the error does not resolve then please share your block file (Perfectmirrors\PmmLayout\Block\Head)

Thanks

| improve this answer | |

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.