Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gantry causing menu error: Undefined index: parent_id #3012

Closed
nhopkinbrc opened this issue Feb 25, 2022 · 4 comments
Closed

Gantry causing menu error: Undefined index: parent_id #3012

nhopkinbrc opened this issue Feb 25, 2022 · 4 comments

Comments

@nhopkinbrc
Copy link

Gantry is causing an error on my wordpress website and the menus won't work because of it. www.suncrestcare.com/
The error is: Undefined index: parent_id
I've turned off all plugins. I've updated php, wordpress, the theme, and all plugins. Please help.
Screenshot 2022-02-24 090229
Screenshot 2022-02-24 085355
Screenshot 2022-02-24 085218

@mahagr
Copy link
Member

mahagr commented Feb 25, 2022

Can you please check the XHR (.json) responses, there may be more information about the error, especially if you have enabled debugging (and development mode in gantry) on the site. I need the file and line number where that happens.

Thank you!

@mahagr mahagr self-assigned this Feb 25, 2022
@nhopkinbrc
Copy link
Author

nhopkinbrc commented Feb 25, 2022

I wish I knew how to do what you are asking.

Does this help? It's what I get when I turn on debugging in Gantry.

An exception has been thrown during the rendering of a template ("Undefined index: parent_id").
Previous exceptions
Undefined index: parent_id (8)

Twig\Error\RuntimeError thrown with message "An exception has been thrown during the rendering of a template ("Undefined index: parent_id")."

Stacktrace:
#41 Twig\Error\RuntimeError in /home3/suncres2/public_html/wp-content/plugins/gantry5/engines/nucleus/particles/menu.html.twig:2
#40 Whoops\Exception\ErrorException in /home3/suncres2/public_html/wp-content/plugins/gantry5/src/classes/Gantry/Framework/Menu.php:349
#39 Gantry\Component\Whoops\SystemFacade:handleError in /home3/suncres2/public_html/wp-content/plugins/gantry5/src/classes/Gantry/Framework/Menu.php:349
#38 Gantry\Framework\Menu:bindMenuItems in /home3/suncres2/public_html/wp-content/plugins/gantry5/src/classes/Gantry/Framework/Menu.php:532
#37 Gantry\Framework\Menu:getList in /home3/suncres2/public_html/wp-content/plugins/gantry5/src/classes/Gantry/Component/Menu/AbstractMenu.php:316
#36 Gantry\Component\Menu\AbstractMenu:instance in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:702
#35 Twig\Template:getAttribute in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/ac/ac89819663998a3b32721053599aee0f9b660edc2aed443625ad85975bf3c809.php:32
#34 __TwigTemplate_cf7a47cb19cdb73bc1a1a288e21f2b9f325979cdcf67c747183d2b3227231325:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#33 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#32 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/d8/d8110aafdfae75d31ab8d73f8e50e8d49e9ee49990bff7ba6d248ea5debb9257.php:85
#31 __TwigTemplate_9436965b5f6129c1081d3337d0363fe62c46153153a6fbef79226549b1bb6f10:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#30 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#29 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/3b/3b267ca8faedb7585887e84994e5a440bb0714833b4f7f5cd563c53c92419a91.php:75
#28 __TwigTemplate_3d1ac815ae5d2e91f7b11832138f1b3afb594833be4e37b9adb4f87419e999ed:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#27 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#26 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/79/7902a58afee7b12767b84c06fdb7e2b0cbe6f83704b82ef8ad9f3fba15903f97.php:58
#25 __TwigTemplate_cfa32ec2eaac93b828ac2936247e5b286e98a7c21d652383aa2885e671dc3472:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#24 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#23 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/a6/a665ece45cbf598548049120ff67c218a14fb035b19934728044ab81bc5ede1f.php:71
#22 __TwigTemplate_f6795ad20be3a93af6b6b88c4f6fe5697d53ae06cf1656d899538a8347cb0ccd:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#21 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#20 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/d1/d1895a339a151420514174f4871ce8c2e0033c2319655e841b76926dc491d452.php:201
#19 __TwigTemplate_6ad24e54850d53ecae7b3f4160010fc4ed5cda7d910b132907d822d7f0537440:block_page_layout in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:214
#18 Twig\Template:displayBlock in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/d1/d1895a339a151420514174f4871ce8c2e0033c2319655e841b76926dc491d452.php:88
#17 __TwigTemplate_6ad24e54850d53ecae7b3f4160010fc4ed5cda7d910b132907d822d7f0537440:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#16 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#15 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/05/050e607f45c1058d5b1424d70f7b75195275513ad47f39ce942a3cd2378715c3.php:36
#14 __TwigTemplate_164e6d3a472506c5a9af58a95a0e98930d600ac0431b4c32e5ed3d30918cc6e2:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#13 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#12 Twig\Template:display in /home3/suncres2/public_html/wp-content/cache/gantry5/rt_galatea/twig/05/05392f29f6ab09dfd66741d038220a248d19a2d44c8e0ad749a34dc9f32780f6.php:40
#11 __TwigTemplate_8b140b353f58dffcad7f5491b6360ed7d291ee8e926f1825c201dfb9e8a0bb7c:doDisplay in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:453
#10 Twig\Template:displayWithErrorHandling in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:420
#9 Twig\Template:display in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/Template.php:432
#8 Twig\Template:render in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/twig/twig/src/TemplateWrapper.php:47
#7 Twig\TemplateWrapper:render in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/timber/timber/lib/Loader.php:79
#6 Timber\Loader:render in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/timber/timber/lib/Timber.php:334
#5 Timber\Timber:compile in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/timber/timber/lib/Timber.php:383
#4 Timber\Timber:fetch in /home3/suncres2/public_html/wp-content/plugins/gantry5/vendor/timber/timber/lib/Timber.php:410
#3 Timber\Timber:render in /home3/suncres2/public_html/wp-content/themes/rt_galatea/page.php:39
#2 include in /home3/suncres2/public_html/wp-includes/template-loader.php:106
#1 require_once in /home3/suncres2/public_html/wp-blog-header.php:19
#0 require in /home3/suncres2/public_html/index.php:17
{% try %}
    {% set menu = gantry.menu.instance(particle) %}
{% catch %}
    <div class="alert alert-error">{{ e.getMessage }}</div>
{% endtry %}
 
