texts:
We are developing a Drupal website for displaying properties. Each property has a minimum and maximum size that is available.  The user can search with a minimum and maximum size also.

We need help trying to work out how to setup the View in Drupal 7. For example, a user might search for properties with min size 10,000 sq ft and max size 50,000 sq ft. The following properties would match:

Property 1 - min size 13,000 sq ft, max size 48,000 sq ft
Property 2 - min size 10,000 sq ft, max size 50,000 sq ft
Property 3 - min size 20,000 sq ft, max size 20,000 sq ft
Property 4 - min size 9,000 sq ft, max size 51,000 sq ft

How should we set this up in the Drupal View? The content type has a min_size and max_size already.


texts:
I am trying Boxes for first time instead of block, however. It is adding some wrapper DIVs. I usually use hook_preprocess_block() to remove them but it is not the case with Boxes

 function HOOK_preprocess_block(&$variables)
{
    switch ($variables['block']->region) {
        default:
            $variables['theme_hook_suggestions'][] = 'block__no_wrap';
            break;
    }
}

How to remove DIVs wrapper for Boxes? Thank you for any help


texts: How do I retain the query string after login?

texts:
I need the user,opening a certain page of my site (www.foo.com/page_to_visit), to login and then go to the requested page, so I set up an hook_menu for this specific page and a callback. In the callback I added this code which works

drupal_goto('user', array('query'=>drupal_get_destination()))

but if the url contains query strings (www.foo.com/page_to_visit?id=12&od=12) they are removed. I mean that, after login, the user gets redirected to www.foo.com/page_to_visit instead of www.foo.com/page_to_visit?id=12&od=12. How do I avoid this behaviour?

UPDATE: Drupl_goto has something supporting this. Produced this code, following documentation

$args = array();
$params = $_GET;
$args[] = $params['q'];
unset($params['q'], $params['destination']);
if (count($params) > 1) {
  $pippo['query'] = $params;
  $args[] = $pippo;
}
drupal_goto('user', array('query'=>$args));

$args results in --->
Array
( [0] => page_to_visit
  [1] => Array
    ( [query] => Array
            ( [id] => 12
              [od] => 12
            )
    )
)

The result is odd for the redirect looks like
    http://www.foo.com/user?0=page_to_visit&1[query][id]=12&1[query][od]=12


texts:
Is there any module which tracks page visit count for taxonomy terms?

Several module exists for node visit report (including Core Statistics). But I have not found any for taxonomy term page visit count.

Some posts found suggest using the Google Analytic module for this purpose. But my client does not want to use Google Analytic as this is intranet site. Still wants a report for category pages visit.


texts: How to design content type for students results

texts:
I have a content type for "Students Grades" which has fields to hold the students exam results for every student and every subject as following:

==========================
| field           | type |
==========================
| student_name    | text |
| class           | text |
| math_points     | text |
| sport_points    | text |
| activity_points | text |
==========================

And, I would like to present students grades as below:

Student Name: John Smith
Class: Primary 1st
================================
| Subject  | Max | Min | Result |
=================================
| Math     | 30  | 15  | 28     |
| Sport    | 10  | 5   | 8.5    |
| Activity | 20  | 10  | 17     |
=================================

The problem for me how to include the values of columns "Max" and "Min", which hold unique values on level of the "Subject" and "Class".

For example, the Max for Math is always 30 points for all students in Primary 1st class, but it could be 40 points in Primary 2nd class. Same applies into "Min" column.

So the question is, what's the simplest design strategy of the content type/views to include every subject result, max and min points without creating too much fields?


texts: How to make sure the correct callback is processed?

texts:
I'm developing a module which add an action in Rules:

In the file .rules.inc I have:

function universal_document_creator_rules_action_info() {
  return array(
    'udc_createdoc' => array(
      'label' => t('Convert Docucument with UDC'),
      'group' => t('Custom'),
      'parameter' => array(
        'templateid' => array(
        'type' => 'integer',
        'label' => t('Template ID'),
        'description' => t('Enter the ID of the template'),
      ),
      'accountmanagersid' => array(
        'type' => 'integer',
        'label' => t('The number of the account manager'),
        'description' => t('The node ID of the number of the account manager.'),
      ),
      'filetypeid' => array(
        'type' => 'integer',
        'label' => t('File type ID'),
        'description' => t('The filetype ID. 1 = Word, 2 is PDF'),
      ),
      'cvnodeid' => array(
        'type' => 'integer',
        'label' => t('CV node ID'),
        'description' => t('The node ID from the CV'),
        ),
      ),
      'provides' => array(
        'filename' => array(
          'type' => 'text',
          'label' => t('File name'),
        ),
      ),
    ),
  );
}

In file .module if have the function

<?php

// This callback creates the document using the parameters provided through rules' UI
function udc_createdoc($templateid, $accountmanagersid, $filetypeid, $cvnodeid) {

  $FileToSave == "foo";
  drupal_set_message(t('test why is this not on my screen'), 'error');

  return $FileToSave;

}

Setting the action in Rules UI is no problem but I do not get the message on the screen. Any suggestions?


texts: Why jquery menu collapse on all pages except front page

texts:
I have a Drupal 8 site and them (upgraded from Drupal 7) and the main menu collapses to a button when the page is narrow enough (i.e. on a mobile device).  Or at least it is supposed to.  I did not design the theme.
SITUATION
Unfortunately when the menu is collapsed into a button, clicking on the button does NOT open the menu.
SITE SETUP
It seems that the old theme used jQuery to handle the collapse of the menu.
I have installed the jquery_ui module.
I added jquery to the .libraries.yml file
  dependencies:
    - core/jquery
    - core/jquery.ui
    - core/jquery.once

There are 4 template files which the only reason I can see is so that the main menu (which is hardcoded) can style the active menu item for the page.

page--node--2.html.twig
page--node--3.html.twig
page--node--6.html.twig
page.html.twig

Each of those pages has as the last line of the page a reference to the JavaScript file located in the site as
<script src="sites/all/themes/custom/mytheme/js/main.js"></script>
FIXED SOME OF IT
Adding jquery.main.js to the /js directory and adding the reference to it in the .library.yml file as
  js:
    js/main.js: {}
    js/jquery.main.js: {}

was enough to get all of the pages to collapse and open the menu EXCEPT THE FRONT PAGE.
JURY-RIG
I can get the front page menu to work if I add a reference to the bottom of the page to the jquery.main.js file I manually added to the local /js directory.
<script src="sites/all/themes/custom/mytheme/js/main.js"></script>
But then the other pages (not node 2, 3 or 6) which should use page.html.twig are run, it does NOT un-collapse the menu.
So for now I make a page--front.html.twig file which includes BOTH script referecnes to the JavaScript files, and all other pages have just the one (to main.js).
QUESTION
I have a couple:

What is the more standard way to situate this? I don't imagine that having a local jquery.main.js file is the best solution but it wasn't working with out it.
Why would the front page not operate like the other pages in accessing the JavaScript and jQuery?

Thank you for any insight.


texts: How to send mail from drupal 7 efficently and avoid 'Too many concurrent SMTP connections' error?

texts:
I'm using the smtp module to send mail from a drupal 7 installation throught gmail. In

 /admin/config/system/smtp

I set

 smtp server 'smtp.gmail.com'
 smtp port '587'
 use encryption 'use tls'

and i set my valid mail 'something@gmail.com'.

Now, it's working, but some days ago a lot of mail, on the account something@gmail.com, began to arrive containing an error message:

 Delivery to the following recipient has been delayed:
 someBadGuy@somemail.com
 Message will be retried for 2 more day(s)
 Technical details of temporary failure:
 The recipient server did not accept our requests to connect. Learn more at https://support.google.com/mail/answer/7720
 [(10) somemail.com. [someip]:25: 421 Too many concurrent SMTP connections; please try again later. ]

There were and there will always be on my drupal site people registering with fake unreachable mail, so assuming i can't solve this problem, what this message means? It began some days ago, out of the blue, so i think something is changed, but i do not know precisely what. And do not know precisely where. (gmail, my provider, my server...)

Anyway, what is the best way to send mail from drupal, excluding the idea of setting up my own mail server and excluding gmail, as it implies this problem?


texts: create email id for registered users in Drupal 7 and Nginx

texts:
I am working on a Drupal 7 site which lets users to register using their email, when the user verifies their email address, I am planning to create new email address for them to use, which has extensions as my domain.

Suppose my Domain is http://abcd.com When Mr. X YZ register and verify his registration he will automatically get new email address from me as x.yz@abcd.com.

How do I accomplish this with Drupal ? Can this be done via server-side if so then I have Nginx server, do I need SMPT {} Block for that ?

I was thinking to ask users to use google mail service to login to their email address provided by me. Still, not sure how to accomplish that one as well.

I feel I am really missing something, as I was searching around, there were few suggestions about Postfix but I really don't know what it is, and how it works.


texts: Each node has a score (percentage) which is updated weekly & want to show latest and the past scores in below/in a chart

texts:
The site is keeping scores (by percentage) of how well it does in a certain area. So each node is a different area and that node will have a score of 7% in week 1. An example: Liverpool's score is 11.23% for week 1 of 2018, week 2 that node (Liverpool) is updated and it gets a score of 12.01%, etc, etc.

In week 2, we update that nodes score to 9.5%, I want to show this prominently at the top of the page as the current score. Then underneath, show a chart of the previous scores or at least at the very minimum show all the scores in a neat line, going back/down in order of date.

I then also want to show all of these nodes (areas) in one view, showing in a ranking list, this would just be a view?

Is this the right way to go about it, with nodes that are updated/revisions? Or am I thinking about this all wrong?

What about using table field for the past scores and just having the current score as it's own field shown at the top?


texts: How to attach a view display switch to a view?

texts:
I am wondering how I can attach a switch/ link from one view display to another view display within the same view. I can only think of messing around in the template files and hardcoding this navigation.

What is the best solution/ is there a better solution for that?

Update: both displays shall have a own url this for caching and possibility to link to a specific display.

myview/(default: display-table)
myview/display-table
myview/display-list


texts: Grouping contents in view by months and year in (Table) Tabular form

texts: When I am grouping by month and time in unformulated list it working fine. But when i selecting table format it showing grouping by date. Here i am putting screen shorts.


texts: How to select from a specific choice of images on content forms?

texts:
Is there a way to have a specific set of images on an add new content form.

So for example the "article" content type, when setting the fields on the form the only option for image is an upload function so the user can upload an image, I would like for there to be a selectable list of predefined images they can choose from.

Not a single default image, but an option of say 5 images.

Thanks.

(Drupal 7)


texts: Field with unique and auto-increments values

texts:
I have a content type that in one of their fields need a value that is unique and auto-increment.
There are several obvious solutions:

Use the node id that is unique and auto-increment.
The Serial module.

The problem with these solutions is that they use the MySQL auto-increments.

Drupal, by default, auto-increments the node ID (nid) and other IDs by one digit for each piece of content you create. You can see this if you visit your site by the node ID path:

http://www.example.com/node/1
http://www.example.com/node/2
http://www.example.com/node/3

However, sites that use database replication as a backup strategy (is my case) often will have non-sequential ids, meaning that you could see nids jump by two or more digits.

http://www.example.com/node/10
http://www.example.com/node/15
http://www.example.com/node/20

The MySQL auto_increment_increment variable determines how many digits to jump for each successive auto_increment value.

And then I have this problem:

How I can do to have a field with unique and auto-increments values?


texts: How can I automatically restore my site from a backup using the command line for testing purposes?

texts:
I am on Mac OS X using MAMP PRO as my local development environment.  I want to quickly reset my site to a known state in order to run some tests I have prepared in Selenium.

I have the Backup and Migrate module installed which makes it easy to restore from the command line via drush, but if I restore using Backup and Migrate it appears to only overwrite the existing data and leaves other data in place, which I don't want-- I want to erase all of this other data as well so that I can be sure that the database is in exactly the same state as the backup file.

Currently, I log in to PHPmyadmin, drop all of the tables in the database, and then re-import from the backup.  This seems somewhat inefficient to me; is there a way to automate this from the command line?


texts: I'm not sure if it's actually doing this; I can't see any options for comment fields in the configuration. How can I check? Does it say explicitly somewhere?


texts:
Am working on an ecommerce site and am using ubercart module for that. Now am stuck with an issue which is ' if the weight of order total is >=1kg, i want to add an extra 150g to the order total and final amount calculated should include this extra grams aaded. for example if i have an order for a product worth 1kg, in the checkout page the final weight of order is 1.150 kg. but the product weight should not be increased.only the final order has an extra weight added. can anyone help me to solve this issue?

Thanks in advance..


texts: Facets are missing post updating Apache Solr Search to 7.x-1.4 version

texts:
I just updated Apache Solr Search module to 7.x-1.4 version, and since then the facets are missing in the assigned region.

Facets of all taxonomy terms are missing, the rest of the default facets like content type, etc are appearing on the settings page.

Plus the Taxonomy term fields are missing under Bias settings as well.

I have tried to disable > Uninstall > re-install all the Apache solr search and Acquia search modules but Facts are not appearing back on the Apache Solr Settings page.

I have this issue on the production server.

Regards,
Anand


texts: How to add data to a message type custom field that's inherited by all message instances?

texts:
I'm using the Message module, and I have some message types. Each message type needs to have a node reference field on it whose value would not change for the entire message type. But different values per message type.

Right now I can create a new message type with a field on it, but the instances of messages are generated programmatically on demand as sent.

What I ultimately need to do is generate a token based on the value of this field.

So how would I go about creating a value that would be inherited by all instances of a message type? Ideas?

Any advice useful. Sort of don't know what functions would be useful here and the docs really don't address this use case.


texts:
I have been trying to use plupload field in a custom form which I am doing by using the following code:

  $form['picture_upload'] = array(
    '#type' => 'plupload',
    '#title' => t(''),
    '#size' => 50,
    '#description' => t(''),
    '#upload_validators' => array(
      'file_validate_extensions' => array('jpg jpeg gif png'),
    ),
  );

This works fine but when I add files it shows the list of files rather than thumbnails like in this example.

What changes do I need to make in order for the widget to show thumbnails rather than a list?


texts: View to show 2 different fields that have multiple values next to each other

texts:
I have a content type that has 2 fields on it:

image (multiple values)
image description (multiple values)

I have 6 images and 6 descriptions. I want to use a view to show each image with each description. I have tried playing around with the "Display all values in the same row" settings but just can't get this to work. It displays the same image repeatedly (6 times) and then the descriptions are all correct, then repeats the next image 6 times again.

I am tearing my hair out here, how do I get a view to simply out output:

Image 1, Description 1
Image 2, Description 2

and so on?

I have included an image of current output plus the way the fields were set up on the node. I have set them up this way as I need to import a lot of them.


texts:
I have a custom field called site_category that I am using in a few different content types.  The field site_category is an entity reference to a content type which has only one field defined:  Title.  For the purposes of this example, I have three instances of that content:  Things, Widgets, Places

I have another content type called content that has a number of fields including site_category

(Think of this like taxonomy, but using content types rather than terms)

I would like to add in the site_category field to my page.tpl.php so that it not only displays the title of the page, it also displays the site category that it is related to.

So, as an example, if I had a "Super Duper Widget De-Duper" that fell under the widgets category...

example URI:

.com/widgets/super-duper-widget-deduper

Page would render (styled of course):

Header
**Widgets**
**Super Duper Widget De-Duper**
Content
Footer

I have found a number of similar posts here on stackoverflow like this one:  Access custom node field in page.tpl.php  However, it dosen't work and I don't know what I am doing wrong.  There is a lot of php code provided, but I don't know where to put said php code because it is never really referenced.

I have added the output from the Devel module.  It appears that the field is being loaded as it is "there."  Shouldn't I be able to access it?

I have added the following code with a reference to the field that is displaying in Devel:

if (isset($variables['id'])) {
// Get the node ID and load it.
$n = node_load($variables['id']);

$variables['site_category'] = "Breakpoint 1";

//If "Breakpoint 1" shows up on the page output, we know that (isset($variables['id']))
//evaluates as  "true"

// Check if the node exists
if ($n) {
  $variables['site_category'] = "Breakpoint 2";

  //if "Breakpoint 2" shows up on the page output, we know that the ($n) evaluates
  //evaluates as true.

I only added the two breakpoints - no other changes were made.  When I view the output, only Breakpoint 1 shows up meaning the node doesn't exist.


texts: Detect language when cache is enabled for anonymous

texts:
I have a multilingual site in which I need set cache page enabled for anonymous using Varnish.

But if you enable page caching language is not detected for anonymous in pages without language prefix. This happens because language can't be detected using browser language detection of drupal. In short, if browser language is detected when page cache is enabled the cache could be affected by the user specific language. In the issue linked they provide a code to allow browser language, if you still want do it.

I've found 2 solutions for solve my problem:

1) Use Global Redirect module to redirect users to page language, and
apply code of the issue to allow browser language detection. With Global redirect users would be allways redirected to page with language prefix.

2) Don't cache page for anonymous, but send cache control max age header by my own, only for anonymous (I've seen 'Expiration of cached pages' set by drupal only works when drupal page is served from anonymous cache). There exists a module to add cache control max age, and made a control by user role?

What of the solutions do you think is the recommended? There is another way to solve this problem?


texts: When to use a Webform vs. simply utilizing the Add Content page

texts:
Where is the line between using the Webform module vs. simply letting users create new content of a certain content type?

I am fuzzy on when each would be more appropriate. Especially after seeing the ambiguity of answers and comments to this question.

Use case: Users aren't entering data for a survey, they are actually entering content in to the site. They are entering data for a node that will be displayed as a normal content page. But it needs to be validated, have conditional fields, etc.


texts: Seeing if node has been changed in custom submit handler

texts:
I have written a custom submit handler that gets called whenever a certain content type is edited.

I was wondering if there was a flag in $form_state that indicates whether the node was actually edited vs whether someone is just clicking the save button without actually changing anything.  I am wondering because I would like to perform an action only if the node is edited. Thank you

function hook_form_alter(&$form, &$form_state, $form_id) {
  $form['#submit'][] = '_unpublish_new_product';
}

function _unpublish_new_product($form, &$form_state) {
   // is there a flag in $form_state that indicates if any fields were changed so I
   // could perform a conditional action??
}


texts: Is it possible to uninstall a module which is causing some errors?

texts:
I have installed Views Bulk Operations but it is causing errors since it needs PHP 5.2.9 while my hosting is PHP 5.2.6.
I have no option to turn it off, it has a red cross.

How to remove this module?


texts: How can I translate the title of taxonomy term pages when using i18n?

texts:
On the page of translated taxonomy term "Site Development" there is Russian source Term name in the title tag and in the page title (h1). You can see the problem at http://tlito.ru/en/categories/site-development

I often use the i18n module, but what kind of error/problem could be causing this?


texts: Preventing users from registering with xxx@yyy format email address

texts:
Drupal seems to let users register with emails like xxx@yyy

I heard that this kind of email address can exist.
But I want users to register with only emails like xxx@yyy.zzz

Is there any way to validate this type of email format and prevent users from registering with it?


texts: How to hide the unflag link text once the flag is set?

texts:
I have a node flag abuse and I want to remove/hide unflag link text "non-abuse" once the abuse flag is set.

How to do this in Drupal? Since I am new to Drupal, I can't think of a  solution for this.

Note: I'm using this inside the Panels module.


texts: Problems getting Carousel jQuery plugin working

texts:
I am trying to get a Carousel on my site, but I am having problems.
I want to install http://www.jqueryscript.net/slider/Full-Width-Responsive-Carousel-with-jQuery-Bootstrap.html.
I have created a content item for testing this on http://xuzo.com/testing/node/26.
Method A: my own stylesheets (not working)
I pasted the HTML from http://www.jqueryscript.net/slider/Full-Width-Responsive-Carousel-with-jQuery-Bootstrap.html and put it in my content item under FULL html format. I have tried to make it work with my own style sheets that I copied from the website above, I put them into my info file, and uploaded them to the server.
stylesheets[all][] = carrousel/bootstrap.min.css
stylesheets[all][] = carrousel/jquerysctipttop.css
scripts[all][] = carrousel/bootstrap.min.js
scripts[all][] = carrousel/jquery.min.js

Since I have the style sheets, I am not sure I had to use CSS injector and JS injector or not.
Method B: external CDN JS styles sheets + my own style sheets (not working)
I put my own style sheets that I copied from the website above into my .info file.
stylesheets[all][] = carrousel/bootstrap.min.css
stylesheets[all][] = carrousel/jquerysctipttop.css

I linked the external CDN files in template.php.
 drupal_add_js('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', 'external');
drupal_add_js('//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js', 'external');

The page shows up with images, but it is not working.
In CSS injector I tried this code.
#jquery-script-menu {
  position: fixed;
  height: 90px;
  width: 100%;
  top: 0;
  left: 0;
  border-top: 5px solid #316594;
  background: #fff;
  -moz-box-shadow: 0 2px 3px 0px rgba(0, 0, 0, 0.16);
  -webkit-box-shadow: 0 2px 3px 0px rgba(0, 0, 0, 0.16);
  z-index: 999999;
  padding: 10px 0;
  -webkit-box-sizing:content-box;
  -moz-box-sizing:content-box;
  box-sizing:content-box;
}

.jquery-script-center {
  width: 960px;
  margin: 0 auto;
}

.jquery-script-center ul {
  width: 212px;
  float:left;
  line-height:45px;
  margin:0;
  padding:0;
  list-style:none;
}

.jquery-script-center a {
  text-decoration:none;
}

.jquery-script-ads {
  width: 728px;
  height:90px;
  float:right;
}

.jquery-script-clear {
  clear:both;
  height:0;
}

In JS injector I tried this code.
jQuery(document).ready(function($) {
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-36251023-1']);
  _gaq.push(['_setDomainName', 'jqueryscript.net']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
});

I know I am missing something, but what?


texts: How to permit one sub admin to change passwords of other certain users?

texts:
I'ld like to make a sub admin be able to change other user's passwords depending on other user's role or uid.

The sub admin should be able to type the password by himself. Emailing a generated password is unfortunatley no optionn since the aimed user accounts will be used by a quite loose group of people (teachers and pupils, sub admin wants to change password every school year).

Until now there are only very few different accounts where that needs to happen. So can I maybe do that with uids?

Is it maybe possible to build a block that provides a form with password fields of the desired users? What hooks or forms would I need to use or alter then?

Any idea and/or explanation is very much appreciated!


texts: Block placer/beans conflict with previously created blocks

texts:
I'm running drupal 7. I'm currently working on a project that was abandoned by it's previous dev, and the client is attempting to duct tape it back together. My current issue:

I have a use case for the module Blocks Placer. The client wants to be able to add call to action blocks that they have previously created to pages that their staff will make. They want these blocks to be able to be placed in various areas on the page, or not at all.

The site is also currently using blocks in various regions. There's around 30 blocks, and 10 superfish menus created by the superfish module. When the blocks placer module is enabled, the /admin/structure/blocks page is replaced with a page that only shows created beans, and no blocks whatsoever. Before I created a bean, the page showed every region empty, including the disabled blocks region. After creating a bean, it was the only thing that shows up.

Is there a way to have this page show beans and blocks, or a separate page that shows only blocks?

Thanks in advance.


texts: Pages are not accessible, menu links are not displaying properly

texts:
I'm trying to resurrect a Drupal 4 site which stopped working at some unknown point, possibly months ago. I can login as admin and reach the front page. Every link after that returns 'you are not authorized to access this page'. The primary_links and secondary_links menus are not being retrieved properly. I have tried switching themes and clearing the cache table. I have also set up a local version for debugging but there are no PHP errors being thrown.

I'm running php 5.2.13, mysql 5.1.44.


texts: Setting a URL alias breaks the relative image paths on those pages. Is there a way to fix this?

texts:
I set a URL alias for one of my content type pages. So now every 'newsroom' content type is at http://myurl.com/newsroom/name-of-article. That's perfect. But that page also has blocks that contain images and now the paths to those images are broken.

my block contains: scr="sites/default/files/mobile-nav.png">
but the page is trying to find the image at src="NEWSROOM/sites/default/files/mobile_nav.png"

The block that contains the image is on every page of the site because it's the mobile nav.

How do I change my url alias? Or what do I need to do to tell drupal how to find the images correctly while keeping the image path relative?


texts: How to dynamically remove field in custom form using AJAX

texts:
Based on the "Add-more button (with graceful degradation)" example available in Drupal examples module I have created a form that can add fields dynamically using AJAX, and now i want to add a separate Remove button to each of those fields so that i can remove individual fields (not just the last field).

Decrementing the number of fields and rebuilding the form only removes the last field in the form.

What's the Drupal way of doing this? and what would be the best approach to achieve my requirement?


texts:
Is it possible to theme the Field Collection widget for just one field? The example I am looking for is a list of text fields. I need some of the text fields to be in two columns instead of one long column, which is the default. I also need to add some formatting guide text for some of the fields. I know I can achieve some of this through CSS, but was curious if there is a hook or something that I could implement that would allow me to change the markup as well? This is in Drupal 7 as well.

Thanks!


texts:
I have a view for a Drupal 8 site that uses 'work' as its path. I want to redirect user to this path right after the node has been submitted.

Form alter seems to be the right solution as it was in Drupal 7, but it's more complicated then it was before. In Drupal 7 we just used a direct path and redirect took place; now we need to provide a route name which isn't that obvious anymore. How do we find proper route name value? It's different for nodes, views, custom paths etc.

What I should use as argument for $form_state->setRedirect('')? How do I find what route name I should use in different cases?

function work_form_alter(&$form, \Drupal\Core\Form\FormStateInterface\FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'node_work_form':
      $form['actions']['submit']['#submit'][] = 'work_redirect';
      break;
  }
}

function work_redirect($form, FormStateInterface $form_state) {
  // Set redirect to some path.
  $form_state->setRedirect(''); // What should I provide here as an argument/arguments
}


texts:
I try to add a new filter criteria to my views with a custom module.

I manage to display my new filter on the filter criteria list but when I select it and go to "Add and configure filter criteria" I have an error saying:

  The handler for this item is broken or missing. The following details
  are available:

  Enabling the appropriate module may solve this issue. Otherwise,
  check to see if there is a module update available.

Here is my content_search.module :

function content_search_views_data_alter(&$data)
{
    $data['node']['content_search_filter'] = [
        'title' => t('Content search filter'),
        'filter' => [
            'title' => t('Content search filter'),
            'help' => 'Filters nodes on its content',
            'field' => 'nid',
            'id' => 'content_search_filter',
        ]
    ];
}

And here is my ContentSearchFilterPlugin, placed in content_search/src/Plugin/Filter/ContentSearchFilterPlugin.php

namespace Drupal\content_search\Plugin\Filter;

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\filter\FilterPluginBase;

/**
 * Filters nodes on on their content
 *
 * @ingroup views_filter_handlers
 *
 * @ViewsFilter("content_search_filter")
 */
class ContentSearchFilterPlugin extends FilterPluginBase {
  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->valueTitle = t('Content search filter');
  }

  public function query() {
    parent::query();
    // TODO: custom query here
  }

}

What am I missing ?


texts:
I am new to drupal i want to set auto complete off in my following code

$form['plantuser']['username'] = array(
    '#type' => 'textfield',
    '#title' => t('Username'),
    '#description' => t(''),
    '#required' => true,
    '#maxlength' => 50,
     '#weight' =>1,
  );


texts: How can I display a selected value of a multivalue entity reference field?

texts:
I have two content types A and B.

There is a multi valued field Persons in content type B. I have created a node of type B and enter two values in Persons field, X and Y.

Content type A has an entity reference field to Content type B which displays the values of the Persons field.

I created a node of type A and selected X in that entity reference field.

Now I have a view which is displaying the content of A. But I am unable to display the selected value of that entity reference field.

It displays the node id or the node title or all the values of the Persons field.

Is there any way to display the selected value of the Persons field in the view of listing the content of A?


texts: Feed content type field with configuration value

texts:
I have a config form with several config variables where i save some user preferences like «position» or «weight»

Now, at the moment of generating a content type i want to feed a select field with the «position» config formerly mentioned saved values as options for this field.

I saw i would may create a reference field as a view reference. So i guess i would do before a view printing those values, but i guess if there is a more convenient way to do this.

I prefer to do it without code, using the gui.

PS: I'm doing this with a simple config form, for customer's reasons i can not use Configuration Entity Types :-/


texts: How to programatically change a view's style_options when user clicking the exposed filter apply button?

texts:
In a Leaflet Map view, the exposed filter is a list(text) field. On user clicking the Apply button of the exposed filter form, I need to programatically change the value of $handler->display->display_options['style_options']['map'], I mean to change the Leaflet map style (which is defined in the module leaflet_more_maps).

How to make it?


texts: How do I display fields from a Commerce Cheque transaction using Views?

texts:
We have been processing payments in Drupal Commerce using the Commerce Cheque module. For accounting purposes, we would like a view showing all checks received with check numbers, etc..

How do I configure a view to display fields from Commerce Cheque, specifically check number?


texts: Twig field collection theme get field id

texts:
I am trying to get the field ID of of a field collection item being rendered in a field collection theme twig file: field-collection-item--field-name.html.twig.

I am able to render content using  {{content.field_name}} but I need a unique identifier to create an anchor link.
I can see an id is available using kint(item) but cant seem to figure out the proper syntax.

Any help would be greatly appreciated...


texts: Is it possible to add fields to a node type declared using hook_node_info? Do I have to add the fields separately? If so, what hook would I use for that?


texts:
I'm having weird benchmarking results with my drupal site.
The command I used (from my home PC) is:

  ab -n 100 -c 10 http://www.mysite.it/

Results with caching disabled:

  Document Path:          /
  Document Length:        69903 bytes

  .... cut ....

  1.5 requests/second

  very long times (about 10s)

Results with caching enabled:

  Document Path:          /
  Document Length:        197 bytes

  .... cut ....

  25 requests/second

  very short times (about 0.5s)

Such a huge difference in requests per second and connection times is hard to believe, but MIGHT be true.
But why is the page with caching enabled only 197 bytes?


texts: how remove required field from billing information into checkout

texts:
I need to add a checkbox to make billing information same as shipping information in drupal 8.
So i want remove required fields into billing address and set this information programmatically after submit the form.

But is very hard to remove required fields from billing information into checkout panes.
I also hack the Drupal\address\Element\Address.php at line 202 to set the #required attribute to FALSE but when i submit the form, i have always the message "... field is required."

Why the attribute #required => FALSE doesn't work? Why is so hard to modify this field? Why is not there a template for this field?

thanks


texts: Views multi field exposed free-text filter/search

texts:
I have a view displaying some course listings. I want to enable a free-text search on some of the fields. Some of these fields will be a term-reference type, and some will be text fields.

What's the best way to enable this type of search functionality? I've stumbled upon this: http://drupal.org/project/search_api but wanted someone else's opinion.


texts:
I'm using the Drupal forum and advanced_forum modules, and I have been struggling with how to set the default vocabulary used by the core Drupal forum module.

I have migrated forum nodes and comments from a Drupal 6 to 7 site without a hitch. The views that come with the forum modules work fine, but I can't seem to change the Panel page that does the heavy lifting.

The forum module was trying to use a vocabulary called Tags, so I uninstalled it, deleted Tags, and re-installed it, and it creates a taxonomy called "Forums". The problem is, I already have a vocabulary with that name.

Note I have correctly set the proper term reference for the taxonomy_forums field. Again, the issue is 1) the core forum module is trying to use the wrong vocabulary; 2) The panels supplied by advanced forum are also using the incorrect vocabulary, and there's no way to change it using the UI.

I'd settle for a manual database update at this point.


texts: Language switcher not visible when logged out (Drupal 7)

texts:
I'm creating a multilingual website in Drupal 7. I'm using the internationalization and entity translation modules and language detection is set to URL. I use the language switcher (content) from the entity translation module to switch between languages.

Everything works fine as long as I'm logged in as administrator. When I log out, or when I'm just an authenticated user, I can't see the language switcher anymore although the html code is generated.
Does anyone what could be the reason for this?

Thank you.


texts:
I have a 2FA option that users can enable. I am currently writing API layer where I want to preserve this functionality but so far I haven't been able to find a point where I can hook into authentication. The \Drupal\user\UserAuth does not invoke any hooks or events so I am wondering if the only solution is to completely swap the user.auth service for a custom implementation?

PS: my thinking is that if the 2FA is enabled, I would be checking a custom header.


texts: Adding classes and aria labels to menu through template file to add accessibility, Drupal 7

texts:
How can I add classes and aria labels to main menu in template file Drupal 7 to enable accessibility in main menu dropdown. "ul" and "li" tags already have styling I need to add "has-submenu"  class to "li" that has submenu and other "aria" related labels.
    <dev aria-label="Main Navigation">

Home

Link LI 1

                        SUBLINKS

SUBLINK 1

SUBLINK 2

Link LI 2

Link LI 3


texts:
I have an URL textarea and I want to add a body class if the current URL is one of those that the user has input in the textarea.

This is my current code:

function MYTHEME_form_system_theme_settings_alter(&$form, &$form_state, $form_id = NULL) {
  $form['head_footer_hiding_urls'] = [
    '#type' => 'fieldset',
    '#title' => t('Hide header and footer on specific url\'s'),
    '#description' => t('Specific url\'s to hide header and footer'),
    '#collabsible' => TRUE,
    '#collabsed' => TRUE,
  ];
  $form['head_footer_hiding_urls']['url'] = [
    '#type' => 'textarea',
    '#title' => t('Set url\'s'),
    '#description' => t('Set url\'s to hide header and footer,
 you can only write one url at a line.'),
    '#default_value' => (theme_get_setting('url') != NULL) ? theme_get_setting('url') : '',
  ];

  return $form;
}

How can I do that?


texts: Image gallery with original image proportions

texts: I was looking for a module a tutorial how to create an image gallery in drupal 7 where when you go in album all images are not cropped in rectangulars and displayed in a table, but remain with their natural proportions and displayed in columns as I provided a print screen below(tumblr theme), each image has a unique page with it's caption. I am not sure what is the particular term for such way of displaying images is called so I am asking here


texts: This may be a fairly basic question, but I'm having a hard time getting the Panels module to show up in Structure after enabling it. CTools is enabled and I also tried enabling the Panels node module and the In-Place Editor, but still no luck. I'm running Drupal 7 and have tried clearing the cache.


texts: How do you theme specific fields in on a content type?

texts:
Currently I want to theme a taxonomy field in my content type and expose the TID and the Term name with link. The default sections only give me one or the other. Is there a setup where I can expose the TID, Term name, and Link?

Below is a screenshot of the teaser view display mode.


texts: When should I "send mail by queue" with the SMTP module?

texts:
On the SMTP module configuration page at /admin/config/system/smtp, it offers the option to Send mail by queue (Mails will be sent by drupal queue api.).

When would I want to check this box?  What are the advantages and disadvantages?


texts: Making user reference field in Drupal 7?

texts: I have searched in Google with queries like "User reference drupal 7" or "User taxonomy vocabulary drupal" "user field drupal 7" "cck drupal 7" but I couldn't find any way to make a field that links for a user profile page... Do you know how to make this as a simple field can be done with CCK in Drupal 6? thanks.


texts: Where does the mysterious blue bar and question mark come from (when logged in as admin)?

texts:
When I'm logged in as an admin, I see a blue bar at the top of the page, with a question mark in a circle, but no text. This is how it looks like:

And the markup is:

<div class="region region-help alert alert-info">

I guess it's some kind of alert, but obviously there's no text, and nothing I can see in any of the logs that might be related either.

Anyone knows what this might be and how to fix it?


texts: Cant clear cache: Table cache_rules doesn't exist

texts:
I just did a clear cache in the browser and also in the terminal with "drush cc all" and I'm getting the following error. I'm not sure what to do next as I can't clear the cache on the site, but it seems like the site is working fine. I'm on Drupal 7.32.

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'phone_drup.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array()

  in cache_clear_all() (line 167 of /home/phone/public_html/includes/cache.inc).


texts: Node post date in views exposed filter as a select list

texts:
I want to add a node post date exposed filter to the views in the following format.

The date exposed filter will be a select list with the following options:

All
Today
Yesterday
Past Week
Past Month
Past Year

It it possible with views or I have to do some workaround?

No one has an answer for this question?


texts: How can I implement a RESTful API in Drupal?

texts:
Can any one please let me know what modules are available to implement a REST API?

So far I've only found the Redmine REST API module, which is used for Redmine.


texts: JS error with nodejs_watchdog and chatroom module

texts:
I am trying to run chatroom and nodejs_watchdog module with OpenAtrium. Nodejs seems to be working fine but in OpenAtrium pages its throwing JS errors, as below.

  nodejs_watchdog JS error : Uncaught TypeError: Cannot read property
  'callbacks' of undefined(anonymous function) @
  nodejs.watchdog.js?o2oo29:4(anonymous function) @
  nodejs.watchdog.js?o2oo29:12

  chatroom JS error : Uncaught TypeError: Cannot read property
  'connectionSetupHandlers' of undefined(anonymous function) @
  chatroom.js?o2oswh:78(anonymous function) @ chatroom.js?o2oswh:191

I am not sure if this errors are due to nodejs or openatrium or jquery version conflict.


texts: View of users having same taxonomy terms?

texts:
I'm running a D7 system where every user has a skills field which is a taxonomy field.

How do I create a view to pull users where they have/share same skills (taxonomy id's) with the login user.

So for example If I've added 'photoshop' to my skills and when I login the view should provide me other user who have tagged their profiles with taxonomy term 'Photoshop'.

Note: view of users having same taxonomy term as well as login user have.

Thanks


texts: Module to allow multiple paths for a single node?

texts:
Is there a module that would allow me to define multiple paths for a single node? (Not just one node; I need to do this for multiples.) For example, I need to be able to access http://www.example.com/node/153 via both http://www.example.com/tracks/big-picture and http://www.example.com/big-picture.

I need to be able to define at least one of the paths manually, i.e. not using a pattern.


texts:
I'm creating a module to batch import/update nodes in Drupal 7 based on input files that can be XML or other formats. Worst case scenario is they are like ~10-20MB and can contain 10-20k entries.

Currently, the module works fine for small files (~2k entries), but I get timeouts during initialization (before the actual batch job) for bigger files. The input file parsing is not the problem, it works fine and this is an example table of parsing times:

ENTRIES  PARSING (s)  FORMAT
     63        0.056  xml
    544        0.144  xml
   1706        0.202  xml
   2741        0.940  xml  <- batch job doesn't start
   3398        0.419  txt  <- batch job doesn't start
   7916        8.726  xml  <- batch job doesn't start
   8607       29.734  xml  <- batch job doesn't start

This is the relevant part of my module's code:

function batch_import($ps_platform, $ps_input_file) {
    # I've tried to change timeout limit with no luck
    set_time_limit(500);

    # Parsing the input file to my own class. The time spent for
    # different size files can be in the table above.
    $o_dat = new DatContainer($ps_input_file);

    # [1/2] Preparing the batch job array we will output
    #---------------------------------------------------
    $a_batch_job = array(
        'title' => t('Importing dat file'),
        'init_message' => t('Beginning dat import process'),
        'operations' => array(),
        'finished' => 'batch_finished',
        );

    # [2/2] Populate the operations sub-array with all the jobs we want to do
    # -----------------------------------------------------------------------
    foreach ($o_dat as $o_entry) {
        $a_batch_job['operations'][] = array('process_entry', array($ps_platform, $o_entry));
    }

    batch_set($a_batch_job);
}

The actual function to process each individual task doesn't do anything by now, it simply prints the progress.

function process_entry($ps_platform, $po_entry, &$context) {
    $context['message'] = "Processing: {$po_entry->s_name}";
    $o_node = _get_entry_node_by_id($ps_platform, $po_entry->s_id);
    $_SESSION['http_request_count']++;
}

Does anybody see where is the problem? After checking many examples for batch api, I'm quite frustrated because my code seems to be correct.

Regards and thanks for your time.


texts: How to hook theme of the main system menu in drupal 7 to display only some of the elements?

texts:
I want to modify the main system menu in Drupal 7. Actually I want to display only some specific elements of the menu and hide some other specific elements, in a given case (which I will implement by a if or switch statement in a function).

What is the easiest way to do this ? And how to do it ? Can you give me an example ?

I have read that using hook_theme or hook_menu can be done, but I have no idea how to do this.


texts: Hierarchical select - Save term lineage option creates 2 nodes

texts:
Hello good people of drupal community!

I'm working on a project which includes Make/model hierarchy of car manufacturers. So my idea was to create a taxonomy vocabulary with all the models under appropriate make, and then to use Hierarchical select module when adding new content to select first make and then appropriate models.

I have Hierarchical select set to "Save term lineage" since I need both make and model to show in node, however, for example if I select "Alfa Romeo" as car make and "Gulietta" as model, Drupal will create 2 nodes instead of one. One node gets created for the make and other node gets created for the model.

Does anyone know how to save the term lineage in one node with both make and model, without separating it in 2 nodes? Big thanks and best regards.


texts: Show/hide fields in a form based on the value of a checkbox

texts:
Is there a way to hide a specific or specifics fields in Drupal when you create content until you checked a checkbox?

Now it looks like this:

I need something like this:

But I need some checkboxes to decide if I have a certain field to show or not. Like this:

(Fieldcollection item 'some information' is showing up now because I checked the checkbox before the label)

Is there a module for this?

What would be nice is if all fields only become mandatory if you checked a checkbox.


texts: how to make cron run once at specific time per day?

texts:
I want the cron run only once at say 01:00 hours after midnight, just to save shared hosting resources as cron empties the caches. My new site is using too much of resources and I'm trying my best to stick with shared hosting. I want to set cron run once in a day. It should run at midnight so that some cache is built before day time, when traffic is high.

I've only two somewhat related threads: make sure hook cron is only run once a day setting
and
How to run cron more often than every hour?

But for such simple thing it don't want to use Elysia module.

From this post: How do I get the (date)timestamp since last cron run? I understand if we manually set cron_last variable then may be next cron time will be calculated with respect to this.

Another way I can do is to run drush cron from a script from crontab which will run it at a particular time. Similarly we can call cron from crontab ( as in here).

I'd want it to be done from within a module etc so that whenever I move my site, it'll work at any new setup without doing any configuration.

Any suggestions?


texts:
How to create hook_menu to display node view mode?

node/% - full view mode (default)

node/%/subpage - custom created view mode of this node, for example "subpage"

I've tried this: How to render custom view mode in d7 but it doesn't work. Maybe something is wrong with the code?


texts:
I have a site where some pages are "virtual".

The path is :

internal_node/XYZ

where
* internal_node/% is defined in a hook_menu()
* XYZ is a number

my "internal_node" callback  call an external service using XYZ like argument, get soma data and display this data to the user. All works without problem. And all is legal.

Now I want to add all "interal_node" links to my google's sitemap.

I have installed xmlsitemap, but this module create a google sitemap for only all internal drupal node and my "internal_node" are not a drupal node.

So, how can I add link to xmlsitemap ?

Thanks.


texts: How to override Breadcrumb theme template?

texts:
I have a custom theme that has base theme: classy setting in the mytheme.info.yml file. When we enable twig debugging locally, we find that the <!-- BEGIN OUTPUT from 'themes/custom/mytheme/templates/navigation/breadcrumb.html.twig' --> is displayed, but there are no theme suggestions available.

This is what displayed on the page.

How can we create theme suggestions for breadcrumbs?

We tried the following in the mytheme.theme file, but it did not print out the ksm() statements.

function mytheme_theme_suggestions_breadcrumb_alter(array &$suggestions, array $variables) {
  ksm($suggestions); // this returns empty
  ksm($variables); // this only returns theme_hook_suggestion and links array
}

The code is based off of what we can do for block suggestions alters.

function mytheme_theme_suggestions_block_alter(array &$suggestions, array $variables) {
  if (isset($variables['elements']['content']['#block_content'])) {
    $suggestions[] = 'block__' . $variables['elements']['content']['#block_content']->bundle();
  }
}


texts:
I'm trying to display roles in the default user profile (no profile2) with consistent formatting to the other fields being displayed.

In user-profile.tpl.php I have this:

<div class="profile"<?php print $attributes; ?>>
    <?php
    // var_dump($user_profile); exit;
    $account = user_load(arg(1));
    $roles = '';
    foreach ($account->roles as $rid => $role) {
        $roles .= "
".$role."
";
    }
    if (count($roles) > 0) {
        $user_profile['field_user_roles'] = array(
            '#entity_type' => 'custom',
            '#bundle' => 'custom',
            '#theme' => 'field',
            '#field_type' => 'text',
            '#title' => 'Roles',
            '#label_display' => 'above',
            '#field_name' => 'field_user_roles',
            '#markup' => '
' . $roles . '
',
            '#weight' => 5,
        );
    }

     ?>
  <?php print render($user_profile); ?>

Which is giving me this output (which is close):

The problem is that it doesn't seem to be using #markup to display the field.

I'm getting these errors which indicate I'm doing something wrong:

  Notice: Undefined index: #items in template_preprocess_field() (line 1060 of /path/to/site/modules/field/field.module).

  Warning: Invalid argument supplied for foreach() in template_preprocess_field() (line 1060 of /path/to/site/modules/field/field.module).

  Notice: Undefined index: #view_mode in zurb_foundation_preprocess_field() (line 311 of /path/to/site/sites/all/themes/zurb_foundation/template.php).

I'm also using the Foundation Drupal template (v7.5) which seems to relate to the above errors.


texts: Views exposed filter: Upcoming/Past events

texts:
I want to implement an exposed filter in the view with a date field. I want to show two choice in select list according to the date value (upcoming events/past events). But I don't know how to achieve this using date field because it allows to choose date only.
Is there any way to achieve this feature?

Thank you in advance.


texts: How do I output the link to the content?

texts:
In a view, I've got a field set up to output the link to the content.

I'm not sure how to reference it in my views-view-fields.html.twig file. I'm referencing all of the other fields values properly as they all work, but that main anchor link just isn't coming out. What is the proper syntax?

 {{ fields.uri.content }}

{{fields.field_work_page_tagline.content}}

{{fields.title.content}}


texts:
I've a custom module I'm sending the content of node and views by email. The module first render the node/view and wrap the results around common template.

But when my views and node content are build, they contain links are relatives. I'm looking for a way to force these links to be absolute (ie. with domain and protocol).

The url() and l() functions can be used to output absolute links, but I don't see a way to force this behavior on all links. I'm planning to process the content as an HTML string to extract all links and complete the URL when required. But this doesn't seem very efficient.

Is there another way to ensure absolute URL ?

Here is the code used to render the content for nodes and views:

//For nodes
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
unset($node->teaser);
node_invoke_nodeapi($node, 'alter', FALSE, FALSE);
$content = $node->body;

//For views
$content = $view->preview($display_id, $arguments);


texts: Views search to find users based on terms

texts:
I want to have search inputs for users to search and find other users based on associated terms(I'm using term reference) of their user profile.  I'm using Search-API, Views-3, and Profile-2.  I created fields on the profile that have terms as check boxes.  But, I can't seem to figure out how to make a view with search inputs to find/search users by these terms.

~Then, this is probably a question for a different post.  But, could I filter the RESULTS to display only certain aspects of that users profile?  I would want the results to render a custom user-teaserprofile.tpl.php or something like that.  Thank you.

...the whole approach is somewhat related to a dating search or something like that.


texts: How to add local task links to referenced entities for a specific content type?

texts:
I have a content type with some entity reference fields to another content types. I want to add local task tabs to the node view page, to link those referenced node. However I cannot figure it out how to do it only for the specific content type.

I have created a my_module.links.task.yml file with following contents:

my_module.my_content.my_content_type:
  route_name: entity.node.canonical
  title: Overview
  parent_id: entity.node.canonical
  weight: 0
  class: '\Drupal\my_module\Plugin\Menu\MyContentTab'

my_module.my_content.my_referenced_node:
  route_name: entity.node.canonical
  title: Referenced content
  parent_id: entity.node.canonical
  weight: 10
  class: '\Drupal\my_module\Plugin\Menu\MyReferencedContentTab'
# ... More tabs to the other referenced nodes

The classes are working as they should, and providing the tabs to the referenced nodes correctly. However the tabs are also showing on all content types.

How can I make them show only on the specific content type?


texts: How to show the description of primary links

texts:
Possible Duplicate:
  How can I add a caption to my navigation menu?

I would like to print my primary links description too in my navigation like this website.


texts:
I'm trying to make a dependent AJAX dropdown form. I create a dynamic form and I render it. But when I do the callback function (chili_callback) and I dpm my form, the newly added form items are not in the form array anymore.. So I can't replace the following dropdown..Any suggestions?

function chili_dependent_dropdown_form($form, &$form_state)
{

$term = taxonomy_term_load(arg(2));
$options = get_settings(strtolower($term->name));
$options_first = _chili_get_first_dropdown_options($options['0']);
$selected = isset($form_state['values'][$options['0']]) ? $form_state['values'][$options['0']] : key($options_first);
$form = array(
    '#prefix' => '
',
    '#suffix' => '
'
);

foreach($options as $key => $value) {

    $first = array();
    if ($key == 0) {
        $first = _chili_get_first_dropdown_options($options['0']);
    }
    else {
        $first = array(
            '0' => DEFAULT_VALUE
        );
    }

    $form[$value] = array(
        '#type' => 'select',
        '#title' => 'Select ' . str_replace("_", " ", $value) ,
        '#prefix' => '
',
        '#suffix' => '
',
        '#validated' => TRUE,
        '#options' => $first,
        '#defalt_value' => $selected,
        '#ajax' => array(
            'callback' => 'chili_callback',
            'effect' => 'fade',
        )
    );
}

return $form;
}
function chili_callback($form, $form_state)
{

$form_state['rebuild'] = TRUE;
 dpm($form);
global $base_url;
$action = $form_state['complete form']['#action'];
$ex = explode("/", $action);
$options = get_settings($ex[2]);

$previous = $form_state['triggering_element']["#name"];
$previous_value = $form_state['triggering_element']["#value"];
$product = "Unicover";

$link = "";
foreach($options as $option) {
    if ($form_state['values'][$option] > 0) {
        $term = taxonomy_term_load($form_state['values'][$option]);
        $link.= "_" . $term->name;
    }
}

$ext = IMAGE_EXTENSION;
$image_url = $product . "" . $link . "" . $ext;
$key = array_search($previous, $options);
$next = $options[$key + 1];

// unset($form[$options[0]]['#options']['0']);

$get_options = _chili_get_options($form_state, $previous);

$form[$next]['#options'] = $get_options['options'];
$form[$next]['#attributes'] = array(
    'class' => array(
        'active'
    )
);

$commands = array();
$base = $base_url . "/sites/print/files";
$file = $base . "/" . $image_url;
if (url_exist($file)) {
    $image = "

";
    $commands[] = ajax_command_replace("#thumb", $image);
}

$base = $base_url . "/product/template/personalise";
if ($next == $options[count($options) ]) {
    $link = $base . "/" . $get_options['result'];
    $a = 'Personalise';
    $commands[] = ajax_command_replace("#personalise", $a);
}

$commands[] = ajax_command_alert($form[$next]);
dpm($form[$next]);
return array(
    '#type' => 'ajax',
    '#commands' => $commands,
);

}


texts: Can I just have a color coded HTML editor in Drupal 6 that keeps line indentations?

texts:
I'm trying to get out some minimally designed pages. The WYSIWYG (CKEditor) has a habit of collapsing the code between saves. WHile this is fine and all, I'm finding myself copying copy and pasting it into sublime text in order to reformat. The copy-pasting -- while not difficult -- is thumbing me up a bit. I've copied/pasted the wrong code and had to redo a lot of my work.

So can I have stop CKEditor from minimizing the HTML code? This is a legacy site in Drupal 6.28.


texts: Displaying non-empty fields in full node view

texts:
Using drupal 7 I have imported an excel spreadsheet into a database and mapped about 20 fields into a Custom Content Type. Not every field contains data in every record. I've created a couple of Views - one based on the Glossary that gives me a searchable form for the entries, and a separate Block view, which gives me the ability to hide empty fields and show random nodes.

However, when I click on a record to view the full node, the display shows all the fields, including the empty ones. If I edit the node, and then save it, when viewed the empty fields are hidden.

Is there a simple way to hide those empty fields all the time in full node view. Can I do it from within Views(3)? I'm not a programmer so not sure that I could edit a page template if that is what is required.


texts: Passing node id as contextual filter to field collection view

texts:
I'm trying to create a view of flagged field collections, filtered by the currently viewed node. I don't seem to be able to add either a relationship nor contextual filter to limit the field collections to those belonging to a single node.

Has anyone managed to do something similar?


texts: How do I add custom CSS to individual pages?

texts:
Im trying to create pages with a search bar in a specific non block area in Drupal 7. If I edit using Live CSS (or another module), it edits all my pages, and offsets the content I created. I need a way to edit the CSS styles for each individual page; in that way, I can edit the search form area, and have also a way to add my own button images.

I can disable Drupal regions/blocks, but that doesn't really help. May someone name some modules that could help, or suggest me some code?


texts:
I have three fields in a content type and want to calulate sum of them in another field.
First, I use Computed Field but it does not work at all.
Then I tried to use conditional field but it is not made for this purpose at all.
So I am trying rules module and make an event: After saving new content(or before) - The condition is: Content is of type [something] - The action: Execute custom PHP code.

And the code is:

$field_a = field_get_items($entity_type, $entity, 'field_absence');
$field_b = field_get_items($entity_type, $entity, 'field_delay');
$field_c = field_get_items($entity_type, $entity, 'field_vacation');
[node:field-sum] = $field_a[0]['value']+$field_b[0]['value']+$field_c[0]['value'];

But it does not do anything at all. I used the same code in computed field but it has no result. I'm not an expert Drupal programmer. So I need your helps in it. Thanks in advance.


texts:
Whenever I run any functions that require a batch to run (delete users, manually check for updates, etc.), the Batch API returns an error "No Active Batch".

I have scoured the internet for pointers, and I have not been able to solve the issue.  I am not running Secure Pages.

Notes about my setup:

Drupal 7.39
nginx 1.8.0
PHP 5.5.28-1~dotdeb+7.1
varnish-4.0.3 revision b8c4a34
memcached 1.4.24

Drupal Modules:

https://gist.github.com/meinemitternacht/237410cf5a1e41bfc901

Varnish Configuration:

https://gist.github.com/meinemitternacht/438bd021d620af2032c3


texts: Views AJAX functionality works, but nothing changes at all

texts:
All AJAX functionality doesn't work properly.

Response body:

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"my_theme"
,"theme_token":"BFQaFl_B7dBeJNtQvTMFxfKldHEJmDp3o5nAOEBhS1E"}},"merge":true}]

