texts: How to prevent users from changing Workbench Access Section

texts:
I have different authors set up with rights to edit different pages of my site (using Workbench Access), and an unfortunate side effect of this is that, when editing a page, they can also assign it to a different Workbench Access Section.

This would, for instance, allow them to accidentally lock themselves out of a page, or allow someone else to gain editing rights to it.  This is definitely not a good thing.

I don't see anything in the permissions that would allow me to fix this, but here are my settings in case some are somehow relevant, despite appearing otherwise.

How can I fix this?  How can I prevent access to this field?


texts:
I have several articles at mydomainname.com/article-title-here. Each article is tagged with a combination of area1 or area2 or possibly even both.

I have another page with a view that will collect articles at mydomainname.com/area1. Can views make it so that once it collects the articles it will change the url to mydomainname.com/area1/article-title-here? Then would there be a way to add all blocks that are on mydomainname.com/area1 to all articles in that view?

Then if I had mydomain.com/area2 and it shared an article with mydomain.com/area1, if I viewed the article from mydomain.com/area2 it would show the area2 blocks on the article instead of area1.

Edit: Or in views if you click to read more about the article, have it "expand" or open in the current view region.


texts:
I need to build a facebook model privacy settings for user. Access permissions must be set to users who are "Public" and "Connected", which the latter is from User Relationship module.

eg: User must have permission settings such as who must view his profile, his nodes, user connections, also some views which are related to user.

Can anyone suggest an idea how can i implement this.


texts: Changing a template using user role and publishing variables

texts:
I've been trying to get the following function to work in Drupal 7, where an unauthenticated user sees a different article template (in this case, node--article2.tpl) than a user that's logged in.  I get no php errors, but the template doesn't change if I'm logged out. What am I doing wrong here?

<?php
   function mytheme_preprocess_node(&$variables) {
   $node = $variables['node'];

   if($node->type === 'article'){
   global $user;
   if($user->uid == 0){
   $variables['template_file'] = 'node__article2';
  }
 }
}

Additionally, I'd like the function to look at an article's published state as well.  We're using the custom publishing options module that adds a publishing state of "archived."

So basically unauthenticated users will get a different template that has a publishing state of archived.


texts: How to add a Custom Serializer to alter the Output of REST EXPORT

texts:
To the Response/Output of REST EXPORT of a view, I want to add one extra row.

So I created a Custom Serializer in my module.
The path of the file is:

My_Module/src/Plugin/views/style/HindiCustomSerializer.php

Here I extended the Serializer Class from core/modules/rest/src/Plugin/views/style/Serializer.php

And I am trying to override the render() method in my custom serializer like this. I am copying the render() method from original Serializer and adding one extra line from my side.

use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\rest\Plugin\views\style\Serializer;

/**
 * The style plugin for serialized output formats.
 *
 * Add and extra row to the output.
 *
 * @ingroup views_style_plugins
 *
 * @ViewsStyle(
 *   id = "hindi_custom_serializer",
 *   title = @Translation("Hindi Custom Serializer"),
 *   help = @Translation("Serializes views row data using the Serializer component."),
 *   display_types = {"data"}
 * )
 */
class HindiCustomSerializer extends Serializer implements CacheableDependencyInterface{

  public function render() {
    $rows = [];
    // If the Data Entity row plugin is used, this will be an array of entities
    // which will pass through Serializer to one of the registered Normalizers,
    // which will transform it to arrays/scalars. If the Data field row plugin
    // is used, $rows will not contain objects and will pass directly to the
    // Encoder.
    foreach ($this->view->result as $row_index => $row) {
      $this->view->row_index = $row_index;
      $rows[] = $this->view->rowPlugin->render($row);
    }

    $rows[] = "JUST ADDING AN EXTRA ROW!!";
    unset($this->view->row_index);
    // Get the content type configured in the display or fallback to the
    // default.
    if ((empty($this->view->live_preview))) {
      $content_type = $this->displayHandler->getContentType();
    }
    else {
      $content_type = !empty($this->options['formats']) ? reset($this->options['formats']) : 'json';
    }
    return $this->serializer->serialize($rows, $content_type, ['views_style_plugin' => $this]);
  }

}

The option to choose the custom serializer MyCustomSerializer should be visible in Format section of view settings.

But its not displaying. Is there any step I am missing? Do I need to add some extra information regarding the serializer in .info file or any such steps needed ?

PS: If I add this line directly to the original Serializer code, I see the extra row coming in the response.

$rows[] = "JUST ADDING AN EXTRA ROW!!";

But of course that's not the correct way.


texts: How can I set a value of a hidden webform field in the backend?

texts: I have a field A that is hidden by conditional logic and only appears if the user selects a specific radio button. But when I want to edit/set a value for the field A of a submission the conditional logic still applies. So the field only appears if I switch the selected radio button. How can I set that the field is always visible when editing submissions?


texts:
My company has just purchased a Drupal theme to apply to some new pages they want to add to an existing site. This theme is different to the existing theme of the site.

They want to create a new content type which will work with the new theme and not affect any of the existing pages using the default theme. So basically we want to switches themes based on what the content type of the page is. They also want the freedom to create any URL they choose so using a multi-site configuration is out of the question.

I've seen a number of posts on the internet showing this is possible in Drupal 7. Is this possible in Drupal 8 and how can I make it work?


texts: How to set one path alias as the canonical alias?

texts:
I use the Tags taxonomy on several of my content types. In order to assist with a site-wide filtering mechanism, I'd like to be able to create additional path aliases for each piece of content.

For example, if my tags include baseball, football, soccer, and I post a news Article, I would like to have a primary path alias to that node using:

/news/my-article-1

but I'd also like to create a path alias to it for:

/baseball/news/my-article-1

/football/news/my-article-1

/soccer/news/my-article-1

However, when I create these programmatically, drupal seems to choose one of them, arbitrarily, to be the canonical alias. Is there any way I can control which alias is the canonical one?


texts: Built in cache system doesn't work in Drupal 6

texts: Recently, I have selected "Normal" (recommended for production sites, no side effects) of the Caching mode at admin/settings/performance; I can see the CPU usage is drop from 60-70 to 6-8 by accessing the Drupal site on the same PC. However, when I use another PC to access the Drupal site, the CPU usage is risen to 60-70 again. So is there any mis-configure on my Drupal site?


texts:
I'm trying to migrate a D7 site to D8 following this tut: http://www.metaltoad.com/blog/migrating-taxonomy-drupal-7-to-drupal-8

When I run

drush migrate-manifest manifest.yml --legacy-db-url=mysql://{dbuser}:{dbpass}@localhost/{dbname}

I get the error:

The drush command 'migrate-manifest' could not be found.

I'm using drush version 8.0-dev. Installed via composer. I also tried version 7.* and got the same message plus "Drush 7.0.0 does not support Drupal 8." What gives?


texts: Views, group by first letter as rest export (Alphabet/Glossary listing?)

texts:
Is there a way to group results by the first letter of their title in a REST export per the screenshot?

My first thought would be perhaps extending Serializer to process the results, at the expense of pagination. In my case, it is only about 100 records, and won't be paginated.


texts: Drupal 7, Entity Reference user autocomplete field

texts:
I have a custom content type that has a users: entity reference autocomplete field. For some reason the list gets populated as [realname] ([name]). In other words the realname and username tokens are both shown in the autocomplete list. Is there a way to only show the realname token?

I would like to go from this...

To this


texts:
When a user clicks on the "My Account" link I would like the user's profile to show up in a lightbox much like the admin menu overlay works.

I am using Drupal 7.

I am not sure how to do this. My first attempt was to render $user_profile and put it in a lightbox:

<div id="lightbox_this_div">
   <?php print render($user_profile); ?>
</div>

but $user_profile is not available in page.tpl.php

Any thoughts?

EDIT: To be clear I just want to lightbox the content of the user's profile along with the tabs and be able to style the page. So I am not looking to lightbox the entire /user page with the site headers in an iframe style.


texts: Is there a way to show views exposed filter with in betweeen operator for integer type as a select list(0-10, 10-20, etc)?


texts: User Relationships view showing the right number of users, but showing my profile link, not theirs

texts:
I'm not very good with Views and Panes, but I've almost completely managed to get what I want working.

I have User Relationships configured to have non-reciprocal relationships (so like Twitter, where "A follows B" does not necessarily imply that "B follows A"). I have a Pane that displays users followed by $current_user and I have cloned it to a new Pane displaying users following $current_user.

The Panel is almost working perfectly, with one exception — it is showing me the right number of profile links, but they're all links to $current_user's profile with $current_user's avatar, rather than links to $following_users' profiles with their avatars.

I changed the Fields section in the Pane definition to point to the requestee User profile picture and the requestee UID, but this doesn't seem to have fixed it. It's not the database query coming out wrong, I'm just displaying the wrong values for each relationship in this Pane.

I'm sure this is really very obvious, I just can't spot the setting I need to change from requestee to requester in the Views Pane interface.

Anyone able to point me to where I'm missing the obvious bit of configuration?

Edit: I've taken a screenshot of the configuration interface (linked, rather than embedded, as you'll want to look at it in a bigger scale than embedding allows). The Custom text in the Fields reads [field_user_image]. In the Contextual filters, I've set the Requester user filter to Exclude. The Argument input reads as follows:

Edit 2: Looking in the Custom text ([field_user_image]), I have Replacement patterns available:

[field_user_image] == User: My profile picture
[uid] == User: Uid
[nothing] == Global: Custom text
%1 == User relationships: Requester user title
!1 == User relationships: Requester user input
%2 == User relationships: Requestee user title
!2 == User relationships: Requestee user input

But I can't work out how to make use of %1 or !1 in order to get the requester's [uid] or [field_user_image], rather than that of the currently-logged-in user.


texts: How do I utilize Drupal commerce to sell large files stored on Amazon S3

texts:
I am working on a project for work that involves replacing a current "tape and staple" file delivery system. It's a Drupal site, but with many many third party outdated VERY unstable software. However, it successfully sells very large files from S3.

My job is to use Drupal 7 with Drupal Commerce Module set, Commerce file Module 7.x-2.0, AmazonS3 7.x-2.0 Module. Also, the files that will be associated with one specific field live in various S3 Buckets.

I successfully got all of the above modules working as advertised. But my functionality is not complete.

What I need:

The ability to choose buckets within the field when creating a product.
link to an existing .zip file already stored on S3

About Bucket Selection: I have files located in various buckets. These files relate to the same Content type and product type. (at the time the business started they didn't understand what buckets meant. so files are a bit disorganized) I need to have the file attachment field have the ability to select a file from S3, from various buckets. Example: Product A has a file in Bucket A. Product B has a file in Bucket B. Etc... So when creating a product, the file field (that will contain the file being sold) will need to have the ability to attach an S3 file located in various buckets

Am I on the right path? Are the above modules the correct ones to have? Is there another one i need to make my connection complete or will I have to design one to get my final needs?

Update: I just found the Amazon S3 File System Module Is this something that would help me?


texts: Rating for anonymous users plus redirection to the login page

texts:
I am using the Fivestar module for product rating with Ubercart. I want to enable rating for anonymous users. At the same time, when the user rates the product, this must be redirect to login page.

Is there any possibilities for doing this?


texts:
How do I integrate Google Adsense? I have installed the Google Adsense module but when I insert the publisher ID, it says I have to insert an ID similar to pub-9999999999999, but Google gave me an ID similar to ca-pub-9999999999999.

Is there a way to resolve this?


texts: Domain Access separate home page per domain does not work

texts:
I have 3 domains set up on my dev machine.
1)drupalx
2)drupaly
3)localhost

Hello, I am using:

Domain Access 7.x-3.11 (with at domain configuration and domain setting enabled)
Internationalization 7.x-1.10.

I JUST enabled domain configuration/domain settings modules to try and get a separate home page per domain. Before I was using domain access without these 2 helper modules.

I am attempting to set my home page per domain.  There appear to be 3 ways to do this and none of them are working correctly.

Option 1) setting the values in /config/system/site-information

With this approach and Domain Access there is a domain access section at the bottom of the site-information page. You are supposed to set the home page and then choose which domain it is for and then save. In this domain access section it is supposed to show all the domains you have created, but mine says "localhost" for all of them.  Looking at domain access options for my content types (related side topic) shows that now the options for the other domains are missing there as well. It ONLY says "localhost".  It used to say localhost, drupalx, drupaly, but as I saved the front page for each of those domains the save process changed the machine name for drupalx and drupaly to "localhost" I am able to go back to each domain individually and change back it's machine name (but weird that it changes that).
After saving I get a message
"The configuration options have been saved for localhost. These settings will be inherited unless overridden per domain." Meaning it is saving that front page for every domain available (checking confirms this)

Option 2) First setting section in "admin/structure/domain/view/2/config"
Here you can set a separate home page per domain but when you go to the home page of those domains there is no front page defined (it just doesn't work).

Option 3) Second settings section in "admin/structure/domain/view/1/variables"
Here you just set the front page per domain.  Anytime I put any value in here after the page saves and reloads that value is gone, re-replaced by "node".  This does not work either.

I only enabled domain configuration and domain setting modules to try and get some extra configuration options to set my front pages per domain.  Didn't get me anywhere.
I of course tried to set the home page before enabling domain configuration and domain setting modules, and that didn't get me anywhere either.

Anyone have any front page advice for any of these front page configuration settings I tried?


texts: Display Image logo along with site slogan and site name

texts:
I  am using Impact theme for my site. It either displays text logo(site name, site slogan) or image logo. I want both image logo and text logo for my site.
Any help is welcome.


texts: Potentially cancel all other submit handlers after my own

texts:
I've unshifted my own submit handler to the #submit handler of a node form. I already have a validation handler, so I can't execute my cancelling submit handler there.

Maybe this makes more sense:

my validation
all other validation
my submit handler, which potentially kills the submit process to form_state[rebuild] => TRUE and try again
all other submit handlers

Is that possible? I can cancel submission if I put my submit logic in a validation, but that's too soon. It should only run when all validation passes.


texts: Alter views with hook_views_query_alter()

texts:
i'm trying to hook all my site views with hook_views_query_alter()

I can't find how to add a relationship and condition in the query.

Here is my (not working) code

/**
 * Implementation of hook_views_api().
 */
function taxonomy_location_views_api() { // your module name into hook_views_api
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'taxonomy_location'),
  );
}

/**
 * Implementation of hook_views_query_alter().
 */
function taxonomy_location_views_query_alter(&$view, &$query) {
  // get taxonomy term ID
  $tid = subdomain_get_sid(subdomain_get_current_subdomain());
  if($tid) {
    $join = new views_join;
    $join->construct('term_node', 'node', 'nid', 'nid', array(), 'INNER');
    $query->add_relationship('term_node', $join, 'node');
    $query->add_where('term_node', 'term_node.tid', $tid);
  }
}

Any ideas?


texts:
I find intresting plugins, for smart image croping:

https://www.drupal.org/project/smartcrop
https://www.drupal.org/node/907984
https://www.drupal.org/project/imagefield_focus

But all of them for drupal 7

Is there a module for Drupal 8? What can I do to install this on Drupal 8?


texts: Block content returns no results for anonymus user only

texts:
I've setup View Block that renders a custom content type. The issue is that block content shows up for logged users only. I ensured that anonymus user has "view published content" permission. No permission restrictions are set for that specific block.

any ideas what is wrong here? Could I use a Devel to inspect that somehow? thx!


texts: How should the view data be defined when adding a custom filter to a field?

texts:
How to add a custom views filter handler for a specific field? answers on how to add a filter to a base field.

I'm looking to add a filter to a non base field. (The field name is contact).

Here's what I have so far:

/**
 * Implements hook_views_data_alter().
 */
function custom_contact_views_data_alter(array &$data) {
  $data['node__contact']['active_contact'] = [
    'title' => t('Active contact filter'),
    'filter' => [
      'title' => t('Active contact filter'),
      'help' => 'Filters node on active contact',
      'field' => 'contact_target_id',
      'id' => 'active_contact',
    ],
  ];
}

It is added, but it complains about group missing in the Views UI Error: missing group

How should the views data be defined when adding a custom filter to a non-base field?


texts: Creating nodes and sub-nodes from database table

texts:
For example I have a database table defined from the following SQL.

CREATE TABLE IF NOT EXISTS `mytable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `base_id` int(11) NOT NULL,
  `page_type` smallint(4) NOT NULL,
  `page_title` varchar(50) NOT NULL,
  `page_content` text NOT NULL,
  `previous_id` int(11) NOT NULL,
  `next_positive_id` int(11) NOT NULL,
  `next_negative_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

I need to create nodes/content by using records inside that table. For example I have a base node, its id is 1. I get its title and its content from mytable. Inside this page I ask a question: "Do you like cats?" If the user selects yes, I send him to sub-node. I get sub-node address, title and content from mytable. You can see the flow like the below. Until the latest sub-node I give options to user. He selects YES or NO and sees relevant content/sub-node.

How can I make it with a Drupal 7 site?
I have another Drupal website but I have never used such complex flow. I created nodes and used contributed modules. Is it so hard to make this flow? Which modules should I use to setup such hierarchy and content management?


texts: How to set Media Styles in Media 7.1.2 / Media 7.2.X?

texts:
Where is the latest form of the component in the Media project family that allows styles to be defined for Media files?

I see a lot of references to the idea that the Media module contains, once contained, or can be compatible with, a UI component that is similar to the Drupal 7 core Image Styles system that allows formats to be defined. Apparently, once upon a time this lived at /admin/config/media-image-styles

There's a module, Styles, by Aaron of Media fame, that has a sub-module called File Styles. On the Styles project decription, it suggests that the Media module implements the API this provides in its bundled sub-module Media Styles. But the latest 7.2.x dev (and also, the latest stable version of the 7.1 branch) of Media that I have downloaded contains no such module, the URL path given for it above goes nowhere, and I can't find any such module as a seperately distributed module. Styles contains a UI module, but this seems to be unrelated to Media, and Styles hasn't been updated since 2011, whereas Media has been in near-constant development since then (with latest Media 7.2.x dev enabled, for me the Styles UI url crashes out with a fatal error Call to a member function getExternalUrl() on a non-object in... ). Also, Styles isn't even mentioned on the current Media project page.

From the way people talked about this media styles UI, it sounds like it was once a very important part of the Media project. I understand the Media project has been in a state of flux for years and documentation has lagged behind the current state of the project.

Where is the latest form of that component that allows styles to be defined for Media files?

Here's some (seemingly now all out of date) related reading:

A documentation page which mentions the path, and has some workarounds dated early 2011
An issue which led to the creation of that documentation page
Aaron's original media styles road map, explaining the rationale behind the Styles module before it was released, written in Jan 2011
Just saw this confirmation that Styles module is definitely deprecated and on its way out of the media family

Edit: Found a clue, buried at the bottom of a "Configuration" documentation page:

  The Media module used to rely heavily on the Styles module before
  Media was converted to prefer the file entity and file fields...
  defining new 'display' or view modes... can be implemented using
  http://drupal.org/project/entity_view_mode

But I can't see anything in that linked module that seems to support the kind of functionality I've seen discussed. There's a limited tutorial for the 7.2 branch which involves using Entity View Mode, but it uses it to define image styles for images, using the regular image style interface. Doesn't look to be anything for file styles for non-image files such as videos, or anything that could do anything more advanced, like have one style that shows a video's thumbnail image and another style that shows a video player. The search is still on...


texts:
I want to query if a specific content type has a photo in a custom cck field. I could probably create a View to find this? My mock up query is below. the photo is inside the table 'content_field_photo' in the row 'field_photo_data' inside this table is another row called 'nid' and this nid value should be present in the content type table called 'content_type_contenttype'

 SELECT * from content_field_photo WHERE
