I have a table defined as follows:

>
   $tables['table_name'] = array('name' => 'table_name',
                                  'join' => array('type' => 'inner',
                                                  'left' => array('table' => 'node', 'field' => 'nid'),
                                                  'right' => array('field' => 'nid')),
                                  'filters' => array('num' => array('name' => 'a number',
                                                        'help' => 'a number',
                                                        'operator' => 'views_handler_operator_gtlt',
                                                        'value' => 'integer'
                                                                    )
                                                     )
                                  );

When I select this field to add it as a filter, I consistently get this error message

Fatal error: Cannot use string offset as an array in ./includes/form.inc on line 676

I'm guessing that I don't have my array correctly defined, but from reading the docs and looking at other code, I can't see a problem.

Comments

merlinofchaos’s picture

Just leave off 'value' there -- if 'value' is set it is expected to be a form widget; it defaults to a basic textfield, which is what you want there.

gsally’s picture

Status: Active » Closed (fixed)

That worked. Thank you!

ankur’s picture

Status: Closed (fixed) » Active

I get the exact same error, except I want to be using integer. My table array looks like:

  $tables['chapter_blog'] = array(
    'name' => 'chapter_blog',
    
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'vid'
      ),
      'right' => array(
        'field' => 'vid'
      )
    ),
    
    'fields' => array(
      'chapter_nid' => array(
        'name' => t('Chapter: Chapter NID'),
        'help' => t('The NID of the chapter node with which this blog node is associated')
      )
    ),
    
    'filters' => array(
      'chapter_nid' => array(
        'name' => t('Chapter: chapter NID'),
        'help' => t('The NID of the chapter node with which this blog node is associated'),
        'value' => 'integer'
      )
    )
  );
merlinofchaos’s picture

Not to repeat myself, but:

if 'value' is set it is expected to be a form widget; it defaults to a basic textfield

KentBye’s picture

ankur: If that worked for you, then go ahead and mark the status of issue from fixed to closed.
Or re-activate it if you need more info.

KentBye’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.