Drupal StackExchange

Trying to make a custom webform element that references other elements from the same form

1 month 3 weeks ago

My goal is to add a custom element to webforms that allows webform editors to subscribe submission posters to a mailchimp mailing list. This used to be a feature in one of the existing modules but was dropped after Drupal 7. The goal is to add an element to the form that allows the form editor (not the submiter) to specify which of the form fields is the email that should be used for registration, which checkbox in the form is the user consent checkbox (this one is optional as it could be setup via the built-in conditions system), and to select from a list of mailchimp audiences (mailing lists) which one to use during subscription. This element does not display anything in the rendered form nor save any data to the submission. The subscription operation will happen in a form handler. The part I am having trouble figuring out (from the available webform element example) is how to add configuration sections and custom content in those sections. The most appropriate section seems to be in the General section within the fieldset named after the element. The goal is to add either two or three drop downs for this new element type which will allow selecting the email field, the consent field and the target mailing list.

The part I need assistance with is how to add those configuration dropdown fields to my custom form element configuration section and how to reference existing form elements in some of those.

An alternative (potentially cleaner) would be do perform the whole thing with a custom handler. In this case the question becomes how to add the references to the form's fields in the handlers's configuration section.

Vitch612

How to create a chart about a date range if some dates in this range are missing?

1 month 3 weeks ago

I use charts module Charts and I want to create a view that shows the stats from a date range.

I have an exposed filter and this filter has a between range. I want to show all dates from values of exposed filter.

I provided the values 7/10/2015 and 15/10/2015 as my date range and always show the dates if no stats exist for specific days in this range.

For example: 7/10/2015, 8/10/2015, 9/10/2015, 10/10/2015, 11/10/2015, etc. up to 15/10/2015,

Attached an image to understand what I want (how the chart should look like).

How can I do this, with filter, arguments or handlers, please give me a example.

For this moment the module "views between date filter" is not working as I want: it only shows all dates for which some data exist. But always need show the dates that no have results.

jonathan

Can I add text to a form file upload field?

1 month 3 weeks ago

Is it possible to add text/markup to a file upload field similar to the image below?

I thought that something like

$form['actions']['edit-field-upload']['#prefix'] = 'First';

in a hook_form_alter would work, but don't see anything.

Venn

Varnish selective clearing not happening

1 month 3 weeks ago

I am using:

  • NginX 1.10.2
  • Varnish 4.1
  • Drupal 7 with the following modules
    • Expire (Set to external.)
    • Varnish (Set to selective.)
    • Purge (Set to 127.0.0.1:80.)

The settings.php file contains the following lines.

// Configuration when using varnish and expire module (selective mode) $conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc'; $conf['cache_class_external_varnish_page'] = 'VarnishCache'; // This allows manual flushing of the cache $conf['cache_class_cache_page'] = 'DrupalFakeCache'; // Turn off drupal page caching (varnish handles this!) $conf['cache_lifetime'] = 0; //$conf['page_cache_maximum_age'] = 21600; // 6 hours //$conf['page_cache_invoke_hooks'] = FALSE;

The output of varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret ban.list is the following.

Present bans: 1480690623.867808 21 - req.http.host ~ metalfans.dev && req.url ~ ^/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit$ 1480690623.867018 0 - req.http.host ~ metalfans.dev && req.url ~ ^/node/1723$|^/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit$ 1480690623.825829 0 - req.http.host ~ metalfans.dev && req.url ~ ^/$|^/frontpage$|^/metalnieuws$|^/node/1723$|^/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit$ 1480690118.323817 29 - req.http.host ~ metalfans.dev && req.url ~ ^/$|^/frontpage$|^/metalnieuws$|^/node/1722$|^/nieuws/1722/zoveel-kost-graspop-metal-meeting-2017$

The VCL file contains the following lines.

