I enabled No script and ad block just to run a quick test with this filter. Clicking preview resulted in the loss of alignment. Once these tools were disabled, the alignment was still lost until a new video was selected.

From examining the code of the of the HTML filter, it looks like the cache is not being cleared, or does not detect the changes.

Comments

drupal_acc’s picture

Title: Not handling text cache properly » Alignment Not Working Properly

After further testing, it appears that align:center only works for the initial preview. A second preview results in a left-alignment and further changes can only alternate between left and right.

drupal_acc’s picture

A further test showed that clearing the cache from the performance settings restored the alignment, but the issue reappears on the next preview.

I have also tried disabling optimizations, but this had no impact on the issue. Neither did adding 'text-align: center;' to the CSS file.

drupal_acc’s picture

Title: Alignment Not Working Properly » CSS file video_filter Not Being Sent
Priority: Normal » Major

Right, I finally isolated the issue with Firebug. The CSS file is downloaded on the first preview, but omitted from every subsequent preview.

It is simply not sent to the client machine.

Anyone got any ideas?

blackdog’s picture

That's odd. It might be that the whole theme-function isn't called again on subsequent page loads, and thus the css file won't load. Maybe we have to move the drupal_add_css to a hook_init() function. I'll try to test this this week.

anon’s picture

Status: Active » Needs review
StatusFileSize
new918 bytes
new1.31 KB

Confirmed, and I dont think this has anyting to do with ad block and no scripts.

Since filters always is cached by drupal, I dont think that it will run thru the theme function where we add the css file every time.

But like blackdog suggested, the hook_init funciton will take care of this.

I provided two patches, one for 2.x-dev and one for 3.x-dev
(for this to completely work in 3.x-dev
#999542: Add left,center and right CSS classes
needs to be patched aswell)

scw’s picture

Hi, had the same problem... And i did hook_init myself i usually did it that way with css-files but according to the drupal api you should include the css in the .info file. I tested it and works fine... cheers

drupal_acc’s picture

Status: Needs review » Active

I just got round to following up on this today. Thanks for your help.

Unfortunately, the patches provided by anon had no effect. I even tried hard coding the align choice just to rule out any parsing errors.

So, I am returning this to active again.

blackdog’s picture

Status: Active » Fixed

Fixed in all branches. For Drupal 6, the hook_init way is the right way. For Drupal 7, the CSS file is added in video_filter.info.

Status: Fixed » Closed (fixed)

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