content_field_photo.field_photo_data IS NOT NULL AND nid is in
content_type_contenttype.nid


texts: How to pass variable to a view after submitting?

texts:
Why does the below code not work?  I am trying to pass the $_POST value to example_page() when I submit the form:

function example_menu () {
  $items['example'] = array(
    'title' => 'Example',
    'page callback' => 'drupal_get_form',
    'page_arguments' => array('example_form'),
    'type' => MENU_CALLBACK
  );
  return $items;
}

function example_page($arg) {
  return "hello, $arg!";
}

function example_form($form,&$form_state) {
  $form['name'] = array(
    '#type' => 'text',
    '#default_value' => t('Enter your name')
  );
  return $form;
}

function example_form_submit($form,&$form_state) {
  //BELOW DOES NOT WORK, and forget about passing raw HTML to output
  return example_page($form_state['values']['name']);
}


texts: drush site install to a different database host

texts:
I created a new Drupal site from a PHP script on a web server. The web server and database server is on different hardware, different ip addresses.

drush si --db-url=mysql://mytest:mytest@dbserver:8080/mytest works only if dbserver is localhost. If apache has a different ip address, the database user has the incorrent ip address.
i.e instead of being dbuser@webserver_ipaddress it is dbuser@dbserver_ipaddress.

Is there any option to specify the correct ipaddress for the user?


texts: Filter a view based on current user's roles?

texts:
Using Drupal 7, Views 3 and the Node Reference module, I'm using a view to populate a node reference field on a custom content type. (So it's a view of "Reference" display type.)

I want to filter this view to show (and allow users to select) only:

published content (OK)
content of a certain type (OK)
only nodes created by the current user (OK)
OR if the current user is admin or some other role, bypass the previous filter (3) and show all nodes (but still respect filters 1 and 2) (not OK)

Filters 1 and 2 are always mandatory; then either filter 3 OR 4 must also be mandatory. I know I can rearrange filters into filter groups to make this work. The problem is that I cannot find a way to build filter 4.

For filter 3, I had to bring in a Relationship of type "Content: Author", which made a lot of new filters appear, including the "User: Current" that I used for filter 3 (node author == current user).

For filter 4, I need to filter based on the role of the current user (not author), and I cannot find how to do that.

In the filters list there's a new "User: Roles" filter available, but it only refers to the "Content: Author" relationship, so it only checks the node author's roles. That's not what I need: I need to check the current user's roles.

I'm guessing I have to add a new Relationship to bring in the current user data (something like "User: current"), and then filter on that data, but I cannot find that in the Add Relationship screen.

Any idea how to do that?


texts: change an exposed filter from a select box to a text field search

texts:
I have a view that utilizes a node-reference field. I want users to be able to filter by this field using a search-box (or an autocomplete field), but when I set the exposed filter to the node-reference field, all I get is a drop-down. How can I force this to be either a text field or autocomplete?

Thanks!

views 3
drupal 7


texts:
How can I approach implementing the following in Drupal 7?

What I need to do is create a module which defines a new fieldable entity, called 'Company'. I have a list of, let's say, 20 fields that need to be filled out by each Company instance. These questions are predefined and some may contain custom validation.

At the moment, I'm at the point when I can add new fields to the Company entity. This works fine at the moment. My issue is that I need all these fields to be there as soon the module is installed, so adding them via the interface isn't an option.

I was wondering how can I approach this? I'd assume it comes down being able to do what can be done using the 'Manage Fields' UI programmatically.


texts: Extending the Year range in Popup Calendar

texts:
I am trying to extend a year range of a popup calendar in drupal 7 but have been unable to see where I can do this.

After doing more research, I discovered that I can change it through the 'More settings & values' option in the field settings which I have seen in other people's screen shots except that I don't seem to have this option at all when I go into my field settings.

I am using the date field and having it display as a popup calendar but cant find the year range setting anywhere - is there something else I need to enable to find this or has anybody else had a similar issue?

I'd be happy to even change some code in one of the files, but I havent been able to find the right one.

Many Thanks


texts: Enabling field translation for content type causes node to not show value for that field

texts:
I am using Drupal version 7.80.
I have a content type called "Public Resource" that has a bunch of fields.  The content type has "Enabled, with field translation" for the Multilingual support.
Up until now we had never tried to translate any of the nodes though.
This changed and I was tasked with making sure the nodes are translatable.
I tried to translate one of the nodes.  One of the fields called "Countries and Regions" is a field that is generated from a taxonomy and when I go to translate it the label says:
Countries & Regions (all languages)
which I figured out means that I have to set this field to be translatable.
When I go to manage field "Countries & Regions" on the content type settings is the "field translation" section.  There is a link that says "Enable translation".  This was why my field had "all languages" showing up by the label when I tried to translate a node.
I clicked the "Enable translation" button and it opened up this window:

and I clicked confirm.  It took a while to complete but it did so without any errors showing.
I then go back to my node I want translated and the English version of the node doesn't have any data showing for "Countries and Regions".
Here is a picture of the node before enabling translation of that field:

and here is a picture of the node after enabling translation of that field:

and if I go to the edit page of the node it shows that there is a value set for Countries and Regions for the node but it is just not showing it on the view node page:

Does anyone know why my values for the field that was just recently enabled for field translation are not showing up???


texts: Commerce product options on product basis

texts:
I am using Drupal Commerce and I would like to create product attributes. So customer can adjust some attributes before he would buy an item.

I know, that there are some commerce modules, that enable attributes / options of product. But I cannot find such module, that would enable setting attribute options separately for each product.

I have found Pricing Attributes module, but I can set options only globally, not separately for each product. I can set separately only price and enable/disable options. But I am not able to add new options.

Is it possible to add new attributes options to product using  UI with some commerce module?
If not, can anybody help to find documentation or API, how could I set product options programatically by myself without existing attribute modules?


texts:
I am experiencing a really strange behavior I have never seen before with Drupal. I am able to upload files of every type but not images. The files system is public. The problem appears on the local test server and on the live server.
Error message:
The image upload widget shows the standard error box logging:
**The file xyz.jpg could not be uploaded.

This value should not be null**

This issue appears on the whole site on every image of the file field widget within the backend.
Even the file upload for Drupal's "File Archive" does just work with every other file type than 'jpg', 'jpeg', 'gif', 'png' file types.
The issue appeared after updating to the "web/" file structure while also updating the core to 8.8. I tried to update to 8.9.12 including every module installed but the error when trying to upload a file stays.
I rechecked all the settings regarding "tmp folder" and also tested the folder access rights (chown, chmod). It is set to 777.
I updated the database (drush updb) and also rebuild the cache (drush cr).
No PHP error log is created (not in Drupals Watchdog or the apache log).
I am sure that it is not a configuration issue as I am able to upload files that are not image files without problems. Another interesting bit is that when uploading a file it is actually created in the final sites/default/files location. The file also has the correct owner and access rights.
I could not find a related issue when researching nor I am able to come up with another idea. I even tried to change the file system to private, created new entities with image or file fields and tried different image upload widgets - nothing seems to work.
Any help is greatly appreciated.


texts:
I use this code in my module for random query:

$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'client')
->fieldCondition('field_client_enabled', 'value', 1)
->addTag('random')
->range(0, 1)
->execute;

with additional function:

function mymodule_query_random_alter($query) {
  $query->orderRandom();
}

But why I get "undefined method" error when use

$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'client')
->fieldCondition('field_client_enabled', 'value', 1)
->orderRandom() // why is this wrong?
->range(0, 1)
->execute;

?

Update:
Answer:
Found that orderRandom() is SelectQuery function, but not EntityFieldQuery

Can I simplify first code to variant without additional function?


texts: How do I NOT clear memcache or other cache tables?

texts:
All of us who love Drupal know the pain of building those cache tables for the first time.

I have a site whose activity is high during a certain part of the day and then non existant at others. I have over 25,000 items of content on the site, and that grows daily.  I  have Memcache, APC (etc) installed for performance. When the site is active, it flies. I am very happy with the speed and performance.

However, if you are part of the lucky few who get to access the site when the cache tables are being rebuilt, you have a good 10 min to sit there and wait.

What can I do to prevent this? Can I have memcache keep all cached files in memory until new versions of pages are requested? I thought about writing a spider to access the site every 15 min to half hour or so (somewhat like boost module does), but wanted to see if any of my caching options could be simply configured before diving into that. If so what configuration options would you recommend?


texts: Drupal commerce show prices inclusive vat on product display

texts:
Is there a way to always display prices inclusive vat on product display?

My problem comes when a customer buys something and it´s shipped to non EU country - then it will display prices without vat.
if customer will make another order shipped to a EU country - then it will show prices without vat until shipping address is changed.

And I want it to always show prices inclusive vat on product display

I´m using EU_Vat module
extra price formatter , flexyformatter


texts:
I am building a book review site. I have two kinds of content: 'Book Listing' and 'Review.' The Review content type has an entity reference field which links back to the Book Listing. Using entity prepopulate, I have created a button which opens the 'Review' add/edit form and automatically sets the value of the entity reference field to the corresponding Book Listing NID.

Now, what I would really like to do, since the button opens a new page, is add the book cover image that is on the Book Listing page to the add/edit form, to help the customer remember what they are reviewing. Amazon has a similar feature. To further complicate things, my 'Review' add/edit form is being rendered with panels. I've been playing around with views (with relationships) and passing arguments into the panel, but am not having any luck. Has anyone done something like this before? Any idea on what to try next?


texts: Prevent node from being saved in hook_node_presave

texts:
When saving / updating node, i need to validate if certain fields combination is unique. Unique field module is supposed to allow this, but that feature is not working (validating only single field). So i created my own hook:

function mymodule_node_presave(\Drupal\Core\Entity\EntityInterface $node) {

  if ($node->bundle() == 'mycontent') {

    $term = \Drupal\taxonomy\Entity\Term::load($node->get('field_mytaxonomy')->target_id);

    $query = \Drupal::entityQuery('node');
    $query->condition('type', 'mycontent');
    $query->condition('field_mydate', $node->get('field_mydate')->value, '=');
    $query->condition('field_mytaxonomy', $term->id(), '=');

    $nids = $query->execute();

    if ($nids) {
      drupal_set_message('Fields are not unique!', 'error');
      // I need to prevent saving of node here
    }
  }
}

Detection of node with duplicite values being created works. How do i prevent saving that node?


texts: Is Commerce Stripe any more or less secure than Commerce Paypal?

texts:
The very first thing the Commerce Stripe module states is this:

As of the implementation of PCI-DSS 3.0 (January 2015), this module is
intended to work within the requirements of the Self Assessment
Questionnaire A-EP. If you are not familiar with the requirements of
SAQ A-EP, which includes a wide range of security practices as well as
quarterly penetration scans by a PCI certified third party vendor, you
should not use this module.

However later on it says

Features
PCI-compliant integration/payments. Utilizes the stripe.js library so
that sensitive card data never touches your server.

The Commerce Paypal page makes no mention of PCI-DSS. If card data never touches my server what changes do I need to make? Do I need an SSL cert?


texts:
I help run quite a Drupal site (up to date) with around a few thousand registered users. More and more frequently I am finding users who have registered with usernames like the following (found 13 so far but I am going back through the history to see if there are anymore):

briantuffddwwjbsao
heiditsfacjsheiffg
vickikqskaiwlfnxcg

I am 99% certain these are not legit users and I have blocked their accounts for the time being.  Oh and they have been authorised (clicking link in email).

When looking at the profile, in every case the first and last names are populated by the same text (the same as the first four or five characters of the username).  The last part of the username is seemingly random characters (no numbers/special characters).  I also note the address does usually exist (at least on gmaps) but I cant comment on the zip code/telephone being accurate (it doesn't seem so).

We do have a CAPTCHA implemented.

Has anyone else had experience with users registering on Drupal with this type of username?  Are they legitimate or is it some sort of "bot"? Am I just being paranoid?


texts: Add location to to profile2 just after the user registers

texts:
I am trying to force add a location to a user's profile2 just after the user register's an account. The user's are able to add locations to their profile by using flags, but since there are no locations just after the user registers, the rules add fails because the locations list has not been initiated.

The below code is what I currently have:

if (isset($account->is_new) && !empty($account->is_new)) {
  function user_account_presave_user_presave(&$edit, $account, $category) {
    global $user;

    // Load profile2.
    $profile = profile2_load_by_user(array('type' => 'next', 'uid' => $user >uid));

    // Add in the necessary custom fields and values.
    $profile->field_next_destination['und'][] = array(
      'longitude' => '0.0',
      'latitude' => '0.0',
    );

    // Save the profile2 to the user account.
    profile2_save($profile);

  }
}

I am not sure if the IF statement should be in the Function, but if it is not, the Function fails to allow users to register because the CAPTCHA reuse attack function is triggered.

Has anyone ever run into this?

Thank you!


texts: How can I exclude folders when updating drupal using drush?

texts: How can I use drush pm_update and exclude some folders? For example, I don't want to update Sites and Profiles folders.


texts: How can I edit all nodes of thier dates at once?

texts: Is there a module that allows me to change the dates of all nodes at once instead of doing it one by one thanks.


texts: How to uninstall module if admin/modules path is not accessible due to memory error

texts:
The problem is - I installed ubercart and was playing with devel module. Now when I'm trying to go to admin/modules I'm getting:

  Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to
  allocate 8642561 bytes)

I would like to uninstall devel module because I think this is its fault, but I can't as I don't have access to admin/modules because of this error :/ . Is there another way to uninstall a module and free some memory?

Edit: Well, turning off some options in devel settings helped, but still it would be nice to know answer to this question as problem can potentially appear for someone :) .


texts: How can you allow an unregistered user to change languages?

texts:
I have no clue to which is the Drupal way of allowing any user (registered or not) to change the website language.

The way I need it to work is to allow any user to click on their preferred language flag and just change the interface language.

What modules should I look into?
Is there any function I should be calling when clicking the flag?

Any link to something resembling a walktrough is also appreciated.


texts: How to make content of a (cck) field visible when pressing a button?

texts:
I am working on a Drupal 7 website and I would like to create a node where a specific (cck) text field is only shown to the users after they press a button.

The effect I would like to achieve is exactly the same you can find in the Careers 2.0 website where, at the end of each job post, there is a button titled "Find out how to apply". When you click on this button the "how to apply instructions are shown". To see how it works you can check http://careers.stackoverflow.com/jobs/10860/foursquare-software-engineer-scala-lift-foursquare?campaign=Featured.

Can somebody please help?

Thank you so much!


texts: Views, When the filter value is NOT available

texts: Cannot figure this out. In views, when creating a contextual filter and set up 'Provide default value' as below. Where are these values being taken from? - Taxonomy term ID from URL, User ID from URL etc... when I see that the current url is mydomain.com/?q=node/38 and cannot see them in the url at all.


texts: How do I add a custom template to my feature?

texts:
I have a feature with a few views. How to I add a custom template file to it?

Edit: Based on sheena_d and schnippy's suggestions, here is my entire .module code. (It is still not working)

<?php
/**
 * @file
 * Code for the Nigel Gallery feature.
 */

include_once('nigel_gallery.features.inc');

function nigel_gallery_init() {
  drupal_add_css(drupal_get_path('module', 'nigel_gallery') . '/nigel_gallery.css');
}

$theme_registry['template_file'] = array(
  'template' => drupal_get_path('module', 'nigel_gallery').'/templates/views-view--gallery-content.tpl.php',
  'type' => 'module',
);


texts: I'm using QuickTabs on a Drupal 6 site. I have a block in which I need to have some normal tabs and some pseudo-tabs, which look like tabs but are actually just links that load a whole new page. Is there a way to do this with quicktabs configuration? In particular, could I use theme_quicktabs_tabs() for this? If so, where do I start?


texts:
I am using Drupal 7 and Views 7.x-3.7.

In a view I have an exposed filter "gender".

If I select the filter type as 'single', it works fine. But I want radio buttons rather than dropdown so I select 'grouped filter' option.

Then the filter renders as I like.

But it always returns an empty result set.

There must be a setting that I am missing. Can you please point me to it?

Thank you.


texts: Add 2 flag fields of 2 types of flag to views field

texts:
I have two kinds of flags. Each flag has a field that gets a value. I want to add these field in one field of views. Any user can flag a content by two kinds of flags.

Should I use "views field view"? What is the instruction?


texts: Add icon to menu link that has system.admin as a parent

texts:
So I have this code in my links.meny.yml file:

webtrack_update_reminder.main:
  title: 'Reminders'
  description: 'Reminders for your project'
  parent: system.admin
  route_name: webtrack_update_reminder.content
  weight: 100

Which adds a link to the "manage toolbar".
Now my question is, how do I place an icon next to the link, just like the other links in the toolbar?

I have been searching but I didn't came up with an answer for Drupal 8.


texts: Patch for module applies with patch command but not composer