Pagination, sorting - nothing is working as supposed to work.

Any ideas?


texts: systemAdminMenuBlockPage callback not respecting menu link permissions

texts:
I added a custom permission on "admin/commerce/config" to disable access for certain user roles.
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[RoutingEvents::ALTER] = 'onAlterRoutes';
    return $events;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
      if ($route = $collection->get('commerce.configuration')) {
        $route->setRequirements(['_permission' => 'administer commerce configuration']);
      }
  }
}

The page can now only be accessed when user has the permissions 'administer commerce configuration'. But it is still visible on the "admin/commerce" page.
The page url's are build by the systemAdminMenuBlockPage callback. The function getAdminBlock (core/modules/system/src/SystemManager.php) builds the menu and has a $element->access->isAllowed function,but this keep returning 1. And so its still printed on the overview page.
Any suggestions for fixing this issue?


texts:
In my project I've used the Features module to deploy content types with its fields and field groups, image styles, views, panels, taxonomies.

The project became very large and the features start to confuse each other.

I would like to disable and delete all features to create new ones for further development and not lose all data.

I tried Features Tools module but it works just for views, rules and boxes.

My question: How can I disable all features without losing data created with it?


texts: Why is my cart empty after I click on the "add to cart" button?

texts:
I'm trying to use the Secure Pages module in conjunction with Ubercart. The module works fine for the most part. However, there is something wrong with the https that prevents an item from going into my cart the first time. Here is my problem in detail:

Start on a product page which is not using https.
Click on the "add to cart" button. I am redirected to https://www.example.com/cart. My cart is empty.
Navigate to any other "unsecured" page, like the product page I came from. I receive a message stating that my item was added to my cart.
Go back to https://www.example.com/cart and I find an item in the cart.
Resume shopping as normal without any further problems.

What is happening in step 2? Why is my item not added to the cart until I go to a different page first? Its worth noting that no errors were reported either in watchdog or other system logs.

I attempted to fix this problem by removing the cart page from the secure pages list. Is there a reason the cart page should be using https?

Additional notes:

The old D6 / UC v.2 version of my site w/ Secure Pages worked without any problems.
I have added $conf['https'] = TRUE to my settings.php
Refreshing the cart page immediately after completing step 2 does not show any items in my cart.


texts: How to display programmaticaly default user picture?

texts:
I want to display programmatically default user picture if the user is not uploaded any. For that I have written code php code but its displaying user uploaded user picture correctly but not the one default when user doesn't upload his/her own. How to do that? help me.

$user = user_load($user->uid);
$account = user_load($user->uid);
print theme(
    'image_style',
    array( 'account' =>$user,
      'style_name' => 'x-small',
     // 'path' =>!empty($user->picture->uri)?$user->picture->uri:variable_get('user_picture_default'),
      'path' =>!empty($user->picture->uri)?$user->picture->uri:variable_get('user_picture_default',''),
      'attributes' => array(
        'class' => 'avatar'
      )
    )
  );


texts: Dymanimcally add links in main menu (e.g. last 4 nodes)

texts:
I have main navigation menu with root menu items. A request is that one of those have links to latest 4 nodes of a certain content type. So for example if I have a structure similar to this:

-Parent item:

child item 4
child item 3
child item 2
child item 1

(All child items are all of the same content type, for example Article)

When a user adds a new node of the content type Article, the structure should be the following:

-Parent item:

child item 5
child item 4
child item 3
child item 2

All I can think of is to use Views to make a list of linked titles in a block and then to attach the block to the menu (i'm using TB Mega Menu which allows this).
The solely problem with this approach is that I then don't have trail of active menu items in menu.

Any ideas?

Thanks.


texts: How to get Drupal to stop overiding table tag background color

texts:
I'm still working in the default Bartik theme that came with Drupal core. I've put an HTML table inside the body area of a node to organize some information. It is just a vanilla HTML table:

 ... 	 ... 	 ... 	 etc.

 ... 	 ... 	 ... 	 etc.

 ... 	 ... 	 ... 	 etc.

etc.

It shows up on the page with a light blue background. I want the background to be white. Putting an attribute in the table tag: "
" does not have any effect. It's not that the attribute is completely ignored because if I make it "
" then the background turns black.

I'm guessing that this has something to do with CSS that I do not have access to and is being controlled by the theme. When I look at the settings for Bartik, there is nothing about tables. Am I just stuck with this blue table background until I instal a different theme? Can I expect that most other major themes will allow me to set something as important as this?


texts: Creating a userlist in Views (including custom user fields)

texts:
I've encountered an issue using Views 3 in Drupal 7.
I want to create a user list with a bunch of fields I added to the user profile (using Drupal's core user fields). I need a list of all users, and right now I keep getting the currently created content and its author (with the appropriate user fields). Not all users have created content.

I've created a relationship "Content: Author" to get access to the custom user fields, but that's not the reason I keep getting the content with its author. I get the same result when I remove the relationship and custom user fields.

In Drupal 6 with views2 I made the same page and had no issues. Could this perhaps be a bug in Views 3, or am I missing something?


texts: how to change node submit form text for all users?

texts:
I created the node type 'application',which can be added by any users and will be unpublished by default.
   I used hook_form_id_alter() to change the text of the submit button as below:

 function custom_module_form_node_application_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

         //   to change the text of the button
          if (isset($form['actions']['publish'])) {
            unset($form['actions']['publish']);
          }
       if(isset($form['actions']['unpublish'])) {
           $form['actions']['unpublish']['#value'] = 'Apply';
       }
}

It is updating the button text,only when I logged in as admin, but  for anonymous users and others submit button text is 'Save' instead of 'Apply'.


texts:
Not sure why I can't do this as it sounds simple, I have:

A content type called 'RSS FEEDS'

A vocabulary called 'Publications' within this I have 3 terms which are 1) NY Times 2) BBC 3) National Geographic

