문제

Is there any reason why template hints are not available in the global scope?

도움이 되었습니까?

해결책

There doesn't seem to be a good reason for it. I only ever enable this on dev platform where I'm happy to enable it globally anyway.

I wonder if it has anything to do with the fact that when you make the setting available in global scope (template_hints/show_in_default = 1 in Core/etc/system.xml), it also displays hints in the backend.

Although, fixing that is just a matter of a store ID condition in getShowTemplateHints(), so it's not like it was easier to disable it altogether in global scope.

다른 팁

nevvermind's comment above is correct. The app always runs in a store scope; for the admin area, this is store scope id 0, which is also used for the default scope. Because the Adminhtml blocks rely on Mage_Core_Block_Template::_fetchView() to render, they will have template path hints.

When you would like to have the option available in the admin, you only need an initialized module with a system.xml:

<?xml version="1.0"?>
<config>
    <sections>
        <dev>
            <groups>
                <debug>
                    <fields>
                        <template_hints>
                            <show_in_default>1</show_in_default>
                        </template_hints>
                        <template_hints_blocks>
                            <show_in_default>1</show_in_default>
                        </template_hints_blocks>
                    </fields>
                </debug>
            </groups>
        </dev>
    </sections>
</config>

Reason is as simple as that, a single instance of Magento can be used to host multiple websites.
If template path hints option were available on global level and you turned on the template path hints on global/default level to debug one of your Website. Then it will also turn template path hints for other websites running on the same instance of Magento, which is of course not a result you wanted to have?. And such kind of accidents can only be prevented if you set the template path hints on store view level.

Hope this makes some sense now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top