Active
Project:
Web Widgets
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2010 at 17:21 UTC
Updated:
27 Jan 2016 at 08:13 UTC
Jump to comment: Most recent
Comments
Comment #1
fletch11 commentedAs a follow up, if you utilized the API would the end user be able to modify the CSS?
Comment #2
BenK commentedSubscribing
Comment #3
sachbearbeiter commentedsubscribing
Comment #4
AviadG commentedsubscribing
Comment #5
nubeli commentedIf you choose Embed Style = Inline you will find that the widget will adopt the styling from the host site. I've only just tested it and found that it's messing up the host css a bit, but that might be just my use case. I'm going to find out why the font size is shrinking everywhere.
Comment #6
problue solutionssubscribing
Comment #7
redkelpie commentedI have just started playing around with the module on my local machine. I've gone into the web_widgets_iframe_wrapper.tpl.php and removed <?php print $styles >. I then added a very bare bones external css stylesheet. It seems like you could customize the template and add classes that would be available for the host site to override and style. Obviously this would only work for developers who would be adding the code to a site and who have access to the back end.
Comment #8
allandk commentedsubscribing
Comment #9
adam_bush commentedI was having this problem - when inline embedding was being used the website using the resulting embed code was getting it's styles broken by the widget pulling through all the styles and javascript through from my client's site.
I have solved this by adding a mod into the web_widgets_style_inline.inc file (which I dont like doing for futureproofing reasons - but I was a bit stuck).
Starting on line 48 is a function called template_preprocess_web_widgets_inline_wrapper
this creates the js_string variable that is used by the widget and calls the following 2 methods:
drupal_get_js
drupal_get_css
the issue with both of these is that they are both part of drupal's common.inc file - (so I didnt wanna mess with them) and these methods both check to see if anything is being passed to them and if not they run methods to get your drupal installs css and javascript (so everything that you would normally get included in the head of your pages) - this is not ideal for inline embedding as it causes conflicts with any site embedding items.
Personally I didnt want any JS or CSS coming through apart from my custom widget only css file.
so on web_widgets_style_inline.inc within the template_preprocess_web_widgets_inline_wrapper function I created the following array/entry
$tempcss['all']['theme']['sites/all/themes/mytheme/css/mywidget.css'] = 0;This matches the format of the css array entries that the drupal_add_css method puts in place.
I then amended the two calls to drupal_get_css() in this function - as they currently pass no variables and hence generate the site css into the js_string - I added a reference to pass my new variable with both calls. I also told the drupal_get_js() method to pass a blank string in as it evals against NULL.
so this:
Becomes this:
Obviously I've now hardcoded a reference to css file in - so if I have multiple widgets on one site, they will all have to use one css file - one thing I would have done for myself is add an option into the views menu to allow the user to choose the stylesheet for the inline widget - but I didnt have time for that.
Just thought I would share what I did to fix this as it may be useful to whoever is looking at this ticket and apologies if I have broken some kind of etiquette by doing so (I dont really post here often).
Comment #10
j9 commentedHi -
I was also able to get the inline widget to display the widget host site's native css by changing this:
to this:
in the web_widgets_style_inline.inc file.
So if xyz.com puts the widget on xyz.com, then the widget display will match the rest of xyz.com styles.
Hope this helps someone. ;0)
Comment #11
clemens.tolboomIt would be awesome if someone updates the issue summary as I guess this is a decent feature request.
I therefore set it to 7.x and hope to work on this the next month.
Comment #12
clemens.tolboomXREF #1666756: Not loading css or js for remote views which adds styling and javasripts :-/
Comment #13
jay.lee.bio commentedFor anyone using the iframe option for 7.x-1.0-alpha2, a temporary solution is surprisingly simple where all you have to do is just delete line 13 on the web_widgets_iframe_wrapper.tpl.php file:
<?php print drupal_get_css(); ?>