I now have a bunch of nodes that are tagged with these 3 terms.

What I want to do is have an accordion with 3 headers:

NY Times,
BBC,
National Geographic

So when I click a header I see all the nodes of that particular type underneath. I have tried an number of things including aggregation, taxonomy views etc but cannot seem to work this out. For clarity I have mocked up how I want this to look.

Any help greatly appreciated.


texts: Assigning a role based on signup url on a Drupal 7 site?

texts:
I need to give out a URL that will grant people who sign up at that URL a specific role. If possible I would like to also have the user fill out profile fields as part of user registration.

I think the Profile 2 module does something like this, but this is already set up with normal Drupal fields, is there any way to make this work?


texts: How to prevent a user from deleting an entity referenced node before deleting the referencing (child) node first?

texts:
I have a Content Type called ItemRequest, and another Content Type called ItemOrder. One of the fields in ItemOrder is "Related Item Request" that is an Entity Reference to ItemRequest. Each ItemOrder has at least one Related Item Request.

How do I ensure that a parent ItemRequest node can only be deleted if it does not have any ItemOrder nodes relating to it? What hook can I use that can test for the existence of these child nodes and call form_set_error to abandon node deletion?


texts: Changing size of user avatar in template file

texts:
In node.tpl I currently display a users avatar' using this code

theme('user_picture', $account)

My avatars are currently set to 85x85px but when they are displayed in nodes I want them to be smaller. How can I change the size for just this inclusion of user avatars?


texts:
I've got Drupal 7.20 on my server (skyislands.pl). I wanted to install (from my local computer) Wysiwyg module (http://drupal.org/project/wysiwyg), but I see this error. My server is running on EHCP. How can I solve this problem ?

Thanks for any help,


texts: How to use Solr Handlers when sending requests from Drupal

texts:
I'm using Solr 4.10.2 and Drupal 7.X, I have the Apache Solr Module Framework operating and sending the requests to Solr From Drupal. Currently when we perform a search, Drupal builds the query and sends it to Solr. Solr just executes the query and returns the results without using it's internal handlers which can be configured through SolrConfig.xml.

I would like to know if there is a way to just send the searched terms (without building a query) from Drupal and let Solr use the internal handlers declared in SolrConfig.xml to handle the request, build the query and then return the data?

The reason for this is we have been working on trying to boost some results when we perform a search (we want exact match first & fuzzy search results after) by changing the "weight" of some fields.

We know that from Back Office we can use the "Bias" function to boost some fields but this is too limited for what we are trying to achieve.

We also know we can change the query sent from Drupal directly from code side by using hook_apachesolr_modify_query() but we prefer changing as little code as possible and using the SolrConfig.xml /handlers which we already have configured to return the results as we want.


texts: How to show "Sub domain - block" updates from sidebar to my "Main domain"?

texts:
I am showing "Recent Blogs" in sidebar second for Subdomain (i.e., for ex:- blog.example.com). Here block is displaying with blog titles with recent blog posts. when we click on any link it shows the particular blog page.

I kept custom block with recent blog posts in my main website (i.e., for ex:- example.com), but I don't want to use this database for recent blog posts. i.e., It should connect to the blog posts related to sub-domian website. If any blog post updated in "blog.example.com", it sholud show in main website "example.com" also. when we click on any blogpost it will
redirect to sub-domain (blog.example.com). Can we do this by editing settings.php? i.e., As like "Single Sign On"... Here Users table is taking from master domain. If we can do with this please reply me the changes in code for blog posts similar to below code (OR) Please reply me the possible working solutions.. Thanks in advance.

$databases = array (
  'default' => array (
    'default' => array (
      'database' => 'drupal2',
      'username' => 'username',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => array(
        'default' => 'drupal2.',
        'users' => 'drupal1.',
        'sessions' => 'drupal1.',
        'role' => 'drupal1.',
        'authmap' => 'drupal1.',
        'users_roles' => 'drupal1.',
      ),
    ),
  ),
);


texts: How to store a single array value into a session variable?

texts:
I have

Array ( [0] => cid [1] => TN201501HP )

Now I want to store "TN201501HP" into some session variable. How to store this value to a session variable?


texts: How to display a Paragraph field with a condition

texts:
Hello here is my problem, I have a paragrah type with an illimited value image field in which I store image(s) to display them in 200*200 but also a single Json file with mapping data linked to the image(s) in the paragraph.

But in the drupal conf I can not hide the json file name since it's stored in the same field, they would both be invisible (json and image).

However I'd like to display in the Frontpage view and so (/node/xxx) only the image(s) and not the json file name even though they are in the same paragraph field, is that possible directly in drupal configuration or do I have to make a template ?


texts:
I'm upgrading a site from 8.4.8 to 8.7.7 via Composer. After a few rounds, things seem pretty good, but I'm stuck on a tricky bit: on drush updatedb the process throws an error on Views post-update. Here's the output

  views module :
    Update dependencies for moved bulk field plugin.
    Add additional settings to the entity link field and convert node_path usage  to entity_link.
    Update exposed filter blocks label display to be disabled.
    Add placeholder settings to string or numeric filters.
    Rebuild cache to allow placeholder texts to be translatable.
    Fix cache max age for table displays.
    Include views data table provider in views dependencies.

  Do you wish to run all pending updates? (y/n): y
  Malformed backend packet [error]
  Post updating views [ok]
  Failed: Exception: No entity type for field field_title on view image_paragraph_default in Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 713 of .../docroot/core/modules/views/src/Plugin/views/HandlerBase.php). [error]
  The command could not be executed successfully (returned: DRUSH_BACKEND_OUTPUT_START - DRUSH_BACKEND_OUTPUT_END, code: 1) [error]
  Cache rebuild complete. [ok]
  Finished performing updates.

So, first of all, am I just missing something obvious? The view is broken in the 8.4 site, too, but I can't figure out how to modify the field or remove  the view, since all attempts throw the same error! Is there a way around that?

Thanks.


texts: How to get a list of all the selected values for a field programmatically?

texts:
How can I get a list of all the selected values for a field?

For example I have a field called countries, and I want to get all countries selected for a certain node.

I need to have this list, because I want the region to be automatically selected in another field (regions), according to the chosen country.

Ex: I choose France in the countries, then automatically the European region is selected in regions

For now I can only copy the selected values in the "countries" field, in the "regions" field, by doing this:

$node->field_regions = $node->field_countries;

Here is the result when I select France in the countries field :

Country: France

Regions: France

Edit: I tried with the function:field_get_items(), but all I get is an array:

$items = field_get_items('node', $node, 'field_countries', $node->language);

Something is wrong? I also tried with this but I get the same result...

$items = $node->field_countries[$node->language][0]


texts: What is the default behavior of the Drupal 7 cache?

texts:
I can't find any specific documentation explaining how the default caching mechanism in Drupal 7 works and when does it clear caches automatically. From my own testing, I can state the following:

Cache is cleared when any content is added
Cache is cleared when any content is updated
Cache is NOT cleared when content is deleted!!! (Check my comment below for update).

Where can I find documentation to approve the above and also learn a little more about this topic? Any other cases where cache is auto cleared?

Details: the above results are based on turning on both "Cache pages for anonymous users" and "Cache blocks" and setting "Minimum cache lifetime" and "Expiration of cached pages" to none.


texts: how to use image for next previous link in pager in drupal 7

texts:
I am woking on drupal 7 I want to change link text and replace them with image. How can I achieve following:

Is there any function in template.php to do so?
Is there any way to overridden template to pager in custom theme?


texts: Sublimetext 2 does not recognize .module file as php file

texts:
I have seen a few posts suggesting how to customize SublimeText for better drupal development, although I did not see any mention of and not sure how SublimeText2 would recognize my custom module's .module as php file and show the various color highlighting for it.

Currently it just treats my .module file as an unknown file and does not show any color highlighting on it.

Thanks.


texts: Search Drupal from an external application

texts:
What I want to do is use the built in search engine I currently have running in my Drupal site, but allow another site to use that same search engine.  Basically a legit copy and paste of the form code.

The reason being is I have a separate web application that is running and I am copying the exact look and feel of the Drupal site to make it seem as if the web application is part of the web site.  It's separate because the functionality would be a pain to implement in Drupal, and I could do it in Rails in 30 minutes.

So, what things do I need to configure in Drupal and in my web application to make this happen?

EDIT:  Just to clarify, my external web application is not consuming any data from Drupal what-so-ever.  All I want to do is POST the "copied" search form to the Drupal engine and have it render the search results as if you had searched directly from the Drupal site.  It seems like the Services module is used to streamline data to external web applications, and that is not the workflow here at all.

EXAMPLE: Say I have my Rails application sitting at http://app.hostname.com/ and my Drupal site sitting at http://hostname.com/.  There is a search form at the root of my Rails application that is pretty much a copy paste of the browser code you'd see as if you had looked at the Drupal site source of the search form.  It's just a simple text box with a submit button.  When I submit that form from the Rails site, I want it to POST the data to the Drupal site and have the returned results be the exact same as if I had searched from the Drupal site directly (I said this already but it doesn't hurt to re-iterate), leaving the URL bar now saying http://hostname.com/search/node/foo%20bar.