texts:
I have encountered a weird issue in which a patch I rolled for Commerce does not apply with Composer; it gives no errors, but the patch is not actually applied.

  "extra": {
    "patches": {
      "drupal/commerce" : {
        "Allow order types to have no cart": "https://www.drupal.org/files/issues/commerce-direct-checkout-2.2-2810723-37.patch"
      },

However, the same patch applies correctly after downloading and using the patch command:

/web/modules/contrib/commerce$ patch -p1 < ../../../../patches/commerce-direct-checkout-2.2-2810723-37.patch
patching file modules/cart/src/Form/AddToCartForm.php
patching file modules/cart/tests/src/Functional/AddToCartFormTest.php
patching file modules/cart/tests/src/Functional/CartBrowserTestBase.php
patching file modules/product/config/schema/commerce_product.schema.yml
patching file modules/product/src/Plugin/Field/FieldFormatter/AddToCartFormatter.php
patching file modules/product/src/ProductLazyBuilders.php

What is wrong with my patch that makes it fail in Composer?


texts: Add Existing Node As Child with Node Module

texts:
I am currently using the node collection module to build parent/child relationships, but I have a lot of existing content that does not already have the parent/child relationship in place.

Is there a way to add the parent/child relationship after the content is created using this module?

I've checked the documentation and looked at the module settings, but I couldn't find a good solution.


texts: Getting a subset of items: Is it better to user PagerDefault and limit, or get'em'all and array_splice?

texts:
I want to pull some number of nodes out of the database for rendering and display.  There are several ways to do this, two of which would be:

do a db_select(...)->extend('PagerDefault'); and add a ->limit()
clause to specify the number of items to be returned.
do the db_select() without the PagerDefault, and use
array_slice to get the desired number of items.

Any advice on the relative advantages of these, especially from a performance perspective?  I've done a few informal tests that suggest about a 100% penalty for using PagerDefault, but I wouldn't want to claim these are definitive.  Any recommendations?


texts: Convert Media tags to markup failing again

texts:
Once again I am plagued by this. Embedding an image from the media library shows in the editor, but when you view the node on the front end you get this:

[[{"fid":"851","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"Reality Check","field_file_image_title_text[und][0][value]":""},"type":"media","attributes":{"height":"333","width":"1502","style":"font-size: 13.008px;","class":"media-element file-default"}}]]

Normally you would confirm a couple things in drupal 7.5 -

Check the text format configuration to make sure convert media tags
to markup is set. In my case its on every filter and it is in the top
position. no matter which position it is in, still nothing works.
Check to see if a custom template is used and make sure it's using
render() and not just a plain echo. In my case, it is a custom
template and it is using render($node->body['und'][0]['value'])
Check to see if any wrapping tags may be causing a conflict. In my
case there is no wrapping tag. It's just an inline image from the
media library.

I'm using a custom tinyMCE install with the wysiwyg module because for reasons unknown the media library module broke everything much worse. Somehow I don't think this has anything to do with tinyMCE though.

Anyone have any further ideas?


texts:
I am trying to create a sample multi-site drupal on my local machine. I use windows XP and XAMPP.
   For creating a multi-site i created a folder in /sites.
   Like /sites/example.com.
   After that I changed example.sites.php to sites.php and removed # from the line given below.
     # $sites['localhost.example'] = 'example.com';

After that i tried to rum by typing localhost/example.com
it is not installing to the new folder example.com but to default folder.
My drupal 7 files are in htdocs
I need help... Is there anything missing????


texts: Is it possible to create a view with exposed filter similar to the image given, where location field is a taxonomy term and rest of it are content types with location field as term reference.


texts: How to tell Custom Breadcrumbs which vocabulary to use?

texts:
In my site I have pages with a single vocabulary called "category" and Custom Breadcrumbs displays the taxonomy hierarchy and it works.

Another content types has several vocabularies, including "category". But here Custom Breadcrumbs (CB) will not use the category but other vocabulary to generate the trail.

If I exclude the vocabularies I don't want CB to use to only allow "category", then no breadcrumb is displayed.

The only difference I see between those content types is the order in which I have created fields. Category was the last field I created for my second content type

So how can I force CB to use category as vocabulary ?


texts: Why does Drupal store the uploaded files for a content node even if the content is not created?

texts: In Drupal 7, I try to create a News, which is a custom content type, with an Image file. I upload the file (not by pressing Ajax button, but just selecting the file), and leave all the other fields (some mandatory) empty. I press Send, and I get the red errors. Even if I close the browser, the image will have been uploaded to the folder ( sites/default/files/news/images ). Even after deleting cache and running cron.php, the orphane image will be still there. Isn't it a bug of Drupal, which would have to delete those images with no associated content? The file is not reused in other content types.


texts: How to get views field data in defineOptions() method of custom filter?

texts:
I am  creating a custom filter for views. In *.views.inc file I am using hook_views_data_alter() to create the filter in views. Then creating a class for filter that extends NumericFilter filter class. Now, in defineOptions() method I want to feed the min and max numbers. These min and max data comes from a field in the view. Therefore, I want to know how can I get field data in that defineOptions() method.

class ItemQuantity extends NumericFilter {

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->definition['options callback'] = array($this, 'generateOptions');
  }

  protected function defineOptions() {
    $options = parent::defineOptions();

    $options['value'] = [
      'contains' => [
        'min' => ['default' => ''],
        'max' => ['default' => ''],
        'value' => ['default' => ''],
      ],
    ];

    return $options;
  }

  public function operators() {
    $operators = parent::operators();
    $operators['overlaps'] = [
      'title' => $this->t('Overlaps by'),
      'method' => 'opOverlap',
      'short' => $this->t('<>'),
      'values' => 1,
    ];
    return $operators;
  }

  protected function opOverlap($field) {
    $this->query->addWhere($this->options['group'], $field, [$this->value['min'], $this->value['max']], 'IN');
  }

  /**
   * Override the query so that no filtering takes place if the user doesn't
   * select any options.
   */
  public function query() {
    if (!empty($this->value)) {
      parent::query();
    }
  }

  /**
   * Skip validation if no options have been chosen so we can use it as a
   * non-filter.
   */
  public function validate() {
    if (!empty($this->value)) {
      parent::validate();
    }
  }

}

I want to get the value of min_quantity field in the view.


texts: Custom "admin/people" view preventing user creation

texts:
I've created a new view for admin/people; as part of the view set up, I've included "Path: /admin/people."

However, this causes a "page not found" error when I go to "admin/people/create"; I'm guessing I'm not supposed to use the path setting here.

How else would I override the default user view?


texts: How can I generate a link from a text field and a URL in a View?

texts:
I have an entity type consisting of 2 fields, a description field and a URL field, and I want to create a view with a single column which consisting of the description outputted as a link to the URL, ie Description.

I don't know whether I am doing it the right way. I tried to use the tokens and rewrite results to create URL in the form Description but it winds up pointing to the Drupal node. Is there some way of creating some kind of calculated field pointing to the URLs?


texts: Components are all returning empty values

texts:
I am trying to run a rules component as the child to a parent rule and I'm only getting an empty value returned to me.

I create the component, the field I will be returning is generated within the component, and then I pass it along (theoretically) by creating a provided variable (we'll call this variable X) in the settings section with the same machine name.

When we get back to my parent rule, it says that it is adding X, however X is empty.

Am I not passing variables correctly from the child component to the parent rule? How is this supposed to be done? Is there another step I need to do besides making the value a provided variable?


texts: How to add value on custom field using rule action

texts:
I am new to Drupal. Trying to get it work with Rules module.
I have added new field (decimal type) to user: field_user_custom which I can see in DB as user__field_user_custom as a table.
I want to add value to this table on each article update.
I have setup rule as this:

Create a Reaction rule

React on Event: "After updating content"

Action:
a. Type: set data
b. Data Value: @user.current_user_context:current_user:field_user_custom
c. Value: 888

However, on article update, this value is not updated. I have tested if the rule is applied with having System Msg and it throws the msg but doesn't update the user field.
I doubt my Data Value is not correct. Which is why I have tried with this:

user:field_user_custom

but this didn't help either. What am I missing?


texts:
Can I migrate a Drupal 7 field from one field type to another using Migrate and $this->systemOfRecord = Migration::DESTINATION;?

I'm trying to move field_phone which is an ordinary Field API text field into a mobile_number field which is also a Field API field but provided by the Mobile number module.

uid is the only listed source field, and that makes sense because it's the only field selected in the query, but I don't see any examples that use JOINs to select data from fields attached to an entity.

How do I add field_phone to the source?

public function __construct($arguments) {
  $this->sourceFields['field_phone'] = t('Phone');
  parent::__construct($arguments);

  $this->systemOfRecord = Migration::DESTINATION;

  $query = db_select('users', 'u')
    ->fields('u', array('uid'))
    ->condition('uid', 0, '>');
  $this->source = new MigrateSourceSQL($query);

  $this->destination = new MigrateDestinationUser(array());

  $this->map = new MigrateSQLMap($this->machineName,
    array('uid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'default' => 0,
      'description' => "User's {users}.uid.",
    )),
    MigrateDestinationUser::getKeySchema()
  );
  $this->addFieldMapping('uid', 'uid');
  $this->addFieldMapping('field_phone_number', 'field_phone');
}

Additionally, If I can keep the same field machine name I rather do that then moving from field_phone to field_phone_number, but it's not important.


texts: Convert a regular autocomplete field into an autocomplete deluxe field?

texts:
I am using the following code.

   $form['usershare'] = array(
     '#title' => t('Share Collection Internally - Example: Alice, Bob, Pat'),
     '#type' => 'textfield',
     '#default_value' => empty($flag->usershare) ? '' : $flag->usershare,
     '#autocomplete_path' => 'user/autocomplete/fl',
     '#multiple' => TRUE,
   );

I installed the Autocomplete Deluxe module.

How do I convert the code I am using to have a form field that uses autocomplete deluxe?

I tried changing the form field type to autocomplete_deluxe, but that didn't work as only a blank input box shows up.


texts: Change url arguments from tid to terms name at exposed filter

texts:
I am using a views exposed filter for taxonomy terms for my node view page with auto-submit.
when I apply the filter at url I am getting a url localhost/test/list?term=66
instead of which I want it to be '?term=[term_name]'.
I have added taxonomy term as relation at the filter.

Note: I have better-exposed-filter module enabled and I am not using contextual filter.

I followed this link posted before, but not able to see the term name instead of term id


texts: How can I schedule in advance an update to a node, to occur at a given time?

texts:
In a situation where I know that a specific change to the content of a specific node will need to be made on a specific date and time, is there any way to automate that change so that I do not need to make the change manually specifically at that date and time, but rather can prepare it in advance?

The Scheduler module allows for scheduling publishing and unpublishing nodes, and I am basically looking for some (hopefully lightweight) way to achieve a similar effect to the content of a node.

This is for Drupal 7 (though compatibility with the upcoming Drupal 8 is definitely a plus). Ideally it will also handle the components on Webform nodes (one of the things I want to be able to do is replace the list of options in a "select" component).


texts: Can the recently read module show multiple nodes?

texts: I am working with the recently read module and it is only showing the last node visited. I want it to show the last 5 nodes visited and that seems like what the module is supposed to do. I have session API enabled so that I can have this available for anonymous users as well. Does anyone know why it is only displaying a single node?


texts:
On my Drupal project, for a local cycling club, on the pages that show the different routes we'll be doing there is a link to a gpx file that contains the route details. Since routes change often before a ride is done, it would be nice to display the upload date of the file available.
I tried options like:
{{node.field_gpx.entity.date}}
{{node.field_gpx.entity|date}}
{{node.field_gpx.date}}
{{node.field_gpx|date}}

None of this seeme to work. Is there an easy workaround?


texts:
When editing a view, I get the following message in the popup.

  Notice: Undefined index: advertising_block in eva_plugin_display_entity->options_summary()
  (line 41 of/.../sites/all/modules/eva/eva_plugin_display_entity.inc).

This view contains 2 displays: a view attached and a block (called advertising_block). This error message appeared both before and after deleting the "advertising_block" to which it seems to refer.

Any idea of what may be causing this error message and how to fix it?


texts:
I created a simple block where it shows good evening or good afternoon depending on the time.

But the problem is that i have to delete the cache otherwise it will stay at good evening ...

How do i disable the cache for this specific block ?

Here is the twig page:

  {% block content %}
{{ content }}
<p>{{ "now"|date("d,n,Y") }}
{% if "now"|date("H") >= '10' %}
 good afternoon,
{% else %}
good evening,
{% endif %}
</p>
{% endblock %}


texts:
I am using Drupal 6 and, therefore, jQuery 1.2.6.

When a user clicks inside my text, there is a pop-up that comes up with a few more options in it. I would like this pop up to disappear when the focus is moved to anywhere outside.   This answer on SO comes very close but the focusout event isn't available to me in jQuery 1.2.6.

Has anyone else encountered this issue? How did you work around it?
I would rather not use the jquery update module, as I don't own the site and don't want to be responsible if the update breaks something else.


texts: How do I break my query result into smaller chunks

texts:
Background

I have a query that returns 140000+ results and I need to perform more calculations on the result before displaying them to the user. This has caused a huge wait time (left it to run for 1hr and 30 mins and it still wasn't finished).

Problem

The wait time is huge and needs to be reduced. I can happily load all the data (140000+ results) and run a lesser calculation. This is no use if I can't run the full calculation.

Possible Solution

I've thought about this and I think if I was able to limit the results returned (say 1000 results) I would be able to run the full calculation with no problems.

Question

Can I limit the amount of results back (say results 0-999) run my calculation on them and then load the next bit (results 1000-1999) and run the calc again?


texts: How to get taxonomy term by description, programatically

texts:
In a D7 custom module, I wish to retrieve a taxonomy term by it's description (and not it's name or TID).

Right now I do have it working, but I feel the code is a bit clunky, and I feel like there is a more elegant / Drupally way of doing it.

Is there a better way of doing it then this?

$vocabulary = taxonomy_vocabulary_machine_name_load('my_vocabulary');
$terms = entity_load('taxonomy_term', FALSE, array('vid' => $vocabulary->vid));

foreach ($terms as $term) {
  if ($term->description == 'my_term_description') {
    // Do stuff when there is a match.
  }
}

Ideally, I feel like there is a better way I cannot find through Google / Drupal API etc. Something like:

$term = taxonomy_by_description_load('my_vocabulary', 'my_term_description');

Thanks everyone.


texts: Suggestions for Adding Documentation to a Drupal Application

texts: I've built a pretty robust application using Drupal and currently have documentation available for the end users via a simple link to a pdf document.  I wondered if anyone had suggestions on how to integrate a more robust help system in a Drupal application, perhaps with search etc.  I've searched around on this topic but everything that comes up assumes I am talking about Drupal help documentation.


texts:
I am trying to find a way to sort the referenced entities in a node. I have found a related question "Ordering of referenced entity" but it cannot be applied in my case for the following reasons:

1) The manual ordering is out of the question in my case. In some of the nodes that need to be fixed there are more than 2000 referenced entities and they are ordered randomly right now. I also need to find a way to do that efficiently, since there will be a lot of nodes in the future that will also have multiple entity references that will need to be ordered.

2) The array_reverse option will obviously not work since the referenced entities are ordered in a completely random manner.

3) The third option in the accepted answer does not even apply to sorting.

4) The rest of the answers are just improvements over the accepted answer's methodology and obviously cannot be applied.

