Active
Project:
Facet API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Oct 2012 at 05:15 UTC
Updated:
27 Feb 2013 at 15:59 UTC
The CSS id's and classes are all lowercase. If the hash is WtseAVugB1EhxGslwR3XIwoa0sVTttYt, the CSS generated is id="block-facetapi-wtseavugb1ehxgslwr3xiwoa0svtttyt"
The id and classes should be case sensitive to allow select them by their $delta and use the same string on CSS selectors and PHP code.
Comments
Comment #1
cpliakas commentedMac_Weber,
Ugh. Thanks for reporting, and I agree this is a problem. Changing the deltas, although probably the best way to tackle this problem, is not something I want to undertake yet again. It is really hard to correctly update the deltas, fix the mappings, etc. Therefore we might have to get hacky and figure out how to modify the block ID to match the existing deltas.
Thanks for posting,
Chris
Comment #2
mac_weber commented@cpliakas if you could give some initial directions to change the ID and classes maybe I could send a patch
Comment #3
cpliakas commentedSo although I agree this is a bug, I am not sure that it should be resolved in the 7.x-1.x version of the module. The reason is that changing the deltas is a bear of an upgrade. Specifically, many people probably have CSS styles that rely on the current IDs, and when the deltas change it causes a lot of issues with facet block disappearing. We blocks are managed in core it can be solved with an update hook (provided that the script is run immediately after the code update), but a lot of people leverage Panels and Context to position blocks as well. I think it is unreasonable for Facet API to account for these modules in its upgrade path, and especially with Context it could be a pain for people to have to reposition all of their facet blocks.
Since the module is stable we can't introduce a lot of pain. I definitely want to resolve the root issue in the next major version, but I want to seek an alternative to keep the status quo but allow people to take the risk upon themselves to modify the hash accordingly. I think that #1828396: Add a hook to alter the block delta might be a valid approach to allow people to easily modify the hash without imposing it on the 10k people who are currently using the module.
Does that sound like a viable option?
Chris
Comment #4
mac_weber commentedHello Chris,
how about keeping the hashes as is and just changing the CSS classes and ID's to be identical to its hash case?
Comment #5
cpliakas commentedHi Mac_Weber,
That is a possibility. I think the issue is that we would have to strip out all of Drupal's CSS / ID API functions and re-implement them inside of Facet API, because the API functions are responsible for converting things to lowercase. In addition, we will have to implement a block preprocess hook for all Facet API blocks to replace their IDs with our custom one. This can get tricky because I am not sure about the implication of doing so. I would bet that a lot of existing CSS styles and JavaScript depend on the current IDs, and again I don;t want to make a sweeping change that has the potential of breaking functionality and display.
Chris
Comment #6
mvci ran into this because collapsiblock saves its configuration based on block.delta, expecting to match the corresponding css class, but this bug breaks that. since overriding every part of drupal that generates css classes sounds like a huge amount of work, i think you would either need to change drupal_html_class() in core to no longer call drupal_strtolower() (which would affect a lot more people than changing this module), or ensure that strings inserted into block.delta will not be changed by that function by calling it preemptively in facetapi_hash_delta().
as an upgrade path, all block deltas could be run through drupal_html_class() and updated, with an error flagged in the rare case that there's a hash collision (should be very unlikely). but as maddening as all this is i agree that users won't be expecting such a large and potentially disruptive change in a point version release so i'll use the patch in #1828396: Add a hook to alter the block delta for now.