texts: How to set start slide for views slideshow jcarousel

texts:
I am using viewsslideshow and viewsslideshowjcarousel modules. I am displaying image thumbnail as jcarousel bottom of the Gallery slides using viewsslideshowjcarousel module. It's working perfectly.

Here is the problem. I would like to navigate to slide directly using the URL. Views slide show support this by passing #unique-id:slidenumber as discussed here. But, i can not able to slide automatically to the the thumbnail of the jcarosel pager that image belongs to. I see setting start option as discussed in Documentation should do the job. But adding that is breaking the carousel in below code inside views_slideshow_jcarousel.js file.

// Add views slieshow api calls for views slideshow jCarousel pager.
Drupal.behaviors.viewsSlideshowJcarouselPager = {
  attach: function (context) {
    // Process pause on hover.
    $('.views_slideshow_jcarousel_pager:not(.views-slideshow-jcarousel-pager-processed)', context).addClass('views-slideshow-jcarousel-pager-processed').each(function() {
      // Parse out the unique id from the full id.
      var pagerInfo = $(this).attr('id').split('_');
      var location = pagerInfo[2];
      pagerInfo.splice(0, 3);
      var uniqueID = pagerInfo.join('_');
      $(this).jcarousel({
        vertical: parseInt(Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].orientation),
        scroll: parseInt(Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].scroll),
        visible: parseInt(Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].visible),
        wrap: Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].wrap,
        animation: (isNaN(Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].animation)) ? Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].animation : parseInt(Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location].animation),
        initCallback: function(carousel) {
          Drupal.settings.viewsSlideshowJCarouselPager[uniqueID][location]['carouselObj'] = carousel;
        }
      });

      $(this).find('.views_slideshow_jcarousel_pager_item').each(function(index, pagerItem) {
        $(pagerItem).click(function() {
          Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
        });
      });
    });
  }
};

Any idea how to start jcarosuel based on the slidenum passed in the url ?


texts: How to add additional class to an imagecache preset?

texts:
Tried:

function ruh_imagecache_formatter_default($element) {
  // Inside a view $element may contain NULL data. In that case, just return.
  if (empty($element['#item']['fid'])) {
    return '';
  }

  // Extract the preset name from the formatter name.
  $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
  $style = 'linked';
  $style = 'default';

  $item = $element['#item'];
  $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
  $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;

  $class = "imagecache beautytips imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
  return theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title'], array('class' => $class));
}

function ruh_imagecache_formatter_imagelink($element) {
  // Inside a view $element may contain NULL data. In that case, just return.
  if (empty($element['#item']['fid'])) {
    return '';
  }

  // Extract the preset name from the formatter name.
  $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
  $style = 'imagelink';

  $item = $element['#item'];
  $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
  $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;

  $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']);
  $path = file_create_url($item['filepath']);
  $class = "imagecache beautytips imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
  return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
}

I've added class - beautytips - but its not appearing on when im firebugging and imagecache image.


texts: Taxonomy not working with the ECK module

texts:
I have created a image gallery using the ECK  module and for some reason the taxonomy is not working.

These are the step I follow to created the image gallery.

  Created a Entity called Media
  Created a Bundle called Pictures
  Add a Image Field (image field is from Flickr Field so all the images are been pull from Flickr)
  Add a term reference field (taxonomy)
  I created a views to display the images (http://test-darrylnorris.gotpantheon.com/media/pictures-gallery)
 Finally add some images to the entity media --> bundle pictures and some taxonomy.

But when I click on the taxonomy term is showing me this error

  There is currently no content classified with this term.

That's not true they are different taxonomy using the term. Also I'm using the Content Taxonomy  to provide the Auto-complete field.

How can I troubleshoot this problem ? Or why my taxonomy terms are not working?


texts: Overriding views-view-grouping.tpl.php when grouping by only one field

texts:
I have a view being grouped by one field. I'm trying to theme the groups as a whole (wrap divs around the whole thing, essentially) and I did so by overriding views-view-grouping.tpl.php. However, nothing happens. Out of curiosity I added another grouping and voilá, my template override is being picked up now. Only problem is, I don't need to group by two fields, just one.

Why is it doing this? Is there a separate override for single-grouped views? What is going on and how can I get Views to pick up my override of views-view-grouping.tpl.php when grouping by only one field?


texts:
We are using the Basic Page content type and it has an Entity Reference field (field_document) that points to the Document (Media bundle), which has a field_document_tag (taxonomy term field). The field_document is not a reference to the taxonomy term, but the Media bundle itself. On the Basic Page we add a Related Documents View at the bottom of the page.

Setup

Illustration of relationship

Example

Goal

Based on the current page's Linked Document, fetch it's field_document_tag values and return other Basic Pages that have a Linked Document who's Linked Document->field_document_tags match.

How would we use the field value from the current page's field_document to pull other related Basic Pages with a similar Linked Document->field_document_tag values?

Basic Page Fields

Linked Document (Entity reference - Media - Document bundle, single value, machine name field_document)

Media - Document Bundle fields

Document Tags (taxonomy term - vocabulary = tags, machine name = field_document_tags)
Name (text field)
File

Here are the view settings we tried, but it does not return other related Basic Pages even when we add any field under Contextual Filters and Relationship:

Format

Unformatted list
Show: Content | Teaser

Filter Criteria

Content: Published = Yes
Content: Content type = Basic Page
(field_document_tags: media) Media: Document Tags

Contextual Filters

content: id -> When the filter value is not available ->provide default value-> content id from url & more -> exclude = enabled
Relationships -> field_document: media

Additional relationships added under contextual filters

Taxonomy term referenced from field_document_tag: relationship -> field_document: media
content using field_document: relationship -> field_document: media

Expected results

when i am on page 1, i expect to see none return
when on page 2, I expected to see page 4 is returned since the linked document->field_document_tags are the same

Current results

All pages are returned


texts:
I try to get all the node that belong to 2 taxonomies terms (term 1 AND term 2).

I try with this :

    $select = db_select('node', 'n')
      ->fields('n', array('nid','title'))
      ->condition('n.status', 1);
    $select->fields('n', array('nid'));
    $select->fields('n', array('title'));
    $select->orderBy('n.title', 'ASC');
    $select->join('field_data_field_sous_theme', 'ss', 'ss.entity_id = n.nid');
    $select->condition(db_and()->condition('ss.field_sous_theme_tid', 517)->condition('ss.field_sous_theme_tid', 514));
    $results = $select->execute()->fetchCol();

or this :

$select = db_select('node', 'n')
  ->fields('n', array('nid','title'))
  ->condition('n.status', 1);
$select->fields('n', array('nid'));
$select->fields('n', array('title'));
$select->orderBy('n.title', 'ASC');
$select->join('field_data_field_sous_theme', 'ss', 'ss.entity_id = n.nid');
$select->condition(db_and()->condition('ss.field_sous_theme_tid', 517)->condition('ss.field_sous_theme_tid', 514));
$results = $select->execute()->fetchCol();

But there is no result.

And when i try this :

$select = db_select('node', 'n')
  ->fields('n', array('nid','title'))
  ->condition('n.status', 1);
$select->fields('n', array('nid'));
$select->fields('n', array('title'));
$select->orderBy('n.title', 'ASC');
$select->join('field_data_field_sous_theme', 'ss', 'ss.entity_id = n.nid');
$select->condition('ss.field_sous_theme_tid', array(517,514), 'IN');
$results = $select->execute()->fetchCol();

I've all the nodes that belong to the term 1 OR the term 2.

I've you got an idea to solve my problem ?

Ps: sorry for my bad english, i'm french :-)


texts: How to make 2 Rules work that use the very same Rules Event?

texts:
On a D7 site I have two rules (using the Rules module) reacting on the same event which is 'After saving a new entityform submission'.

When the actual event occurs only 1 gets fired, even though I've played around with Rule weights. So either I can give precedence to 1 of them or get them to fire at the same time but no luck.

Any help/suggestions would be much appreciated.


texts: How to override template for a Profile2 page

texts:
I'm working on a project which request, for a particular type of user, the need to choose a different template for the main profile page (public page).
I need to override the main profile page but I can't find the php file to edit.
Can you help me.


texts: Use one textfield for searching in two or more fields in Views

texts:
I have a simple content type in Drupal 7 with title and body (and other fields). I've defined a view with exposed filters.

I want just one text field that searches in title or body. So, if I search for 'foo' both nodes with 'foo' in their body or/and title will be matched.

One solution is to use "Global: Combine fields filter" and combine title and body, but Views then uses a CONCAT function in where clausule, something bad for performance.

I've a solution, but there're drawbacks and I'm not sure if it's optimal.


texts: What would cause contextual filter settings NOT to save?

texts:
I have a view in Drupal using a contextual filter.  I save the changes about what to do when a value is passed.  After I hit save, everything revers back as if nothing ever happened.

Has anyone seen this before? Any suggestions?


texts:
I read the description, but I didn't understand what this component does.
The description says:

If not checked, the bundler will not split up aggregates.

I know the purpose of aggregation is joining files and I take this splitting isn't de-aggregation. What is it?
The description for the CSS bundling option says:

If file count is selected then each bundle will try to have a similar number of original files aggregated inside of it.
If file size is selected then each bundle will try to have a similar file size.

I would like to understand what that means too.


texts:
I recently inherited this website from a colleague of mine: http://cityrentacar.gr

It runs under Drupal 7 with the Nexus theme.

I am trying to edit the fields/select-options on the sidebar request form but as soon as i login i only see a configure button over the form?

Is there a way to manually edit the field?

Any help would be appreciated.

Thanks.


texts: Access to referencing entity field from referenced entity template in Drupal 8

texts: I'm building a custom block type with referenced nodes, on the "view" of the block type I configured to show the full node instead just links. And I want to access from the node--type.html.twig to some of the fields of the parent block (when the block is rendered). How we can do that?? is there any other good approach to doing this??


texts:
I have the following token set up: [current-page:url:absolute] in metatag settings.

If I visit my site: https://www.example.com it displays http://www.example.com where I used the token.  Everything else (css,js,etc..) uses https.