{% macro getCustomWidth(item, menu, mode, dropdown_type, start_level) -%}
    {%- if (item.width|default('auto') != 'auto') and not (dropdown_type == 'fullwidth' and item.level > start_level) -%}
        {%- if mode == 'item' %} style="position: relative;"
        {%- elseif mode == 'submenu' %} style="width:{{ item.width }};" data-g-item-width="{{ item.width }}"
        {%- endif %}
    {%- endif %}
{%- endmacro %}
 
{% macro displayParticle(item, context) %}
    {% try %}
    {% set in_particle = (context.in_particle ?? 0) + 1 %}
    {% if in_particle > 5 %}
        {% throw 500 'Particle loop detected' %}
    {% endif %}
 
    {% set context = context|merge({ particle: item.options.particle, in_particle: in_particle}) %}
    {% set classes = item.options.block.class %}
    <div class="menu-item-particle{{ classes ? ' ' ~ classes }}">
        {% include ['particles/' ~ item.particle ~ '.html.twig', '@particles/' ~ item.particle ~ '.html.twig']
        ignore missing with context only %}
    </div>
    {% catch %}
        <div class="alert alert-error">{{ e.getMessage }}</div>
    {% endtry %}
{% endmacro %}
 
{% macro displayTitle(item) %}
    {% if not item.icon_only or not (item.image or item.icon) %}
        <span class="g-menu-item-title">{{ item.title }}</span>
        {% if item.subtitle %}
            <span class="g-menu-item-subtitle">{{ item.subtitle }}</span>
        {% endif %}
    {% endif %}
{% endmacro %}

@mahagr
Copy link
Member

mahagr commented Feb 28, 2022

@nhopkinbrc Thanks, I got just what I needed to fix the issue. Can you try the fix using CI build from https://gantry.org/downloads#ci-builds , just make sure you take the WP version of the plugin.

@nhopkinbrc
Copy link
Author

That fixed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants