texts: Using xdebug to find out why a variable is mysteriously set to 0

texts:
Thanks in advance for your help! I'm new to xdebug and trying to figure it out. I have a situation I'm trying to debug where a variable is mysteriously set to 0.

I know from xdebug (I'm using PHPStorm) that it happens at this specific line:

// breakpoint here: $id_key is 'my_entity_id_key'
$e_entity_ids = my_module_fetch_col_keyed($query, $id_key, $created_column);
// breakpoint here: $id_key is 0

It's weird, because $id_key is not a reference, nor does the function take a reference as a parameter. Also, after the value has changed to 0, $id_key is blue in the variables pane of the debugger. I should note that $e_entity_ids comes out here with the proper value.

I've tried making a copy of the variable and using it to pass to the function instead:

$id_key2 = $id_key;
$e_entity_ids = my_module_fetch_col_keyed($query, $id_key2, $created_column);
// breakpoint here: $id_key is 0, and so is $id_key2

I'm wondering:

How could the value of $id_key be mysteriously changing to 0?
How can I create a copy of $id_key so that it's not changed when I pass the copy to my_module_fetch_col_keyed()?
What does it mean when a variable name is blue in the variables pane in PHPStorm?

When I step into my_module_fetch_col_keyed(), there's a line after which $column is mysteriously 0, as shown:

function my_module_fetch_col_keyed(Query $query, $column, $key_column = NULL) {
  try {
    $result = $query->execute();
  }
  catch (Exception $e) {
    return FALSE;
  }

  if (!isset($key_column)) {
    try {
      // breakpoint here: $column is 'my_entity_id_key'
      $column_results = $result->fetchCol($column);
      // breakpoint here: $column is mysteriously 0
    }
    catch (Exception $e) {
      return FALSE;
    }
    return $column_results;
  }

  try {
    $assoc = $result->fetchAllAssoc($key_column);
  }
  catch (Exception $e) {
    return FALSE;
  }

  $keyed = array();
  foreach ($assoc as $key => $result) {
    $keyed[$key] = $result->{$column};
  }

  return $keyed;
}


texts: Panels page or Panels node - which to use?

texts:
I have two content types for a theatre listings site:

Production: title, description, image gallery, video
Show: date, ticket cost, production (nodereference to Production)

So a single Production node that runs for 14 nights will have 14 Show nodes linked to it. Simple.

Each Production page will pull together a list of Shows (using a View), images, video and maybe some other stuff. So I think Panels would be useful for this display.

But I'm struggling to understand whether it's best to create a single Panels page for this (that maybe overrides the default display of Production content type) or turn Production into a Panels node. The layout will be the same for each Production, so maybe a single Panels page is best?

The Production node edit page has to be simple and easy to edit, so making it a Panels node might add complexity?

Essentially, this boils down to what are the main differences between Panels page and Panels node?


texts:
I'm having a problem with the date format in Drupal 7. I want that JSON returns only the year in VALUE. But drupal devel renders the full date like "value":"2018-01-01 00:00:00"

I tried modifying the database but doesn't seem to work. I googled the problem but it looks like a date core module problem.

The last thing i tried was to modify the template.tpl with this code (according to devel module):

  $variables['node']->field_fecha[LANGUAGE_NONE][0] = array(
        'value' => format_date(strtotime('now'), 'custom', 'Y', 'UTC'),
        'timezone' => 'UTC',
        'timezone_db' => 'UTC',
     );

But doesn't change anything. And on top of that i looked at DOM an returns this:

2018

I know that i want to display the year only, but it returns it with all the other fields by default: -01-01T00:00:00-03:00

I would like if it's posible that the value looks like this:

2018

I have seen people in forums that could split the values, but they don't explain how to do it. Any help would be appreciated!!!


texts: How can I pass an argument using ajax to an entity reference view?

texts:
I have a Vocabulary called Program which has terms nested as follows:

Parent 1

Child 1
Child 2

Parent 2

Child 3
Child 4

I would like to create two Entity Reference fields using this Vocabulary.  One that displays a select list of parent terms.  Then, depending on the parent term that is selected, I would like to populate the second field with it's respective child terms.

In the field settings I am using Views as the Entity Selection mode on both fields.  I have a view with two Entity Reference displays, one for the parent and one for the child.  The child display has a contextual filter of Parent Taxonomy Term.  However, I'm not sure how to pass the argument using AJAX after the Parent term is selected.


texts: Is it possible to implement a hook_block_configure inside a theme? I would like to have a configuration that is related to my theme in each block but don't want to implement this in a module because I'd generate a dependency from the theme to the module.


texts: form_set_error message delayed one page refresh

texts:
I'm making a custom validation in a form I'm making but my error message is always delayed by one page refresh.

$form['submit']['#validate'][] = 'asap_sollicitation_form_validate';

function asap_sollicitation_form_validate($form, &$form_state)
{
    if(strlen($form_state['values']['pass']) < 6){
        form_set_error('pass', t('Must be longer than 6'));
    }
}

It successfully marks the field in red but the message is delayed. If I use only drupal_set_messsage without the form_set_error I do get a message displayed in time.
I render my form in a node template:

$arr = drupal_get_form('asap_sollicitation_form');
print drupal_render($arr);

How can I get my message to display after form submit?


texts: Search API index one of many fields as one field

texts:
I have a site-wide search page that's powered by Search API and Search API Solr. It returns results straight from an index that contains content from various entity types (files, nodes, taxonomies, etc.). Among the things rendered in the search result is a description, a short blurb of text from the content.

The problem I have is that this blurb isn't just one field. The different entities use different fields as their description field. They have different required states, so some of them are guaranteed to have values, while others can be blank. Some entities don't even have the field at all.

How do I index all entities to have a single "description" field that could come from one of many possible fields?

For example:

field_page_description (Article content type has this)
field_something_description (Basic Page content type has this)
field_another_description (Another Page file type has this)

I want to check field_page_description first if it exists and has a value. If it does, index that. If it doesn't, repeat the process on the next field. If all of the fields are empty or non-existent, the index value indexed shall be blank. In the end, I'd have a single field in the index whose value comes from any one of the three fields.

How should I go about this?


texts:
Trying to count selected radios in a webform, I managed to make it work outside drupal (please see link below) but I'm not sure how to add it to my theme/webform.

https://jsfiddle.net/j9q75Lay/

I created a .js file with the jQuery code in it as follows:

    $(document).ready(function() {
    $('input:radio').change(function(){
        var a =  $("input[value='a']:checked").length
        var b =  $("input[value='b']:checked").length
        var c =  $("input[value='c']:checked").length
        $('.a_results').text(a)
        $('.b_results').text(b)
        $('.c_results').text(c)
    })
});

I saved the .js file in my theme's /js folder and I added it to mytheme.libraries.yml file like this :

    global-scripts:
  js:
    js/jscripts.js: {}
    js/webform_count_radios.js: {}
  dependencies:
    - core/jquery

I drush cr

I created a textfield element in my webform and added the "a_results" class to it. (I shall add two more each for the b_results, and c_results)

I later added an Advanced HTML/text type webform element with the following to display all results from the 3 categories :

0 A's &ndash; 0 B's&ndash; 0 C's

But none is working yet! Actually having the .js file seems to break other js dependent features in my theme/webform (e.g. iCheck and rrssb block).

This is my first such trial and am not sure where I'm going wrong.

Thank you for your kind help.

EDIT:

I re-defined the webform library in mytheme.libraries.yml as follows :

webform:
  version: VERSION
  css:
    theme:
      webform/webform.css: {}
  js:
    webform/webform_count_radios.js: { preprocess: false }
  dependencies:
    - core/jquery

Adding the { preprocess: false } property made other scripts work properly. But still the count js is not working!

I added to the webform-submission-form.html.twig :

{{ attach_library('mytheme/webform') }}

Still no luck!  What am I missing ?!!!

EDIT:
After changing the script as per below, it's attaching now (I get the popup alert) but still the count function not working!

(function($) {
alert('Test');
    $('input:radio').change(function(){
        var a =  $("input[value='a']:checked").length
        var b =  $("input[value='b']:checked").length
        var c =  $("input[value='c']:checked").length
        $('.a_results').text(a)
        $('.b_results').text(b)
        $('.c_results').text(c)
    });
})(jQuery);

EDIT: Actually the above change seems to fix it but (while on the webform test page) the count only works when I re-select any of the selected radios and then the results are updated in the span element NOT the text-field elements.

However, the results are empty on the preview page (why ? still on mytheme!) and results pages (since that's on the admin theme)! How can I make them appear on there too ?


texts: Is Drupal forum module suitable for a massive forum

texts:
If I use the Drupal forum module (not the advanced forum module) to create a forum website (30 replies per page) and if the forum grew to a massive forum, will this module decrease the performance?

Drupal is caching the comments separately, will that going to be a problem?


texts: How to add title attribute to views trimmed title field?

texts:
The title field of a view is trimmed to 40 characters, and the Title field is linked to it's content. Since the Title field text is trimmed I need to add title attribute to the <a> tag of the Title field and the content of the title attribute must be the non-trimmed version of the Title field. So on mouseover event it should show the non-trimmed Title field text. How do I can do this?

I tried this

 function THEME_preprocess_link(&$vars) {
    // If title set and not empty dont do anything
    if (isset($vars['options']['attributes']['title']) && !empty($vars['options']['attributes']['title'])) {
        return;
    }

    // Use the link text as the title
    $vars['options']['attributes']['title'] = strip_tags($vars['text']);
 }

But it shows the trimmed version as the title attribute.


texts: Automatic Node Expire / Unpublish with Renew Option

texts:
I have a classifieds site and would like to have a node expire after 45 days (unpublished), no matter how many times the user edits and saves the node. However after the node expires, the user has the ability to renew (publish) for another 45 days. I would like the time to be strictly 45 days with simple a renew button when it is expired.

Here is the workflow:

User creates node
Email is sent to node author indicating successful post.
Node is automatically expired 45 days later.
Email is sent to node author indicating expired post.
User has the ability to easily renew ad (expiry date is 45 days later yet again)
Email is sent to node author indicating renewed post (different from step 2)

I would also like to have a countdown for the days remaining until the expiry date.

I have successfully built steps 1-4 using rules only, however the rules are based on the event 'After saving new content', which means when a node is republished/renewed the rules do not follow because it is not new content.

I have also tried using the Scheduler module to set the unpublish date but cannot figure out how to enable renew only after it has expired.

I have also tried Auto Expire but I think it only gives the ability to renew before it expires, not after.


texts: How to load one certain js before all others?

texts:
We are struggling around here with SVG in IE8. Amongst other approaches we'ld also like to try the SVG Web Toolkit. In it's quick start guide they say:

  To use SVG Web, you must drop a script tag into your HTML page. This must be the first script tag on your page.

The JS is now loaded by a custom module. I tried

drupal_add_js($modulepath . '/libraries/svg.js', array(
   'group' => JS_LIBRARY,
   'weight' => -1000,
   'every_page' => TRUE));

When I vary these options it's sometimes higher, sometimes lower. The above code makes it the highest I can get it. But there still are quite a number of scripts loaded prior to it.

How can we ensure the svg.js to load first? Is there maybe a way to do it with drupal_add_js in our custom module?


texts: Using a taxonomy select field as a contextual filter for an Entity Reference View powered select box

texts:
I've got a parent child relationship between two content types: Properties and Parks. They are organized into a taxonomy we'll call Market. When creating a Park you select the Market it belongs to. Then creating a Property (which is child to a Park) you also select the Market and then select the Park it should be a child of. I need the select list of Parks (which is an Entity Reference) to filter based on what Market is selected to only show Parks from that Market. I have created an Entity Reference View properly and am able to see it filtering properly in the preview. But how can I use the data from the first select box for Market (a Term reference select list) to power the contextual filter of the second select box for Parks (an Entity Reference select list with the Entity selection set to filter by Entity Reference View).

I'm not sure if this is even possible, but have been stuck on it for a while.


texts: Change where the theme gets its files from

texts:
I'm a beginning developer and I am working in this one Drupal 6 website that has multiple websites in the root. To add to the complexity, I am working with the module Mobile_tools to direct users to a mobile theme.

My issue lies with the sharing of images. When users are directed to the mobile theme, I want to find a way to specify where the website grabs it's images from. It seems that by default, it grabs them from the /sites/all/files rather than the /sites/all/themes/theme/files location.

What would be the best way to go about changing this location? I was thinking of implementing a hook override, but have no idea where to or how to begin.


texts: fail to open system.install after transferring to debain

texts:
I am moving a completed Drupal site from the wamp in my windows system onto my virtualBox, which uses Debian system for this. Just to practice before I move everything onto the real linux server later.

Now I have imported the database successfully onto phpmyadmin. I have copy paste the site files onto the localhost directory. when I try to open the site from the localhost/MySite, it directly went to localhost/MySite/install.php and return a blank page. So I checked the error log, here is what I got:

[Fri Jul 26 15:13:07 2013] [error] [client ::1] PHP Fatal error:  require_once(): Failed opening required '/var/www/MySite/modules/system/system.install' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/Mysite/includes/install.core.inc on line 241
[Fri Jul 26 15:13:53 2013] [error] [client ::1] PHP Fatal error:  require_once(): Failed opening required '/var/www/MySite/modules/system/system.install' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/MySite/includes/install.core.inc on line 241

I don't understand the include_path bit, what is this route?

I have also checked the permission for both MySite directory and system.install file using ls -ld

I got this for the MySite direction:

drwxrwxrwx 9 root yikaiw 4096 Jul 26 14:22 /var/www/MySite

and this for the file:

-rw-r--r-- 1 root yikaiw 112795 Jun 25 14:36 /var/www/Brompton/modules/system/system.install

I noticed the second date is weird, but I have no idea what is happening now.

Please help me! Many thanks in advance!


texts:
It's enough for me to have taxonomy term page as node page.

I use Pathuato and Token to set auto Urls. For my node I choose token with term's path [node:field-tag:url:path].

But after creating a node I receive the node Url as term-0 instead of term.

How to set the node url just as term url without any -0 or -1?


texts: Is there a way to create a Webform automatically via script using Drush or another method?

texts:
I'm automating a base Drupal 8 install using a bash script with Composer and Drush commands that installs Drupal and uses Drush and other methods to set my basic site configurations.

I'd like to also create some other basic settings like creating a standard Webform contact form, including its URL, etc.

Is this possible to do somehow via a script? Perhaps have a Webform config export stored somewhere and import it via the script? Note, this would be a new site so its UUID would differ each time.


texts: How do I access the loaded comment object?

texts:
I'm trying to access the comment field value in controller. With the following code I'm able to access the particular comment object.

$comment = \Drupal::entityManager()->getStorage('comment')->load($commentID);

When I try print_r for the $comment variable, I can see the fully loaded comment object.

I understand I cannot access the values by traversing the object since the values are protected. I tried $comment->get('subject')->value function, this time its looping and doesn't return any results.

How do I achieve retrieving the value of specific fields associated with comment entity?


texts:
I've got a module building/theming question I was hoping to get some help with today?

I'm building two custom modules that create their own pages to be displayed on. Adding CSS and JS though "drupal_add_css" and "drupal_add_js" has worked just fine.
the problem I'm having is that the CSS/JS is not the last CSS/JS that gets added when the page is called.
The theme css is still being called last and overriding some of my styles.

So my questions are: can I unset the theme css from the module for the page where my mod appears? is that the right way to do things? or would it be better practice to rename my IDs/classes where conflicts occur?

Thanks!

Stephanie


texts: Drupal Custom Widget not saving form field value

texts:
I am trying to add a Custom Element to the Webform  Content Type  and save it in the Webform(table) column (group_id)

Here is the Webform Custom Field which list all the groups as tree and does not save to node on submit

http://pastebin.com/nsSzyT06

[field_webform_group] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                    )

            )

    )