# This is a basic VCL configuration file for varnish. See the vcl(7) # man page for details on VCL syntax and semantics. # # Default backend definition. Set this to point to your content # server. # vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8282"; } acl purge { "localhost"; "127.0.0.1"; } # handles redirecting from http to https sub vcl_synth { if (resp.status == 750) { set resp.status = 301; set resp.http.Location = req.http.x-redir; return(deliver); } } sub vcl_recv { # Do not cache these paths. if (req.url ~ "^/status\.php$" || req.url ~ "^/update\.php" || req.url ~ "^/install\.php" || req.url ~ "^/apc\.php$" || req.url ~ "^/admin" || req.url ~ "^/admin/.*$" || req.url ~ "^/user" || req.url ~ "^/user/.*$" || req.url ~ "^/users/.*$" || req.url ~ "^/info/.*$" || req.url ~ "^/flag/.*$" || req.url ~ "^.*/ajax/.*$" || req.url ~ "^.*/ahah/.*$" || req.url ~ "^/system/files/.*$") { return (pass); } if ( (req.http.host ~ "^(?i)metalfans.dev|test.be") && req.http.X-Forwarded-Proto !~ "(?i)https") { set req.http.x-redir = "https://" + req.http.host + req.url; return (synth(750, "")); } # Always cache the following file types for all users. This list of extensions # appears twice, once here and again in vcl_fetch so make sure you edit both # and keep them equal. if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") { unset req.http.Cookie; } # Remove all cookies that Drupal doesn't need to know about. We explicitly # list the ones that Drupal does need, the SESS and NO_CACHE. If, after # running this code we find that either of these two cookies remains, we # will pass as the page cannot be cached. if (req.http.Cookie) { # 1. Append a semi-colon to the front of the cookie string. # 2. Remove all spaces that appear after semi-colons. # 3. Match the cookies we want to keep, adding the space we removed # previously back. (\1) is first matching group in the regsuball. # 4. Remove all other cookies, identifying them by the fact that they have # no space after the preceding semi-colon. # 5. Remove all spaces and semi-colons from the beginning and end of the # cookie string. set req.http.Cookie = ";" + req.http.Cookie; set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";"); set req.http.Cookie = regsuball(req.http.Cookie, ";(SESS[a-z0-9]+|SSESS[a-z0-9]+|wcf_cookieHash=[a-z0-9]+|wcf_userID=[a-z0-9]+|NO_CACHE)=", "; \1="); set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); if (req.http.Cookie == "") { # If there are no remaining cookies, remove the cookie header. If there # aren't any cookie headers, Varnish's default behavior will be to cache # the page. unset req.http.Cookie; } else { # If there is any cookies left (a session or NO_CACHE cookie), do not # cache the page. Pass it on to Apache directly. return (pass); } } } sub vcl_deliver { if (obj.hits > 0) { set resp.http.X-Cache = "HIT"; } else { set resp.http.X-Cache = "MISS"; } } sub vcl_recv { # Check the incoming request type is "PURGE", not "GET" or "POST". if (req.method == "PURGE") { # Check if the IP is allowed. if (!client.ip ~ purge) { # Return error code 405 (Forbidden) when not. return (synth(405, "Not allowed.")); } return (purge); } }

The other related issue I found is Configuring Varnish for Drupal with Proper Module Usage (Expiration Cache, Varnish, Purge, Memcache).

Yet, the page age doesn't change at all until the TTL has expired, which is set to about 5 minutes, while the minimum cache is set to "0"/none.

The watchdogs logs shows that the clearing is happening, so it must be on the Varnish side NginX doesn't do full page caching.

This is the Varnish/Drupal log.

Varnish log: * << BeReq >> 360553 - Begin bereq 360552 pass - Timestamp Start: 1480696516.686305 0.000000 0.000000 - BereqMethod POST - BereqURL /node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - BereqProtocol HTTP/1.0 - BereqHeader X-Forwarded-Host: metalfans.dev - BereqHeader X-Real-IP: 192.168.0.142 - BereqHeader X-Forwarded-Proto: https - BereqHeader X-Forwarded-Port: 443 - BereqHeader X-Secure: on - BereqHeader Host: 127.0.0.1 - BereqHeader Content-Length: 21671 - BereqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 - BereqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - BereqHeader accept-language: en-US,en;q=0.5 - BereqHeader accept-encoding: gzip, deflate, br - BereqHeader referer: https://metalfans.dev/node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - BereqHeader upgrade-insecure-requests: 1 - BereqHeader content-type: application/x-www-form-urlencoded - BereqHeader X-Forwarded-For: 192.168.0.142, 127.0.0.1 - BereqHeader Cookie: SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - BereqHeader X-Varnish: 360553 - VCL_call BACKEND_FETCH - VCL_return fetch - BackendOpen 24 861794af-024b-4385-9de4-2bffb4c51725.default 127.0.0.1 8282 127.0.0.1 45761 - BackendStart 127.0.0.1 8282 - Timestamp Bereq: 1480696516.686349 0.000044 0.000044 - Timestamp Beresp: 1480696518.436420 1.750116 1.750072 - BerespProtocol HTTP/1.1 - BerespStatus 302 - BerespReason Moved Temporarily - BerespHeader Server: nginx - BerespHeader Date: Fri, 02 Dec 2016 16:35:18 GMT - BerespHeader Content-Type: text/html; charset=UTF-8 - BerespHeader Connection: close - BerespHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - BerespHeader Cache-Control: no-cache, must-revalidate - BerespHeader X-Content-Type-Options: nosniff - BerespHeader Location: https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit - TTL RFC 0 10 -1 1480696518 1480696518 1480696518 280299600 0 - VCL_call BACKEND_RESPONSE - TTL VCL 120 10 0 1480696518 - VCL_return deliver - Storage malloc Transient - ObjProtocol HTTP/1.1 - ObjStatus 302 - ObjReason Moved Temporarily - ObjHeader Server: nginx - ObjHeader Date: Fri, 02 Dec 2016 16:35:18 GMT - ObjHeader Content-Type: text/html; charset=UTF-8 - ObjHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - ObjHeader Cache-Control: no-cache, must-revalidate - ObjHeader X-Content-Type-Options: nosniff - ObjHeader Location: https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit - Fetch_Body 4 eof stream - BackendClose 24 861794af-024b-4385-9de4-2bffb4c51725.default - Timestamp BerespBody: 1480696518.436477 1.750172 0.000056 - Length 0 - BereqAcct 911 21671 22582 354 0 354 - End * << Request >> 360552 - Begin req 360551 rxreq - Timestamp Start: 1480696516.686255 0.000000 0.000000 - Timestamp Req: 1480696516.686255 0.000000 0.000000 - ReqStart 127.0.0.1 44983 - ReqMethod POST - ReqURL /node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - ReqProtocol HTTP/1.0 - ReqHeader X-Forwarded-For: 192.168.0.142 - ReqHeader X-Forwarded-Host: metalfans.dev - ReqHeader X-Real-IP: 192.168.0.142 - ReqHeader X-Forwarded-Proto: https - ReqHeader X-Forwarded-Port: 443 - ReqHeader X-Secure: on - ReqHeader Host: 127.0.0.1 - ReqHeader Connection: close - ReqHeader Content-Length: 21671 - ReqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 - ReqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - ReqHeader accept-language: en-US,en;q=0.5 - ReqHeader accept-encoding: gzip, deflate, br - ReqHeader referer: https://metalfans.dev/node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - ReqHeader upgrade-insecure-requests: 1 - ReqHeader content-type: application/x-www-form-urlencoded - ReqHeader cookie: _ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIta - ReqUnset X-Forwarded-For: 192.168.0.142 - ReqHeader X-Forwarded-For: 192.168.0.142, 127.0.0.1 - VCL_call RECV - ReqUnset cookie: _ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIta - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIt - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIt - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew;SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA;SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew;SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA;SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDi - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDi - ReqHeader Cookie: ; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - ReqUnset Cookie: ; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - ReqHeader Cookie: SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - VCL_return pass - VCL_call HASH - VCL_return lookup - VCL_call PASS - VCL_return fetch - Link bereq 360553 pass - Timestamp ReqBody: 1480696516.686347 0.000091 0.000091 - Timestamp Fetch: 1480696518.436485 1.750230 1.750139 - RespProtocol HTTP/1.1 - RespStatus 302 - RespReason Moved Temporarily - RespHeader Server: nginx - RespHeader Date: Fri, 02 Dec 2016 16:35:18 GMT - RespHeader Content-Type: text/html; charset=UTF-8 - RespHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - RespHeader Cache-Control: no-cache, must-revalidate - RespHeader X-Content-Type-Options: nosniff - RespHeader Location: https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit - RespHeader X-Varnish: 360552 - RespHeader Age: 0 - RespHeader Via: 1.1 varnish-v4 - VCL_call DELIVER - RespHeader X-Cache: MISS - VCL_return deliver - Timestamp Process: 1480696518.436498 1.750243 0.000013 - RespHeader Content-Length: 0 - Debug "RES_MODE 2" - RespHeader Connection: close - Timestamp Resp: 1480696518.436509 1.750254 0.000011 - ReqAcct 1032 21671 22703 436 0 436 - End * << Session >> 360551 - Begin sess 0 HTTP/1 - SessOpen 127.0.0.1 44983 :80 127.0.0.1 80 1480696516.686237 20 - Link req 360552 rxreq - SessClose RESP_CLOSE 1.750 - End * << BeReq >> 163863 - Begin bereq 163862 pass - Timestamp Start: 1480696518.438621 0.000000 0.000000 - BereqMethod GET - BereqURL /nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit - BereqProtocol HTTP/1.0 - BereqHeader X-Forwarded-Host: metalfans.dev - BereqHeader X-Real-IP: 192.168.0.142 - BereqHeader X-Forwarded-Proto: https - BereqHeader X-Forwarded-Port: 443 - BereqHeader X-Secure: on - BereqHeader Host: 127.0.0.1 - BereqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 - BereqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - BereqHeader accept-language: en-US,en;q=0.5 - BereqHeader accept-encoding: gzip, deflate, br - BereqHeader referer: https://metalfans.dev/node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - BereqHeader upgrade-insecure-requests: 1 - BereqHeader X-Forwarded-For: 192.168.0.142, 127.0.0.1 - BereqHeader Cookie: SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - BereqHeader X-Varnish: 163863 - VCL_call BACKEND_FETCH - VCL_return fetch - BackendOpen 24 861794af-024b-4385-9de4-2bffb4c51725.default 127.0.0.1 8282 127.0.0.1 45766 - BackendStart 127.0.0.1 8282 - Timestamp Bereq: 1480696518.438658 0.000038 0.000038 - Timestamp Beresp: 1480696519.142807 0.704186 0.704149 - BerespProtocol HTTP/1.1 - BerespStatus 200 - BerespReason OK - BerespHeader Server: nginx - BerespHeader Date: Fri, 02 Dec 2016 16:35:19 GMT - BerespHeader Content-Type: text/html; charset=utf-8 - BerespHeader Connection: close - BerespHeader Vary: Accept-Encoding - BerespHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - BerespHeader Cache-Control: no-cache, must-revalidate - BerespHeader X-Content-Type-Options: nosniff - BerespHeader Content-Language: nl - BerespHeader X-Frame-Options: SAMEORIGIN - BerespHeader X-Generator: Drupal 7 (http://drupal.org) - BerespHeader Link: ,,,,,,<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit?amp>; rel="amphtml",<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit>; rel="canonical",<https://metalfans.dev/node/1723>; r - BerespHeader Content-Encoding: gzip - TTL RFC 0 10 -1 1480696519 1480696519 1480696519 280299600 0 - VCL_call BACKEND_RESPONSE - TTL VCL 120 10 0 1480696519 - VCL_return deliver - Storage malloc Transient - ObjProtocol HTTP/1.1 - ObjStatus 200 - ObjReason OK - ObjHeader Server: nginx - ObjHeader Date: Fri, 02 Dec 2016 16:35:19 GMT - ObjHeader Content-Type: text/html; charset=utf-8 - ObjHeader Vary: Accept-Encoding - ObjHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - ObjHeader Cache-Control: no-cache, must-revalidate - ObjHeader X-Content-Type-Options: nosniff - ObjHeader Content-Language: nl - ObjHeader X-Frame-Options: SAMEORIGIN - ObjHeader X-Generator: Drupal 7 (http://drupal.org) - ObjHeader Link: ,,,,,,<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit?amp>; rel="amphtml",<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit>; rel="canonical",<https://metalfans.dev/node/1723>; r - ObjHeader Content-Encoding: gzip - Fetch_Body 4 eof stream - Gzip u F - 50512 302363 80 212767 404025 - BackendClose 24 861794af-024b-4385-9de4-2bffb4c51725.default - Timestamp BerespBody: 1480696519.180351 0.741730 0.037544 - Length 50512 - BereqAcct 821 0 821 790 50512 51302 - End * << Request >> 163862 - Begin req 163861 rxreq - Timestamp Start: 1480696518.438582 0.000000 0.000000 - Timestamp Req: 1480696518.438582 0.000000 0.000000 - ReqStart 127.0.0.1 44988 - ReqMethod GET - ReqURL /nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit - ReqProtocol HTTP/1.0 - ReqHeader X-Forwarded-For: 192.168.0.142 - ReqHeader X-Forwarded-Host: metalfans.dev - ReqHeader X-Real-IP: 192.168.0.142 - ReqHeader X-Forwarded-Proto: https - ReqHeader X-Forwarded-Port: 443 - ReqHeader X-Secure: on - ReqHeader Host: 127.0.0.1 - ReqHeader Connection: close - ReqHeader user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 - ReqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - ReqHeader accept-language: en-US,en;q=0.5 - ReqHeader accept-encoding: gzip, deflate, br - ReqHeader referer: https://metalfans.dev/node/1723/edit?content_lock_token=i7EJ9zBOgYFwoo3oJo0Q2-8vJcxXIQHAS6rF_wpwu6w - ReqHeader upgrade-insecure-requests: 1 - ReqHeader cookie: _ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIta - ReqUnset X-Forwarded-For: 192.168.0.142 - ReqHeader X-Forwarded-For: 192.168.0.142, 127.0.0.1 - VCL_call RECV - ReqUnset cookie: _ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIta - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIt - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769; Drupal.tableDrag.showWeight=0; DRUPAL_UID=1; DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoIt - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew;SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA;SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew;SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA;SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS - ReqHeader Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDi - ReqUnset Cookie: ;_ga=GA1.2.2139442399.1477560769;Drupal.tableDrag.showWeight=0;DRUPAL_UID=1;DrupalModuleFilter=activeTab%3Dnew; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDi - ReqHeader Cookie: ; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - ReqUnset Cookie: ; SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - ReqHeader Cookie: SSESS66c4e60279a94b947645ab1ea38c2c77=IFnE4CiYlSSuvwUqH9PVCeMxat9fc-gllYz3uWNyuTA; SESS66c4e60279a94b947645ab1ea38c2c77=YwcVtmCMoItaDicS4uGJKlilsFiybrpJ-lxhsIC48vs - VCL_return pass - VCL_call HASH - VCL_return lookup - VCL_call PASS - VCL_return fetch - Link bereq 163863 pass - Timestamp Fetch: 1480696519.142865 0.704283 0.704283 - RespProtocol HTTP/1.1 - RespStatus 200 - RespReason OK - RespHeader Server: nginx - RespHeader Date: Fri, 02 Dec 2016 16:35:19 GMT - RespHeader Content-Type: text/html; charset=utf-8 - RespHeader Vary: Accept-Encoding - RespHeader Expires: Sun, 19 Nov 1978 05:00:00 GMT - RespHeader Cache-Control: no-cache, must-revalidate - RespHeader X-Content-Type-Options: nosniff - RespHeader Content-Language: nl - RespHeader X-Frame-Options: SAMEORIGIN - RespHeader X-Generator: Drupal 7 (http://drupal.org) - RespHeader Link: ,,,,,,<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit?amp>; rel="amphtml",<https://metalfans.dev/nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit>; rel="canonical",<https://metalfans.dev/node/1723>; r - RespHeader Content-Encoding: gzip - RespHeader X-Varnish: 163862 - RespHeader Age: 0 - RespHeader Via: 1.1 varnish-v4 - VCL_call DELIVER - RespHeader X-Cache: MISS - VCL_return deliver - Timestamp Process: 1480696519.142896 0.704314 0.000031 - RespHeader Accept-Ranges: bytes - Debug "RES_MODE 4" - RespHeader Connection: close - Timestamp Resp: 1480696519.180378 0.741796 0.037482 - ReqAcct 942 0 942 875 50512 51387 - End * << Session >> 163861 - Begin sess 0 HTTP/1 - SessOpen 127.0.0.1 44988 :80 127.0.0.1 80 1480696518.438567 21 - Link req 163862 rxreq - SessClose RESP_CLOSE 0.742 - End ---------------------------------------------------------------------------------------- Drupal expire log: Expiration was executed for the next URLs: URL: Wildcard: false Expired object: node -------- URL: frontpage Wildcard: false Expired object: node -------- URL: node/1533 Wildcard: false Expired object: node -------- URL: metalfestivals/hellfest-open-air-2017 Wildcard: false Expired object: node -------- URL: metalnieuws Wildcard: false Expired object: node -------- URL: node/1723 Wildcard: false Expired object: node -------- URL: nieuws/1723/de-eerste-namen-voor-hellfest-2017-zijn-een-feit Wildcard: false Expired object: node --------
user1064293

