English 中文(简体)
第7号意见 3 致命错误: 不能获得受保护的财产
原标题:Drupal 7 Views 3 Fatal error: Cannot access protected property SelectQuery::$where

我在试图修改第7号判决第3号判决中的价值时,正在发现这一错误:

Fatal error: Cannot access protected property SelectQuery::$where in /Users/joe/Sites/sdgea/docroot/sites/all/modules/custom/sdge_video/sdge_video.module on line 275

Here is the code that is causing this:

function modulename_views_pre_execute(&$view) {
  if (is_numeric($term_no)) {
        // set the filter
    $view->filter[ tid ]->value[$term_no] = $term_no;
        // set the query
        $view->query->where[0][ conditions ][2][ value ] = $term_no;
        // set the build info
        $view->build_info[ query ]->where->conditions[0][ field ]->conditions[0][ field ]->conditions[2][ value ] = $term_no;
        //$view->build_info[ query ]->where->conditions[0][ field ]->conditions[0][ field ]->conditions[2][ value ] = $term_no; // <-- This line specifically is causing fatality.
  }
}

也许部分是D7的一些超人物体。 任何人对我如何在观点3(D7)中修改过滤器的价值持有任何看法。

此外,还要求回答为什么出现“受保护财产”的情况。 我是一位法典家。 我不想有任何保护!

提前感谢!

问题回答

这可能是很晚的,但你可以使用hook_views_query_alter加以修改。

function modulename_views_query_alter(&$views,&$query){
    //...rest of the code
    $query->where[0][ conditions ][2][ value ] = $term_no;
}




相关问题
Drupal Multi-language: Simple strings not translated

I m adding additional languages to a Drupal site that I m building. Getting the translation of content working is fairly easy using the Internationalisation module. Yet, simple things such as date ...

Setting up a WYSIWYG editor for Drupal site users [closed]

Looking through the Drupal contrib modules, and after a few Google searches, it becomes evident that there are any number of choices and combos available to set up a WYSIWYG editor in Drupal. I m ...

Change size of user/password login box

I don t know how to change the size of the login username/password boxes on the drupal site that I m trying to build. I m stumbling through the theming, and don t know where to find the file that ...

How does Drupal provide an edit/review/publish model?

How does Drupal support a means to update and review a website before it is published? Does it only allow you to preview a page at a time before you publish it or is there a way to create a site ...

Term for rotating header

I m looking for terminology that describes this behavior: The header of a web-page contains a different image every time you visit it. Update: It is not an advertisement, but images related to the ...

Has anyone checked out Drupal 7? [closed]

Has anyone checked out a copy of Drupal 7 yet? What do people think? I m pretty excited about the PDO and all of the designers I work with a very excited about the new admin interface/structure. Do ...

热门标签