drupal

How to make the address code on one line with TWIG?

半腔热情 提交于 2020-01-25 07:58:08
问题 I have a TWIG code to display the address of a store. Currently the address is rendered on 3 lines. How to make the address code on one line ? {{ store.address|render|trim|replace({'<br>': ' - '})|striptags|raw }} 回答1: Your are outputting the address inside a <pre> tag. The white-space of the <pre> tag is set to pre by default. See here for more information about this. So you have 2 options Replace the <pre> tag with a <div> <div> Lorem ipsum dolor sit amet </div> Overrule the white-space of

Redirect all the data served by https to http

不羁岁月 提交于 2020-01-24 12:33:11
问题 So, here is the situation: We are running a website which is powered by Drupal. Sometime ago, it was decided that the website should be served as SSL. The settings to redirect the site from http to https was done by a guy who is not with us anymore. I can see in the .htaccess file the following lines #Redirect http to https RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://docs.dev.domain.com/$1 [R,L] mydomain.com points to the root of the LAMPP server and my site is

Redirect all the data served by https to http

六月ゝ 毕业季﹏ 提交于 2020-01-24 12:33:06
问题 So, here is the situation: We are running a website which is powered by Drupal. Sometime ago, it was decided that the website should be served as SSL. The settings to redirect the site from http to https was done by a guy who is not with us anymore. I can see in the .htaccess file the following lines #Redirect http to https RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://docs.dev.domain.com/$1 [R,L] mydomain.com points to the root of the LAMPP server and my site is

Drupal 7 + jQuery, how to get jQuery to interact only with the active node (via nid) and not every node in the list

人盡茶涼 提交于 2020-01-24 03:49:08
问题 I've been searching for a very long time without any luck within the subject, please point me in the right direction if I have been missing an older thread. What I'm trying to achieve: Having a regular view of multiple nodes and by pressing a button (or whatever) within a node make jQuery interact with this specific node in any way. Ex. make a hidden div appear. The problems I'm facing are for starters that I'm still finding it hard to work with jQuery together with D7. I've been using jQ for

Twig: how to check the inner html content of a field

假装没事ソ 提交于 2020-01-23 12:25:32
问题 i have a single field and that field can have one or two lines of html: <p>One line</p> or: <p>first line</p> <p>Second line </p> Using twig how can i check if the field has one or two tags. Example of what i want to do: {% if item|length('<p>') = 1 %} <div class="one">{{ item }}</div> {% elseif item|length('<p>') = 2 %} <div class="two">{{ item }}</div> {% endif %} Any ideas of how to accomplish this? Update #1: What Honza said is true I want the parent div to have a class if there is only

Drupal: automatically add menu items when new nodes are added

被刻印的时光 ゝ 提交于 2020-01-23 07:06:52
问题 can I automatically add a menu item when I add a node to the page in Drupal? In other words, can I associate a menu parent with a node content-type, and then automatically add the children if new nodes are added ? thanks 回答1: Yes. I am sure there is a module do to something like that, but you could also create your own. There are two ways you could go about it. You could use hook_menu() to query for the items you want and return the correct menu structure. You would need to also make sure the

Drupal: automatically add menu items when new nodes are added

↘锁芯ラ 提交于 2020-01-23 07:04:05
问题 can I automatically add a menu item when I add a node to the page in Drupal? In other words, can I associate a menu parent with a node content-type, and then automatically add the children if new nodes are added ? thanks 回答1: Yes. I am sure there is a module do to something like that, but you could also create your own. There are two ways you could go about it. You could use hook_menu() to query for the items you want and return the correct menu structure. You would need to also make sure the

Refused to set unsafe header “Cookie” with ajax call Rest server

岁酱吖の 提交于 2020-01-21 03:37:21
问题 Im busy building a Phonegap app that connects with my Drupal rest server (Module: Services). My Drupal website (PHP) has the code: header('Access-Control-Allow-Origin: *'); When I'm trying to connect to my Rest server with the following code: http://pastebin.com/xfygQexn I'm getting the following console message: Refused to set unsafe header "Cookie" Code: http://pastebin.com/FNGgPQKv Error: Refused to set unsafe header "Cookie" Is anyone familiar with this problem? Many thanks. Im needing

Drush enable error

别来无恙 提交于 2020-01-17 12:25:10
问题 when i what to enable module using drush I'm getting this error Im using mamp pro 3 and php 5.5.10 <h1>Additional uncaught exception thrown while handling exception.</h1 <h2>Original</h2> <p>PDOException: SQLSTATE[HY000] [2002] Socket operation on non-socket in drupal_is_denied() (line 1933 of /Users/edinpuzic/desktop/projekti/studiotnt /includes/bootstrap.inc).</p> <h2>Additional</h2> <p>PDOException: SQLSTATE[HY000] [2002] Socket operation on non-socket in _registry_check_code() (line 3185

Checkboxes with watchdog_severity_levels()

﹥>﹥吖頭↗ 提交于 2020-01-17 12:23:09
问题 I have this code that gets me out some checkboxes with the watchdog severities: /** * Checkbox for errors, alerts, e.t.c */ foreach (watchdog_severity_levels() as $severity => $description) { $key = 'severity_errors' . $severity; $form['severity_errors'][$key] = array( '#type' => 'checkbox', '#title' => t('@description', array('@description' => drupal_ucfirst($description))), '#default_value' => variable_get($key, array()), ); return system_settings_form($form); } I set this $key in my code