What I would ideally like to achieve is grab the first number in the title of the referenced entity and use this to sort the referenced entities.

Note: It is very important to handle cases of "software release number ordering" which in plain English means that 1.1 comes before 1.2 which in turn comes before 1.10.


texts: I am using Field Group module and I would like to make certain group repeatable if needed, like adding a plus (+) icon next to it. Is that possible? and how?


texts: Drupal 8 - Pathauto taxonomy terms in content paths

texts:
I currently have a pattern set up for my site's basic pages. It pulls in some generic fields associated with the content type, and no problems there.

Got a new requirement to associate some data from a taxonomy term into the URL path. The content type already had an entity reference field to pull in the taxonomy terms, so the user could associate any number of those terms with the content.

My issue is that I can only use the Taxonomy Term's Name field in the Pathauto pattern configuration. I see no way to bring in another field associated with that Taxonomy term. So, for example, the vocabulary Company has a field called field_short_name that I would like to include in the Basic Page's URL.

Example data of what I have:

Company taxonomy term

Title: ACME Limited Corporation
Short Name: ACME

Basic Page content:

Title: John Doe
Entity Reference: ACME Limited Corporation

Path Auto:

/[node:field_company]/[node:title]

This currently gives me www.example.com/ACME-Limited-Corporation/John-Doe where I really want it to give me www.example.com/ACME/John-Doe.

I hope I'm explaining this in a way that makes sense.


texts: Add value to a custom composite element in webform via hook_update_N

texts:
Testing out some bits with webform. I have created a webform via my module. In it I have a number of elements including a custom composite. Inside the custom composite I have several elements, one is a select element with a list of options (i.e. allowed values).

Now comes time I need to do some updates. That is run hook_update_N on an existing module/set-up.  I have updates for all other fields (not webform) working correctly. Rough code shown below:

/**
  * Update for mymodule to add more options to the paragraph and webform custom composite.
  */
 function mymodule_update_8001() {
   // Updates the paragraph allowed field
   $fields = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(array('field_name' => 'myfield'));

   foreach ($fields as $field) {
     $allowed = $field->getSetting('allowed_values');

     // New value(s) to add here.
     $allowed['test'] = 'bob was here...';
     $field->setSetting('allowed_values', $allowed);
     $field->save();
   }

   // Code to update the custom composite element to go here.

 }

I know it is rough code, ignoring that, still getting my head around the changes to Webform too.  I know the \Drupal::entityTypeManager()->getStorage method doesn't work for webform composite custom elements and can't see any update function in the composite example module.

So the question is how to I get the options (allowed values) of a select in a custom composite from the webform so I can edit, add, update, etc... when I do other updates to my module?

The method noted in How do I programmatically update the allowed values of a list field? works for basic fields but with for dynamic options. It will not cover what I need here as (a) it is not performing an update of existing fields and (b) doesn't appear to work with custom composite in WebForm, or at least I cannot get it to work, with a select.


texts: Generate 1D bar code based on user defined input

texts:
My requirement is to generate 1D bar code based on user defined input in the text box.
 for example if user give 10 as input in the text box then he should able to generate 10 bar code with different serial number after saving the content ....
so far, I have used bar code module to generate the bar code and serial module for different serial number and I am able to generate single bar code on saving the content.

now my problem is how to generate series of bar code based on the number which we give as input.

I am not getting how to map the input text box field to content and call multiple time.can any one help on this.


texts: What is the difference between the various log messaging severity levels?

texts: There are several types of log messaging severity levels - emergency, critical, error, alert, info, notice, warning, debug. What does each level mean? Example, emergency and critical sound similar, what's the difference? Also, info and notice sound similar.


texts: Recursive multilevel taxonomy feeds Drupal 7

texts:
I am currently using 2 feeds of module Feeds to load a simple structure of nested taxonomies, with just 2 levels. I use two CSV files, one with the parent taxonomies, and the other with the children (see attached image to see the relationship through a PGUID, parent id).
But now the problem is that my client will want no 2 fixed levels, but 3, 4, or more, varying depending on demand. So I do not know how to optimize the load (it is running in a cron in Elyisia cron right now).
Must I create a new feed for each level? What happens if the levels differ from day to day? Is there any recursive solution to this - Multilevel Feeds or something ?

Note: the handling of the multilevel taxonomies should be done in just a single CSV file.


texts:
I have an entity reference view setup that currently pre-populates a content authors user name into the content form. This field has to stay the same no matter which user edits it in the future.

It works however it only works for editing content, nothing is pre-populated when creating new content with the form. I've tried adding the current user ID to the form but that will only work for creating new content and it is overridden each time the node is edited.

I can figure out how to do both the things I need but they refuse to play together. It seems like it's has to be one or the other. But there must be a way!

How would I filter the view to show the content author and the current logged(or original author) in user for use on both the edit and create new content pages?
Here is a screenshot of my view:
And the contextual filter settings:


texts:
Is it possible to connect 2 AD's to drupal intranet to have single sign on (with the LDAP module)?

thank you in advance


texts: Override drupal form output. Place two input fields side by side

texts:
I am building a form using the FAPI and so far it is going fine.

I do however have a requirement for two tightly coupled values (currency and amount) that I wish to appear side by side in the form and not on separate lines.

What I need is something very similar to the way Drupal handles dates (3 inputs side by side, Im not sure, but are their input values added together to produce one value?)

Im sure this is possible using the FAPI but I cant see how off hand.

I would like to avoid any extra modules if possible.

Any takers?

thanks

Kevin


texts: I'm currently using Drupal Commerce and the Commerce PayPal (https://www.drupal.org/project/commerce_paypal) module in order to allow my users to purchase items. That said, some of the items require that my customer be charged every month. Is there a way to store credit card data in order to run recurring payments (Commerce Recurring doesn't seem to be compatible with Commerce Paypal)? If I'm not mistaken, the documentation states that PayPal doesn't include the option to run recurring payments? Is there another module I can integrate in order to allow this?


texts: How to display the same node twice in one teaser?

texts:
I added some new fields to Basic page:

teaser image
teaser title
teaser subtitle

Now I want to show 2 separate blocks in teaser that point to the same node (basic page). Is it even possible?

Example of teaser

Teaser block 1

title: Buy Acrobat
subtitle: View our software
image: acrobat.png

Teaser block 2

title: Buy InDesign
subtitle: Software for low prices
image: indesign.png

Both teasers should lead to the same basic page "Buy software".

Notice that teasers are displayed on home page (option "promote to front page") and taxonomy (View: Taxonomy).


texts: redirect user to page where they clicked an "add node" link

