Closed (works as designed)
Project:
Views (for Drupal 7)
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Feb 2008 at 15:23 UTC
Updated:
4 Feb 2008 at 16:43 UTC
I've been battering my head against this for hours now, clearing caches, stopping and starting web server, etc. This is just not working and it makes no sense. =(
I have even tried editing an item already visible on the views page to see if it changes - nothing! So frustrating! Could someone tell me what's wrong with this picture? This test item simply will *not* appear as an option under Views:
function whattalent_alpha_views_tables() {
$tables['node'] = array(
'name' => 'node',
'fields' => array(
'all_images' => array(
'name' => t('WhatTalent: Test field'),
'notafield' => true,
'help' => t('Display all node images in one field.'),
),
),
);
return $tables;
}
Comments
Comment #1
greg.harveyOk, trying to find out more. I'm expecting the hook_views_tables hook to expose a new item on the Fields select list when I Add/Edit a view. The reason I'm expecting this is I can't really find in the documentation specifically how it says you do this, but I chose a module (node_images) and searched for a string exposed through the Views interface.
So, I searched site-wide for the string "Node Images:", as it appears in the Fields: Add Field form item on the Add view page. This string only appears in ONE PLACE ... in _node_images_views_tables() within node_images.views.inc (which is called by node_images_views_table() in the actual module):
in the include:
and in the module:
Now, since this is THE ONLY PLACE THIS APPEARS IN THE CODE, I altered the string to something else, but nothing - it stayed the same. So I commented it out completely. Still appears.
Cleared the caches, truncating every cache table in the database. It's still there!
So I restarted my computer! Still it is the same! This is an evil issue.
Has anyone experienced this before? I can't believe I'm the only one, but this is driving me nuts.
Comment #2
merlinofchaos commentedYour problem is that you're trying to define a table that already exists. hook_views_tables is for defining new tables, not attempting to override old ones. The 'node' table is already defined.
If you really need to modify an existing table -- and it doesn't appear that you do -- try hook_views_tables_alter
But really, you should be using your own table name. Or a dummy table name.
Comment #3
greg.harveyThanks for the reply. Ok - that explains why my "test" example doesn't work.
However, I just edited post #1 - if you have time, I'd love to know what you think of that....
Comment #4
merlinofchaos commentedYou probably didn't truncate cache_views
And -- one issue per issue, please. It's way too difficult to follow multiple issues in the same thread.
Comment #5
greg.harveyRats, you're right. I have a script, but it was open in MySQL Query Browser and I accidently only ran one of the six lines. =(
Sorry about the issues, but this was my main problem - the other one was a spin-off from it...!