When I compare this with the summary field.The webfrom custom field does not include a storage form state


texts:
I am new to drupal, currently learning about example module and its sub module, I already created the form using custom modules, in that form I wish to add progress bar for submit button, i referred many sites but, i can't get any clear idea, what i did for submit button is,

function custom_form_menu() {
$items = array();
$items['think/form'] = array(
'title' => t('Entry Free'),
'page callback' => 'custom_form_form',
'page arguments' => array('ajax_example_progressbar_form'),
'access arguments' => array('access content'),
'description' => t('My form'),
'type' => MENU_CALLBACK,
'file' => 'ajax_example_progressbar.inc',
);
return $items;
}

and for submit button,

custom_form_my_form($form , &$form_state) {
$form['first'] = array(
'#type' => 'textfield',
'#title' => t('First name'),
'#description' => "Please enter your first name.",
'#maxlength' => 6,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}

So, now how can I add progress bar in this submit button, when the form is submitted.


texts: Can't get id/name of view in hook_preprocess_views_view_unformatted

texts:
In this function I can't get id of view

function THEMENAME_preprocess_views_view_unformatted($vars){
  $view = $vars["view"];
  //does not work
  $id = $view->storage->id();
  //does not work
  $name = $view->name;
}

$id does not  get anything meanwhile if used in hook_preprocess_views_view_fields work properly.  Why it does not work here ?

EDIT: the process is firing and I can see with a debugger that id/name don't get a value meanwhile on other hook above can get the id ... could it be a bug ?


texts: As usual, I am debugging something and this time, it's jsonapi. I already have $settings['cache']['bins']['render'] = 'cache.backend.null'; and $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null'; this works for HTML, how do you force JSONAPI to not cache?


texts:
function hook_file_download_access_alter(&$grants, $field, $entity_type, $entity) {
  // For our example module, we always enforce the rules set by node module.
  if (isset($grants['node'])) {
    $grants = array('node' => $grants['node']);
  }
}

The arguments $field, $entity_type, $entity are not used in the  implementation. What are these arguments used for, when the function is called?


texts:
$fbuser = new stdClass();
   $fbuser->first_name = 'abc';
   $fbuser->last_name = 'cde';
   $fbuser->location = 'Vas';
   $fbuser->link = 'http://www.facebook.com';
   $fbuser->gender = 'male';
   module_load_include('inc', 'node', 'node.pages');
   $node = new stdClass();
   $node->type = 'profile2';
   node_object_prepare($node);
   $node->uid = 1;
   $node->field_profile_fn[0]['value'] = $fbuser->first_name;(textfield)
   $node->field_profile_ln[0]['value'] = $fbuser->last_name;(textfield)
   $node->field_profile_city[0]['value'] = $fbuser->location;(textfield)
   $node->field_profile_facebook[0]['value'] = 'http://www.facebook.com';(textfield)
   $node->field_profile_gender[0]['value'] = $fbuser->gender;(select list)
   node_save($node);

In the above code I am trying to create a new content of type profile2 .
My node is created but some of the fields show empty text like

field_profile_facebook which is textfield does not show value provided above and gives empty text.


texts: Installing on CentOS 6 with Apache 2.2.15

texts:
I'm trying to install 8.0 RC4 on CentOS6 with Apache2.2.15 and I'm being stopped by this error message:

  Apache/2.2.15
  The minimum version of Apache needed to run Drupal without mod_rewrite enabled is 2.2.16. See the enabling clean URLs page for more information on mod_rewrite.

I've made sure to have this on httpd.conf:
AllowOverride All

And mod_rewrite is in fact being loaded correctly. I tried httpd -M | grep rewrite and I get:
rewrite_module (shared)

I even tried copying the htaccess sample into httpd.conf. I restart apache, and I always still get the same error. Does Drupal 8 simply not support this version of Apache? Could it be the fact that I'm accessing the site via the server's IP rather than a host name?

I tried upgrading to Apache 2.4 but that was an ordeal since the package manager doesn't provide it and the end result gave me even more problems.

Any advice?

Edit: I've installed a wordpress site and tried using SEO friendly URLs, everything works fine. Clearly mod_rewrite has to be working.


texts: Limit the number of characters of Node Body(summary) in Search Results

texts:
In Drupal 8, I am using 'Search API' template file to display search results. My each page has more than 1000 words content. When I perform a search it display the results correctly, but I see the full content in search results.

I just want to display 20 to 30 characters just as it display with default Drupal 8 search.

Here is the Code of Search Results page template:

{{ form }}

{% if search_title %}

{{ search_title }}

{% endif %}

{{ results }}

The content is printed with {{results}}. How Can I break it so that instead of printing full body summary text, it only prints 20-30 characters but only those which matches with the keyword.

Thanks


texts: Is it possible to send Email from Drupal Template File

texts:
I need to send email from a template file. I have already seen this thread and i get the point that its a bad thing to do. Any how i must send email from the TPL file in my case.

Using PHP mail function sends email, but once I add <img src="test.jpg"> tag, the email is never sent. Any clues what is happening here?


texts: How to correctly start a website using Git/Drush/Composer workflow?

texts:
I am trying to follow this article to start a D8 site:
https://www.drupal.org/node/803746

The article is for D7 but I think there are no much differences.

These are the steps I followed so far:

Cloned Drupal 8.2.x repository to my dev environment
Branched to 'my-project'
Created a remote repo, replaced it as my 'origin' and renamed Drupal.org to 'drupal'.
copied the example .gitignore as is, it by default ignores settings.php and vendor folder.
Ran composer install at root
Installed Drupal to local MySQL instance (after settings up Apache)
Committed and pushed files of the entire site to repository
Created staging environment and cloned from repository
Copied settings.php, dumped dev database and re-imported it to staging, and re-ran composer install at staging environment
I ran drush rebuild to refresh cache.

I expected this to be all and now the staging environment should be up and running, but it is running with now style, apparently the themes are not correctly copied.

So my first question is what did I miss, do I have to use composer to install core themes?

My second question is, do I have to re-install any additional theme or modules using composer on all sites? Or in other words, why is it a good practice to git-ignore vendor folder rather than install once on dev env and pull dependencies from repository?

Below is a screenshot for how staging main page looks like:

[EDIT]
Checking the /admin/reports/dblog page, these was the warning that appeared a lot:

warning: file_put_contents(temporary://filexmZMo3): failed to open stream: "Drupal\Core\StreamWrapper\TemporaryStream::stream_open" call failed in file_unmanaged_save_data()


texts:
I have brought an image in from an API and cropped it using imagecrop in a custom module. I now have an image resource. But I cannot figure out how to turn the resource into a file I can save in Drupal or just save the resource directly as a file through Drupal. I have tried variations of file_get_contents and file_save_data. Any help would be appreciated.
When I use the following:
$cropped_image = imagecrop($image_resource, $rect);
$final_file = file_save_data($cropped_image);
$type = array('type' => $content_type);
$node = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->create($type);
$node->field_image = array(
  'target_id' => $image_file->id(),
);
$node->save();

I get the error "Call to a member function id() on bool in" on the $node->field_image line. That has made me think that the resource is not getting saved into a file with file_save_data() (obviously, not exactly sure what is happening).
When I included a file_get_contents($cropped_image) and then process that through file_save_data (as I do when I bring in an image from a URL), I end up with an error that the system is unable to handle the request in nothing in the recent log messages.
I have tried various other methods as well with no joy.


texts: Overriding the function of a module in another module

texts:
Module1 has a function named 'function1'. 'function1' is not a type of hook, but it is a menu callback, or called inside a hook.

Module2 wants to override 'function1' using all variables which are available to function1 inside Module1.

I can call function1 using module_load_include(), but I need to override the called function.

How can I achieve this?


texts: Mod Rewrite for Subdomain to point to TLD

texts:
Is it possible to create a Mod Rewrite rule to point a subdomain to a TLD?
Example; cars.test.com -> Mycarsite.com

Am using the shared cookie, tables (for the users), and Domain access in D7. Now all I need to do is craft a rewrite rule that can point all the requests going to subdomain.tld.com to goto mytld.com.

CLARIFICATION/EDIT: This is specifically a drupal question. I shared the users with test.com & cars.test.com so that I can do a single sign on. So I did the typical adjustments to settings.php and crafted the single db with prefixes per site. The only "out of the box solution" that works with D7 for an SSO solution is sharing the DB and and sharing cookies. I got that part working. Now this is the part that am experimenting with but am not sure its possible. I want all requests that goto cars.test.com appear as if they are coming from mytld.com. I already have mytld.com parked on the host. But when I goto cars.test.com using the mod rerewrite rules from @acouch below, it redirects me test.com. Is this possible?


texts: LDAP Authentication + Drupal Registrations possible issue

texts:
I wish to have a site that allows for both LDAP authentication and plain old Drupal authentication (Drupal users without LDAP accounts). LDAP accounts will be employees, while Drupal accounts will just be all other types of users.

I foresee a problem with this in the future: What if a new employee is hired and the username (which is mandated by business rules) is already taken by an existing user. For example, a user "Jason Smith" created an account jasons. A new employee "Jason Sutherland" is then hired and an LDAP account is created for him jasons. Using the LDAP module http://drupal.org/project/ldap, the employee jasons would essentially be locked out of our Drupal site. And no, we cannot ask the user to change their username.

What are my options here? I first thought of forcing LDAP accounts to login by their email, disallowing any users from registering with the suffix @company.org. Since this should be unique, this could potentially solve the issue. Is this a viable solution? How could I do something like this? Would this require hacking the LDAP module a bit? Do I have other options?


texts:
I have made textfield to be autocomplete field by using hook_form_alter.

mymoudle_form_alter(&$form, &$form_state, $form_id){
   $form['field_state']['und'][0]['value']['#autocomplete_path'] ='get-state-values';
}
    function mymoudle_drupal_menu() {
    $items = array();

    $items['get-country-value'] = array(
            'title' => 'Country Value',
            'page callback' => '_get_country_value',
            //'page arguments'  => array(1),
            'access arguments' => array('access content'),
            'type' => MENU_CALLBACK,
    );
    $items['get-state-values'] = array(
            'page callback' => '_get_state_values',
            'access arguments' => array('access content'),
            'type' => MENU_CALLBACK
    );
    return $items;
}

function _get_state_values($string){
    $country =$_SESSION['country'];
    if($country == 'India'){
        $state = array('Tamilnadu' => 'Tamilnadu','Karanataka' => 'Karanataka');
    }
    else{
        $state = array('NewYork' => 'NewYork','Manahattan' => 'Manahattan');
    }
    print drupal_json_output($state);exit;
}
function _get_country_value(){
    $country = $_REQUEST['valueSelected'];
    $_SESSION['country'] = $country;
    print drupal_json_output($country);exit;
}

If I select country as India and type in the state as 'n' it shows me in auto-complete as two states with n words like tamilnadu and karnataka which is correct(it runs ajax to fetch the values as shown in screenshot-1).

The issue over here is if I again change the country to 'Us' and type same 'n' it shows same set of results and it doesn't run the ajax(as shown in screenshoot-2). Its showing from cache I think for previous results.

NOTE: I want an fix for the ajax caching issue.

I have attached the screenshot of what's happening .How to avoid this issue?.Any help will be much appreciated.Thanks in advance.


texts:
I am struggling with Drupal menu. Currently my menu is not responsive. I know how to change it to become responsive using CSS. But I am wondering If there is any module that can do this easily.

Please give any menu module if available to be responsive and adaptive to different screen sizes or suggest me if there are any simple tweaks.


texts: What are the legal considerations to build a service like Drupal Gardens and earn profit from it?

texts:
I ask for your help to clarify a doubt I had on the usage and licensing of the Drupal platform to build a commercial project like Drupal Gardens.

Today, I have read both licensing and usage rules from the drupal.com and drupal.org, but I have found nothing that could give an straight answer to my curiosity about what will take both legally and economic to maintain a site 'like' Drupal Gardens. Being specific a service where people will pay to get a deployed Drupal instance.


texts:
For granular node access, TAC, TAC lite, Content Access or ACL can be used, but because of some technical limitations and issues, I can not use them.

While implementing the node access part of my module, I've realized there are 2 type of hooks, total of 3. I've watched hours of videos, read many articles and I am still confused which one does what:

hook_node_access()
hook_node_access_records()
hook_node_grants()

For granular access control over each node with an specific nid, I can implement hook_node_access and see if the user has permission to view/update/delete the requested node.
I will also disable any other kind of node access system (roles permissions to access nodes, TAC, ACL,...) so only my module decides who has access to what.

This should work fine but the question is: what is node_access table used for? ACL and other fellas use it. But what is it? does it direcrly concern me too?


texts: select distinct articles in views not working

texts:
I am trying to remove the duplicate selected article.
Even though my filters are simple and direct I am still getting duplicate articles
Here's screenshot of my view

Attempts I used:
 1. I have applied Query Settings Distinct.
 2. I tried to use aggregation but I got sql error.


texts:
As far as I see the view titles are not translatable. As a quick fix I just created a new views-view.tpl.php file and changed the line 32 from:

<?php print $title; ?>

to

<?php print t($title); ?>

What do you think? Is this a right method?


texts:
I have a CSV of data which I am importing as Commerce-Products.

The issue is the price data gets rounded up or down when loading the price field data from the CSV into the price field of commerce-product entities.

For example, one CSV field has a price value of £71.89. I configure the price under manage display with the provided options and I get the following results:

Raw Amount: £72
Formatted Amount: £0.72
Formatted Amount with components: £0.72

So, I need help in importing the price data exactly as it is in the CSV, please.


texts: Data export view gives error if 0 records

texts:
I have a data export option on a view.  however , if the filter has not chosen any records, the excel export gives an error.  Is there anyway to disable the data export icon if no records have been chosen, or other wise avoid this error?

thanks


texts: How to rename installation profile name in existing website in D8

texts:
I have installed Drupal 8 with a custom subprofile. 'my_custom_profile'.

Development of site is almost completed and we have added all the contents in the site.

In this stage how can I rename my installed subprofile name from 'my_custom_profile' to 'custom_profile'?

Is it possible to update DB entries manually for subprofile?


texts:
I am using drupalvm to manage my vagrant machines and I want to be able to be able to log into the vagrant machine and run drush to sync with the dev/stage/prod environments. I cannot do this without a bunch of extra setup to pass ssh keys and change usernames.

I would prefer to just pass the ssh username along with the drush command. Does drush have an argument that allows me to do this? I was unable to find it in the docs.


texts: How to add multiple terms to a taxonomy via feeds and tamper

texts:
I am importing nodes with taxonomy terms for one vocabulary. I have a set of terms that I would like to use that are set up with their own columns.

I know feeds tamper can explode a set of data in one column using a delimiter and apply that to a term, but I need each taxonomy term to be in it's own column. This is easier for readability for the people who are setting up the database.

How can I do this?

Thanks!


texts: Create many to many Relationship with a specific fields in a Content type to taxonomy

texts: I am currently encounter a problem, I have one content type (Type) and two taxonomy needed to be link up, in that content type, I need to apply a many to many relationship among a field (Name: Core) and two taxonomy Terms (Such like below image), I would like to ask is there any method to implement this idea??


texts:
I have a custom form where admin users upload a CSV file. Everything is working fine, but the file is saved with an underscore. For example, I upload callLog4127_Lorem_20170701.csv but the file is saved as callLog4127_Lorem_20170701_1.csv.

I checked the database, but I don't find any reference to callLog4127_Lorem_20170701. I also deleted the temp folder, and ran cron, but I am still getting the same problem.

It happens just with this file; when I upload another file it's working correctly, which means the filename is not changed.

This is my form validation handler. Is there anything wrong with it that could cause the behavior I am seeing?

function upload_rtap_validate($form, &$form_state) {
  $file = file_save_upload('calllogrtap_file', array(
    'file_validate_extensions' => array('csv'), // Validate extensions.
    'public://mrtap/', FILE_EXISTS_REPLACE
  ));

  if ($file) {
    $file = file_move($file, 'public://mrtap/', FILE_EXISTS_REPLACE);
    $file->status = 1;
    file_save($file);
    $form_state['storage']['filename'] = $file->uri;
  }
}

If I print the content of $file with print_r($file), after file_save_upload(), I get the following.

stdClass Object(
  [uid] => 1
  [status] => 0
  [filename] => callLog4127_GentleDental_20170701.csv
  [uri] => temporary://callLog4127_GentleDental_20170701_4.csv
  [filemime] => text/csv
  [filesize] => 48429
  [source] => calllogrtap_file
  [destination] => temporary://callLog4127_GentleDental_20170701_4.csv
  [timestamp] => 1501309335
  [fid] => 235
 )


texts: How to do "has term (with depth)" filter on field of a related field

texts:
i have a content type 'product', and two taxonomy lists 'company' and 'country'.
Country list has one level of depth like:

........
state1
-city1
-city2
........

Each product has a 'company' field. Each 'company' term has a 'country' field.
I'm trying to create a view for 'product', filtering by 'country'.
By adding the relationship "content: Company" i have only "taxonomy term: field_country" filter without depth.
There is a way to filter with depth like "Has taxonomy term (with depth)" ?

I'm on drupal 7


texts: How can i check if css class exists on page and add new one to the body

texts:
something like:

function mytheme_preprocess_html(&$vars) {
  //if css.class exists on page{
  $vars['classes_array'][] = 'my-class';
 //}
}

... All i want is to add class to other elements if there is custom views (module:views) on my landing-page


texts:
I have an ASP.NET website using MySQL.
1 table('books') holds more than 1000 books, each record has unique ID, name, writer etc.
I want to import those books into Drupal. I'm planning to create Custom Fields(name, writer etc) for a New Content Type.

Is it possible to create Nodes like this from SQL file?


texts:
The index page of a site I am building is to be a video and nothing else which clicks through to the site.

I have read about page templates and seen some modules called 'front page' but I would like to to do this within the code.

Is there a best advised / standard way to do this?

I have tried setting an if statement for $front_page but this seems to happen for every page.


texts: Multigroup field in view only showing single delta

texts:
How are CCK multi groups handled in a view? Because when I select the fields for the views, they come with a "delta" field:

The delta fields are always empty, so it doesn't work out of the box. The delta fields are always empty in the table view.

Is there any way I can have support for multigroup fields, or even a way to concatenate the delta's of the three fields ('Naam', 'Bedrijfsnaam', 'E-mailadres') for each delta?


texts: how to create view that display just 2 level of taxonomy vocabulary

texts:
i have a vocabulary that contain plus of 5 level descendant, i need to create the view to display the first 2 levels and grouping by the first one, i do this:

FIELDS: (Parent) Taxonomy term: Name - Taxonomy term: Name
FILTER CRITERIA: Taxonomy vocabulary: Machine name (= All Type
Announce)
SORT CRITERIA: (Parent) Taxonomy term: Weight (asc)
RELATIONSHIPS: Taxonomy term: Parent term

and i get all list of taxonomy for this vocabulary grouping by parents, how to set only 2 levels?


texts: How can I change URL of 'Add new comment' link on teaser?

texts:
Currently, I have a list of teasers and they have a comment count and an 'Add new comment' link.

That link goes to a dedicated comment page with a URL of the form "/comment/reply/19#comment-form".

However, I want it to go to the actual node which has the comment form at the bottom (eg. "/node/19#comment-form").

Maybe this can be done is the template.php or some other way. Any ideas would be greatly appreciated.


texts: Export news items (including pictures etc.) from Drupal to SQL

texts:
I would like to export newsitems from Drupal including images to import them into a whole different database.

Is there any module or whats the best way to create an export from Drupal to a SQL, CSV file?


texts:
I’d like to redirect the: aegir-server.com/a-site-url.com to a-site-url.com without hacking Aegir and based on a pattern so any future site will follow this type of redirect. Is it possible through Aegir?

(Aegir redirects the : aegir-server.com/node/site_id/goto_site to the site, but this is not what I need)


texts: How to change "to" to "-" while displaying start and end date in views?

texts:
When using views to display start and end date by default it adds "to" text in between two dates, I was wondering what is the appropriate way to convert "to" to "-" or anything else.

Thanks


texts: Checking which radio button was clicked on a cck form using Javascript or Jquery

texts:
I have a content type which I am loading in a block as a form. I am looking to know which radio button out of 2 buttons was clicked so that I can display additional fields. What is the best way to achieve this using JavaScript?

 I am: *

 <input type="radio" id="edit-field-org-or-part-value-organizer" name="field_org_or_part[value]" value="organizer"   class="form-radio" /> Organizer

 <input type="radio" id="edit-field-org-or-part-value-participant" name="field_org_or_part[value]" value="participant"   class="form-radio" /> Participant


texts: How to show data of user that flagged a content(5 flag types or more)?

texts:
This is a followup question about this Old question
I have 5 flag types for a content type. consider we have 5 flag types and we don't know how many flags our user used. I mean, the first user can flag a content by flag type 1, type 2 and type 5, and other user can flag same content by flag type 2 and type 4, and etc, OK?
I want to show a list of users that flagged same content, some users can use all flag types and others can use some flag types. thus I don't know users will use what flag types. You consider moreover "username", I want to show user's "E-mail". thus in this table I want to show "username", user's "E-mail" and "flag fields".
In below picture, I showed that a content can has different value. because any user can input different value in flag field. this table will appear in content page. I mean any content page has its specific table.

UPDATE
Now I have a new Idea that I would explain.
I can use Global custom text field. Consider I have 5 flag types, I added my 5 flag types username fields and hide them in views(exclude from display). As you know, First I should add flag types in Relationship part of views. when I add a username field, I should choose relationship in username field. Thus I should add 5 username fields.
After that I can use REPLACEMENT PATTERNS in "global custom text". Now I have 5 patterns for my 5 username fields. Now I have a problem.
Consider when one user use 3 flag types(3 of 5 flag types that I enabled for specific content), I mean when he(she) flag(s) a specific content by 3 flag types, in custom text field we can see username that repeated 3 times, because we use all 5 PATTERNS of username fields in global custom text field.
How can I solve this problem?
Is there any HTML code to show one of these patterns?
Also I can use global PHP. Is there any PHP code for this problem?
alternatives welcome also


texts: What is the equivalent of "Referential Integrity for CCK" in drupal 7?

texts: Is there a Drupal 7 equivalent for the Referential Integrity for CCK module?


texts: How do I trigger Infinite Scroll with FancyBox in Drupal 7

texts:
I have a gallery of photos which uses Infinite Scroll as the pager.
I am also using the fancyBox module so that when I click each photo it appears in an overlay, with the photos grouped per page so I can cycle through them with the FancyBox overlay.

The problem I have is that I can only cycle through the photos that have already been loaded by the Infinite Scroll (which makes sense as they are the only photos the Infinite Scroll has 'seen'). But what I want is to trigger the infinite scroll to load more photos just before I reach the end of the cycle with the FancyBox overlay so a user can simply use the overlay to cycle through all the photos on the site without having to use Infinite Scroll to load them all first.

Any help with the sort of thing I should be thinking about to try and achieve this?


texts: Drush minimal bootstrap only for variables for vget

texts:
How do you make drush bootstrap  minimal. How do you specify the bootstrap method like DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_CONFIGURATION  in the drush command?
Background:
I just want to have the drupal variable value in a shell script variable. I can use vget, but i donot want to make the full bootstrap.


texts:
I have been trying to upgrade to 8.8.3 from 8.4.4 for some time. My 8.4.4 site was holding but after repairing a database malfulnction in which the watchdog file went mad with assert errors, now I can't login to the back end. After failing to login using the login module on the front page, the WSOD appears with this meesage.

'''The website encountered an unexpected error. Please try again later.Drupal\Core\Extension\InfoParserException: Missing required keys (core) in core/modules/path_alias/path_alias.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 29 of core/lib/Drupal/Core/Extension/InfoParserDynamic.php).'''

I don't know where to start with this.


texts: How can I limit the taxonomy terms of certain nodes?

texts:
I have a content type that can have unlimited taxonomy terms. However those taxonomy terms should be unique to each node ID.
Since the user will create the taxonomy terms, should I write a "nid" field with each taxonomy term, or is there a better way?


texts: Add new column "Block description" on block layout page

texts:
I need to add a new column called Block Short Description on Block layout under /admin/structure/block.

Can anyone let me know how to achieve it?

I have Attached screenshot for reference.


texts: Replace last item in a Views grid of images

texts:
let's say I have 1000 image files on my server and I am paging the 10 newest (2 rows with 5 images each) on my frontpage in a views block, formatted as a 'grid'. The settings of my view are:

Format: Grid, Show: Fields, File: Rendered, and then filter by File: Type (= Image) and sort by File: Upload date

Instead of adding a "see more" link I would like to replace the 10th image with a "see more" button which has the same format as the images. Is there a way to only render a grid of 9 images and tell views which image to use as the 10th?


texts: Druapal Glossary Mode not showing in contextual filters

texts:
I dont see the glossary mode  when adding arguments in contextual filters.

But on other views I am able to set the glossary mode.


texts: How can I load custom module JavaScript on content type edit form?

texts:
I'm trying to load jQuery on the admin edit form of a content type.

To accomplish this, I developed a module "exclusivetabs" with the following directory structure:

|-- exclusivetabs
    |-- exclusive_tabs.info.yml
    |-- exclusive_tabs.libraries.yml
    |-- exclusive_tabs.module
    |-- js
        |-- cse_banner_header.js

The contents of the relevant files are as follows:

exclusive_tabs.libraries.yml

exclusive_tabs:
  version: 1.x
  js:
    js/cse_banner_header.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

exclusive_tabs.module

<?php

/**
 * Implements hook_form_alter().
 */
function exclusive_tabs_form_node_form_alter(&$form, &$form_state, $form_id) {
  /* @var Drupal\Core\Entity\FieldableEntityInterface $node */
  $node = $form_state->getFormObject()->getEntity();

  if ($node->getType() == 'unit_landing_page') {
   /* var_dump($node);*/
    $form['#attached']['library'][] = 'exclusive_tabs/cse_banner_header';
  }
}

cse_banner_header.js

(function($, Drupal) {

/* Add span to wysiwyg button classes for alignment
------------------------------------ */
Drupal.behaviors.calloutControl = {
        attach: function (context, settings) {
                console.log("I'm loaded!");
                $('#callout-link-options .single-link').click(function () {
                        $('input[type="checkbox"]').attr('checked', true);
                        console.log("I'm checked!");
                });
                $('#callout-link-options .multi-link').click(function () {
                        $('input[type="checkbox"]').attr('checked', false);
                        console.log("I'm unchecked!");
                });
        }
};

})(jQuery, Drupal);

The module loads on the specific content type edit form as intended; my trouble is that I haven't figured out how to get the jQuery to load from the cse_banner_header.js file. I also checked the running scripts in the browser, and from what I can tell, the js file does not load on the page.

What am I missing? How can I get the js file to load on the page?


texts: How to access User Picture field for a comment in Views?

texts:
I have a Views table with each row showing the node title, node author, and node author picture. I am also adding the last comment title and last comment author to each table row. I would like to add the last comment user picture but that doesn't seem possible from looking at the code.

There is a database table called Node Comment Statistics which Views uses to query the last comment author name and UID.

I would like to somehow use that last comment UID to query the database for the user picture and render it through the theme_user_picture function adding it the View or attaching it someway to the Username with some markup.

Is this possible?


texts: D6: How to create a rule with a button field to send a bulk mail of a certain node?

texts:
I want to do this with my Drupal 6 install:

Create content (The content type being used has a button field (link to module in case needed)
When a user clicks the button on the newly published node it will load a view so the user can do a search and then send a customized email (pre-confirgured) to selected users using Views Send.

I have been looking everywhere and I cannot seem to find a way to get it to work using Rules. Anyone have some suggestions? This is driving me nuts!


texts:
I have a drupal project with a hierarchical page structure. On each category page (top level), I'd like to have a blurb about the category, and then a series of links to subpages, where each link has a title, an image, and a sentence or two, laid out in a box.

I've looked into modules such as "Menu Node Views" and "Node Hierarchy" but I'm not certain that those are the best way to go about doing this. (Right now, as a temporary solution, I've just defined a bunch of blocks each containing an individual link/image/blurb and attached them to the overview pages using contexts).

Can someone suggest a good way to do this? Ideally it could be attached to the menu system in some way so that changes to the menu would be reflected in the appropriate overview page.

(See http://www.freethechildren.com/aboutus/index.php for an idea of the kind of navigation structure I want to display in the page content, although there will be actual content above the link blocks).


texts:
I need to create a flags view that displays a list of users that have "poked" the current user with D7, Views 3 and Flag 3. I've read through this question and drupal.org/node/296971, neither instruction seems to work or at least I am not able to get the settings right.

To define the functionality:

Users are presented with a list view of other users
Users click the "poke" flag link on a single user
Users then browse to /pokes/ and view all other people that have poked them

This is either a difficult setup or I'm missing a couple settings (the latter is extremely likely). Any hints or thoughts?


texts:
I've done quite a bit of googling and can't seem to find any information on this error, so I'm going to assume it's not a common one.

The error is:

  Notice: Undefined property: views_handler_relationship_broken:: $alias
  in EntityFieldHandlerHelper::query()  (line 84 of
  /MYPATH/sites/all/modules/entity/views/handlers/entity_views_field_handler_helper.inc).

A bit of information about my set up, I've been using Views to show a list of my Drupal Commerce Product displays, set up similarly to Commerce Kickstart where you have the Product Display that references the Commerce Products via the SKU. This error arose shortly after removing some fields relating to a relationship the view was using, as these fields no longer exist they cannot be re-added.

I've cleared the views cache, the site cache, to no avail. Is there any kind of database entry that may be referencing this particular relationship still?

Regards, Daniel.


texts: Views filter out nodes based on taxonomy field

texts:
I have multiple node types on my website and a special View listing all the nodes on the site.

I have a taxonomy field which I have applied to some node types but not others. The trouble is any user with editor permissions can add the taxonomy field to any node type which previously did not have it.

My Views needs to list content only of node types which have the taxomony field included. In other words, if a node type does not have field_taxonomy_example included, my View should list NO nodes of that type.

My problem is I can't find a way to dynamically exclude node types - statically setting them is not an option because new types can be added any time.

Please help :-)


texts: Adding Google Remarketing Script tags to Drupal 7 website

texts: I need to find a way to easily add google remarketing script tags to my Drupal 7 website. If there is a module that can do this easier and faster then that's what I need.


texts:
I have created a new menu called new-menu.  I go to Admin > Structure > Menus > Settings

And I choose "New Menu"  for the "Source for the Main links" option.

However, on my site, it still shows the Main Menu links (instead of New Menu links).

What am I missing?

Note: I am running a custom "Drupal core" from my university, and I've never worked with Vanilla Drupal, so I'm not sure if something is missing that should be there.


texts: Upload multiple files (with multiple attr) in custom form: how to get files?

texts:
I've made a form. Now I want it to upload files. I've made a form element to do that:

  $form['attachments'] = array(
    '#type' => 'file',
    '#title' => t('Attachments'),
    '#name' => 'attachments[]',
    '#attributes' => array('multiple' => ''),
  );

I've set #name and #attributes.multiple because I want to use the HTML5 multiple files upload thingie. They invented that for a very good reason. I assume Drupal knows how to handle that.

How do I get the files in the submit handler? I don't want to save them to the file system. I want to e-mail them.

Ofcourse (?) I can just query $_FILES, but even I think that's not right in a framework like Drupal.

Is there a better way?


texts: Modifying argument of programmatically called render service. (e.g.: theme to use) = Get object from service container with modified argument

texts:
I use the D8 core render service for generating markup that is indexed in an external search service. The indexing is happening on hook_entity_update, where I call my indexing service. My custom indexing service is then using the core render service for creating the markup.

Example with static service call:

// Get the render array for the teaser.
$viewBuilder = \Drupal::entityTypeManager()
  ->getViewBuilder($entity->getEntityTypeId());
$render_array_teaser = $viewBuilder->view($entity, 'teaser');

// Generate the markup from the render_array.
$renderer = \Drupal::service('renderer');
$rendered_teaser = $renderer->renderPlain($render_array_teaser);
// When called in hook_entity_update $rendered teaser has a crappy
// default markup in it as a 'teaser' view mode and the correct twig
// templates don't exist in the backend theme.

This works fine when called from drush. But when called from hook_entity_update() the renderer has the wrong theme context. As the node edit form that triggers the update uses the backend theme, the renderer gets also the backend theme as context instead of the default theme.

The renderer gets the current theme injected with the ThemeManager object.
See core services:

renderer:
  class: Drupal\Core\Render\Renderer
  arguments: ['@controller_resolver', '@theme.manager','@plugin.manager.element_info', '@render_placeholder_generator', '@render_cache', '@request_stack', '%renderer.config%']

How can I initialize the service but provide my own version of the ThemeManager object?

There is a setter method on the ThemeManager object where I could easily set the right theme. But I need to hand this over to the renderer.

e.g.:

$my_theme_manager = \Drupal::service('theme.manager');
$my_theme_manager->setActiveTheme('my_frontend_theme');

// How to get the service with this alternative context?
// e.g. something like that.
$service = \Drupal::Service();
$service->setService('renderer');
$service->setArgument(['@theme_manager' => $my_theme_manager]);
$default_theme_renderer = $service->getService();

Or is there some way to alter the ThemeManager Object when it is initialized? Before it is injected into the render service? So I can set the correct theme in an event or alter hook?

I know that I can alter the service in general by implementing the ServiceModifierInterfacebut this will modify the container when it gets created as far as I know, and is not a way for manipulation during runtime.


texts: Display suite, two layouts for the same node?

texts: I'm using display suite with nodeblock and I'd like to have a different layout for the block than the main page. How can I do this?


texts: simple hierarchical select widget type name

texts:
I'm programming a custom content type. I need to select some childs inside a parent taxonomy. I want to use simple hierarchical select

I can't seem to find the

widget => 'widget name'

for it.

I tried

shs_taxonomy
taxonomy_shs
select_shs
shs_select

none seem to work.

Has anyone got some experience on this?

greetings
Thomas


texts:
I tried using mobilize and made my drupal site mobile ready very fast i.e. added the java script code directly in the theme page.tpl.php file. I wanted to make this a module and made a new module and added code like below and enabled the module, But mobile version of website doesn't work. Any thing wrong i ma doing? mobilize is the module name

<?php
function mobilize_init() {
 $path = drupal_get_path('module', 'mobilize');
 drupal_add_js($path . '/site.js', 'file');
drupal_add_js('http://cdn.mobilizejs.com/releases/0.1/js/mobilize.core.min.js','external');
}
?>


texts: How can I rewrite the output of image field to become a div with this image as a background image?

texts:
I have a view to display a content that have an image field, and I need to display this image as a background image of a div so I can apply some CSS on it.

what I tried to do is to rewrite the output of this field using twig to be like this:

the problem is that Drupal strips style attribute so the output will be like this:

In D7 I used to fix this kind of issues by overriding the template for the specific field, but I couldn't figure out what is the name of the needed template in D8. when I enabled twig debug it turned out that the field is using the template file views-view-field.html.twig which is the default template for all fields in views, but I couldn't find the needed template name for this specific field in this view, I tried to rename it like in D7 to be views-view-field--page-image--field-image.html.twig (the view name is page_image) but it didn't work out.

any suggestions?


texts:
I'm using the feeds module to import thousands of nodes into my Drupal 6 site (the source is a Drupal 5 site) and after figuring a few things out, it actually works really nicely! I just have one problem though, most of these nodes are supposed to contain inline images, and I'm wondering how to recover them as they don't come with the import...?

Thanks!


texts:
This question follows Override webform module submit

Based on this answer, I used the rules module to create a node after webform submissions.

My webform contains an <input type="file" />

for other <input type="text" /> I used this solution to How to save webform submissions data in fields using rules module

How can I add this file data in the field-image table?


texts:
Is it possible to alter html_head using hook_page_attachments_alter() per node? I need to attach different <script> tags to a list of nodes. I am able to add it to each node, but all gets overridden with the last alteration.
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['type' => 'faq_page', 'status' => 1]);

foreach($nodes as $node) {
  $description = [
    [
      '#tag' => 'script',
    ],
    // …
  $page['#attached']['html_head'][] = [$description, 'description];
}


texts: How to implement user hierarchy with different levels of roles under different branches, groups etc

texts:
I have to create a web portal, that should have a number of users from super administrator to employee. Users have single or multilevel access (either to data of one branch or to multiple) on the system.

Some can add/edit data and some can only view some data. The system has different branches, different departments etc.. How can I implement such a system using Drupal?

I had created multiple roles and given permissions to them. But how can I achieve those multi branch multi groups kind of user hierarchy?

Update:
Can I achieve it by using TAC : https://www.drupal.org/node/31601 ?


texts:
I am loooking for the way to find a node by the value of custom field using XMLRPC.

Here is more context:
I am  developing an application to integrate our software with drupal 7.
The application is developed in java and it communictaes drupal via XMLRPC service.
I am able to perform all the basic CRUD operations on nodes and on files.
In order to synchronize drupal node and object of my application,
I am using drupal field, which contains id of the object in my application.
I fill this field every time I create new node in drupal.

I know to use node.index in order to find nodes match some particular fields values,
however I can not use "custom fields" in this method.

Please advise.


texts: Upcoming birthday list in views, based on birth date

texts:
In Drupal 8
I created some extra fields at "user", such as date of birth" (dd-mm-yyyy)
I want to show in a block in views the upcoming birthdays.
BUT...I can't sort them on date, because the order takes also the year!
How to make a birthdaylist in Drupal 8 bases on the day of birth, regardless the year.
Can you do it this way, or are there more ways to display an upcoming birthday list?
Thank you all!


texts: Is there a way to install a module through an existing module's update hook?

texts: I am curious whether there is a way to install a module through an existing module's update hook?


texts: How to implement challenges with prizes in a Drupal site?

texts:
I've been working on a Drupal Commerce site where you can buy goods with points. Users gain those points with a system I already implemented. Everything is fine, but now I have to implement challenges.

Basically, the users will need to "follow" the challenge, then every point they gain from that moment will fill their point meter of the challenge. Every user who reaches the point limit (specified when the challenge is created) will win a prize.

How can I do this? I was told that I could use the Flag module for the following part, but I'm really clueless.


texts:
I'm wondering how easily it would be to achieve the following.

I want to create a Drupal site where users have a small "file area" to upload files.
I would like to be able to take those files and upload them to another server (using FTP, HTTP posts, or XMLRPC).
It would be also nice to get the "remote server" directory listing.

I obviously think this can be easily achieved by ftp; but can I tell to the FTP manager to use the username/password couple of the Drupal user? How can I hide those information to the end user?

What I have in mind is the implementation in Drupal of the Dropbox service, where the Drupal site would be the Dropbox provider.

Any ideas on where to get started ?


texts: Why does $page['content']['#attached']['js'] works , while $page['#attached']['js'] does not?

texts:
Trying to attach js by means of #attached by means of hook_page_alter (see https://drupal.stackexchange.com/questions/171918/how-to-add-javascript-with-attached-and-hook-page-alter), I found that the following code

 function MODULE_page_alter(&$page) {
  $my_path = drupal_get_path('module', 'MODULE' );
  $page ['content']['#attached']['js'][] = array(
    'js' => array(
    'type'=>'file',
    'data' => $my_path . '/module_test.js'),
  );
}

works properly - it attaches the file - while

function MODULE_page_alter(&$page) {
  $my_path = drupal_get_path('module', 'MODULE' );
  $page ['#attached']['js'][] = array(
    'js' => array(
    'type'=>'file',
    'data' => $my_path . '/module_test.js'),
  );
}

does not. Why is it so?


texts: Drupal views preview working but in actual page not?

texts:
I'm trying to show an image with teaser and name of the node type.

It is working in views preview, but not in the actual page.

can anyone suggest?


texts: What can cause a site to hang when deleting a user?

texts:
When I try to delete users the whole site hangs, i.e. Drupal does not respond anymore. What can cause that?

The site does not have any special user profile modules installed.

Edit:
There is only one custom (self made) module with a hook_user which switches on $op. The 'delete' case looks unsuspicious:

case 'delete':
    $sql = "DELETE FROM {mynewsletter_users} WHERE uid = %d";
    db_query($sql, $account->uid);
    break;

Doesn't look bad to me. Should not invoke a hook_user-circle.

Edit:
The problem is gone all by itself. No idea what happened.


texts: Recipes for most compatible slideshows and/or carousels?

texts:
I'm getting ready to implement a carousel for client in Drupal 7. I've been searching for information about how to implement carousels and slideshows for maximum compatibility. I've installed several modules in my search and I realize that there is not an out of the box complete solution.

Most of the modules I've tried will make a mess of the page when js is disabled, some of them are buggy on mobile devices etc. I've seen some CSS3 solutions but haven't tried them yet by reason of not knowing the classes employed by them and the level of support they have in browsers/devices. I'd like to ask the community for what solutions exist aside from not using carousels and slideshows to accomplish this. A reasonably compatible solution that looks and functions ok, even on non js enabled browsers.


texts:
I have a content type named 'products' and every product have a unique vendor, so I want to add a field to the content type 'products' that allow me to chose the appropriate vendor from a list.

Is this possible without creating a custom module ?
Can I create another content type 'vendors' and join the two content type ?

Thanks.


texts: How to assign a role to a user depending on order subtotal using Ubercart?

texts:
I am using ubercart in drupal 7 . I need to assign a role to user after checkout. For this I created a rule using checkout complete.
But I need to assign a role depend on order subtotal. this option is not meeting me on rule.


texts: Install profile that automatically inserts data / config settings

texts:
I am trying to create a custom installation profile for small internal usage and I'd like to hide certain steps and also implement new functions as a quick-and-dirty way to pre-populate some default content (nodes, blocks, menus) and configuration settings (wysiwyg) by inserting them into the database during the profile installation.

I am using the standard profile as a guide to work from as well as following this guide, but having trouble getting this to work smoothly and since it's all pre-installation I can't use devel to troubleshoot (it's not enabled yet).

Let's call the custom installation profile customprofile and the files I have are:

customprofile_profile.info
customprofile_profile.profile
customprofile_profile.install

I've figured out (for example) how to override the "Select locale" step and hard-code that to be English in customprofile_profile.profile:

function customprofile_install_tasks_alter(&$tasks, $install_state) {
  $tasks['install_select_locale']['display'] = FALSE;
  $tasks['install_select_locale']['function'] = 'customprofile_select_locale';
}

function customprofile_select_locale (&$install_state) {
  $install_state['parameters']['locale'] = 'en';
}

...but I haven't been able to track down the syntax for:

1) inserting a new step at the end of the profile install

2) inserting some SQL (I found this old post but it seems to be for Drupal 6 and both the profile syntax and SQL insertion are incompatible with Drupal 7)

Any guidance for next steps on either/both of these would be appreciated!


texts: Views won't handle my pathauto pattern for taxonomy pages

texts:
I have two taxonomies on my site that need to be browsable independently using different Views. Therefor I decided to prepend the term paths with the vocabulary name. In PathAuto patter section I have defined:

[term:vocabulary:name]/[term:url:path]

and the paths look the way I want:

vocabname/taxonomy/term/tid

however the Views don't work. The pages that are generated for the path

vocabname/taxonomy/term/%

somehow won't jump in. I see the error that no content has been tagged with this term, whereas the view should display teasers of the children terms.

So, do you think there is a wrong assumption on my side as per the url aliasing process (what occurs first)? Should that work?


texts: How to get the data of field collections

texts:
I have one field collection with 4 fields. How to get the data of field collection in views tpl file

I am trying to load data as

field_collection = entity_load('field_collection_item', array($node->field_suppliers_value['und'][0]['value']));
print_r($field_collection);

The fields in field collection are one is text field and another one is entity reference and one more is term reference and last one is date type.

I am able to retrieve the data only for text data type and for other data types it was showing as [target_id]=some number.

How can i retrieve the data for other data types except text.


texts:
I would like to print the result when calling the node_load() function. All I get is an error... How do I get something on my screen?

Here is the code I try:

$form = node_load(1473);
print render($form);

And the error:

Recoverable fatal error: Object of class stdClass could not be converted to string in include() (line 10 of ...

How can I display the content of $form properly?


texts: Writing a custom migrate process plugin for multiple entity_lookups matching the same entity

texts:
I'm working on a migration of Album nodes, and before importing a given row, I'd like to do an entity_lookup that checks if there exists an Album node that has both a matching title and artist (field_artists), skipping the row if there is a match.
My understanding is that I'll need a custom process plugin to handle that, but I can't wrap my head around how to write it so that it does the multiple entity_lookups properly.
This is the initial YAML from when I was only doing an entity_lookup against the title (which works, but isn't sufficient, given that two albums by different artists could very well have the same title):
process:
  skip:
    -
      plugin: entity_lookup
      entity_type: node
      bundle: album
      bundle_key: type
      value_key: title
      source: name
      ignore_case: 1
      access_check: 0

Here's my YAML in its current state, in which I'm not sure how best to structure sources:
process:
  skip:
    -
      plugin: entity_lookup_multiple
      entity_type: node
      bundle: album
      bundle_key: type
      value_key: title
      sources:
        name:
          value: title
        field_artists:
          value: field_artist
      ignore_case: 1
      access_check: 0
      method: row
      message: 'Album already exists; skipping row.'
  [...etc.]

The plugin, EntityLookupMultiple.php, is where I get lost: I'm not sure whether to extend ProcessPluginBase like it appears other migrations do, or if I need to extend EntityLookup directly.
class EntityLookupMultiple extends ProcessPluginBase { ... }
Then within that, I see that I think I can dig into my sources array using $this->configuration['sources'], and I see that I should throw a MigrateSkipRowException if both lookups match. In between that, how do I perform an entity_lookup against both values specified in the row (title and artist) and see if there's a matching entity that satisfies both requirements?


texts: dupal form: how to assign specific id to radio button using form api

texts:
I wanted to change id of radio button. But i dont know which attribute shall i use to do that.

$form['entry.497535900'] = array(
'#type' => 'radios',
'#title' => t('Category'),
'#options' => array('P' =>'Product','S' => 'Services','O' =>'Others'),

);


texts: Drupal migrating cck int_phone field (6 to 7)

texts:
I'm trying to migrate the phone field type ('int_phone') that are in CCK fields from drupal6 to drupal 7 using the CCK migrate tool but I continuously get this error,

  Error creating field field_user_phone:
  exception 'FieldException' with message 'Attempt to create a field of unknown type int_phone.' in D:\site\unops63\modules\field\field.crud.inc:110

Any idea why the error is coming. I could comment the error handling but I was thinking of a solution at this point.


texts: Simple OAuth Role assignment within a Scope

texts:
I have a web app that has multiple scopes under a single OAuth consumer. I want the user's Drupal role to be used when logging in.

In simple OAuth, I have created 1 consumer that has 2 scopes: editor_user and regular_user.

I run oauth/token with grant_type=password, this returns a token that covers the authenticated, editor_user and regular_user roles.

When logging in as a user with role regular_user and forcefully setting the scope to editor_user, the user role gets set to editor_user !

This seems highly unsafe. User roles need to be properly enforced on the backend.

I would expect the Drupal backend to correctly check for a user's roles, and ignore any scopes that do not match. Regardless of whether the consumer itself is allowed access to more scopes than a user.

Is there a way of restricting the token to the user's role within a scope that can contain multiple?

So, if a regular_user authenticates, but a front-end user manipulates the request, still only the role of regular_user is assigned to him? Not the roles that are defined in the scope?

Additional information

If I request a list of articles, as a regular user with scope properly set to regular_user, I see the articles (except for a field for which regular users don't have view permissions, thanks to field_permissions module).

When setting the scope for a regular user to editor_user, I don't receive any articles. Not sure if this is thanks to a security mechanism or due to a bug.

My reasoning would be that the editor_user scope does not match the user's assigned roles and hence gets removed. Which leaves an empty scope and ... ? gives the same permissions as for anonymous users? Not sure about this.
Anonymous users should see the article list too, though.


texts:
I have given alias to the above pages as

  www.example.com/node/123

(to)

  www.example.com/about

and

  www.example.com/node/145

(to)

  www.example.com/contact

When search with a keyword in google, google crawler takes this page as www.example.com/node/123 and not as  www.example.com/about. same in the case of contact page. Please advice me whether i can add Disallow : /node/ to my robots.txt to solve this issue. Will this affect my about and contact page from crawling. Will this affect only nids or the alias too. Thanks in advance.


texts: Table with sqlsrv driver is not showing headers or pagination

texts:
I just wanted to practice doing the table "header sorting" and pagination to display a Drupal 6 table using a simple MSSQL query. At the moment, the table headers are not showing and there is no pagination, but the data in the query is being displayed. Can anyone see anything wrong with the code?

/* open database connection */
include "mssqlconnection.inc.php";

/* set up the table headers */
$headers = array(
  '',
  array('image_id' => t('image_id'), 'field' => 'image_id', 'sort'=>'asc'),
  array('geo_post' => t('geo_post'), 'field' => 'geo_post'),
  array('geo_sample' => t('geo_sample'), 'field' => 'geo_sample'),
  array('gps_lat' => t('geo_lat'), 'field' => 'geo_lat'),
  array('gps_long' => t('gps_long'), 'field' => 'gps_long'),
  ''
);

/* Set up and execute the query. */
$sql = sprintf ("SELECT TOP 100 image_id,
  geo_post,
  geo_sample,
  gps_lat,
  gps_long,
  FROM images"
);

/* add the order by clause */
$stmt .= tablesort_sql($headers);

$stmt = sqlsrv_query($conn, $sql);
if ( $stmt === false) {
  echo "Error in query preparation/execution.\n";
  die( print_r( sqlsrv_errors(), true));
}

/* collecting results */

while ($doc = sqlsrv_fetch_object($stmt)) {
  $rows[] = array(
    sprintf($imgPublish . '&nbsp;&nbsp;&nbsp;' . $imgDelete, $doc->nid),
    $doc->image_id,
    $doc->geo_post,
    $doc->geo_sample,
    doc->gps_lat,
    $doc->gps_long
  );
}

$table = theme('table', $headers, $rows);
$table .= theme('pager', array(), 10, 0);

return $table;

/* Close the connection. */
include "closemssqlconnection.inc.php";


texts: Create Node contains Field collection with restws + services

texts:
I am trying to create a node with RESTFULL api using restws and services modules (latest versions) on Druapl 7 - openpublish destro.
the node contains a Field collection (images field collection field) i was trying to attache the fid returned from the /backbone/rest/files.json [POST] but the field accept nothing

JSON Sample for the field

  "field_op_gallery_image": {

    "und": [

 {
   "value": "3",
   "revision_id": "3"
 },
 {
   "value": "4",
   "revision_id": "4"
 },
 {
   "value": "5",
   "revision_id": "5"
 },
 {
   "value": "6",
   "revision_id": "6"
 },
 {
   "value": "7",
   "revision_id": "7"
 },
 {
   "value": "8",
   "revision_id": "8"
 }

      ]
       },

Can any one help , thanks in advance


texts:
I have some products type , I want when  a specify product type is in order add amount to shipping cost.
my idea was  create a rule with condition Order contains products of particular product types  ,and select action add a amount to unit price but  in  item identifier *
Specify an identifier of a commerce Line item section I try everything but returned me error.

I try commerce-order:commerce-line-items: and commerce-order:commerce-line-items:0,commerce-order:commerce-line-items:1 ,commerce-order:commerce-order-total:

but all of them return me Data selector commerce-order:commerce-line-items: for parameter commerce_line_item is invalid. error.

what I should input there ? is my idea correct way to add amount to shipping price when specify products are in order?


texts: How to set multiple default values in cshs field using form alter?

texts:
I am using cshs widget on my taxonomy entity reference field.
The taxonomy entity reference field can accept unlimited values.
I want to set the default value for this field using form alter based on a condition.
if (some_condition) {
   $form['my_field']['widget'][0]['target_id']['#default_value'] = ['target_id' => $tid];
}

This sets the default value as the first value. But I am unable to set the 2nd default value because there is no $form['my_field']['widget'][1] index.
I tried with the following code.
$form['my_field']['widget'][1] = $form['my_field']['widget'][0];
$form['my_field']['widget'][1]['target_id']['#default_value'] = ['target_id' => $tid];

It sets the 2nd default value. But then when I click on the add another item button, nothing happens.
Is there any easy way to set the default values of cshs fields?


texts: So for a file the standard url is example.com/sites/default/files/the_file.pdf how can I get rid of the leading /sites/default ?


texts:
I am currently experimenting with drupal_http_request to send my users information to a payment service - there is more configuration to be done so it is not working yet.

When I do get it successfully POSTing users details, it is important that the user is redirected to the payment service.

Can anyone tell me if drupal_http_request does redirect as it POSTs data?

If it doesn't I would appreciate suggestions on how I can achieve simultaneous POSTing and redirection.


texts: How to search the body of text by content type?

texts: Is it possible to create a view where the user enters a text to query, and the view will only display results for certain content types?


texts: Sending HTML emails from sendmail module

texts:
I was using SMTP authentication and drupal mail module for sending HTML emails.

Suddenly emails are not going. Hence i disabled the SMTP module and directly send emails using drupal email but emails are not receiving in HTML format.

//Email hook function

function caps_lead_mail($key,&$message,$params) {
switch ($key) {
  case 'send_link':
    $message['headers'] = array_merge(
      $message['headers'], array(
        'Content-Type' => 'text/html; charset=UTF-8; format=flowed',

    'bcc' => $params['bcc'],
  )
);
$message['subject']=t($params['subject']);
$message['body'][]=$params['body'];

break;
}
}
//Sending html email
     $sender = "ce.com";
     $subject ="Weekly Report of new profiles and visit log";
     $message = '<h4>No new profiles and visit log </h4>';
     $message .= "Note: This is auto generated Email please do not reply to this Email.";
     $params = array(
     'body' => $message,
     'subject' => $subject,
     'headers'=>'simple',
     'bcc' => 'ce.com',
   );
      $to = "ce.com";
      drupal_mail('caps_lead', 'send_link', $to, language_default(), $params, $sender, TRUE);'


texts: Content pane of users related to node by field using panels, views (D7)

texts:
I've created a Content Type of Service Page which is the same as a Basic Page.

I added a new field to Users called service_type and then added this field to Service Page. I set the service_type in both Users and Service Pages appropriately. When a Service Page is displayed I would like a list of the Users with the same service_type to appear below it.

I thought this would be a perfect place for Panels and Views so I made a Content Pane of Users:

Argument Input -> From context -> service_type

Contextual Filter -> Field: service_type

I added this Content Pane to my Panels Node and set Field: service_type to Node being viewed.

Doesn't work though; in fact, nothing appears. If I delete the Contextual Filter I do however get the full list of users, so clearly this is where the problem must be.

Can anyone point me in the right direction?

Views 7.x-3.1, Panels 7.x-3.0


texts:
I am building a fairly simple module, and I am trying to set up a block, but it doesn't appear. I can't figure out what is wrong with my code.

function quick_links_block_info() {
  $blocks['quick_links_staff'] = array(
    'info' => t('Quick Links'),
    'status' => 1,
  );
  return $blocks;
}

function quick_links_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'quick_links_staff':
      $block['subject'] = t('Quick Links');
      $block['content'] = quick_links_get_links();
      break;
  }
  return $block;
}

function quick_links_get_links($department = '') {
  return t('Hi');
}


texts:
I am having site built in Drupal 7 and in future I want to migrate my site to Drupal 8.

How can I write hook_menu() and hook_menu_alter() to routing.yml files?


texts: How to trigger a Rule when content is viewed with Panels activated?

texts:
Easy problem: when users visit a node page on my website, one of the node's integer fields should be changed. Answer: Rules. Now comes the tricky part...

I installed Panels and enabled the node template node_view via the Pages UI. I added the Pane "Node being viewed" content (build mode: Full content), but none of my Rules with an event Content is viewed is triggered anymore on the node pages. After searching around a whole day on the internet, I think my problem is a classic, but I didn't find a clear answer anywhere. Hopefully, we can get over it here once and for all.

Here are some things that I tried so far:

This comment suggested to disable the No extras option in the Pane's settings (which works), but that also renders the comments, comment form, etc.; which is not what I want, since I add those as separate Panes.
Combining the power of Conditional Rules and Rules URL Argument. The general idea is to check on Drupal is initializing whether the path starts with node, save the nid arg(1) as a variable, load the node and make the necessary changes afterwards. Unfortunately, I couldn't find a way to use the nid in the path without using custom PHP (I want to avoid that).
Forgetting about Rules and trying to code is also fine for me, but I haven't found the correct hook yet. Using hook_node_view doesn't work, because it doesn't get called (that's precisely why the Rules aren't triggered). I also tried to use

function hook_init() {
  if (arg(0) == 'node') {
    $node = node_load(arg(1));
  }
}

in my custom module, but that results in some theme related errors, so I'm afraid that my node templates are getting messed up by this. Lastly, different sources referred to hook_ctools_render_alter, so that seemed promising. Though, after some debugging, I quickly gave up trying to understand how this hook works. If this is the correct way to go, I would like to have some more information about the hook or some example code.

Do you have any suggestions to fix this frustrating problem?

Note: I'm using the currently latest versions of all modules, i.e. CTools 1.11, Panels 3.8 and Rules 2.9.


texts: #states doesn't work with Aggregate JavaScript

texts:
Recently I have encountered the strange behavior of setting form created with Form API in Drupal 8.

I am using #states to hide one of the form elements ( radios ) when another element is empty. The problem is - it doesn't work with Aggregate JavaScript files option. After you submit the form, this element is still visible - even if condition to hide it is fulfilled.

When I disable Aggregate JavaScript files option, it works as expected - radios are hidden.

Is there anything I can do to solve this problem?


texts: ignore exposed filter on taxonomy combination

texts:
I have a view which show a list of downloads(saved as node).

And I have a exposed filter for the title, category (tax), language (tax).
Because not all files are available in native language, I would now like to achieve the following:

No matter what language is selected in the filter, all files wich are exactly the language combination DE,EN should always be visible(non DE, EN, FR or otherwise but only DE, EN)

As example:

Data:

File1-kat1-EN
File2-kat1-DE,EN
FileX-kat1-DE,EN,FR

If I filter by EN, I want to see File1 and File2.

If I filter by DE, I want to see File2.

If I filter by FR, I want to see File2 and File3.


texts:
I'm writing a custom module to obtain an online quote.

The form has an additional button and once it is clicked, a database query runs and print a value.

//My code for custom button
function garden_form_alter( &$form, &$form_state,$form_id ){
if ($form_id == 'webform_client_form_4208') {
$form['actions']['garden_quote']  = array(
    '#type' => 'submit',
    '#value' => t('Get online estimate'),
    '#submit' => array('mymodule_custom_submit'),
);
$form['#validate'][] = 'mymodule_custom_validate';
}
}

//Custom submit handler
function mymodule_custom_submit($form, &$form_state) {
$query = db_select('gardenvalue', 'f');
$query->fields('f', array('total_cost'))
    ->condition('meters', '2', '=');
$result = $query->execute();
dpm($result);
}

Once the form has been submitted dpm shows the 'meters' value as'db_condition_placeholder_0' and not number 2. What can be the reason?

Also I would like to show the $result value on a new text field once the form reloads. If we assume this new text field key is 'total_garden' how can I change its' value to $result on form reload?

Thanks in advance!


texts: How to turn off " " surrounding vars in the output of t()?

texts:
In my module I display a menu inside a block using drupal_render(menu_tree('my-menu')).

In the output the variables printed with t() are surrounded by  .

Drafts (4)
Inbox (2)

How do I turn this off?


texts: node_overview_types no hook? how to customize

texts: Ok, i'm finally starting to understand how to use hooks! I am trying to customize the table that appears on admin/structure/types  I would like to add a custom link between manage fields and manage display.  I have tracked the creation of this down to the node_overview_types function in content_types.inc.  I did not see any hooks like hook_theme_table.  My initial response was to look for a hook_table_alter but I did not see one in the drupal api. Any help would be appreciated.


texts:
I have a multistep form with mforms in forth step my form have fivestar field from a review node content type.
All fivestar field display option are set to basic, but fields are displaying differently.

I tried to change the display widget in my module, with no luck. If i try to change the widget it returns to defaults.

Any suggestion are welcome. thx

function _reviewform_step4(&$form_state, &$next_step, $params) {

    $form = array();

    //attaching existing content type fields
    $review = new stdClass();
    $review->type = 'review'; //content type

    field_attach_form('node', $review, $form, $form_state);

    foreach ($form_state['field'] as $field) {
        if ($field['und']['field']['type'] == 'fivestar') {
            $field_name = $field['und']['field']['field_name'];
            // not working
            $form[$field_name]['und'][0]['rating']['#settings']['widget']['name'] = 'flames';
            $form[$field_name]['und'][0]['rating']['#settings']['widget']['css'] =     'sites/all/modules/fivestar/widgets/flames/flames.css';
            // not working to
            $form[$field_name]['und'][0]['rating']['#widget']['name'] = 'flames';
            $form[$field_name]['und'][0]['rating']['#widget']['css'] = 'sites/all/modules/fivestar/widgets/flames/flames.css';
        }
    }


texts: view to work for particular set of taxonomy terms

texts:
Case: I have a taxonomy vocabulary namely 'categories'. It consists of some parent terms with their child terms as shown.

 Parent1

 -p1child-1

 -p1child-2

 Parent2

  -p2child-1

  -p2child-2

I want to create a view which work only for a particular set.

Suppose in this case I will create 2 views, each for both parent terms and both will have different set of exposed filters and sort criteria.

So if I visited taxonomy/term/parent1 or taxonomy/term/p1child-1 or  taxonomy/term/p2child-2, it would render that specific view of parent1.

is it possible ?

Please help


texts: Visibility problem with 'restricted to certain pages'

texts:
I'm porting a site from D6 to D8 and having problems with block visibility for listed pages. I have a config like this which worked on D6:

news
news/*

And pages like /news/op-ed-suu-kyis-plan-outsource-myanmars-presidency-problems-proxy would match and display the block. In D8.1.2 I have the same rules, but the migrated page with the same URL doesn't trigger the block. If I remove the rules, the block displays again, so it's definitely something here.

Am I missing some changes in how D8 handles these rules? or is it maybe something with URL aliases?


texts: Check new form-input against old form-input

texts:
I have added some extra options in the My Profile page which users can edit. But now I have to track down the change of this value...

It's a checkbox and whenever the user (un)checks this box, something must happen. So I thought this would be in the $form_state, but no luck there.

Next thing I did was to preform an EntityQuery on the user object and try to cross-reference it with the input, but again, no luck.

So how can I (programmatically) detect if a form-element goes from unchecked to checked or the other way around?

EDIT: What I try to do is an implementation with Campaign Monitor (a newsletter plugin). If a user has changed it's checkbox, his subscription must be updated (of leave it as it is when there is no change)


texts: Drupal menu callback create node permissions

texts:
I am creating a small menu, where I want to give access to a menu item when your are an authenticated user.

So I gave permission to authenticated users to create nodes of the type 'donation', but how would I formulate that in the menu acces arguments ?

$items['donate/%'] = array(
    'title' => 'Donate',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('get_donate_form'),
    'access arguments' => array('create donation'),
    'type' => MENU_CALLBACK,
);


texts: Is it possible to create a Nodequeue of Nodequeues?

texts:
I have a number of node queues that serve as collections of nodes. I want the user to be able to take those collections (node queues) and add them to a queue, essentially allowing the user to have a node queue of node queues. Is this possible? If not, are there ay recommendations on how I might implement something like this?

also, I'm using drupal 7


texts: Views 3: how to list users related to nodes category and exposed filter by that category

texts: I need to list the node authors based on node category and also expose filter with that category. Can any one tell me how to solve this issue?


texts: How can I integrate solr with a existin view?

texts:
I have a question on how to integrate a solr search page to an existing view, because I bought a theme and they have a great view for search in a specific content type and I want to add to that view facet filters and solr search core, how can I do that?

Thanks!


texts:
I use the following code to add some filter fields to the search form in a module:

function mymod_form_search_form_alter(&$form,$form_state,$form_id) {
    $q=drupal_get_query_parameters();
    if(isset($q["filter"])) {
            $values=[];
            foreach($q["filter"] as $k=>$v) {
                    if($v!=0)
                            $values[]=$k;
            }
    } else
            $values=[1,2,3,4];

    $form["filter"]=[
            "#type"=>"fieldset",
            "header"=>["#markup"=>"
Filtern nach
"],
            "checkbox"=>["#type"=>"checkboxes","#options"=>[1=>"Ausschreibung",2=>"News",3=>"Projekt",4=>"Experte"],"#default_value"=>$values],
            "submit"=>["#type"=>"submit","#value"=>"Anpassen"],
    ];
    $form["#submit"][]="mymod_search_form_submit";
}

When I now load the site once, the search form includes said filters. One drush cc all later (or when I post a new content) however the field disappears and I have to manually empty the cache_form DB table to make the field reappear temporarily.

Once I disable the caches with DrupalFakeCache however, I don't have that problem at all but site performance basically vanishes.

How do I fix that cache issue?


texts: How do I show the image in a node enlarged?

texts:
I use the TinyMCE editor as site's editor. When I publish an image, I want the users click the image to view it enlarged.
How can I do this? The image is not a field; it is an image in the node.