texts: Need system wide time zone calculation ability

texts: I need to hook into the time zone pipeline before date display to properly calculate "local" time events. It seems Drupal provides site and user time zone settings (and Views has its own TZ control for date time) but none of those are applicable. Since Drupal stores datetime in UTC(a fixed point), I need to display datetimes using offsets for local time. That is, UTC=12345678ms, New York will be -5 and Los Angeles will be -8 off of it. When viewing/editing entities where events occur in -5, the dates displayed are (UTC-5hr) and events that occurred in LA at precisely the same time (12345678ms) are UTC-8hr. So neither system/user or Views TZ settings apply. A Views report must show local times where events/alarms occur, not system/user/Views time zones. Where can I hook into the pipeline to accomplish this?


texts: Take over display of a content type node route

texts:
I have a discussion content type. I would like the primary viewing experience (at "discussion/discussion-name") to be a cacheable form using a form mode.

Basically, I'm trying to create something like a web app experience where anyone who can view it, can edit it, so there is no point to separating view and edit, a more integrated experience is desired.

It feels like it should be easy, but I haven't found anything about how to override the routing for just one content type.

How can I override the route for a content type?


texts: There are currently @count users online translation issue

texts:
The following string is the default English translation source of the "Who's online counter"

There are currently @count users online

My site has Arabic language translation. When I tried to translate the above string from en/admin/config/regional/translate/translate and when the users number changed to another numbers. I find a new entry like the followings:

There are currently @count[2] users online.
There are currently @count[3] users online.

Does this mean that I have to set translation for every number in the digits line?!!! What could I do to solve this issue?


texts:
I currently have 2 webforms displayed on a page - these are inserted dynamically from a node.tpl.php file.

However, I also have a cck field on the current node for an email address - I would like to be able to pass this email value directly to the "Email To" field of the webform.

This would create a new email recipient depending on which node you were viewing. For example:

The "About Us" page contained the field "email: hello@mydomain.com" - therefore the webform loaded in the sidebar would be sent to this address.

The "Location" page contains the field "email: location@mydomain.com" - now this would be the email address that receives any submissions from that page.

The idea is to have 1 webform and dynamically change the email its sent to based on a cck field. Is this possible at all?

Thanks,
Garry.


texts: Boost module, drupal-server encoding issue

texts:
Background

I use Drupal 7.38 and Boost 7.x-1.0. According to Cron everything is up2date. I store my site at a (CentOS) NGINX-based shared hosting plan that seemingly does include UTF-8 encoding (my site is in Hebrew and the problem is language related). I have no idea if the following problem is a Boost bug or a fail, from my side, providing one of Drupal's encoding-related system requirements.

The problem

The Boost module is installed and working (verified it's work when visited root/sitename/cache...) but now, in the bottom of each non-English webpage, I get the following 2 errors:

  Warning: Cannot modify header information - headers already sent by (output started at
  /home/user/public_html/sitename/includes/common.inc:2748) in
  drupal_send_headers() (line 1232 of
  /home/user/public_html/sitename/includes/bootstrap.inc).
  PDOException: in dblog_watchdog() (line 160 of /ho/home/user/public_html/modules/dblog/dblog.module).

The exact whereabouts

These errors appear ONLY in non-English webpages... In English ones, they just don't appear... moreover, The cached webpage files that BOOST creates are named in Hebrew - i.e their file names are in Hebrew and actually resemble their H1. If I change the file name to an English one, and visit it from the site --- these errors no longer appear in it's bottom.

Maybe the server\Drupal\Boost fails to access the files correctly and and therefore prints these errors in their bottom. Note: It doesn't happen on a local Windows WAMP server, so it's likely the problem is in my online server and not in Drupal.


texts:
Drupal 7.9 re-introduces height and width attributes to images - I understand this helps improve front-end performance, but it's giving me problems while using flexible images in the vein of responsive web design.

This is the same issue as whitefleaCH mentioned on this post: How can I prevent height/width attributes on images run through the theme system?

Using max-width in CSS still scales images, however the height remains as what was defined in the markup. Does anyone know how to either correct this in CSS or remove the height/width attributes from images all together?


texts:
Drupal is a complex CMS but all I need is simply a text on my page in the specific region of the page ( that will be rarely changed ) that can be changed by an admin.

Here's my theme mockup.

The text is going to be in the red square area as seen above. That text is going to be rarely changed. I was trying to do this with 'Basic page' content type block but It isn't showing me what I want it creates some text showing up

"No front page content has been created yet. Add new content"

and when I create new content It shows up Read more and then redirects me to node/1 URL If I click it.

There must be some other simpler way of doing this. I mean all I want is text that is editable by admin in control panel not some fancy blog posts. Also please notice that I am still learning Drupal and any answer would be great!


texts: Add Checkboxes to a views listing of titles

texts:
I am looking to pull in a views listing of events by title into a entity form.

I need help figuring out how to add checkboxes to the views listing of title. This way if someone checks the box when the form submits it will show in the form submitted information that they are interested in that event. Then I need to add that listing to the form.

Thanks


texts: Twig conditional render if specific field in array of referenced entities contains text

texts:
In a Twig template, I'm conditionally rendering a sidebar based on whether custom field content.field_body (Paragraphs entity reference revisions field type) contains any items.
{% if content.field_body['#items'] %}

In this article:

      {% for item in content.field_body['#items'] %}
        {% if item.entity.field_subhead %}

            {{ item.entity.field_subhead.value | raw }}

        {% endif %}
      {% endfor %}

{% endif %}

This worked fine until the requirements changed. :)
Now I need to render this entire sidebar
 if and only if one of the item.entity.field_subhead fields in the ['#items'] array contains a value.
{{ dump(content.field_body['#items']|keys) }} returns the following:
^ array:2 [▼
  0 => 0
  1 => 1
]

So the ['#items'] are a regular numerically-indexed array.
Rephrasing the question, is it possible in Twig to write a conditional that returns true if any key of a multi-value field contains a specific field?
This is further complicated by the fact that there may be different Paragraph types referenced here, and only one of these (the "Section" paragraphs type) will contain entity.field_subhead, but there might be any number of Sections.
Bonus points if whitespace returns false.
EDIT: Thanks @Hudri!
For future reference, the code that worked in my case looked like this:
{# Test every Section for non-empty Subhead #}
{% set render_sidebar = false %}
{% for field_item in node.field_body %}
  {% if field_item.entity.field_subhead %}
    {% if not field_item.entity.field_subhead.isEmpty %}
      {% set render_sidebar = true %}
    {% endif %}
  {% endif %}
{% endfor %}
{# If any Section contains non-empty Subhead, render block #}
{% if render_sidebar %}

    {# a bunch of markup #}

{% endif %}


texts: Primary and secondary zone's links in drupal 7

texts:
This is my website in drupal 7. The page at http://150.254.36.80/wige/kandydaci/aktualnosci shows the following header.

I would like that "kandydaci" in this white menu will be active (black lighted) in every page in this zone, for example on http://150.254.36.80/wige/kandydaci/o-wydziale.

We are in the "kandydaci" zone, but the white menu doesn't show it.


texts: Getting literal ampersands from summary field in a view of fields

texts:
I have a view where we are using the Body Summary field. I got a bug report that an HTML entity, &amp;,  displaying, where they wanted a literal ampersand.

When I updated our existing view, based on fields, to use the Body Summary field instead of a trimmed body, I did not find the Body Summary field by itself in the list of fields. So, I added another Body field to the view, and re-wrote its results: {{ body__summary }}.

Thinking that the problem was from our site's configuration, I repeated the same steps on a fresh Drupal install: using the Article content type, I added content in the Summary field, and created a view of fields of the Article content type. I got the same behavior on the fresh install.

I posted a question here, but I did not include information about what kind of view I created. I made a mistake from neglect; I did not include all the information needed to understand the situation and answer the question.

A helpful user went through the trouble of creating a fresh install, with two different versions of Core, and reported that he did not get the same behavior, but nonetheless gave a helpful and relevant answer.

That answer got me thinking, and I created a second view of teasers instead of fields. That view has literal ampersands, which is what I want. I concluded that leymanxx, when he did his testing, created a view of teasers, because I neglected to mention what kind of view I made, and thus, he did not see the same behavior that I did.

So now it looks to me that the body field re-write is the origin of the problem. I'm not sure the best way to address it:

Did I overlook the summary field in the list of fields somehow? Is there a "right way" to add it, and I simply did it a wrong way?
When I inspect the field with the escaped ampersand with theme debugging, it tells me this: <!-- THEME HOOK: 'views_view_field' -->
<!-- BEGIN OUTPUT from 'core/modules/views/templates/views-view-field.html.twig' --> When I look at that theme file, apart from the comments, I see only this {{ output -}}. Should I override this template? I'm not sure I know how to fix only the HTML escaping issue while ensuring that I'm not creating unwanted side-effects for all my other views. It appears that all views with fields get processed by this template.
Edit just make a new field, this is too much bother. See edits below.

How do I get a summary field displaying literal ampersand characters in a view of fields in Drupal 8?

Edit According to his comments, laymaxx didn't create a view of teasers, but added the body field and set the formatter to "summary or trimmed". We can't use this in our situation, because we never want the trimmed body; first, Drupal does a bad job trimming, and second, our wording in our summary will almost always be different from the first few lines of the body text. We want to use the summary and the summary alone.

At this point, I'm thinking just to add a new field and use that. However, I am curious as to the "right way" to do this, in case I am ever faced with a situation like this in the future.


texts:
I'm running a new Drupal 7 site on Ubuntu 14 (so no httpd.conf file), and am trying to make a simple htaccess rule to redirect from no subdomain to www. Basic stuff, the Internet told me what to do, and I used this:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Problem is that if I put in a subdomain - something.domain.com - it concatenates the URL to www.something.domain.com

How can I get around this? It's... quite annoying. Perhaps a module would be a better solution than an .htaccess update?

(Also Global Redirect Case Sensitive URL Checking isn't working, but that's another story...)

Thanks.


texts:
I am aiming to place a block on an entity.
It seems like this should be simple as entity integration in D8 is well-developed and (in parts) user-friendly.
I can get the view block working fine and can 'Place Block' on different content types successfully.
However when it comes to entities there are no options in the 'Configure Block: Visibility' tabs.
Perhaps there is some standard documentation on customising the appearance of entities in this way that I just cant seem to find?
D8 seems to have integrated entities quite well with Views etc. But somehow simply placing a block on an entity remains a challenge.
I expect other relatively less experienced users would be experiencing the same challenges.
Perhaps I am missing something very obvious. If so perhaps someone could let me know! :-)
Thoughts and guidance welcome.


texts: how to change "username" text located in registration form

texts:
how i can change "username" text, located in registration form.. i need to change it to "Organization Name" and everywhere of my website "username" text should replace with "Organization Name". How to do it?
Thanks


texts:
I am trying to build a module that checks if user session set in all pages of a certain book. if the session is not set it will be set.
I am using a sso system so the user data will come from there, The users will not be Drupal registered users.

Now, I built a function in the controller that sets the session in a certain path and it work good.

My question is how do I turn the path value in the module routing file, so the function in the controller will work in all the specific book pages.

This is the routing file content:

achva_sso.ssocheck:
  path: '/ssocheck'
  defaults:
    _controller: '\Drupal\achva_sso\Controller\SsoController::ssoCheck'
    _title: 'SSO Set ssocheck'
  requirements:
    _permission: 'access content'

This is the controller function:

class SsoController extends ControllerBase
{
    public function ssoCheck()
    {
        $session = \Drupal::request()->getSession();

        if ($session->get('name') !== null) {
            $status = 'check is already logged in ' . $session->get('name');
        } else {
            $status = 'was logged out' . $session->get('name');
        }
        return [
            '#type' => 'markup',
            '#markup' => '<p>' . $status . '</p>',
        ];
    }
}


texts: Is there a way to clone a content type and its fields?

texts:
I have a content type named "event_xyz" that I want to rename to "event".  I figure I can clone the content type and then delete the original.  But I don't see any tuts or modules on how to do this.

Alternatively, is there a way to rename a bundle's machine name?

I found a closed question related to cloning content types for Drupal 7, but not for Drupal 8.


texts:
in line 80 of php.module there is an "eval" command that executes the code passed through the php fields.

If there is an error, you get information on its type, but not the code that generated that.

Is there a way to find which php code is causing the error in line 80 of php.module?


texts: Help with Geocoding and Openlayers missing markers

texts: I have followed this tutorial exactly http://drupal.org/node/1002852 to create a node type with geocoding. I have a default install of openlayers, openlayers_geocoder. Geocoding appears to be working when editing/saving the node, however the marker (or polygons) do not appear on the node's map.


texts: How do I hide one block and show another in a template

texts:
My page.tpl.php is set to use a particular block in the right-hand column.

However, I have one template page (created by a module) in which I don't want to display this block.

How can I hide the block ONLY on that page and show a different block instead?


texts: How do I prevent a form from being cached for anonymous users?

texts:
I have a form that is pre-populated with information specific to an anonymous user's session information. However, the form appears to get cached for all anonymous users by default.
'Internal Dynamic Page Cache' is enabled, 'Internal Page Cache' is not.

How do I disable caching of this form? It should be rebuilt fresh every time it is displayed.


texts: How can I get the width or height of an image field image into a twig template?

texts:
I'm using PhpStorm/xdebug/MAMP to look at the variable I want to access:

I have tried using the following to get at the data:

{% set image_width = content.field_image.0['#item'].values.width %}

and

{% set image_width = content.field_image.0['#item'].values.width.value %}

Neither of these lines produce any data.

Any help is greatly appreciated!


texts: How to restrict access to blocks depending on the roles?

texts:
How can I restrict the Access to the blocks in my website depending on the roles? I.e only a particular role can see (edit view delete configure) a particular block and nobody else can do so.

I tried the Block Access module but to no avail.

Is there any other module that can help?


texts: Module that provides Rules action to create node?

texts: Is an Action to create a node available in any module? I tried searching but couldn't find it. I was hoping something as basic as a node create action would be available.


texts: Deleting content leaves a lot of data in the tables

texts:
I deleted all content from my site via the content panel (/admin/content). And when I looked in the DB (in node, node_field_data, and all fields associated with my only content type) the data was still there but the content panel shows no nodes.
Is this a bug? Why is there still data in the tables?


texts: Is it safe to enable Contextual Links for all users?

texts: I've installed lazy-load module for images. And when users don't have Contextual Links permission they don't see images if module is enabled. Is it safe to give this permission to everybody?


texts: "COPY_ERROR: Unable to copy" while using drush make with download type "copy"

texts:
Here is my module structure:

.
|-- mymodule.make
|-- mymodule.info
|-- mymodule.module
|-- mymodule.install
`-- sub1
    |-- sub1.make
    |-- sub1.info
    |-- sub1.module
    `-- sub1.install

I would like that when using drush make the sub-module sub1 is also made (so I would like that sub1.make is called too).

In mymodule.make I declare:

api = "2"
core = "7.x"

projects[drupal][version] = "7.39"

; Modules
projects[sub1][type] = module
projects[sub1][download][type] = copy
projects[sub1][download][url] = "./sub1"

And here is the error that I have:

Found makefile: mymodule.make                                [ok]
COPY_ERROR: Unable to copy sub1 from ./sub1. -- build forced [warning]

However, the documentation tells

  download[type] = copy Copies a project from a local folder.

so I think I'm using the correct [download][type]...

I've also tried with projects[sub1][download][url] = "file://./sub1" and have the same error.


texts:
Anyone know of a way to export all the data found in a panel layout, context e.g. into a custom module in order to deploy from development to production?

Something like with views via the Implements hook_views_api() ?


texts:
If I try and clear my drupal site's cache using drush cc all command - the command completes successfully but when I pull up my drupal site in a browser its a mangled mess because there is no CSS.

Whereas if I sign into my site as an admin go to "Flush All Caches" my site works just fine.

This is discussed briefly here: http://dnotes.net/blog/dark-side-drop/david/why-all-my-css-gone-drush-cc

Although I don't really see a solution.

I think the underlying issue is that drush cc all isn't re-creating LESS CSS files but the "Flush All Caches" is? Is there some way I can make drush re-create the LESS files after a cache clear?

Thanks
Brad


texts: How to make mail messages use the UTF8 character encoding?

texts:
I am sending mails to users about products, using the SMTP Authentication Support and Mime Mail modules. I set UTF8 as charset in the mail header, but the header is changed from UTF8 to multipart on this line in the mail.inc file:

$message = $system->format($message);

It actually changes the Swedish characters to some strange characters. So that's the problem: I can't display them correctly.

Any suggestions to correctly display them?


texts: How to create a CSV file to migrate my Commerce Products with the Feeds module?

texts:
How do you create CSV files?

I have a new Drupal Commerce website and I want to migrate all my products from my previous Drupal 7 Commerce site. I want to use the Feeds module to import my products.

I have not been able to find a way "to create a CSV file". Any suggestions?

  How do I create a CSV file
  from my current drupal commerce to my new one?


texts: I have two drupal sites running locally on my computer. When i try to test the search of two sites, the other works fine, the other is not. I tried to search taxonomy terms and tags but it yielded no results. I don't know what the problem is, please comment or any advise?


texts: define and use global jquery functions from 2 different files

texts:
I am attempting to define a jQuery function in A.js in the following way:

jQuery.fn.demo = function(){
    console.log("heizsa!");
}

I am trying to run this function from B.js file this way:

jQuery().demo();

Having no luck there. Both .js are defined within the same module.
Any idea how this is doable?

Files are included in the .info file this way:

scripts[] = js/A.js
scripts[] = js/B.js


texts: How do I create and synchronize product fields with entity fields on another site

texts:
Case description:

I have one centralized 'Asset management' Drupal website "A" (something like a simple ERP site) which manages the administration of purchased Assets, being ECK entities. The assets are unique, no stock management required.

I also have a Drupal webshop "B" using the Drupal Commerce modules, which has Commerce Product entities.

Goal:

The assets and products need to be two-way synchronized between the two sites, in such a way that:

New Assets in site A will create new Products in site B.
Some fields (title, price, status) will need to be two-way syncronized (so that when a product is sold, the Asset status field will be changed)

Requirements

Preferably without custom coding, but using existing Drupal modules in combination with Rules to allow flexibility in configuration.

Question:

What would be a good approach in this case? Preferably without custom coding.

My current investigations:

There are multiple ways to construct a non-coding contributed module combination to get the result needed. My preference is a lightweight but configurable solution using Rules. I checked out these modules:

Services module: Without other modules this requires custom coding to import and sync entities. Most services-based modules are dependent on it.
Web Service Data module, This module allows you to bypass the default data storage location for fields and entities and instead load the data from a web service. Does not import or sync. Probably not suitable because the entities are not identical (assets and products)
Remote Entity Api module but this might not be the
most efficient way because that module creates local copies of the
remote entities. This means that in site B there would exist also the
same amount of asset entities as in site A, which are synchronized
with the Product entities.
Feeds module allows one-way import and sync, could be two-way but probably complex.
The Migrate module: large framework, is a developer's tool, must have
php skills.
Services Client module the UUID needs to be inserted per entity? Not for many entities.
Service Rules module creates endpoint for Rules Components.
Requires a services client module. Might be of use (optional, see below)

[UPDATE MAY 30 2016]

According to my research the following modules combined, will likely be the most lightweight and configurable solution. I take into account that this case is not so much about migration of data, but about creating and updating using rules triggers and actions (as per the requirements).

Web Service Client module is made to consume services without custom coding. It integrates with Rules to perform the required actions.
Web Service Client for Feeds integrates the Web Servcice Client module with Feeds, which allows for a cron-based import of created or changed entities.
Sevices Views module: in order to create a view of the assets
fields that need to be created or updated.

TO DO:
The suggested approach mentioned above needs to be tested in order to prove that it works. I still don't quite understand how to configure the Web Service Client module configuration of the 'REST service descriptions'. Probably because I am a newbie to services. In order to figure that out, I posted a question about it. I will add screenshots to that where needed.

For those answering this BONUS question: The answers have been rather broad up to now. Using the abovementioned update (may 30) please provide specific support for the solution suggested by me using the Web Service Client module configuration. This allows me to choose who gets the bonus. You may answer in the connected question in order to keep the answers on topic per question.
I have also created two test sites with the modules installed and can provide admin login details if you want to test it out, or help me out with the configuration.


texts: Does module_invoke() work for non core modules?

texts:
I tried using module_invoke('casrel','nodeapi', $node, 'view'), but what I get for  casrel_nodeapi() is a truncated $node and "load" instead of "view".

Does anybody have an idea on what is happening?


texts: Hiding 3rd level menu from sidebar, but displaying elsewhere. Possible? - D7

texts:
I have a 3 level menu structure in the sidebar. I would like to add a set of submenus for one of the Second level menu items, but would this time like to hide it's children from the sidebar. Instead, I would like this menu to be displayed in the main content area. Is this possible? How would I go about doing this?

So just to clarify, some 3rd level menus I would like to display in the sidebar, but other 3rd level menus I would like to hide from the sidebar, but instead display in the main content area.


texts: How to hide a form element having a certain class in ajax callback in form?

texts:
How can I hide the product using ajax callback . I am trying to implement that using ajax_commands_invoke but it does not work using below code

  $form['field_product_type_select']['und']['#ajax']= array('callback' => '_change_table_product_type','wrapper' => 'display-table-ajaxify');
 $header = array(
   'field_name' => t('Field Name'),
   'field_type' => t('Field Type'),
   'field_no_of_values' => t('Single/Multi Value'),
 );
 $options = array();

 foreach(commerce_product_types() as $product_type => $product_type_array){
   $field_info_instances = field_info_instances('commerce_product',$product_type);

   foreach($field_info_instances as $key => $value){
   $field_info_types = field_info_field_types($value['type']);
   $options[$key] = array(
     'field_name' => $value['label'],
     'field_type' => $field_info_types['label'],
     'field_no_of_values' => $value['cardinality'],
   );
  }

 $form['display_table'][$product_type] = array(
   '#type' => 'tableselect',
   '#options' => $options,
   '#header' => $header,
   '#multiple' => TRUE,
   '#prefix' => '
'.\
$product_type_array['name'].'',
   '#suffix' => '
',
 );
 }

function _change_table_product_type(&$form,&$form_state){
  $commands = array();
  $product_type = $form_state['values']['field_product_type_select']['und'][0]['value'];
  drupal_set_message($product_type);
  $commands[] = ajax_command_invoke('display-'.$product_type,'show');

  /* $product_type = $form_state['values']['field_product_type_select']['und'][0]['value']; */
  /* foreach ($form['display_table'] as $key => $value){ */
  /*   if ($key != $product_type) { */
  /*     unset($form['display_table'][$key]); */
  /*   } */

  /* } */
  //  return $form['display_table'][$product_type];
  //  return array('#type' => 'ajax', '#commands' => $commands);
  print ajax_render($commands);
}


texts: Paragraph's fields value loaded in a custom controller are in the default language instead of the current language

texts:
I made a custom controller that load a paragraph field from a node and then render some part in a template. The paragraph field field_title and field_description are translatable.
The translation works fine on the admin side. I followed https://www.drupal.org/docs/8/modules/paragraphs/multilingual-paragraphs-configuration and I can see the content is translated from the admin. But my controller only loads the default language value instead of the current language.
<?php

/**
 * @file
 * Contains \Drupal\MyModule\Controller\MyModuleController.
 */

namespace Drupal\MyModule\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class MyModuleController extends ControllerBase {

    /**
     * Controller load the game
     *
     * @return \Drupal\MyModule\Controller\RedirectResponse
     */
    public function gameView() {

        $nid = 1;

        // Load the game
        $game = \Drupal::entityTypeManager()->getStorage('node')->load($nid);

        $stages = [];

        // Get all the stages of the game
        $paragraph_field_items = $game->get('field_stages')->getValue();
        if (!$paragraph_field_items) {
            throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException('This game has no level');
        }

        // Get storage for paragraph
        $paragraph_storage = \Drupal::entityTypeManager()->getStorage('paragraph');
        // Collect paragraph field's ids.
        $ids = array_column($paragraph_field_items, 'target_id');
        // Load all paragraph objects.
        $paragraphs_objects = $paragraph_storage->loadMultiple($ids);

        /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
        foreach ($paragraphs_objects as $paragraph) {
          // Get field from the paragraph.

          $description = [
              '#type' => 'processed_text',
              '#text' => $paragraph->get('field_description')->value,
              '#format' => 'basic_html',
          ];

          $stages [] = [
              'title' => $paragraph->get('field_title')->value,
              'image' => $paragraph->get('field_image'),
              'description' => $description,
              'east_lv95' => $paragraph->get('field_east_lv95')->value,
              'north_lv95' => $paragraph->get('field_north_lv95')->value,
          ];
        }

        return [
            '#theme' => 'game_map',
            '#party' => $party,
            '#stages' => $stages,
            '#game' => $game,
        ];
    }


texts: How to resolve error 'migration_group' entity with ID 'migrate_drupal_7' already exists?

texts:
I have been trying to migrate to Drupal 8 using the drush. I have followed all the instruction as mentioned in [https://drupalize.me/blog/201604/custom-drupal-drupal-migrations-migrate-tools][1]

After installation, enabled all the required modules like migrate upgrade, migrate tools and migrate plus, and then added the code in settings.php file mentioned below.

 // Database entry for `drush migrate-upgrade --configure-only`
$databases['upgrade']['default'] = array (
  'database' => 'dbname',
  'username' => 'dbuser',
  'password' => 'dbpass',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);
// Database entry for `drush migrate-import --all`
$databases['migrate']['default'] = array (
  'database' => 'dbname',
  'username' => 'dbuser',
  'password' => 'dbpass',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

Now used the command - **drush migrate-upgrade --configure-only --legacy-db-url=mysql://dbuser:dbpass@localhost/dbname --legacy-root=/path/to/sites/default/files** and than drush returns the following errors - ***'migration_group' entity with ID 'migrate_drupal_7' already exists***

How can I resolve the error?


texts: Drupal Services returns javascript after results

texts:
I am using Services Views and have a view that returns the json array, plus a script tag (the default jQuery.extend(Drupal obj...). I do not want this jQuery.extend script to be added for a services response (obviously!) and I don't know how it got here.

The endpoint url is api/events. The view Services display has a path of event. nid is an explosed filter. The view works, I get the right json, but then I have this  tag at the end.

Anyone seen this before?

Here's an example:
http://www.mysite.com:8082/api/events/event?nid=9

Result:
[{"nid":"9"}]

<script type="text/javascript"&gt;jQuery.extend(Drupal.settings, {"thmr_2":{"id":"thmr_2", "name":"textfield", "used":"theme_textfield", "type":"func", "duration":0.17, "candidates":[ "catholicfoundation_textfield" ], "preprocessors":[  ], "processors":[  ]}, "thmr_3":{"id":"thmr_3", "name":"form_element", "used":"theme_form_element", "type":"func", "duration":0.07, "candidates":[ "catholicfoundation_form_element" ], "preprocessors":[  ], "processors":[  ]}, "thmr_4":{"id":"thmr_4", "name":"button", "used":"theme_button", "type":"func", "duration":0.08, "candidates":[ "catholicfoundation_button" ], "preprocessors":[  ], "processors":[  ]}, "thmr_1":{"id":"thmr_1", "name":"views-exposed-form.tpl.php", "used":"sites\u002Fall\u002Fmodules\u002Fcontrib\u002Fviews\u002Ftheme\u002Fviews-exposed-form.tpl.php", "type":"tpl", "duration":7.42, "candidates":[ "views-exposed-form.tpl.php" ], "preprocessors":[ "template_preprocess", "template_preprocess_views_exposed_form", "contextual_preprocess" ], "processors":[ "template_process", "rdf_process" ]}, "thmr_5":{"id":"thmr_5", "name":"form", "used":"theme_form", "type":"func", "duration":0.08, "candidates":[ "catholicfoundation_form" ], "preprocessors":[  ], "processors":[  ]}, "request_id":"13390714085122a99db5036", "devel_themer_uri":"\u002Fdevel_themer\u002Fvariables\u002F13390714085122a99db5036"});</script>


texts:
I'm running a D7 system where users follow each other by using a 'follow' flag and then on user profile I've added a view to show all the users followed by a 'logged-in-user'.

What I'm struggling with is how do I generate a list of users who are followed by the friends of 'logged-in' user.

something like facebook 'mutual friends' functionality so 'logged-in' user get a list of users followed by the users he/she following.


texts: how do I make Drupal Zen sub theme mobile friendly?

texts:
I have changed over to using the Zen theme (instead of Omega) on my drupal site, I have a Superfish menu configured with default settings for SF Small Screen plugin to enable on browser width (screen width 768px which is default). It worked perfectly on Omega where i had exactly the same settings, but now with my Zen sub theme, the menu doesn't change to a mobile friendly version when i reduce the browser width on safari. I have my site installed on localhost and looking at view source it shows:

<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width">

Yet using the same site with omega theme it shows:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" >

Am i missing a setting on Zen to enable mobile responsive?

I have ticked all these settings on my zen sub theme:

Add HTML5 and responsive scripts and meta tags to every page.
 Add Respond.js JavaScript to add basic CSS3 media query support to IE 6-8.
 Add HTML5 shim JavaScript to add support to IE 6-8.
 Add meta tags to support responsive design on mobile devices.

Can anyone help?


texts: Views Better exposed filter, input required

texts:
In which hook_ of the views.api can i hide the results if no exposed inputfilter is selected.

I tried:

hook_views_query_alter($view, $query) {

if($view->getExposedInput() ...) {
 // Do not show any results, make clear no results should be shown..
}

Or

hook_views_pre_render($view) {
    if($view->getExposedInput() ...) {
      $view->result = array();
      // But pager still shown and $view->getPager()->destroy() gives error.
      // Also feels wrong, query should not be executed.
    }
}

Any suggestions, solutions, .... Thx!


texts: How can I access language currently viewed in Views Customfield: PHP Code?

texts:
I'm looking for a way to display some text in a view—information about who posted an article, and a link to read more—in a specific language based on which language for the site the user has selected.

I thought I'd do this with a "Customfield: PHP Code" to make an if statement echoing a string depending on the language.

How do I access this variable, or how do I solve the problem in another way?


texts: How can I render a responsive image style from an image in the theme directory?

texts:
I am working on template views-view-fields--myview.html.twig. But I do
not think it matters what template you are working with for this to
work.

I found this Twig that can add Drupal responsive images to an
image that is not in a field. In this case this image is in the files
directory. My question is that I want to place this image in my themes
directory in: /themes/custom/mytheme/img/mygraphic.png. What URI can I
use to make that work in this example?

Second question is: The
image alt tag is empty even though I provided one. How can I display an
alt tag?

{% set responsiveimagestyle = {
    '#theme': 'responsive_image',
    '#responsive_image_style_id': 'my_custom_responsive_style',
    '#uri': 'public://mygraphic.png',
    '#alt': 'my alt text',
    '#attributes': { class: 'img-responsive' },
} %}

In the views-view-fields--myview.html.twig template I now can use the following
variable.

{{ responsiveimagestyle }}

The image is wrapped in the picture tag and is using the Drupal Responsive Images style.


texts:
I have a form for which I want to theme with a template file, and I also need to use ajax in it. But I get this error messages in the log and ajax doesn't work :

message 1

Invalid form POST data.
message 2

Notice: Undefined index: form_build_id in ajax_get_form() (line 320 of /Applications/MAMP/htdocs/ta/includes/ajax.inc).

ajax_test.module :

function ajax_test_menu() {
    return array(
        'ajax_test' => array(
            'title' => t('Ajax test'),
            'page callback' => 'drupal_get_form',
            'page arguments' => array('_ajax_test_form'),
            'access arguments' => array('access content'),
        )
    );
}

function ajax_test_theme() {
    return array(
        '_ajax_test_form' => array(
            'template' => 'ajax_test-form',
            'render element' => 'form',
        ),
    );

}

function _ajax_test_form() {
    return array(
        'name' => array(
            '#type' => 'select',
            '#id' => "select-id",
            '#options' => range(1, 40),
            '#ajax' => array(
                'callback' => '_ajax_test_callback',
                'wrapper' => "more-options",
            ),
        ),
    );
}

function _ajax_test_callback($form, $form_state) {
    return '
Hello world!
';
}

ajax_test-form.tpl.php :

    <? echo drupal_render($form['name']); ?>


texts: Block/mosaic type homepage with heavily interactive menu

texts:
I wanted to know if this was possible to do for a Drupal website like this website has the main navigation how it works and interacts with the main content layout. http://goo.gl/HQ4P8H

What modules must be used to do that? I am okay if it needs .js for the 'effects', but I want to understand how it works when loading new stuff from navigation while in the same page without refresh.

Also when you hover on blocks it gives various/interactive content, menus and links. How is that done on Drupal? Is it something can be pulled of from Views and then applying jQuery to output content in that way while on hover?

So in overall I wanted to know if this can be achieved without custom php coding, because I am not programmer, if it's only .js .css and modules that would be great to know which ones.

Cheers.


texts: can't upload files from computer in any wysiwyg editor

texts:
When I want to upload an image from an editor it only allows me to insert a URL and the ability to browse and upload a file is missing.
So there's something that behind all the wysiwyg editor that is preventing me from doing this and honestly don't know where to start looking for this.

Tried FCKeditor, CKeditor, jwysywig and TinyMCE and in all those cases I can only insert a URL but not upload from hard drive

There's a tutorial I found on youtube here. At 0:19 you'll see 4 tabs called 'Image Info', 'Links', 'Upload' and 'Advanced' respectively.
So my problem is the 'Upload' tab is missing from my editor as well as all other editor where this upload function is supposed to be.


texts:
I am using Media module on a Drupal 7 installation and have created a content type called Media. I then used the Multimedia asset of the Media module, so users can upload both images and videos.

I now want to create a view with the latest videos and also latest photos, but there is not anything on the filter to select a video (or photo). How can I add such a filter?


texts:
In Drupal 7, if we need to define multiple instances of blocks from a database table, we use a foreach loop to return the array key, and then we we get all the multiple instances of our block using hook_block_info().

function mymodule_block_info() {
    $blocks = array();
    $add = db_select('mymodule_blocks_data', 'n')
                  ->fields('n', array('delta', 'title', 'content_type'))
                  ->condition('n.form_type', 'Add', '=')
                  ->execute();
    foreach ($add as $row) {
        $blocks[$row->delta] = array(
      'info' => t('@name (Add Form Block) Type: @type', array('@name' => $row->title, '@type' => $row->content_type)),
      'cache' => DRUPAL_NO_CACHE,
        );
    }

    $edit = db_select('mymodule_blocks_data', 'n')
                  ->fields('n', array('delta', 'title', 'content_type', 'nid'))
                  ->condition('n.form_type', 'Edit', '=')
                  ->execute();
    foreach ($edit as $row) {
        $blocks[$row->delta] = array(
      'info' => t('@name (Edit Form Block) Nid: @nid', array('@name' => $row->title, '@nid' => $row->nid)),
      'cache' => DRUPAL_NO_CACHE,
        );
    }

    return $blocks;
}

In Drupal 8, I suppose hook_block_info() is replaced by plugin derivatives.
Though I found a way here where they display nodes by using the entity manager, I have still to understand what I need to do when I am using my custom database table, and not an entity.

What is the equivalent code in Drupal 8 for hook_block_info()?


texts: Programmatically create a user and assign a role

texts:
I'm programmatically creating a user with the following code.

$newUser = array(
  'name' => $mail,
  'pass' => 'password',  // note: do not md5 the password
  'mail' => $mail,
  'status' => 1,
  'init' => $mail,
  'roles' => array(5)
);
$user = user_save(null, $newUser);

I have got a role with the role ID equal to 5; when I create the user, in the table "users_roles" there is only a row with the value 0 for the role ID, but if I print the user object with var_dump(), it looks like the roles are created.

What am I doing wrong?


texts: How can I access an external table in a MySQL database?

texts:
I have a database (MySQL) with information about food.

It has several columns, for example:

-----------------------------------------
| product name | calories | fat | unit  |
-----------------------------------------
| bread        | 100      | 10  | grams |
| potatoes     |  50      | 20  | grams |
-----------------------------------------

Is there anyway way to import this dataset into Drupal and work with it in a field type, perhaps with taxonomy? Or should I program my own module?


texts:
I have a content type where users upload a file. An administrator then uses a select list which is an Entity Reference that assigns the node to another user with a specific role. They do there work on the file and upload their work. The issue is, when the second user saves the node the entity reference gets blanked. Using version 7.51
How can I insure that the field stays populated through the whole process?
Thanks


texts: Why page-view counters not working (displayed)?

texts:
I have set up to display the page-view (hit) counter, using the Drupal 7 core statistics module, following the standard procedure (see, for example, the summary here).

However, (A) only English contents show the counter but none of the other languages on a site, and (B) none of the contents show the counter on another site.

The structure and installed modules in those sites are slightly different.  However, as far as the settings (configuration, permission etc) of the statistics module is concerned, they are the same.

What is happening? Where should I look for to investigate?


texts: Adding a class to select options from Views Exposed Filters

texts:
Currently I have a views exposed filter for a "City" field. Typical output looks like:

<option value="Liverpool">Liverpool</option>

I would love to be able to add a class to this such as:

<option value="Liverpool" class="north-west">Liverpool</option>

I currently have a CCK field "field_region" which is set to "North West" for Liverpool - so it would be brilliant if anyone had any suggestions with how to achieve this on my exposed form input.

Cheers,
Garry.


texts: Add country, state dropdown to user registrtaion

texts: i am creating a user registration form. In this i want to add fields for country, state, area and the fields are dependent on each other i.e. state depends on country and area depends on state. Is there any module in drupal or any way to integrate it with user registration form.


texts:
Can anyone tell me why I would get this error:

Migration MyData could not be constructed.                                                           [error]
    SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'sourceid1'

...from the following code:

class MyDataMigration extends Migrator{

    public function __construct($arguments){
        parent::__construct($arguments);
        $this->description = t('Imports data');

        // source
            $options = array(
                'header_rows'=>1,
                'delimiter'=>','
            );

            $uri = drupal_get_path('module', 'migrator') . "/includes/MyData.csv";
            $this->source = new MigrateSourceCSV($uri, array(), $options );

        // destination
            $this->destination = new MigrateDestinationNode('link');

        // map
            $this->map = new MigrateSQLMap(
                $this->machineName,
                array(
                    'user_id' => array(
                        'type' => 'varchar',
                        'length' => 10,
                        'description' => t('User ID'),
                        'not null' => TRUE,
                        'default' => '',
                    ),
                    'page_id' => array(
                        'type' => 'int',
                        'length' => 10,
                        'description' => t('Page ID'),
                        'unsigned' => TRUE,
                        'not null' => TRUE,
                        'default' => 0,
                    )
                ),
                MigrateDestinationNode::getKeySchema()
            );
        }

}

...importing this sample data:

user_id,link_id,page_id,name,request,promote,position,status
LKSDET,11030,19600,Online Forms - Haringey,,NULL,NULL,Active
ASDFRE,3,21747,e-payments,,NULL,NULL,NULL
JYHGKI,4,19574,Directorates,,NULL,NULL,NULL
OOLPKH,5,19574,Directorates,,NULL,NULL,NULL
VBNGTY,108,21236,SAP Resources,,NULL,NULL,Active
QWERCF,1047,19640,Pay and Conditions,,NULL,NULL,NULL
LPOUIJ,12,21747,e-payments,,NULL,NULL,NULL
XCBGTY,13,21747,e-payments,,NULL,NULL,NULL
UJUIKU,10,21747,e-payments,,NULL,NULL,NULL


texts: Disable editing of a node after it has been published

texts:
Scenario:

A user can create a node (content type "story"). All story nodes that are created are unpublished by default.

I have a boolean field called "publish my story". Once this has been checked and saved the node is published using rules.

Question:

Is it possible to revoke a users ability to edit published nodes by using rules as I do not want them to change the story afterwards.


texts: hook_install_tasks() in `drush site-install`?

texts:
Does anyone know of a way to add install tasks to drush site-install?

I have already added a hook_install_tasks() my custom installation profile, but that does not make it into drush when I run drush site-install.

Drupal: 7.39

Drush: 6.0


texts: Get url of referenced entity in twig based on target_id

texts:
I have a content type with a field « referenced entity » called field_suggestion_articles.

User can choose related content and a view displays this list of related content at the bottom of the content. The views uses "content" (display mode, a template like teaser) and not fields.

I use a loop to display this list in node--article--related-content.html.twig:

{% for key,value in node.field_suggestion_articles.value %}
    {# display the title #}
    {{ content.field_suggestion_articles[key] }}

    {# display a text field #}
    {{node.field_suggestion_articles[key].entity.field_resume_suggestion_article.value|raw}}

{% endfor %}

But I don’t know how to get the node urls of these related content.

When I dump node.field_suggestion_articles.value, I get the target_id of the node so I guess I should use it to retrieve the url. But I’ve tried a lot of solutions found on Drupal forums and here on stackExchange but without success.

Could you point me in the right direction ?


texts: Custom review system with content type reviews and coasters

texts: I have a content type "reviews" with a node reference to "coaster". I want to be able to have users rate a roller coaster while writing a short review and giving a user rating. I added a Fivestar "rating" field in "review" . I would like users to submit review and rating, then on the coaster node display an average rating based on the individual reviews. So far I have managed to display the individual reviews on the relevant coaster node with a view and relationship and contextual filters. What is my best option to display the average? I've looked into views calc, but I'm relatively new to Drupal. Thanks for any help.


texts:
I'm working on a D7.27 site I've inherited and when adding a new content type I'm getting this error:

DatabaseSchemaObjectExistsException: Table
field_data_body already exists.
in DatabaseSchema->createTable() (line 657 of
/blah/docroot/includes/database/schema.inc).

All I've provided is the new name and clicked Save. It seems to have created the type, but without the Body field (!).

I've deleted the content type and tried again, and it's quite reproduceable! I have never encountered this error before, any ideas?

Edit

In case this helps.

mysql> select field_name, count(*)
       FROM field_config
       WHERE field_name LIKE "%body%" GROUP BY field_name;
+-------------------------------+----------+
| field_name                    | count(*) |
+-------------------------------+----------+
| field_blog_taxonomy_term_body |        1 |
| field_body                    |        1 |
+-------------------------------+----------+

mysql> show tables like "%body%";
+----------------------------------------------+
| Tables_in_drupal (%body%)                    |
+----------------------------------------------+
| field_data_body                              |
| field_data_field_blog_taxonomy_term_body     |
| field_data_field_body                        |
| field_data_field_email_share_body            |
| field_revision_body                          |
| field_revision_field_blog_taxonomy_term_body |
| field_revision_field_body                    |
| field_revision_field_email_share_body        |
+----------------------------------------------+


texts: Clean field value handling inside views_handler_field subclass?

texts:
I am writing a few views_handler_field subclasses that render fields of my entity depending on other values of the entity. The examples I see use a very awkward way of accessing the other field data, eg.

function render($values) {
  if (isset($values->field_name[0])) {
    $my_stuff = $values->field_name[0]['raw']['value'];
  }
  ...
}

Is there a clean way of accessing other fields in the entity, like EntityMetadataWrapper? I would just load the entity and create a EMW instance but that seems expensive to do for each cell in a big table.


texts: Change Boolean field status on clicking submit button

texts:
I have placed an additional button to the term edit page, and when the user clicks on the additional ("Archieve") button, the status of the boolean field should change from 0 to 1 in the database.

I have written the following code for achieving the above:

function security_settings_form_alter(&$form, &$form_state, $form_id)
{
    if($form_id == 'taxonomy_form_term')
    {
        dpm($form);
        $form['actions']['push'] = array(
            '#type' => 'submit',
            '#value' => t('Archieve'),
            '#submit' => array('my_custom_submit_function'),
            '#weight' =>25
        );
    }
}

function my_custom_submit_function($form, &$form_state)
{
    $form_state['values']['field_test_button']['und'][0]['value']=1;
    db_query("UPDATE {field_data_field_test_button} SET field_test_button_value = :val WHERE entity_id = :eid",
             array(':val' => $form_state['values']['field_test_button']['und'][0]['value'], ':eid' => $form_state['values']['tid']));
    drupal_set_message(t('Your form has been archieved.'));
}

The above functionality is working fine.

But if the user clicks on the same archieve button again, its status should change from 1 to 0 in the database.

Any idea how can achieve this?


texts:
We have had a lot of feedback about our Drupal site running very slow on a different network. Most of the users on this network use IE (IE6 and IE8), which is causing a huge slowdown compared with Firefox.

However, even in Firefox it is still slower than what we would expect. We have put this down to a local DNS issue (the DNS request is timing out after 2 seconds, then works off another DNS sever. I am assuming this is adding a 2 second latency to all page loads?)

What other problem could be causing a dramatic slow down for Drupal, only in IE?

Site in FF from YSlow:

Empty Cache = Total Weight - 586.2K
Primed Cache = Total Weight - 267.3K


texts: Looking for a Module to allow presentation of data like a Microsoft Access Table

texts:
A client that is currently using Microsoft Access to manage some reporting tasks would like us to extend a custom module to allow them the same (or similar) functionality on their website.

I was looking at Data Tables which has a Drupal module and that would get us most of the way there however I wanted to reach out to the experts out there to see if there are any better solutions.

Their website is currently Drupal 6 but we may be rebuilding it in Drupal 7 so I will need solutions for both versions.

EDIT I'm interested in displaying data tabularly, but also need to have the filtering and sorting options on the columns. Data Tables has the sorting down but I don't see how it can filter.

Thanks in advance!


texts: How to get jquery working on Drupal 7 - for Newbies

texts:
I have been reading many tutorials online on how to get jquery working on drupal 7.
Although there are many lines of code and examples, what i cannot find is what piece of code to put where (maybe it is obvious for most of the developers)

So, what I do is

1)I create a new custom block

2)Over there from drupal UI, I write my code

(function ($) {

  $(document).ready(function(){

    // jquery here

  });
})(jQuery);

3)I display the block, but the jquery is not loaded.

I am reading that I should be putting this code in template files , theme files, css files, info files and I do not know whatelse!

It is not clear to me in which file exactly and in which path I have to put the above code to work properly ?

Any advice?

Many thanks!


texts: How to direct a dynamic url to a Drupal page

texts:
I created a little web app that allows people to keep content on a page.  They can specify the url of the page.  Instead of accessing their page like this: http://example.com/stuff?page=their_url I want the url to be like this: http://example.com/stuff/their_url

But I can't figure out how to direct a dynamic url to a Drupal page.  I've even tried Apache redirects, but I can't get that working either.  I keep getting 404's.

I'm willing to use Apache rewrites to get to the right page.

I'm willing to point to a regular PHP file on the server and bootstrap Drupal, but so far I haven't been able to get that working.

I'm willing to put PHP code into a Drupal page.

I really don't want to write my own Drupal module, so if you want to offer some Drupal code, please tell me where to use it.

I'm willing to use a Drupal 7 module if you know of any.

Thanks a lot!

--
Magmatic


texts: Cannot translate a content type "The configuration objects have different language codes so they cannot be translated"

texts:
I cannot translate a content type

The configuration objects have different language codes so they cannot be translated:
node.type.article : fr
core.base_field_override.node.article.title : en

I think it was because by mistake the article was created in French then after I go back to en... But I don't know how to change it ?

I tried to fix this via drush :

drush cset node.type.article langcode en

but it doesn't seems to work so I would like to know how to fix it via the admin ?


texts: Event "After cloning a node" by node clone module is not working

texts:
I am trying to use the event "After cloning a node" provided by Node clone module for Rules integration but its not working.Do any one came across this issue before?

I have created the issue as a bug in issue queue of node clone module.

Any pointers on this?


texts:
I'm trying to use an attachment to use the existing filters of blocks I have the attachment set to but for some reason it is not returning the the results related to that specific block it keeps displaying the same result in each block I have the attachment set to. I have attacked screenshots for the settings I have.

Heres the attachment
and here is my block


texts: Is it possible that a view list entities that are not related to other (like a not in (select ...) )?

texts:
I have been trying to build a view to list entities A that are not related with entities B.

Entities A are users. Entities B are submissions. I need to list users that don't have submissions for a certain year.

In SQL it would be: select uid from users where uid not in (select uid from submissions where year = NNNN).

Is there a way to do this using Drupal 7 and Views 3?


texts:
By adding use-ajax to a link we can open a modal using the Drupal ajax library as per the docs.
E.g.
<a class="use-ajax"
    data-dialog-options="{&quot;width&quot;:400}"
    data-dialog-type="modal"
    href="/node/1">
    First article displayed in modal dialog.
</a>

This will use the ajax library to fetch node/1 and then display it in a modal.
There is also a Dialog API for JavaScript which allows opening modals using JavaScript.
E.g.
var myDialog  = Drupal.dialog(ADOMElement, settings);
myDialog.show();

The problem with this API is you need to pass in a existing DOM element.
My question is can I trigger opening a modal with JavaScript and utalise the internal Drupal ajax library to actually fetch the content?
E.g Can I do something like this?
var myDialog  = Drupal.dialog('/node/1', {useAjax: true});
myDialog.show();

I could just create an html link as per my first code block, hide it with css, and then trigger a click on it with JS but this seems a bit hacky - there must be a way to trigger this action using pure JS.


texts: Which IP address(es) should I use for Allowed Hosts in Elysia Cron?

texts:
I am configuring Elysia Cron on a Rackspace Managed Cloud Server. We have a loadbalancer in front of two webservers.

Am I supposed to use all three (3) IP addresses (Load Balancer, Web01, Web02) in the "Allowed Hosts" field (= a Drupal setting)? Or just use the IP address of the Load Balancer?


texts: How to preserve discount set with query parameters into cart?

texts:
Using Drupal Commerce, I've been experimenting with applying a simple discount to a product using query string parameters. The goal is to allow a user to navigate to a product display page and see a discounted price based on this syntax:

http://example.com/product_display?code=discount_code

Where 'discount_code' represents some kind of discount to apply to the product.

By writing a custom action that's triggered on the event "Calculating the sell price of a product", it's pretty easy to alter the price of a line item with rules with something like:

function mymodule_apply_discount_via_url($line_item) {

  if ((isset($_GET['code'])) {

    // code to figure out if code is valid

    // code to figure out type of discount

    // code to alter the unit price and add difference as a component

Which works fine - the user will see the discounted price on the product display page. This is nice, because the user has access to all product information along with the discounted price.

However, on "add to cart", the product will appear in the cart at the original price. I assume this is because the pricing rules are run again but without the query parameter.

How can I preserve a discount applied this way through the add to cart step?


texts: Scheduled rules execute a hour after they are supposed to

texts:
I have created a scheduled rule that sends a email based on a date field in nodes of a certain content type. The rule executes as scheduled and the email is sent but for some reason it only fires exactly a hour after its supposed to.

E.g on the admin/config/workflow/rules/schedule page the item is scheduled to execute at Thu, 2017-08-03 15:30 but I only receive the email at 16:30.

I could fix this by adding a offset to the trigger time but I would rather want to understand why this is happening and fix the problem accordingly.


texts: How to use JSON data generated by views_datasource as a php array?

texts:
I extracted data in JSON Format from a view (using views_datasource). This is the snap-shot of preview of view.

Now I want to use this data as php array/object so that I can access each field individually and use it. I tried this in my html.tpl.php file (just to see if the data is fetched or not):

    $vdata = views_embed_view('view_name');
    $json_data = drupal_json_decode($vdata);
    $thedata = $json_data->nodes->node->title;

    print ($thedata);

But this code is not printing anything. Showing error:"trying to get property of non object".

I am new to JSON thing so I dont know if that is the correct way to extract the data from it.

I would be very grateful if I could see  a sample of code which does extraction of data and use it as array. Thank you.


texts:
I created child elements for the main navigation. I went into the block configuration and adjusted it to show up to three levels of sub menu's.

For Drupal 7 I know that I used Nice Menu's to get the menu working with child links. But it's not usable yet with Drupal 8.

I was wondering if there was another module or how I could get my Child Links to show up.


texts: How to Move Tooltip Away from Checkbox in Bootstrap Theme?

texts: I am using the Bootstrap theme as the administration theme. The tooltips get in the way of the checkboxes. How to move?


texts: Is there a way to add fee to total order balance once, based on some conditions? The product pricing rules are added for each product. I need this to be a price component, so it needs to be displayed as fee on the total order display (not as an added product!).


texts:
I want to do display a list with Views, which shows all Nodes the current user have ever edited.

The workbench Module includes a list like I need, 'workbench_edited', this view uses the Filter

(revision user) User: Current (Yes)

But the problem is that this View only checks if the user is the editor of the CURRENT REVISION, it does not check all revions of a node, just the current one.

Is there a way to list all Nodes a User ever edited? So that Views checks all revisions of a node?


texts: how can I set #attributes for each item of selectlist

texts: I know I can set style for form items with #attributes  but I want set background for select list (drop down) items, how can set #attributes for each item of select list(dropdown) in form_alter ?


texts: How can I switch back and forth between globally installed Drush versions?

texts:
I installed Drush 8 using cgr (which is a safer replacement for composer global require):
cgr drush/drush:8.x-dev --prefer-source

But now I also want to install Drush 9 for certain sites. Is there a way to switch between Drush 8 and 9 easily?


texts: why is my simple node Service returning views.exposed_data

texts:
my simple Services endpoint uses the Views 3 & JSON data document settings in this screenshot:

at least a few days ago the structure was simply...

{}{
"nodes": [{node:{},..],
"view": {
"name": "biz_locations",
"display": "page_1",
"path": "locations.json",
"root": "nodes",
"child": "node",
"pages": 9,
"page": 0,
"count": 173,
"limit": 20,
}
}

now all of the sudden it's including these three HUGE arrays:

"exposed_data": {BIG OBJECT},
"exposed_raw_input": {BIG OBJECT},
"filter": {BIG OBJECT}

with way more than I need or want to return. I don't know what I've changed to having Services include these. The Simple setting is the generally structure I want, but only with the first set of json properties above.

Is there a place you can defined / add your own JSON data format? or how can i remove the large exposed_data, exposed_raw_input, and filter properties in Drupal's administration?


texts: role delegation module : how to fine-tune the 'edit-administer-users' permissions?

texts:
Using role delegation module , i allow a user say 'mat' with a 'site_admin' role to assign other users to a 'VIP_role'.

The problem is role delegation needs apparentely 'administer users permission' being selected for 'assign' actions to work.

When logging in with 'mat' credentials that's been set with 'administer users permission', it gives some back office links that i would like to restrict.

How could I restrict 'role delegate' to editing existing users and assign them roles ?


texts: Ajax callback does not replace the form but add a new field

texts:
I use his code to populate a select after giving à zipcode.

$form['responsible']['zipcode'] = array(
      '#type'               => 'textfield',
      '#title'              => t('Zipcode'),
      '#default_value'      => empty($account->Dossier->responsable->adresse->codePostal) ? Null : $account->Dossier->responsable->adresse->codePostal,
      '#required'           => True,
      '#maxlength'          => 5,
      '#ajax' => array(
        'callback' => 'ajax_get_cities_callback',
        'wrapper' => 'edit-city',
        'method' => 'replace',
      ),
    );

    $form['responsible']['city'] = array(
      '#type'               => 'select',
      '#title'              => t('City'),
      '#options'            => array(),
      '#required'           => True,
    );

My callback

function ajax_get_cities_callback($form, $form_state){
  $client = new SoapClient('myWebservice',array("trace" => true,  "exceptions" => true,));
  $requestParams = array(
    'parameters' => array (
      'numSite' => 1058,
      'typeListes' => array(
        'RechercheTypeListe' => array(
          'typeListe' => 'LST_VILLE',
          'param1' => $form_state['values']['zipcode']
          )
        )
    )
  );
  $dataresponse->requestParams = $requestParams;
  $response = "";
  try {
      $response = $client->__Call('GetListes',$requestParams);
  }
  catch (Exception $e) {
    var_dump($e);
    return False;
  }

  $form['responsible']['city']['#options'] = array(
    0 => "aaaa",
    1 => "test2",
    2 => "test3"
  );

  return $form['responsible']['city'];

}

When I give a zipcode, a new select is created behind the first one.( picture here: https://www.uploady.com/#!/download/zjKvglzRTSe/ZIMYkjSAAaLrUFUq)
I tried to return only $form['responsible']['city']['#options'] but it does not fixe.

Any idea ?

Thank you


texts: I have the same form displayed twice on the same page. It's the comment form . I put it twice on the same page . when I fill the inputs in the second one and I click on submit . I notice that the values that i've put appear in the input fields of the first comment form as well. Any idea why?


texts: Show English when there is no translation

texts:
I have a website for a client, with more than 5 languages (bg, en, ru, ch, de, it ...). The client wants to add a news section but the news should be only in en or ch and if the user selects a language which is different then en or ch, en should be shown.

Is it possible when you add a content with English language, automatically translations for all other languages to be created instead of adding one by one the translations via translate menu entry?


texts:
I have got an issue unflagging a node with Rules scheduler when triggering it with cron. The node gets unflagged just fine if we execute the component manually, however, if I schedule it to unflag the node like 2 minutes after triggering the Rule, it doesn't unflag the node.  I ran cron multiple times, refreshed the page, but nothing.

I have done some preliminary testing and found out that flag_rules_action_info() is just not being called at all when executing this through cron. I have checked permissions and every thing looks good there. Would appreciate it if you guys could give me some input as to what might be the problem when triggering it with cron. I have included the rules debug info below and an export of the rule and the component. Thanks.

Debug Info:

0 ms Scheduled evaluation of action set my component, task Unbookmark 10..
90.748 ms Evaluating the action component_rules_my_component. [edit]
0 ms Evaluating action set my component.
0.473 ms Evaluating the action component_rules_my_component. [edit]
0.528 ms Not evaluating action set my component to prevent recursion. [edit]
1.07 ms Evaluating the action flag_unflagnode. [edit]
5.439 ms Evaluating the action add_badge_by_name. [edit]
7.16 ms Finished evaluation of action set my component.
98.707 ms Evaluating the action flag_unflagnode. [edit]
98.982 ms Evaluating the action add_badge_by_name. [edit]
116.401 ms Finished evaluation of action set my component, task Unbookmark 10..

Component Export:

{ "rules_my_component" : {
"LABEL" : "my component",
"PLUGIN" : "action set",
"REQUIRES" : [ "rules", "flag", "user_badges" ],
"ACCESS_EXPOSED" : "1",
"USES VARIABLES" : { "node" : { "label" : "node", "type" : "node" } },
"ACTION SET" : [
{ "component_rules_my_component" : [ ] },
{ "flag_unflagnode" : {
"flag" : "bookmarks",
"node" : "10",
"flagging_user" : [ "site:current-user" ],
"permission_check" : 1
}
},
{ "add_badge_by_name" : { "badge" : "4", "user" : [ "node:author" ] } }
]
}
}

Rules Export:

{ "rules_test_scheduler" : {
"LABEL" : "test scheduler",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "rules_scheduler", "flag" ],
"ON" : [ "flag_flagged_bookmarks" ],
"IF" : [
{ "entity_is_of_type" : { "entity" : [ "flagged-node" ], "type" : "node" } },
{ "node_is_of_type" : {
"node" : [ "flagged-node" ],
"type" : { "value" : { "blog" : "blog" } }
}
}
],
"DO" : [
{ "drupal_message" : { "message" : "this works" } },
{ "schedule" : {
"component" : "rules_my_component",
"date" : "+2 minutes",
"identifier" : "Unbookmark [flagged-node:nid].",
"param_node" : [ "flagged-node" ]
}
}
]
}
}


texts:
I can currently upload with an Image field for SVG.   I am using the SVG image module.

I just installed the Media module so I can use the Media library functionality.   However when I add a new Image using Add Media.   I am getting the error message I was having problems with before.

Only files with the following extensions are allowed: png gif jpg jpeg.

Not sure where to resolve this.   Please advise thanks.


texts: I'm trying to create two content types at once in one form. One is a parent page the other a child page

texts:
So I'm workoing on a story archive website and I've created several interations using the Book module in drupal. However while I like all the stuff book does by default I need to streamline the process of content creation and I'm no longer sure I can do that easily with book module.

I am right now trying to figure out how to create a way to create both the front page and the first child page of a story/book in the system, and create an easier way to add a chapter to a story and tell drupal what the chapter number is. If anyone has any advice on this I would appreciate it emensly.


texts: How to show the uploaded managed_file in the edit page?

texts:
I am able to successfully upload files using managed_file. The file is saved in the correct directory and the record shows up in the file_managed table.

$form['image'] = array(
    '#title' => t('Image'),
    '#type' => 'managed_file',
    '#default_value' => (isset($foo->image->fid) ? $foo->image->fid : ''),
    '#upload_location' => 'public://foo_images/'
);

But when I edit the form, it still shows the Upload button, similar to the Create page before I have uploaded a file. How do I make the edit page look like I have already uploaded a file for that particular entity?


texts: Large var_dump when looking at $variables

texts:
This might not be the correct place to ask this question, please remove if it is wrong...

But, when I do a var_dump($variables) in one of my nodes I get a very large output that repeats several times... Is this just the way Drupal normally acts or might this indicate that there is something wrong with my site?

Thanks


texts: Translate a taxonomy term in the exposed filter select options

texts:
I'm using Drupal 8 with Better Exposed Filters and for some reason the select options in the exposed filters (which are taxonomy terms) are refusing to appear translated, despite the fact that the rendering language is set to "Interface text language selected for page."

I'm using Better Exposed Filters, but this behavior also occurs when it's not used.

How can I make them appear translated?


texts: PHPUnit Testing when a custom class contains drupal calls and references other classes

texts:
Ok, I am brand new to TDD within the Drupal environment but we have been asked to try write tests where possible for our custom and/or utility/support modules.

I've managed to write some simple PHPUnit tests, but because the classes within my module have some methods that try to load entities (Content Types built via standard Drupal UI) and then do various thing with them, I am having trouble how to bridge this gap.

Currently when I run my tests most of the assertions pass as they are fairly simply but the one is giving me a warning:

1) Warning
The data provider specified for Drupal\Tests\lrgContentTypes\Unit\AuctionEventTest::testGetNodeFields is invalid.
\Drupal::$container is not initialised yet. \Drupal::setContainer() must be called with a real container.

This has only occurred recently because I have now fleshed out the code for the entity class that the parent is trying to pass in the provider.

I am unsure where to go from here, the Drupal 8 documentation seems to be spotty and gives no clear guidance from a basics point of view.

Is there anywhere that gives a definitive set of examples to show how to test methods that try to load a node via Node::load and where Entity Reference Revision objects are expected?

I will post my classes and test classes below in case its relevant.

1) AuctionEventTest class

https://pastebin.com/vkaiPfUD

2) AuctionLotTest class

https://pastebin.com/ptUmF8UJ

3) AuctionEvent Class (Auction Event content type utility class)

https://pastebin.com/NCDy34z2

4) AuctionLot Class (Auction Lot Entity Reference Revision util class)

https://pastebin.com/mmZ0dh1i


texts:
Am newbie here. I just have a problem with fields adding them to a page.
I want fields specificly textboxes and a button to be in a page. This page will be used by my authenticated users. These textboxes will be filled in by the said users then have the system save the info to the DB after click of the button.

How do I do this? I created a content type of this but i can't seem to add them in the page. No article i can find here either that answers my problem. Please help. Am new here and am not a coder.
Thanks y'all.


texts:
I want to embed RichFilemaneger (https://github.com/servocoder/RichFilemanager) in a Drupal-8 site. RichFilemanager has its own index.html and a php-conncetor for implementation in other sites.

But it's not clear to me which approach to follow.

Should i keep RichFilemanager in it's own directory in the Drupal-root and connect to it via the php-connector? In that case it seems to me that Drupal can't take care of the security...
or should i copy the content of the index.html to a twig template? But that would make it hard to keep up with updates of RichFilemanager.

Can anyone point me in the right direction?
Are there similar tools implemented which i could use as an example?


texts: Add Option to Centre Images on Content Pages

texts:
Currently, to align images only Right & Left options are available as shown in below image:

How to Enable full-width images similar to the link which is displaying images: https://medium.com/perspectives-from-the-economist-intelligence-unit/lake-chads-twofold-crisis-27545789e9d7


texts: Adding a page to a menu with query parameters in the URL

texts:
I'm trying to add a page generated by CiviCRM to my menu. The pages url is 'civicrm/contribute/transact?reset=1&id=6'. I've added the link to the drupal menu manually, and it goes to the page, but that menu item isn't set to active and the active-trail class is not set to it's parent items.

I tried using the full URL and also tried created a module that added a hook_menu function to create a url without query parameters. The hook_menu callback would redirect to the path above.

How can I add that link to my menu, and have the active and active-trail classes set?


texts: Error migrating a Drupal 8 site from beta15 to final

texts:
I have a site in development that is currently running Drupal 8 beta 15. As it is on shared hosting without shell access, I'm planning on moving it to a VPS. Updating Drupal 8 via FTP is just far too annoying.

But when I tried to move the site to a new server I encountered a problem. The new server is running  Ubuntu 14.04 with PHP 7 on it.

I installed the final Drupal 8 on the server, and then copied the sites, themes and modules folder from my beta site and restored the beta database on the new server.

But now I get the following error when trying to access the site:

  PHP message: Uncaught PHP Exception InvalidArgumentException: "$max_age must be an integer" at /var/www/html/drupal/core/lib/Drupal/Core/Cache/CacheableMetadata.php line 81"

I tried drush cr, but that didn't do anything. I also can't execute an updatedb, I get the following error then:

  Error: Call to undefined function drupal_get_installed_schema_version() in /var/www/html/drupal/core/includes/install.inc on line 80
  Error: Call to undefined function drupal_get_installed_schema_version() in drupal_load_updates() (line 80 of /var/www/html/drupal/core/includes/install.inc).

Any ideas on how to fix this particular error? Or alternatively, a better way to migrate my beta site that doesn't rely on shell access on the server?


texts:
I am using created date of ubercart order to compare with filter selected values of date.

created date is in timestamp with time. Where as filter selected values it is just date and if try to convert the date to timestamp, its not fetching accurate results as per filtered dates.

I have attached the image for clear understanding.

I have used this as query:

$query = $query->condition('uc.created',array($from_timestamp,$to_timestamp),'BETWEEN');

Any suggestions ? Thanks in advance.


texts: how to show html content when select box item selected

texts: i have a select box called Delivery method and it has two options Drop off and pick up..,i want to load few extra html fields like size ,pick up address to the page when user select pick up method,what is the best way of doing it drupal..


texts: How to set the Organic Group while saving a node based on the node's current language

texts:
We want to use a hook_node_presave to set the Organic Group (OG) field on the basic page content type based on the node's language. We have created several OGs using nodes and each one is assigned a language so there is a mapping between Language to OG based on the OG node.

So basically, when the basic pages' language is set to en, then the OG with a language of en, will be assigned to the basic page's OG field.

Current nodes:

OG1
--Title = test 1
--language = en

OG2
--Title = test 2
--language = en-gb

OG3
--Title = test 3
--language = fr

basic page1
--title = some title1
--language = en
--og_field = ??

basic page2
--title = some title2
--language = fr
--og_field = ??

Expected result when the hook_node_presave is done:

basic page1
--title = some title1
--language = en
--og_field = OG1

basic page2
--title = some title2
--language = fr
--og_field = OG3

here is what i have tried, but not sure why it is not working (assume organic_group is the content type machine name)

function mymodule_node_presave(&$node) {

    if($node->type == 'page') {
        //get the OG node that has the same language as the current node
        $result = db_select('node', 'n')
           ->fields('n', array('nid', 'language', 'og_field'))
           ->condition('n.type', 'organic_group')
           ->condition('n.language', $node->language)
           ->execute()
           ->fetchAll();

        //store OG node's nid into og_field
        $node->og_field = $result->nid;
    }
  }


texts: Several field templates or on node template?

texts:
Try to figure out when field templates are the wrong approach...

I've been told and agree that you should ultimately avoid creating node templates and try to process things before they hit the theming layer. I believe this because you alway want to add more room for theming later, and data changes should stay with the proper entity... at least a field template if not template preprocess, nodeapi, etc.

So... if I have a node type that's requiring I end up with 3-5 field templates, to do some logic on the display of links vs. text, add standard suffix text, etc. When do I throw in the towel and just do it all in the node template because that's the right thing to do?

Maybe I just need contemplate?

Your thoughts?


texts: How can programatically translate an non-English country name to English?

texts:
I have a webform hook that processes some conditionals depending on a country name dropdown on the webform.
The conditionals need to compare to the English name because there are many various conditions. But the country name from the webform may be translated to a different (non-English) language.
I have the non-English country name in my code and I'd like to translate it to English for my conditionals. Is this possible?
From my webform handler hook:
 $country = $data['country']['country'];

How can I translate the country name above to English in my code?


texts:
So far I have tried this code in mytheme.theme:

function mytheme_form_search_block_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    $form['keys']['#attributes']['placeholder'] = t('Custom wording');
}

And this one:

function mytheme_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['keys']['#attributes']['placeholder'] = t('Custom wording');
  }
}

Also this one:

function mytheme_form_search_block_form_alter(&$form, $form_state) {
    $form['keys']['#attributes']['placeholder'] = t('Custom wording');
}

Site is not crashing, but nothing happens on the placeholder.

I have based these 3 snippets on these pages:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_FORM_ID_alter/8.5.x
How to replace the search submit button with a Font Awesome character?


texts: Commit doesn't show up in profile on Drupal site

texts:
I submitted my first, (and very small patch) here, by following the instructions here.

It looks like the patch worked, but when I look at the Commits tab of my profile, I don't see any entries.

When using Git, I created a new branch for the issue, made the changes, and then checked in. Should I have switched back to the dev branch and checked in?


texts: How can I make content type appear as a table?

texts:
How can I make content type appear as a table each time I add content through it or its easier to make it in Views?

I am trying to make a website for students and each students will see some numbers and statistics only for him (absence, degrees, home works, etc). So how can I make a table in specific content type to fill the data instead of making a table for each student?


texts: "Disabled" regions re-enable after navigating away and back from module page

texts:
I have a form module that I would like to have on its own page, with no header, footer, etc.. I thought I was successful with adding hook_menu() and a page callback to render the form's block, then added hook_page_alter() to cycle through all available regions and unset them:

function mymodule_menu () {
  $menuitems['myform-page'] = [
    'title' => 'Survey Form',
    'page callback' => 'mymodule_form_page',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  ];
  return $menuitems;
}

function mymodule_form_page (&$page) {
  dpm($GLOBALS['_GET']['q']);
  $current_path = $GLOBALS['_GET']['q'];
  if ($current_path === 'myform-page') {
    $module = 'mymodule';
    $delta = 'mymodule_block';
    $block = block_load($module, $delta);
    $form_page = _block_get_renderable_array(_block_render_blocks(array($block)));
    return $form_page;
  }
}

function mymodule_page_alter (&$page) {
  $current_path = $GLOBALS['_GET']['q'];
  if ($current_path === 'myform-page') {
    $regions = ['top','header','footer_1','footer_2'];
    foreach($regions as $region) {
      foreach($page as $key => $value) {
        if ($region === $key) {
          unset($page[$key]);
        }
      }
    }
  }
}

After all of that, I clear cache and visit the "myform-page", er, page. All the undesired regions are gone (though their HTML wrapper DIVs are still rendered, but I'm okay with hiding those with CSS). I leave that page, going to the front page, for example, then manually type in the address for "myform-page" in the browser and hit enter. The header and footer regions are back!

The "mymodule_page_alter" function only runs once and never again until I clear cache again. The "mymodule" block loads, looks, and functions exactly how I want it to, except for the regions returning when I navigate back to the page. I've reproduced this in a virtual OS environment, so I'm afraid I done goofed. I just don't know where. I've tried using hook_theme() to load a simple page template per info found here:
PHP Output in module
...with varying results, ultimately with the undesired regions still showing up. Would anyone know why the page alter hook stops working after executing once? I'd appreciate everyone who can point me in the right direction.


texts: What is the deal with config collections?

texts:
When manipulating configuration yaml files in config/sync, I note that if you put files in subdirectories, and run drush config:import, the files in those subdirectories are denoted as belonging to a 'collection'. (Top-level files have no collection listed)

This seems like it might be a useful organisational unit. However, it seems like configurations that are part of a collection are not acted on.

For example, if I put a node.type.test.yml in config/sync, and run drush config:import then a corresponding node type is created as expected. However, if instead I put the file in config/sync/test and run drush config:import, then no type is created.

What is the purpose of these collections? Is there some way to indicate that you want collections to be activate/inactive within the configuration? Do they serve some completely different purpose?


texts: What is the correct workflow for updating a high traffic site?

texts:
I launched a site based upon Drupal 7.14 with at least 100 simultaneous users accessing the site at all times.

From the Devel module, I see that every page is generating about 200 to 400 Mysql requests.

First question: Is that a lot with 5 customs blocks per page?

With the full caching system for anonymous user, the site is running smoothly.

I had to make two updates. For that, I put the site in maintenance mode, made my modifications and uploading new files, flushed the cache and put the site live again.
The first update did not generate any issues. But the second one, my MySQL server crashed due to a huge amount of simultaneous requests.

So how to avoid the flushing of all pages and updating properly JS, CSS and templates files?
What's is the correct workflow? Because after the maintenance, if 10 users request a non-cached page, it's more likely that the server won't be able to handle the load.

Does Drupal automatically regenerate the page cache if a JS, CSS or template associated file has been changed? So, is no flushing needed? The page would be correctly regenerated according to the cache configuration?

Here the server specifications:

ProLiant DL360 G5
CPU Intel Xeon 5133 (dual core) 2GHz
RAM 2×512Mb DDR2


texts: I want to call a mymodule.functions.inc file

texts: Hi all drupalers i am new in drupal coding i wrote a new drupal module that works perfecr but my boss wanted to put all my functions of my .module file in a new folder called 'includes' and in a files that called mymodule.functions.inc now i got an error in my code that says called of undefined function... How I can call this mymodule.functions.inc file in my mymodule.module file?? I need a real help hear guys plz help me out :)


texts: Fieldgroup accordion does not open to first field of group

texts:
I am using the accordion group and item via the Field Groups module. If I open an accordion group, scroll to the bottom of the group and then click on the next one to open, the new group opens in the same place in the browser as I was left at. But the new group header goes to the top of the page. So I'm left in the middle or at the end of the group I'm trying to access, rather than at the top of the new group.

Very confusing to describe!


texts: How can I detect if the current viewed page is administrative?

texts:
How do I detect whether the user the page is currently viewing, is considered administrative?  An administrative page can be recognized when the administration theme is activated.

In my case I would like to print a notice if this condition is met, and if the user can 'administer modules'.


texts: How to search through database of businesses/how to build the content template?

texts:
sorry in advance for the more than likely simple/beginner/waste of time question(s). Anyway, I'm working on building a business ratings site of sorts (Yes, I know, way overdone. Don't worry about it! :D). However, since I know very little programming and am completely new to Drupal (7), I don't quite know the best way to go about building the basic nodes, how to add an itemized search function to the site, or how to get the listings to show up in said search. I've done as many searches as I can think of, but I think the problem is that I don't know what I don't know, and therefore am searching the wrong things.

I guess for me those are all different ways of asking a similar question. How do I build the template node for the business page so that it can be searched for and sorted based on its characteristics. For instance, when creating the basic content type template, how would I build it so that the listing can be searched, for instance, by state?

I need to display the address of the business on its page simply because of the nature of the site. So, is there a way for a search to pick up on that, and display it in a search sorted by the state that it's in? Do I need to somehow link that field to a taxonomy term of some sort? Also, what module would be the best to use for adding that type of search to the site?

I'm not sure whether this is helpful, but the modules that I have installed so far in my journey toward building this site/solving this problem are: Views, CTools, Display Suite, and Custom Search. I'm guessing that I will be able to use custom search for the actual search function, but I haven't delved into using it yet since I haven't figured out how to build what it searches.

Sorry for what I'm sure is a silly post, and thank you in advance for any help anybody may have to offer.


texts: Entity Validation API not invoked on saving the taxonomy overview form – misunderstanding or a bug?

texts:
I have a Constraint and ContraintValidator to validate a field of taxonomy terms. Its a hierarchical taxonomy called channel with a field field_product. It's required that a channel has the same product (term reference) set as it's parent channel term. It's working well on taxonomy term form, but on saving the taxonomy overview form after reorder (moving one channel to a parent with a different product set) – while xdebugging the code apparently the validation is not called at all.
Some pseudo-code:
In helper.module:
function helper_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
  if (!empty($fields['field_product']) && 'taxonomy_term' === $entity_type->id() && 'channel' === $bundle) {
    $fields['field_product']->addConstraint('MatchParentChannelProduct', []);
  }
}

helper/src/Plugin/Validation/Constraint/MatchParentChannelProductConstraintValidator.php:
/**
 * Validates the MatchParentChannelProduct constraint.
 */
class MatchParentChannelProductConstraintValidator extends ConstraintValidator {

  /**
   * {@inheritdoc}
   */
  public function validate($items, Constraint $constraint) {
    // This is a single-item field so we only need to
    // validate the first item
    $product_reference = $items->first();

    if ($product_reference && $product_reference->target_id) {
      /** @var \Drupal\taxonomy\TermInterface $term */
      $term = $product_reference->getEntity();
      /** @var \Drupal\taxonomy\TermInterface $parent */
      $parent = $term->get('parent')[0]->entity ?? NULL;
      // Nothing to validate, when term has no parent it may have any product.
      if ($parent === NULL) {
        return;
      }

      $parent_tid = $parent->get('field_product')->target_id ?? NULL;
      if ( $parent_tid !== $product_reference->target_id ) {
        $parent_channel_product_name = $parent->get('field_product')->entity->name->value ?? 'unknown';
        $this->context->addViolation($constraint->productDoesNotMatchParentChannelProductMessage, ['%parent_channel_product_name' => $parent_channel_product_name]);
      }
    }
  }
}

\Drupal\taxonomy\Form\OverviewTerms::submitForm() calls $term->save(); I would have expected that this will invoke the entity validation API, but it seems that it doesn't do that. What does it need to validate the therm entity before it is saved? Do I need to implement hook_entity_presave() and there $entity->validate() or $entity->field_product->validate();, as in Using the (Entity Validation) API? Or is there a bug somewhere?


texts: Social Media Embed Problems With the URL Embed module

texts:
we have been using the alpha version of url_embed with Drupal core 8.9.1. Locally, I am now testing the beta version.  This update also involved updating the Embed module from 1.0 to 1.4.
On the alpha version of url_embed, I could get the LinkedIn embed to work, but not Twitter or Instagram. On beta, Twitter and Instagram embeds work, but not LinkedIn. We are using Ckeditor for these embeds.
Is this a bug? Am I doing something wrong? Any help is more than welcome.  I'm reading the code of both url_embed and embed to get some clues, but so far no luck.


texts: How to theme field for many views in drupal 7?

texts:
I want to theme field--uc-product-image.tpl.php for two views. How to do this?

Is Drupal have theme like view1-field--uc-product-image.tpl.php ?


texts: How to create an end date field in a hook_form_alter

texts:
I've succeeded creating a simple date_popup field with the following code :

$form['date_start'] = array(
  '#type' => 'date_popup',
  '#title' => t('Start date'),
  '#default_value' => '',
  '#date_format' => 'Y-m-d',
);

Now, is there any way to directly create the "End date" field without having to create a second field declaration ? Is there any bundled widget I can use ? I've seen something about date_combo but I'm not sure to understand it well.

Thanks for help !


texts: Rules in Drupal 7: EntityMalformedException in custom PHP

texts:
I used to run successfully the following custom PHP code in rules before a node is stored

$update_node = node_load($node->nid);
$lat1 = floatval($node->field_geo["und"][0]["lat"]);
//SOME MATH HERE
$update_node->field_winkel_dorf["und"][0] = array("value"=>$winkel);
node_save($update_node);
}

But now after a major update of lots of modules I get this error:
EntityMalformedException: Fehlende Paketeigenschaft auf einem Element des Types node. in entity_extract_ids() (Zeile 7663 von /var/www/vhosts/mydomain/httpdocs/includes/common.inc).

I have no idea what changed....

Any help very very welcome.