Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be cool, if the query builder plugin could define some options. As example you could store the amazon api key there.
This is the first NOT WORKING version.
Comment | File | Size | Author |
---|---|---|---|
#41 | views_621142-39.patch | 740 bytes | linclark |
#34 | views_621142-16_2_0.patch | 13.34 KB | dawehner |
#33 | views_621142-16_2_0.patch | 11.36 KB | dawehner |
#32 | views_621142-16_2.patch | 10.21 KB | merlinofchaos |
#29 | views_621142-16.patch | 10.07 KB | dawehner |
Comments
Comment #1
dawehnerThe problem with the current patch, the method option_definition has to be fired and the options has to be stored after submit
Comment #2
dawehnerJust some ideas: Move groupby-settings, distinct ... into the query builder settings. Thats sure not supported by every query builder plugin.
Comment #3
dawehnerRerole the patch. No progress else.
Comment #4
seehawk CreditAttribution: seehawk commentedIs this issue still a planned part of this patch?
http://drupal.org/node/548104
Thanks!
Comment #5
dawehnerIt is planned, but i don't had time to develop it.... you could help coding it
Comment #6
seehawk CreditAttribution: seehawk commentedIf I was a better coder, I would. :-) I'll be happy to help test, though!
Comment #7
Scott Reynolds CreditAttribution: Scott Reynolds commentedSubscribing, Solr Views needs this to go forward here and remove some HEAVILY crufted code. Hoping to come back to this real soon.
Comment #8
YK85 CreditAttribution: YK85 commentedsubscribing
Comment #9
Scott Reynolds CreditAttribution: Scott Reynolds commentedI took a quick look at this last night and this original patch was going to allow the query plugin to be configurable on a View level not a Display level. I am reworking it for a Display level: http://skitch.com/supermanscott/n43ty/query-builder
Is there a good reason why it wasn't on the display level ?
Comment #10
dawehnerOh damn i really missed to upload a recent version
But this does not work
Comment #11
Scott Reynolds CreditAttribution: Scott Reynolds commentedHe is a 'working' patch though it doesn't export properly and I have a couple issues with it.
1.) The options form function has to fetch the plugin and init it. Its really strange, it shouldn't have to do that it should be handled in the views_plugin_display::init()
2.) The option definition is similar to access and cache. And thats probably wrong in this case. And the reason its not exporting properly.
3.) I don't like this wording: "t('Disable node access')". As someone who as written a couple db_rewrite hooks, it isn't always node access. The option should actually say what it does and I further hope that this becomes a Filter in D7 or a separate UI element for query tags.
4.) Distinct and group by should be default query plugin options. While Solr does have a rudimentary group by-like system, its will have distinctly different behaviors and I think that will hold true for other query plugins.
5.) like to move the summary_title() from views_plugin_query_default to views_plugin_query.
I think the big thing to review, is the decision to have the display object init the query as opposed to the View object itself and the ramifications that can hold.
Comment #12
Scott Reynolds CreditAttribution: Scott Reynolds commentedOk here is a working clean patch. It addresses all the points above expect Distinct and group by. First off, group by isn't an issue, there is a whole system around that, views_query::get_aggregation_info() so it is not a worry.
Distinct is a bit of a different beast and that probably is best handled in a separate issue.
Comment #13
Scott Reynolds CreditAttribution: Scott Reynolds commentedThis is a reroll with a little cleanup. Overriding isn't working.
Comment #14
Scott Reynolds CreditAttribution: Scott Reynolds commentedIt is also not setting the 'options' array based on the $query::option_definition and its not setting the right query type. Probably don't need to maintain the query type as its determined from the base_table anyways.
Here is what the solr form is looking like: http://skitch.com/supermanscott/n5n5i/solr-query-form
Comment #15
Scott Reynolds CreditAttribution: Scott Reynolds commentedposted a patch for Solr Views #750234: Configurable boosts per View display..
Right now I think the problem resides with how option_definition is called. Sometimes it is called after views_plugin_display::init() and other times it hasn't been. This causes issues with the default value for the query type. So while normal Views are fine, once exported it isn't as the query type has been lost.
The other issue is that the options can't be overridden it seems. I think this is a logical issue not necessarily an architectural issue.
Ideas? Thoughts? Am I way off base?
Comment #16
Scott Reynolds CreditAttribution: Scott Reynolds commentedOk, I got this one. Here is an updated, working patch.
Actually had to do this so that way export_plugin could figure out the option_definition(). So i made sure to $display->set_option() that in the views_plugin_display::init. The Solr patch is updated as well.
I believe I got all the ->init_query() calls, but please grep yourself to make sure.
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedFor me, the options still can't be overriden in the user interface.
I am using a textfield for inputting a URL, just like Twitter Views does. I try to change the URL from the default and click update, but when I look back the default value is there again.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedNevermind, need to add a submit handler.
Comment #19
dawehnerYou shouldn't have to add a submit handler. Can you pastebin your code somewhere?
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedHere is the code for the options_defintion and options_form: http://pastebin.com/CC0mbgcV
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commenteddereine, did you try the patch in #16 with Twitter Views? For me, it doesn't work with Twitter Views either. The options box displays in the Views UI, but I can't change it from the default.
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedI solved the problem. I wasn't passing $query_options into the init() function in mymodule_plugin_query_sparql.inc.
In case anyone else runs into this problem, this is what I had to do. I am just setting the $this->endpoint_url to the options even if it hasn't been defined yet because I don't have a default value--the user always needs to define their endpoint.
in sparql_views_plugin_query_sparql.inc
Comment #23
Scott Reynolds CreditAttribution: Scott Reynolds commentedAhh this puzzled me for awhile as well. That makes sense, that is the major api change.
It should probably
And then there is a switch on the api method which should be instead
And the url should use the $options array as well.
But it seems that the form work and it saved everything for you and you were able to export it? If so, would you consider it RTBC ?
Comment #24
dawehnerCan't we just move this to the init method of views_plugin_query and call parent::init in the other init-methods
Comment #25
Scott Reynolds CreditAttribution: Scott Reynolds commentedYes, that is what the default plugin does in this patch. Getting bogged down in details for another module, seems like this patch worked though!
Comment #26
Scott Reynolds CreditAttribution: Scott Reynolds commentedFirst, I doubt this applies anymore. Second, it should model view::init_style(), which will delay building the query till its needed.
Thanks for dereine for the review.
Comment #27
dawehnerIt still applied.
I removed the init_query from display handler initing, this was not nice.
Fixed some more stuff and made init_query clean.
This patch looks now much better for me.
Comment #28
dawehnerHere is a new version which fixes a notice
Comment #29
dawehnerSry this file contained another patch. Here is a new version.
Comment #30
dawehnerThis is part of the roadmap for me
Comment #31
dawehneradd tag
Comment #32
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted to 6.x-3.x!
Doesn't quite apply to 7.x so marking for porting.
I've created http://drupal.org/node/882800 as a followup to move the DISTINCT setting.
Comment #33
dawehnerI just mentioned that db_rewrite_sql will not work at the moment for d7. Huge performance improvement ;)
OH. I just realized that this patch helps for some of my major performance problems. Subscribing
I love dbtng, i have to underline this again.
As you can read on http://drupal.org/node/310077 node has node_access but terms has term_access. The problem is that i can't find a generic way to add the access tag.
The patch currently uses addTag($this->base_table . '_access'); but this is not working for terms.
What about adding a "access query tag" property in the base table data?
Comment #34
dawehnerThis uses the previous approach
Comment #35
dawehnerCool. There was some minor bugs but now it works fine.
Comment #37
Anonymous (not verified) CreditAttribution: Anonymous commentedI am unsure of something that was committed in this issue. It seems to have started in the patch posted in #12.
Why is export set to FALSE? If I change this to true, then it seems to work perfectly (I can export and import settings).
Feel free to close this if this is by design.
Comment #38
Anonymous (not verified) CreditAttribution: Anonymous commentedTo give a little more context, here is the block around that line as it shows up in the last patch.
Comment #39
Anonymous (not verified) CreditAttribution: Anonymous commentedAlso, I believe that addMetaData is a function only in Drupal 7. I noticed this in alpha3 when I was trying to develop tests because it failed the basicView test.
EDIT: Nevermind, it looks like you caught this in the final commit.
Comment #40
dawehner#38
The stuff here is a bug in 6.x-3.x too.
yes this is part of basicView test in d6?
Comment #41
Anonymous (not verified) CreditAttribution: Anonymous commented#38
Ok, I can post it as a new issue if you think that is best. I am attaching a patch that fixes it in this one case, but I haven't looked through to see if there is anything I'm missing. This patch fixes it for me, at least.
#39
I noticed that it was in one of the execute functions in 6.x-3.0-alpha3. But when I downloaded 6.x-3.x-dev, I saw that you had already taken care of it. But then when I saw it in the patch here, I thought that maybe it had been a part of the patch that was committed. After posting, I realized that you had already caught it and that it wasn't in -dev.
Comment #42
dawehnerI understand now why it does not happen. You don't implement option_definition in your query plugin. :(
See #907400-5: Unable to override Query Settings
Comment #43
mathieu CreditAttribution: mathieu commentedsubscribing
Comment #44
dawehnerSo this is fixed again. *puh*