Show subterms in a page

1 month 3 weeks ago

I have two categories and each one has subcategories. I put the parent categories in a menu. What I need is: when I click a parent category its subcategories should be shown in a new page.

How I should that? I'm using Drupal 7.

dianikol

Add javascript to returned form after ajax validation

1 month 3 weeks ago

I've built a form with the form API, and it's submitting via ajax via this type of thing:

$form['submit'] = array( '#type' => 'submit', '#value' => 'submit', '#ajax' => array( 'callback' => 'handyman_form_callback', 'method' => 'replace', 'wrapper' => 'form-wrap', 'effect' => 'fade' ) );

The problem is, if the form is returned due to validation errors the javascript applied to the form no longer works. I've read lots about the attachBehaviors function but I'm not sure where I could put this to make it work, and not sure if this is even the correct thing to do.

Any help?

Chris

EntityFieldQuery with Workflow

1 month 3 weeks ago

I need to filter an EntityFieldQuery with a given workflow state, let's say workflow it is state 21 (sid = 21). Below, the query I am using

$query_formularios_completos = new EntityFieldQuery(); $query_formularios_completos ->entityCondition('entity_type', 'node') ->propertyCondition('type', array( 'evento_agencia', 'evento_energia' ) ) ->propertyCondition('workflow', 21) ->fieldCondition('field_e_expositor', 'target_id', $node_expositor_nid); $result_formularios_completos = $query_formularios_completos->execute();

