hook_query_alter and hook_query_TAG_alter allows us to alter dynamic queries before they are executed.
Unfortunately in real world these hook basically only allows us to add conditions and not remove them.
For example: I can always add/change sorting, join tables, add conditions etc.. but I can never remove a condition, remove sorting, remove field, remove join, list tags, etc... from the query.
I think these things are quite essential for developers and should be available. Otherwise we have just partially working concept and not the whole thing.
To do(add):
- getConditions()
- removeCondition()
- getTags()
- getSort()
- removeSort()
- getFields()
- removeField()
- getJoins()
- removeJoin()
- getTables()
- removeTable()
- isDistincs()
- removeDistinct()
- getRange()
- removeRange()
- hasExtender()
- removeExtender()
...
Comments
Comment #1
dawehnerconditions() for example return a reference so you can alter it.