texts:
In several places on my site I use an "add node" link that lets users add a node (I'm using organic groups).  After saving the node, I'd like to redirect users back to the page on which they clicked the "add node" link.

I know how to redirect users to a specific page after saving a node, but that doesn't work in this case, as the add link shows up on several pages.

I've tried setting $form_state['redirect'] = false, but that also doesn't help as it puts users back in the node edit page.

Would be wonderful if anyone could point me in the right direction. Thanks!

EDIT: 2 minutes after I posted this I came up with the following:  Add Contact

This redirects the user to node 52, which happens to be the group page on which this add link lives.  This is a step in the right direction.  Would be even better if I could use a token in the link.


texts:
Does anyone have experience with using a feature as a module?
The usage I am talking about is strictly placing hooks inside the .module file.
Can that trigger any sort of bug?


texts:
I am nearly finished with my website on Drupal 8, and one last thing I have to do is optimize the search function. At this moment the search function only searches for node titles.

What I want to achieve is that the visitor can search by words and that the node will be shown as the search result. My website only has 7 seven pages at the moment, and will never grow beyond 10+ pages.

Example : I have a page about motorbikes( lets call the page motorbikes), in this page are some text blocks with motorbike brands like : yamaha and harley davidson and kawasaki. Now if the user is on the homepage and searches for kawasaki it should return the page motorbikes.

At this point the user would have to search for the page name, which in this case is motorbikes, to find the page.

So in short: I want to have a search function that searches the whole site for 1 or multiple words and then displays the page in which the words are found.

Can you guys help me on how to approach this problem, I don't need any code, just a little bit of guidance. Thanks in advance for any help !


texts: Apache solr with rules module, on refresh, rule viewing node triggers it in search page

texts: I'm building a site in free Acquia cloud env with apache solr running, I need to count when a node (for one content type) is being full displayed, that’s already working fine, but every time I refresh results page (viewing only teasers), it triggers not once, twice in all nodes within the content type, so my node full displayed count is not correct, Rules only option is 'when node is being viewed' and not 'node being displayed', I have to mention that this count field is to set solr sort results with a custom module (already working), any suggestions please?


texts: Will all Drupal 7 Ubercart 3 orders be deleted if I disable & uninstall all Ubercart related modules?

texts: I'm working on migrating a Ubercart site to Commerce and wanted to know if all Ubercart orders and tables will be deleted if I disable & uninstall all related modules. Since I don't need the old data, I don't mind it having it completely deleted.


texts:
If I navigate to http://localhost:8080/import I am taken back to the index page.

If I navigate to http://localhost:8080/?q=import I am take to the import page.

If I navigate to http://localhost:8080/admin I am taken to the list of admin options.

The webserver for localhost is the default one that comes with Phpstorm (in ubuntu 14.04), which is the built in webserver that comes with php5.4 and above.

When deployed to a remote server /import works.

What might cause this issue?


texts: Drush error — missing module Console_Table

texts:
I want to know how may I resolve this issue !!! I'm using Centos Machine and drush

  $ drush status
    Drush needs to download a library from                               [error]
    http://download.pear.php.net/package/Console_Table-1.1.3.tgz in order
    to function, and the attempt to download this file automatically
    failed because you do not have permission to write to the library
    directory /usr/local/share/drush/lib. To continue you will need to
    manually download the package from
    http://download.pear.php.net/package/Console_Table-1.1.3.tgz, extract
    it, and copy the directory into your /usr/local/share/drush/lib
    directory.

I've done what it is said in the request but it still give me the same error :

$ sudo wget http://download.pear.php.net/package/Console_Table-1.1.3.tgz
$ sudo tar -xzf Console_Table-1.1.3.tgz
$ sudo mv Console_Table-1.1.3/Table.php usr/local/share/drush/lib/table.inc


texts: Show field collection fields with profile field

texts:
I have used Recruiter module to manage job and resume and its working almost well but when i m displaying resumes it has field collection like Personal information which contain some field like name, address etc. and some normal fields. Now i want to show all of them in table.I tried field collection views but its showing all field collection data in single column called personal information with other fields.

Please let me know how i can do this....really struggling in drupal.


texts: Views format: faster fields or rendered entity?

texts:
I'm building some views that returns many content types that have different fields, so I'm choosing to display results as "rendered entity" instead of "Fields".
I would like to know if there are perfomance reasons to use fields or rendered entity.


texts: Add class to a views field depending on image's being vertical or horizontal

texts:
I have a view that outputs an image field. I would like to add a class to the .views-field div (for example, actually a views-row would also do the job) depending on whether the image is vertical (length > height) or horizontal (height > width).

I tried making a custom views-view-field-tpl.php for outputting the view's field, but I have no idea how to access the image or the image data.

EDIT: I've found that $field contains additional_fields, which in turns includes field_photo_width and field_photo_height. Those are arrays, though, and I have no idea how to get an actual value from them.


texts: Content type term reference field selected or populated from URL parameter

texts: I need to be able to click on a link, that goes to node/add/example. and populate a term reference field with a URL parameter. I thought i could be able to do this through the default value, but i guess it isn't possible. Anyone have any other ideas to try?


texts:
I have created a custom form in Drupal 7 and entered some values then submit the form. I want to display the submitted value in a block. How to do this in drupal 7. I am new to this.

This is the code for my custom module

function myForm_menu() {
  $items = array();

  $items['examples/form-example'] = array( //this creates a URL that will call this form at "examples/form-example"
    'title' => 'Example Form', //page title
    'description' => 'A form to mess around with.',
    'page callback' => 'drupal_get_form', //this is the function that will be called when the page is accessed.  for a form, use drupal_get_form
    'page arguments' => array('myForm_form'), //put the name of the form here
    'access callback' => TRUE
  );

  return $items;
}

function myForm_form($form, &$form_state) {

 $form['Value1'] = array(
    '#title' => 'Value 1',
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#size' => 10,
    '#maxlength' => 10,
    '#required' => TRUE, //make this field required
  );

 $form['Value2'] = array(
    '#title' => 'Value 2',
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#size' => 10,
    '#maxlength' => 10,
    '#required' => TRUE, //make this field required
  );

 $form['Value3'] = array(
    '#title' => 'Value 3',
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#size' => 10,
    '#maxlength' => 10,
    '#required' => TRUE, //make this field required
  );
 $form['Value4'] = array(
    '#title' => 'Value 4',
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#size' => 10,
    '#maxlength' => 10,
    '#required' => TRUE, //make this field required
  );

  $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Click Here!'),
  );

  return $form;
}

/*function myForm_form_validate($form, &$form_state) {
  if (!($form_state['values']['Value1'] > 0)){
    form_set_error('price', t('Price must be a positive number.'));
  }
}*/

function myForm_form_submit($form, &$form_state) {
    $form_state['rebuild'] = TRUE;
    //print($_POST['Value1']);
    //print($_POST['Value2']);
    //print($_POST['Value3']);
    //print($_POST['Value4']);

    drupal_set_message('' . print_r($form_state['values'], TRUE) . '');
    // php

$myurl='http://www.example.com/php/fabric/example.php';
$headers = array('Content-Type: multipart/form-data');
$ch = curl_init($myurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch,CURLOPT_NOBODY,$data_string);
curl_setopt($ch,CURLOPT_POST, true);/*
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data))
);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);*/
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$obj = json_decode($response);
 $count = count((array)$obj);
  $count_MACHINES=  count($obj->MACHINES);
  //echo $count_count;
  for($i=0;$i<$count_MACHINES;$i++)
  {?>
                                        <input type="checkbox" id="cont" name="weavingMachine[]" value="<?php echo $obj->MACHINES[$i];?>"><?php echo $obj->MACHINES[$i];?><br/><?php

                            }
curl_close($ch);

}


texts: How to change page CSS based on parent menu item?

texts:
I'm building a fairly simple site, and I need to alter a background image based on what section the user is in. The main menu only has 2 levels. I'm unsure where I should hook into in order to be able to get the current section (i.e. the root menu item of the current page, see example below) so I can adjust the classes on the page. I was looking at this article as a possible solution, but I only want to alter CSS classes, and that seems like an awful lot of code for such a simple task.

Main Manu:
-- Section 1
   --- Page A
   --- Page B
   --- Page C
-- Section 2
   --- Page D
   --- Page E <- Active page, CSS class "section_2"
   --- Page F


texts: How to properly add a second join in a custom Views relationship handler?

texts:
I'm developping a Drupal 7 module that allows text fields to reference entities that have a title / name matching the field's text value. I have successfully exposed Views relationships for these text fields by implementing text_field_views_data_views_data_alter(&$data, $field), for example if I have field_main_researcher configured to reference user entities, the relationship looks like:

$data['field_data_field_main_researcher']['field_main_researcher_value']['relationship'] = array(
  'label' => t('User entity referenced from field_main_researcher'),
  'group' => t('Text or Entity'),
  'title' => t('Referenced Entity'),
  'handler' => 'views_handler_relationship',
  'base' => 'users',
  'base field' => 'name',
);

I'm now trying to add support for the Real Name module, so in the case above I started out by changing base and base field to realname which produces the correct SQL query and allows me to add the Realname field or use it in a contextual filter. But I need to be able to access the whole user entity, not just the Realname entry!

Since the views_handler_relationship documentation states this base class can only handle a single join, I set out to implement a custom relationship handler that will add the second join to the query when needed. This is what I've come up with so far:

class text_or_entity_handler_relationship extends views_handler_relationship {
  function query() {
    parent::query();
    if (!strcmp($this->definition['base'], 'realname')) {
      $second_join = new views_join();
      $second_join->definition = array(
        'left_table' => 'realname_' . $this->table,
        'left_field' => 'uid',
        'table' => 'users',
        'field' => 'uid',
      );
      $second_join->construct();
      $second_join->adjusted = TRUE;
      $alias = 'users_' . $this->table;
      $this->query->add_relationship($alias, $second_join, 'users');
      $this->query->add_table('users', NULL, $second_join, $alias);
    }
  }
}

The above code properly adds the second JOIN on the users table and links it to realname via the shared uid column, but for some reason I still can't access the user entity fields or contextual filters despite adding the users table to the query!

What am I missing?


texts: Commerce rule for total of product lines only (not shipping as well)

texts:
I have a requirement to add an amount to the total of all Commerce product lines items in a users cart and then add that amount to the shipping amount.

The rule I currently have uses the "calculating a shipping rate" event. The element on the rule uses "Calculate a value" with the input value as commerce-line-item:order:commerce-order-total:amount. However, this value also takes into account the shipping. I only want to apply the calculation to the ordered items in the cart - not shipping as well.

Does anyone know how I can access just the subtotal for the cart?

Thanks!