When using DEVEL to inspect my node, I can see there is a property ->workflow, side by side with ordinary properties like ->title or ->created. Although I can see it there and I expected to filter only items with workflow state 21, I get a horrid database error when trying to execute the code above. Here is more or less the message I get:

Column not found: 1054 Column 'node.workflow' unknown in 'where clause'

Any ideas on how I should filter an entity query using a workflow state as filter? Maybe what I am trying to do isn'tpossible and I have to actually run a query using db_query and applying the appropriate joins.

Marcos Buarque

How to add / update a field collection without updating parent node/entity?

1 month 3 weeks ago

I needed to to add / update field collections to node entities without updating the node entities. I tried two ways listed in https://www.drupal.org/node/1842304 and http://alexrayu.com/blog/saveupdate-field-collection-without-nodesave but none of them seems to be working exactly the way I want.

I tried as follows:

$node = node_load($nid); $field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_college_rating_data')); $field_collection_item->setHostEntity('node', $node); $field_collection_item->field_text1['und'][0]['tid'] = $form_state['input']['field_text1']['und']; $field_collection_item->field_text2['und'][0]['value'] = $form_state['input']['field_text2']['und']; $field_collection_item->save();

It added a field collection but it updates the node.

I also tried to alter the field collection form submit and used custom submit handler as follows:

function own_custom_field_collection_submit($form,$form_state) { $field_collection_item = field_collection_item_form_submit_build_field_collection($form, $form_state); $field_collection_item->save(TRUE); drupal_set_message(t('The changes have been saved.')); $form_state['redirect'] = $field_collection_item->path(); }

I have copied this code from core field collection module to change the default argument to "TRUE" in the save function. It added the field collection but didn't associated with the parent node.

I need to save the field collection separately since my node entity form is very large with 50 to 60 fields and field collections and I don't want to update it as many times as I add / update any field collections to the node.

Any help?

user24595

On a content page that references a taxonomy term, how can I display only content that references that taxonomy term's immediate children?

1 month 3 weeks ago

In Drupal 8, I have a hierarchical taxonomy vocabulary called "Living Things" containing these terms:

Animals --Fishes ----Blennies ------Yellow Blenny ------Green Blenny ----Gobies ------Blue Goby ------Red Goby

I have created a custom content type called "Taxon Page" which includes a single reference to the "Living Things" vocabulary.

Using the "Taxon Page" content type I have created a page for each of the terms in the "Living Things" vocabulary. So for example, my "Yellow Blenny Facts" content page contains a reference to the "Yellow Blenny" taxonomy term.

On those "Taxon Page" content pages, how can I display only content that references that taxonomy term's immediate children (if there are any)? For example, the "Fishes Facts" content page should display data from the "Blennies Facts" and "Gobies Facts" content (not just a link to those taxonomy terms), but not their children.

I have tried to achieve this by creating a view for "Content type (= Taxon Page)" and adding a "contextual filter: Content: Has taxonomy term ID (with depth)" (depth of 1) but it did not work.

Note that this question is related but different, as it only refers to taxonomy terms, not content referencing those taxonomy terms.

Nick Hope