I would like to pull a value from a field I have in Paragraphs.   I have a content type called "Landing Pages" (landing_pages)  I have a paragraph type called "Landing Page" (landing_page)  The field in the said paragraph type that I would like to pull is called "Background Color" (field_background_color)  As you can probably guess, I would like the user to be able to set the background color of the individual Paragraph. I have figured out how to get the template to display said inline style, but I am puzzeled on how to get the value in the "style=background-color:" tag.   Any help would be appreciated
46172
I have a content type, basic, where i have added a Paragraph field field_pr that has two fields: field_text, field_color. I have a twig template node--basic--full.html.twig where I want to print the value of the paragraph field node.field_pr.   node.field_pr can have between one and ten paragraph values.   When I print the array for content.field_pr, I get a huge array. However, I only want the values from the field_pr.field_text and field_pr.field_color. How would I be able to do this from the node twig template?   I have tried the following but cannot seem to access the values. What am I missing?  {% for field in content.field_pr %}    {{ field[loop.index0].entity.field_text.value }}    {{ field[loop.index0].entity.field_color.value }} {% endfor %}  {% for field in content.field_pr %}    {{ field[loop.index0]['#paragraph'].field_text.value }}    {{ field[loop.index0]['#paragraph'].field_color.value }} {% endfor %}   Here is an image of the array that is printed for the node.field_pr field.
12322
I'd like to highlight paragraphs such that the highlight color appears as one whole rectangle underlying the entire paragraph. I have looked around but nothing gives me the desired effect so far.  For example \fcolorbox{} from xcolor cannot highlight an entire paragraph; \hl{} from soul leaves out spacings between lines uncolored.  I am wondering how I can do this?
47153
myfield is a plain text field. {{ content.field_myfield }} renders the field with HTML markup and the field label.  How do I render the raw value of the field? {{ content.field_myfield.value }} doesn't work.
92330
I am trying to display images from a static resource in a css property.  .PDF {     width:50px;     height:50px;     background-image: url("{!URLFOR($Resource.FileTypes, 'png/pdf.png')}";  }   What i am trying to do is to display an image instead of displaying the filetypes in contentversion object. So what i thought of was to have a div with a class of the filetype  &lt;div class="{!cv.FileType}"&gt;&lt;/div&gt;   The html generated is all coming correct but the image does not appear. Further checking on firebug, the background-image tag in the css is not displayed at all. Not sure if its an issue with how i am using the static resource. The zip file has a folder called png and it has the images of all the file types.  Any ideas why the image is not getting displayed. The div gets displayed with the height and width as 50px
22022
I have found out how to get tab-delimited X,Y data into a layer but the Z field value is not given as an option on import?  I tried to edit the attributes to add and define a new field but it keeps crashing.
81633
I am creating a GUI frontend for the Eve Online API in Python.  I have successfully pulled the XML data from their server.  I am trying to grab the value from a node called "name":  from xml.dom.minidom import parse dom = parse("C:\\eve.xml") name = dom.getElementsByTagName('name') print name   This seems to find the node, but the output is below:  [&lt;DOM Element: name at 0x11e6d28&gt;]   How could I get it to print the value of the node?
54712
In my scenario I'm trying to display a flag (Font Awesome icon) in Views Global Text Field if another field in the same row of a type "Date" has a value of, say, a week from now. I tried  but it has some bugs with filters I'm using, so I thought that using the above approach would be better.
82816
I want to programmatically create a custom content (custom content created via the admin UI). Before the creation, I want to check the types of fields of my custom content.  My custom content contains a field "body" (type text), a field "description" (type text), an int field (type int), an attached file field (type fid ?).  I tested several ways; this is my last try.  // I get the entity object "my_custom_content" $entity_object = NodeType::load("my_custom_content"); dpm($entity_object); //Work perfectly   $test = \Drupal::getContainer()-&gt;get("entity_field.manager")-&gt;getFieldDefinitions("my_custom_content",$entity_object-&gt;bundle())   The code returns an error:     The my_custom_content entity type does not exist.   With this $entity_object, how can I get the list of the fields of my custom content?  I see the EntityFieldManager class, the FieldItemList class, but I still do not understand how to play with Drupal 8.
63815
I'm creating a color object using the following code.  curView.backgroundColor = [[UIColor alloc] initWithHue:229 saturation:40 brightness:75 alpha:1];   How can I retrieve RGB values from the created color object?
20516
I've actually reached the bottom of Google trying to figure out how to add a css class to each row of a view.  The trick is that I need the class for each row to be dynamically determined based on some of the data from the node that the view pulls from.  The function that pulls this off neatly for the node is -   function pgc_preprocess(&amp;$variables) {   $node = $variables['node'];   if ($node-&gt;type == "event") {     $variables['event_class'] = '';     $num_trainers = $node-&gt;field_number_of_trainers[0]['value'];     $count = count($node-&gt;field_trainer);     if($count &lt; $num_trainers) {         $variables['event_class'] = 'red';     } else {         $variables['event_class'] = 'green';     }     return $variables;   } }   The point of this is to color code an event that hasn't had enough folks sign up.  There will be a list of events on the front page, and I need  them to be color coded also.  I really hope there some simple solution along the lines of -  function pgc_preprocess_views_view_unformatted(&amp;$variables) {   // Magic here, preferably having something to    // do with the function I already wrote. }   Just dropping &lt;?php print $event_class ?&gt; in the view .tpl doesn't do it.
84662
I want to clone a node type and add a few fields in it. I think the simplest will be to duplicate it and start working on it.  It seems there is no official way to clone a content type in Drupal 7. Features may allow it but there is no written procedure as to how it could be done.  I've even tried  module.  What'll be best way to clone any content type in Drupal 7?
65967
I am trying to read a custom (non-standard) CSS property, set in a stylesheet (not the inline style attribute) and get its value. Take this CSS for example:  #someElement {   foo: 'bar'; }   I have managed to get its value with the currentStyle property in IE7:  var element = document.getElementById('someElement'); var val = element.currentStyle.foo;   But currentStyle is MS-specific. So I tried getComputedStyle() in Firefox 3 and Safari 3:  var val = getComputedStyle(element,null).foo;   ...and it returns undefined. Does anyone know a cross-browser way of retreiving a custom CSS property value?  (As you might have noticed, this isn't valid CSS. But it should work as long as the value follows the correct syntax. A better property name would be "-myNameSpace-foo" or something.)
92375
Here's an example I just ran into. I'm trying to put some HTML in the label of my field.  $form['field_feedback']['und']['#title'] &lt;- has the title $form['field_feedback']['und'][0]['#title'] &lt;- has the title $form['field_feedback']['und'][0]['value']['#title'] &lt;- has the title. (Works)   Why are there three populated #title attributes with only one being used?
53525
How to print fields value in views-view.html.twig I have created a views-view.html.twig file for my view slider_3. The template name is 'views-view--slider_3.html.twig' The view formatting is done by this template, but I need a field is come at begging position of the view:  &lt;div class="slider-3-main"&gt;{{ rows.required_field }} &lt;div{{ attributes.addClass(classes) }}&gt;   {{ title_prefix }}   {% if title %}     {{ title }}   {% endif %}   {{ title_suffix }}    How can be the field will written to display at {{ rows.required_field }}
70124
Using regular expressions, what is the simplest way to fetch a websites HTML and find the value inside this tag (or any attribute's value for that matter):  &lt;html&gt;   &lt;head&gt;   [snip]   &lt;meta name="generator" value="thevalue i'm looking for" /&gt;   [snip]
31400
I'm trying to capture the display css property value for an element. However, unless I set style.display value in js it doesn't work. HTML: &lt;div class =&quot;dropdown slds-size_1-of-4&quot; &gt;    &lt;p&gt;A&lt;/p&gt;    &lt;p&gt;B&lt;/p&gt;    &lt;p&gt;C&lt;/p&gt; &lt;/div&gt;  CSS: .dropdown{     position: absolute;     display: none;     background: white; }  JS: Below JS method is be called from one of the input boxes in html: updateDropDownStyle(){    console.log('display : '   ,this.template.querySelector('.dropdown').style.display); }  However, the console prints nothing at all. However, if in the same method I set the element.style.display value as none and then try to console the above - it prints none. What's the issue here?
23273
I added a new (text) field to a Drupal 7 content type that already has many nodes.   How can I fill the field with a default value for all these nodes?