texts:
I am trying to add a contest to my website which will be based on how frequently they login into my website. Each user will be assigned one point per day irrespective of how many times the login in a day. A winner will be picked every month, at random, based on the number of times they have logged in. Hence the more times you login, the more odds you have of winning.

Any ideas on what would be the best approach? Would I have to build a module from scratch? Modify a current module? Any help would be appreciated.

Thanks,
G


texts: Move field from one profile type to another?

texts:
I have a field in one profile type that really belongs in another profile type. The field already contains values.

I can imagine exporting the contents of the field, attaching a new instance of the field to the "other" profile, and importing the exported values to the new instance using feeds. But is there a more straightforward way to move a field (and existing values) from one profile type to another?


texts: How to programmatically update a file uri in a node

texts:
I'm programmatically moving a pdf file and then trying to update the uri in the node. Here's my code:
$node = \Drupal\node\Entity\Node::load($nid);
$entity = $node->field_pdf->entity;
if ($entity) {
   $uri = $entity->getFileUri();
   // move the file and update the uri to the new location
   $entity->setFileUri($uri);
   $node->save();
}

The uri is correct--the file gets moved--but the node isn't saved with the updated uri. What am I doing wrong?


texts:
I'm trying to transform my textinput into a select-field but I keep stumbling upon An illegal choice has been detected-error.

What I try in my hook_form_alteris this:

$form['distance']['search_distance']['#type'] = 'select';
$form['distance']['search_distance']['#options'] = drupal_map_assoc(array(100 => '100 km', 200 => '200 km'));

It looks like he's doesn't like strings to be in the select list, although, the value of the input is an integer...

How can I make this input field accept my modifications?


texts: How to use CSS preprocessor LESS.js with Drupal 7?

texts:
I would like to use LESS, the CSS preprocessor, with Drupal 7 projects.

What are the required steps to use LESS in Drupal?


texts: How can I include a node reference field in my form?

texts:
My module implements hook_menu() in order to define a settings page:

function MYMODULE_menu() {
    $items = array(
        'admin/config/system/mymodule' => array(
            'title' => 'MyModule settings',
            'description' => 'Various settings for MyModule.',
            'page callback' => 'drupal_get_form',
            'page arguments' => array('__MYMODULE_settings'),
            'access arguments' => array('administer site configuration'),
            'type' => MENU_NORMAL_ITEM
        )
    );
    return $items;
}

That settings page takes it's settings from __MYMODULE_settings():

function __MYMODULE_settings() {
    $form = array(
        'my_text_field' => array(
            '#type' => 'textfield',
            '#required' => TRUE,
            '#title' => 'Facebook link'
        ),
        'my_node_field' => array(
            '#type' => 'entityreference',
            '#required' => TRUE,
            '#title' => 'Contact node'
        ),
        'submit' => array(
            '#type' => 'submit',
            '#value' => 'Save'
        )
    );
    return $form;
}

However when I do this, the "my_node_field" field (of type entityreference) doesn't display.

On the settings form I want to have a setting that points to a node. I'd like to use the "entityreference" module for that setting — I already have entityreference installed, and I'm using it to put node reference fields on a handful of my content types.

Looking at entityreference_field_info(), it looks like entityreference defines a field called "entityreference" — shouldn't I be able to use this field?


texts: Set pager none in a view programmatically

texts: I want set pager none in a view programmatically, but I can not find a way to do it, the object "$view" does not seem to exhibit a way


texts:
Composer always installs the latest version of Drupal core, but I want Drupal 8.6, not Drupal 8.7.
How can I install a specific core version?


texts: Exposed Taxonomy filter relationship with two levels

texts:
I have searched about that but I didn't found any solution for my problem, I also tried to combine different solutions that I found but didn't work.

Those solutions were different combinations of what I mention on this post (for eg. 2 relationship and contextual filter, one relationship with contextual filter, only contextual filter, on filter criteria add "has taxonomy term", "term ID" etc.

I have taxonomy terms with childrens

Car

BMW
FIAT
VW

Motorcycle

Yamaha
Honda
Kawasaki

I created page view with filter criteria like this

My output is this:

Until here is everything works perfectly.

Now I want a brand subfilter.

So I filter by "car" and the result is all car brands (bmw, fiat and vw), after that I want to choose "bmw" or "fiat" or "vw" and the result will be all cars with choosen brand.

I have added another filter criteria:

And my output is:

Now I want:

when I choose "car" show me all cars (works)
when I choose "car" and "BMW" show me all BMW cars (not working)

Instead I have no results.

If I don't group second filter criteria (brands) this works as expected BUT I have a select list with all options (car, bmw, fiat, vw, motorcycle, yamaha, honda, kawasaki), but I don't want this, I only want the car brands.

There is a way to show on a select list only brands(bmw, fiat and vw) instead of all options? I could work with this.

I tried different configurations on brand filter criteria, group them (is one of, is all of, etc).

Also tried to create a relationship by term, create another relationship (parent) and contextual filter "taxonomy term: parent terms" but didn't work these 3 together. Tried only with one relationship but didn't work. Tried only with contextual filter and didn't work.

I always get no results.


texts: views with multiple contextual filters - should return data only when both or any one filter is present

texts:
Views of content is having two contextual filter. For some reason node object is available to views so it is passing through url's 7th argument.

1.Content: Has taxonomy term ID
Configuration: Php Code

$nid = arg(7);
$node = node_load($nid);
if($node && isset($node->field_tags)) {
      $related = field_get_items('node', $node, 'field_tags');//dpm($related);
      foreach($related as $tag) {
          $view_par[] = $tag['tid'];
          //dpm($tag);
      }
return implode(',', $view_par);
}
else{
return 0;
}

2.Content: Nid (Ref: entity-reference-and-nested-arguments-in-views)

$nid = arg(7);
$node = node_load($nid);
$Related_ids = array ();
    $Related = field_get_items ('node', $node, 'field_some_er')    // Get the entity reference scope
    if ($related && is_array ($related) && sizeof ($related)> 0) {
      for ($i = 0; $i <count ($related); $i++) {
        $ Related_ids [] = $related[$ i]['target_id'];
      }
    }
    return implode ('+', $related_ids) // It returns the values of the field entity reference

Relationships:

Content: Taxonomy terms on node (Require this relationship :TRUE)
Content entity referenced from field_er_in_content (Require this relationship :TRUE)

With above configuration/modifying how to retrieve views's data only when

1. Any one of the filter should be present i.e either field_tags(term reference field) or field_some_er (entityreference field)
2. Both filter could be present.

but should not retrieve when both value is absent. Is there something can be done using common variable like found flag that can be shared to both php code and break the view operation.


texts: Drupal Webform not submitting sometimes right after clearing cache

texts:
I add a webform node to another node via hook_page_alter() or in a block. Sometimes when submitting this form it doesn't submit the data and redirect to the Custom URL set in the settings.  Right after I see the
the form give me this issue I notice that the submitted data does not appear under Results -> Submissions.  It only happens right after clearing the cache. Once it happens if you refresh the page or go to another page that has the form it doesn't happen.  If I go to the actual node that is the webform I can't reproduce this issue.

Below are the steps I take to reproduce this problem (FYI I can only reproduce it sometimes. I can reproduce it logged in as user 1 but I have better luck reproducing as anonymous user):

Flush all cache via drush cc all command
Refresh page with form
Fill out form and submit
Notice that the page refreshes instead of going to destination url (this happens maybe 40% of the time)

This is how I display the webform on certain nodes via hook_page_alter():

$get_my_free_download_node = node_load($nid);
$markup = drupal_render(node_view($get_my_free_download_node, 'hcp_gmfd_slide_in'));

$page['content']['sliding_panel'] = array(
  '#markup' => $script . $markup,
);

I am using Webform 7.x-3.24.  I added debug code webform_client_form_submit() and my code never gets run when this issue happens.

I'm wondering if Varnish or Memcache is causing this issue?  I don't ever remember seeing this a long time ago but I don't think I ever did a test of clearing the cache and testing the form right away.

These are my Memcache settings in settings.php:

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_inc'] = './sites/all/modules/memcache/memcache.inc';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array('127.0.0.1:11211' => 'default');
$conf['memcache_bins'] = array('cache' => 'default');
$conf['memcache_key_prefix'] = 'AW';

$conf['reverse_proxy'] = true;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
# Bypass Drupal bootstrap for anonymous users so that Drupal sets max-age > 0
$conf['page_cache_invoke_hooks'] = FALSE;
# Fix for admin_menu disappearing see https://drupal.org/node/442560#comment-2692220
$conf['admin_menu_cache_client'] = FALSE;

Update

I originally stated that this only happened in production but after testing locally more often I was able to replicate the issue locally.


texts:
In a custom module i'm using an EventSubscriber to redirect different people to different frontpages. Below is the simplified code I'm using.
//GET PATH
$nid = 1;
$domain_url = \Drupal::service('path_alias.manager')->getAliasByPath('/node/'. $nid);

//FRONTPAGE REDIRECT
$response = new RedirectResponse($domain_url);
$event->setResponse($response);

The module is working but there is one detail I can't seem to solve.
For example on my website domain.com I have node/1 that has an alias path /home.
When going to domain.com it is, because of my module as expected, redirected to domain.com/home. But what I want is the url not to show the home part. Is it possible to show the content of /home but keeping the url domain.com?


texts: Drupal Commons notifications queue is not working

texts:
I have a site where we noticed the notifications are no longer working. The Queue states there are 238 notifications, and they are set to process immediately. The send method is "mail," and other emails go out from the site with no issue (e.g. registration emails).

I'm looking for any information which may help me troubleshoot this issue. There are no entries made in the watchdog table, no settings that I can see to log any kind of debug information, and no general setting or indication where I can see that would cause the problem.

The only thing I can guess is that updating Drupal Commons from an early version to 1.5 broke notifications in some way that I'm not familiar with.  The only significant thing I turned up on Google is this: http://network.acquia.com/node/1469103.

It's a combination of so many modules interacting that I'm honestly not even sure where to start.