backdrop-contrib / views_bootstrap

This module provides a set of styles for the Views module. It allows you to create responsive Bootstrap 3.x components, such as grids, carousels, tabs, and tables, all within the configuration settings of the powerful Views module.
https://backdropcms.org/project/views_bootstrap
GNU General Public License v2.0
0 stars 7 forks source link

Views Bootstrap Demo generating php notices #70

Open stpaultim opened 2 years ago

stpaultim commented 2 years ago

Enabling the views boostrap demo module is generating a bunch of PHP notices.

image

Here are the details for the first five of them.

Notice: Trying to get property 'settings' of non-object in node_object_prepare() (line 917 of /app/core/modules/node/node.module).
Notice: Trying to access array offset on value of type null in node_object_prepare() (line 917 of /app/core/modules/node/node.module).
Notice: Trying to get property 'settings' of non-object in node_object_prepare() (line 920 of /app/core/modules/node/node.module).
Notice: Trying to access array offset on value of type null in node_object_prepare() (line 920 of /app/core/modules/node/node.module).
Notice: Trying to get property 'settings' of non-object in node_object_prepare() (line 923 of /app/core/modules/node/node.module).

I first noticed this problem with the Recipe modules that I maintain. They are generating the same errors, which leads to the obvious conclusion that these notices are being generated during the creation of either content types or of demo nodes.

I don't recall getting these in the past, but I tested on version 1.21.0 of Backdrop CMS and got the same result. Not sure if this is a problem in core or if we need to improve the way we are creating content types or nodes.

stpaultim commented 2 years ago

I'm testing with one of my recipes and am pretty sure that the problem is the code being used to create nodes. I think this is the better way to create nodes and will not generate all those notices.

    $faq = new Node(
      array(
        'title' => st('How do I download more Backdrop recipes?'),
        'field_faq_answer' => array(
          LANGUAGE_NONE => array(
            array(
              'value' => st('<p>Recipes can be downloaded from BackdropCMS.org. On the module page <a href="https://backdropcms.org/modules?s=recipes">search for recipes</a>.</p>'),
              'format' => 'filtered_html',
            ),
          ),
        ),
        'uid' => 1,
        'status' => 1,
        'promote' => 0,
        'type' => 'faq',
      )
    );
    $faq->save();

I will try to submit a PR soon to fix this.

stpaultim commented 2 years ago

Just confirmed that this was the problem in my recipe. Working on a PR to fix this.