texts:
I use Taxonomy with Contextual Filter, so I can categorize content (nodes), associating taxonomy terms to each content, and filter them in a View.

I can have a node and 2 different vocabularies, lets say A = {1,2,3} and B={a,b,c}. I can, by default in Drupal usual behaviour, associate a node with multiple values of A and B, lets say that node Nid has associated 1,2 and a,b.

What I need, if it is at all possible, is to have paired associations, i.e., not only 1,2 and a,b separatedly, but in combination. Let's say
{1,a} and {2,b} and the contextual filter or equivalent, if looking for {1,a} will return the node, but if looking for {1,b} it will return nothing. Of course, {1,all} would have to return the node.

Is there such a module or behaviour in Drupal 7 ?

Note: the problem does not lie with the search or filter part. The very basic problem is how to assign a combined value to the node, in the very first place. Later I will face the problem of looking for or filtering for that data. But I don't know how to merge both taxonomy fields into one, so the node is assigned to {1,a} and not to "1" and "a" separatedly.


texts:
I've a Drupal 8 (8.5.4) site  which is using a custom created on top of Bootstrap Barrio. I'm using Easy Breadcrumbs module. Here is the configuration I used.

Easy Breadcrumb settings

The default homepage in /admin/config/system/site-information is set as node.
Nothing is added in "No Results Behavior" for the view "FrontPage"

The problem is when I go to http://localhost (place where my site is hosted), the breadcrumbs are not rendered. I'm expecting it to show the text "Home" in the breadcrumb region, as configured in Easy Breadcrumb settings. However on rest of the pages, the breadcrumb shows the breadcrumb for the page preceded by Home.


texts: How can I catch the current node object and make changes into it before it is rendered?

texts:
I have a content type with multiple fields.

On the node display page I want to do some modification on this node (like. changing label text etc.) and I want to do it for display only. Nothing should change in the database.

I want to know how can I do this? Where exactly can I catch the current node object and make changes into it before it is rendered?


texts:
I am wondering if Drupal 7 commerce support the multistep checkout via hook or contrib modules, the target was I have products that is subscription based and once user select lets say product a before he can add to cart he needs to select how many months of subscription he wants after selecting that he can then press the select plan then move to another page to select attributes of the product items that is limited to 2 option or more then after he select and continue he will be on the page of customer info and last step was payment,

So basically it's a 4 page process.

Is this achievable? Can I setup the product types to accommodate subscriptions, with attributes?


texts:
I've created a glossary page with the view module and for now i can display some nodes by clicking on their first letter. What i want is to display all nodes before the click and then be able to sort them with a letter or a filter. Can't find any options to do this in the view.

I'd also like to know if i can modify this page directly by programming it, i don't find the file who contain the glossary page.


texts:
I have created a new content type and I called it Opinion. Then using views, I have created a page with path /opinion to be a view for all nodes of type Opinion listing i.e. a master page.

The problem is that I could not able to access a the details something like /opinion/the-node-title. however, It accesed like content/the-node-title

I tried to create a new page from the regarded view with contextal filter Content title it works fine using direct access from the browsers address bar. I tried to rewrite the content on the linked title field but I could not able to find a suitable token:

[title]---

i.e I could not find any way to convert title into a slug.

Another thing for SEO, I don't want the same content to be accessed from more than one resource i.e in my case content/the-node-title and opinion/the-node-title


texts: Turning user email into a configurable field

texts:
I am using drupal 8 and am running into an issue with the field entity_field:user:mail. This field is available on users, but not visible to users other than Administrator and the user itself, or usable in views or the display. I can access it through Panelizer, but again, nobody but Administrator has access to view it. I want to display it on the user profile page (which I created using panelizer), so all I really need is to be able to set the permissions for the field. Since it's only a base field, the https://www.drupal.org/project/field_permissions module doesn't help either.

Does anybody have a clue how to make the field configurable? I was looking at the API docs on https://www.drupal.org/docs/8/api/entity-api/defining-and-using-content-entity-field-definitions but it's hard to see the forest through the trees there.

Any pointers as to how I can either do this with an existing module/configuration (probably not) or which hook I need to look at to modify the field to become a configurable field? If I need to create a module for it, it's fine, but if I can do it on the theme level, it would be better (already have a custom theme anyway).


texts: How to propely add views grouped filters with exposed filter in one of them

texts:
I have a views with grouped filters like this

Group 1
field_1_condition
AND
field_2_condition (exposed)

OR

Group 2
field_3_condition
field_4_condition

I am expecting it to work like this:
Filtering is done based on the first group and input comes from user to the exposed  filter field. Then I want the query to check the second group and add all the matching things from there.

The initial query seems to be correct but as soon as I give input to exxposed filter the query is wrong. Views tries to combine similar fields for some reason

Initial query with those groups:

SELECT DISTINCT node.title AS node_title, node.nid AS nid, node.language AS node_language, og_membership.gid AS og_membership_gid, node.created AS node_created, 'node' AS field_data_field_event_date_node_entity_type
FROM
{node} node
LEFT JOIN {og_membership} og_membership ON node.nid = og_membership.etid AND og_membership.entity_type = 'node'
WHERE (( (node.type IN  ('birthday_event')) AND (og_membership.gid IS NULL ) AND (node.status = '1') )OR( (node.status = '1') AND (node.type IN  ('event')) ))
ORDER BY node_created DESC

The query when exposed filter gets input

SELECT DISTINCT node.title AS node_title, node.nid AS nid, node.language AS node_language, og_membership.gid AS og_membership_gid, node.created AS node_created, 'node' AS field_data_field_event_date_node_entity_type
FROM
{node} node
LEFT JOIN {og_membership} og_membership ON node.nid = og_membership.etid AND og_membership.entity_type = 'node'
WHERE (( (node.status = '1') AND (node.type IN  ('event', 'birthday_event')) AND (og_membership.gid = '1') ))
ORDER BY node_created DESC

This is the image of my views filter settings


texts:
I'm using Drupal 8. I have a content type of “course”. Each course should have a “Banner” block in it that we can upload different background images to (per course).

I've created a “custom block type” of Banner and in this block type I have fields for “desktop image file”, “tablet image file” etc. I then created a “block” called Banner that uses this “custom block type" of Banner. Then, I added the block to the top of the “Content region” and set it to display for the course content type only. I can then see the block on the course pages. So far so good...

However, if I alter the text in the block, it changes the text on all pages... how do I configure it so that I can change the text and images I upload per course/page? Thanks in advance! (Hoping the answer doesn't involve installing extra modules).


texts: Is it safe to change INT to BIGINT or DECIMAL in database?

texts:
I need to change a field from INT to BIGINT or DECIMAL. I tested changing it directly in the database on field_data and field_revision tables and apparently all is working fine, but I have my doubts and I don't want to do that on production until I'm entirely sure it's safe. It's enough to change the data type on database or I have to do something else like the solutions listed in the links below? If it's not safe to just change it in database, I'd like to know why.

change field from int to big int in drupal
How to change a field type from Integer to Decimal?
field is Integer and I am getting PDOException error thrown


texts: Need CKEditor to encode special characters

texts:
I would like CKEditor to encode all special characters. Currently it only html escapes >, <, and & I believe.

I need the current html markup of this

Let's take a "ride!"

to become something like this

Let&rsquo;s take a &ldquo;ride!&rdquo;

In this situation, the Let's take a "ride!" is still what would display to the user, but the html should reflect the encoding so my styling is properly applied.

I am seeing that Drupal 7 had a config.js file that could be modified to accommodate this; however, Drupal 8 does not have this by default and does not seem to recognize it when one is created.

Does anyone know how I can make this happen?

EDIT: our content authors are using the Basic HTML editor permissions.


texts:
We use commands:

composer outdated drupal/*
drupal/core 8.6.10 8.6.13 Drupal is an open source content management platform powering millions of websites and applications.

It does show 8.6.13.

We run either composer update drupal/core --with-dependencies or composer update drupal/core:8.6.13 webflo/drupal-core-require-dev --with-dependencies and we get nothing, it does update some dependencies and that is it. Our site is built with composer.

Here's the rest of the log:

composer update drupal/core:8.6.13 webflo/drupal-core-require-dev --with-dependencies
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Package "drupal/core:8.6.13" listed for update is not installed. Ignoring.
Dependency "drupal/core" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "twig/twig" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 5 updates, 0 removals
  - Updating symfony/css-selector (v3.4.22 => v3.4.23): Loading from cache
  - Updating symfony/phpunit-bridge (v3.4.22 => v3.4.23): Downloading (100%)
  - Updating symfony/dom-crawler (v3.4.22 => v3.4.23): Downloading (100%)
  - Updating symfony/browser-kit (v4.2.3 => v4.2.4): Downloading (100%)
  - Updating squizlabs/php_codesniffer (3.4.0 => 3.4.1): Downloading (100%)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
root@dev /var/www/example.com # composer update drupal/core
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles
root@dev /var/www/example.com # drush status
 Drupal version   : 8.6.10
 Site URI         : default
 DB driver        : mysql
 DB hostname      : localhost
 DB port          : 3306
 DB username      : root
 DB name          : example
 Database         : Connected
 Drupal bootstrap : Successful
 Default theme    : seven
 Admin theme      : seven
 PHP binary       : /usr/bin/php7.2
 PHP config       : /etc/php/7.2/cli/php.ini
 PHP OS           : Linux
 Drush script     : /usr/local/bin/drush
 Drush version    : 9.4.0
 Drush temp       : /tmp
 Drush configs    : /var/www/example.com/vendor/drush/drush/drush.yml
                    /var/www/example.com/drush/drush.yml
 Install profile  : standard
 Drupal root      : /var/www/example.com/web
 Site path        : sites/default
 Files, Public    : sites/default/files
 Files, Temp      : /tmp

Drush is still reporting 8.6.10

First time we did get the WSOD from https://www.drupal.org/project/drupal/issues/3039408 so we ran composer require twig/twig:1.37.1 to fix it.


texts: Solr search schema compatible with solr server 5.1

texts: I am using Drupal 7 with Solr search (search_api_solr)7.x-1.6. I have a solr server version 5.1. How to make the 4.x config compatible with the solr server config 5.x?


texts: Can't uninstall "Translation Language capabilities (tmgmt_language_combination)" dissabled ALL translation modules that might be dependant

texts:
I've tried drush, I disabled i18, ALL fields, multilingual, entity translation, l10n, everything about translation is disabled.

How can I completely get rid of this module, it's caused nothing but griefwith patches and bugs...


texts: How to create a Class that I can reuse in multiple modules?

texts:
I would like to create a class that has a set of methods that I want to reuse across the site in either mytheme.theme or secondmodule.module files.

How would I create this class and class methods so that they can be used in multiple areas? Would I have to create a custom module for this?

Here is what I was trying so far, but need assistance on next step.

<?php
namespace Drupal\CustomClass;

class MyClass {
  public static function processEntity($var1, $var2) {
    /* process the parameters */
    return value;
  }
}

If I wanted to use this in a mytheme.theme file I was thinking to do this

<?php

use Drupal\CustomClass\MyClass;

function _some_function() {
  /* processing logic here which results in $var1, $var2 */
  $results = MyClass::processEntity($var1, $var2);
}


texts:
I have installed node count view module and configured it.

But it's not showing me anything anywhere in my site. And I am not getting the setting of node count view.

Any suggestions about where I can see the 'node counts'?


texts: Show taxonomy term's image field on node page

texts:
Ive added an image field to my taxonomy terms. On a node I need to display the image of the terms it tagged with.

Ive created a view with the NID as an argument and attached it to the node content type with the EVA module.

Ive added a relationship of 'Taxonomy terms on node'. This allows me to add 'Content: All taxonomy terms' as a field which shows the term name, but I cant figure out how to load the term's image instead.


texts:
I have installed Role Expire module but how can I set its expire date?

Can anybody please help me because I don't get any clue to write expire date for a particular role?


texts: "CiviCRM Upcoming" block displaying old events

texts:
Currently running Drupal 7.61 with CiviCRM 5.7.2.

We have the "CiviCRM Upcoming" block enabled in our sidebar, however it continues to display events after their start date.

I've been fixing this by manually going into CiviCRM and disabling events which have passed, but ideally would like the Upcoming Events block to only display events which are actually upcoming (as I read it should here: https://wiki.civicrm.org/confluence/display/CRMDOC46/Event+Listings)

Thank you in advance!


texts:
I'm using WebSpeech API to allow users speech recognition on my site. I'm using example 3 on this page: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html.

My code looks like this:

function _google_speech_speak_form($form, &$form_state) {
$modulepath = drupal_get_path('module','google_speech');
$form['textarea'] = array(
    '#type' => 'textfield',
    '#title' => t('Speak It'),
    '#prefix' => '
',
    '#suffix' => '
',
   );
$form['button'] = array(
    '#type' => 'button',
    '#attributes' => array('onclick' => 'return (false);'),
    '#value' => t('Click to Speak'),
   );
$form['submitt'] = array(
    '#type' => 'button',
    '#value' => t('Save'),
   );
$form['#after_build'] = array('_google_speech_speak_after_build');
return $form;}

function _google_speech_speak_form_submit($form, &$form_state) {
$speechkey = $form_state['values']['textarea'];
drupal_set_message($speechkey);
echo "test";}

function _google_speech_speak_after_build($form, &$form_state) {
drupal_add_js(drupal_get_path('module', 'google_speech').'/webspeech.js');
return $form;}

Webspeech.js:

 Drupal.behaviors.[google_speech] = function(context) {
 $('#edit-button').click(function() {
  var recognizing;
 var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
reset();
recognition.onend = reset;

recognition.onresult = function (event) {
  for (var i = resultIndex; i < event.results.length; ++i) {
    if (event.results.final) {
      textarea.value += event.results[i][0].transcript;
    }
  }
}

function reset() {
  recognizing = false;
  button.innerHTML = "Click to Speak";
}

function toggleStartStop() {
  if (recognizing) {
    recognition.stop();
    reset();
  } else {
    recognition.start();
    recognizing = true;
    button.innerHTML = "Click to Stop";
  }
  }
 });
 };

I referred to this question: How to make form buttons call only javascript?
The "toggle" button is not refreshing the page (which is good) but it's also not toggling speech recognition like it should. There are no errors on the screen or in the logs. Any ideas?


texts:
I am trying to set a custom theme suggestion for the item-list template. It does work but I am getting an error message:

User error: "attributes" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).

Function:

function MYTHEME_theme_suggestions_item_list_alter(array &$suggestions, array $variables) {
  $moduleclass = str_replace('-', '_', $variables['attributes']['class']);
  $suggestions[] = 'item_list__' . $moduleclass;
}

Not sure what the probleme is here?


texts: Is it possible to create (and update) a nodequeue based on results from a view?


texts: Altering Views Exposed Form Elements and their Associated Labels

texts:
I have a series of Views Exposed Forms across a Drupal 8 website. My goal is to generate unique template suggestions so I can theme each individual input and their labels differently as needed.

Here is my current approach. Placed into theme.theme.   I've hit a brick wall.

function HOOK_form_views_exposed_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
    $form['#attributes']['twig-suggestion'] = $form['#id'];
}

function HOOK_theme_suggestions_input_alter(&$suggestions, array $variables) {
    $element = $variables['element'];

    if (isset($element['#attributes']['twig-suggestion'])) {
      $suggestions[] = 'input__' . $element['#type'] . '__' . $element['#attributes']['twig-suggestion'];
    }
}

function HOOK_theme_suggestions_form_element_label_alter(&$suggestions, &$variables, $hook) {
    $element = $variables['element'];

    if (isset($element['#attributes']['twig-suggestion'])) {
      $suggestions[] = 'label__' . $element['#attributes']['twig-suggestion'];
    }
}

All input and label [#attributes] are null via Kint.
Here are the URLs I have referenced for background:

1) http://kevinquillen.com/drupal/2017/01/28/adding-twig-template-suggestions-for-form-elements

2) https://www.chapterthree.com/blog/how-to-create-custom-theme-suggestions-drupal-8

3) https://yellowpencil.com/blog/getting-granular-with-drupal-eight-forms/


texts:
I tried to remove "read more" link from the "basic page" content type.
In Structure -> Content types -> Basic page -> manage display I checked "full content" and unchecked everything else and this didn't help.
Where am I doing mistake?

I found in another question the possibility to edit the template file, but I would rather do it in the settings.

thank you


texts: How do I retain user input in a form after submission?

texts:
I am working on a simple form for searching a collection of marriage licenses. It consists of a select box where the user may choose to search last names, first names, or both, and a text field where they type the name they're searching for.

Everything is working fine so far, except that the user input is not retained after the form is submitted.  For example, if I choose "Last names" and enter "Olsen", after the form is submitted the search box will be empty and the select box will revert to its default of "Both first and last names".

Here is my buildForm() method:

public function buildForm(array $form, FormStateInterface $form_state){
    // The select box.
    $form['target'] = [
        '#title' => $this->t('Search'),
        '#type' => 'select',
        '#options' => [
            'both' => $this->t('Both first and last names'),
            'last' => $this->t('Last names'),
            'first' => $this->t('First names'),
        ],
        '#default_value' => $form_state->getValue('target'),
    ];

    // The search box.
    $form['q'] = [
        '#title' => $this->t('for'),
        '#type' => 'textfield',
        '#default_value' => $form_state->getValue('q'),
    ];

    $form['actions'] = ['#type' => 'actions'];

    $form['actions']['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Go'),
    ];

    return $form;
}

As you can see, I've tried using #default_value to set a default value by calling the form state to get whatever the user picked/entered.  But alas, this does not seem to have done it.

How do I get it to display the user input in the form after submission?


texts: How can I detect what control caused AJAX callback?

texts:
I have a form containing a table, which displays rows from a database table, and has a couple of editable fields, which is all working fine.

I now want to make one of fields trigger an AJAX callback when changed, and the callback to update another field in the same row.

Can the callback function check which instance of the changed field triggered the callback, so it knows which row to update?

Thanks for your help, and happy new year!

James


texts:
My scenario is as follows:

I'd like to create 2 node types "public file" and "private file".  Each node type has the file field for file uploads.  I would like the ability to assign user permissions to any file that is uploaded to the private node type.  The users would be managed through the Drupal User module.

Thanks in advance!


texts: Quickest Way To Create a Pre-Register Form

texts:
I'm looking to allow users to "Pre Register" for a new site (actually I'll use this for a standard 'template' process), I want to get users to sign up so I can keep them informed of news, updates etc on launch and want to get this function installed quickly. I'm not really want to 'hack' template.php at this stage (later maybe with ongoing development) so just need a really simple approach which will sign them up, subscribe to a newsletter and give registrants the normal 'subscribe/'unsubscribe' from within email contents. I have two roles, so can code the layout with simple "Sign Up" links going to relevant registration forms. In your opinion, what would be the best approach, maybe I should use a Rules structure (and tie in things like Coupon Codes/incentives) or would you suggest a different process?

PS:
Just like to add, that I use a process for pre-registration users to sign as up as such: 1st level - as a 'temp' role, then the user cannot go any further until they join one of either 2 roles (one free, one paid for services).

In following the accepted response below, I'll set the Notify up for a 'temp 'user then the user can choice on 'launch'  the Role route they wish to sign up for. Hope that helps readers. (-:


texts:
I want to add line breaks in title field
I managed to use the replace functions in the template >

{{ node.getTitle()|replace({'|': '<br />'}) }}

Replacement works, but outputs the field as non-HTML. Do you know about a way to force an HTML output? Or any other way to be the  a real line break instead?


texts:
In my theme on Drupal 7:50 there is #banner just beneath #menu. For #banner I have made {border-bottom:5px solid blue} The problem is that sometimes #banner is empty and then the #border remains and goes up beneath #menu and that kills the layout.

Is there a way to #banner{display:none} if "banner is empty by using PHP or how to do it. All suggestions are welcome. Killing the border with JS and CSS if #banner height is below 5 ?

Hans


texts:
I want to print a custom module in a type of content already created through the interface. Is there any way to print it?

I have seen that one of the ways in drupal 7 to print the module is by using the 'module_invoke' function, is there any equivalent in drupal 8 to print in a twig template?

Thanks!


texts: Node.tpl.php file: Check is several fields are empty

texts:
On my node, I have three location fields (primary, secondary, code) and three object fields (food, fuel, accommodation).

I want my node.tp.php to check if all the location fields are empty or if all the object fields are empty and then print a message.

How can I do this?

Steps I have tried

1. Checking if the fields are empty.

This post says you can check if a single field is empty with the following code:

$field = field_get_items('node', $node, 'field_post_image');
if ($field) {
//Do something with the field
}
else{
//There are no results
}

I have adapted the code by adding the fields to an array and then testing to see if the array is empty:

<?php $empty_message = "No items here, click edit to add some.";?>

<?php
$field = array();
$field[]= field_get_items('node', $node, 'field_primary');
$field[]= field_get_items('node', $node, 'field_secondary');
$field[]= field_get_items('node', $node, 'field_code');

if (empty($field)) {
print $empty_message;
}
?>

<?php
$field = array();
$field[]= field_get_items('node', $node, 'field_food');
$field[]= field_get_items('node', $node, 'field_fuel');
$field[]= field_get_items('node', $node, 'field_accomodation');

if (empty($field)) {
print $empty_message;
}
?>

But it doesn't seem to work. The original post actually says this is the wrong way to check if fields are empty, but I'm not sure how to adapt the suggested code.

2. Using Field Group

I would prefer not use this module, as it adds too much complexity for my needs.


texts: Missing "operation links" from all content list page

texts:
I am currently missing the links that appear next to a piece of content on admin/content, the ones that say "edit / delete" etc.
I have all permissions enabled for the user I am logged in as, and I can still edit a piece of content if I go to view it first, just not on the list page.

Any ideas of what could be causing this?

Thanks


texts: Why does drupal_session_start fail after a user clears cache then logs back in?

texts:
I'm writing a document management module which has come pretty far and is almost ready for a final review and release, but I've found a really strange authentication issue that is requiring a gross work around.

Several actions in my module are handled via AJAX. I need to authenticate my user when I run the AJAX protocol. I also need to get the drupal core functionality so I'm using the following code:

// Bootstrap Drupal
define('DRUPAL_ROOT', dirname(dirname(dirname(dirname(dirname(__FILE__))))));
require_once( DRUPAL_ROOT . '/includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// Validate the user
_drupal_session_read($_POST['sid']);
drupal_session_start();
if ( ! user_access('manage documents') ) {
    die('Access denied');
}

$_POST['sid'] contains the value from session_id() or $user->sid. They should be the same thing, but if I clear my cache, log back in, go to the page, and run any AJAX action, I will get permission denied on the first request every time. My ugly work around is to send a "checkin" action that just triggers the access denied because once it happens once, it doesn't happen again.

Can anyone explain to me why this code would behave this way?

Thanks!


texts: Sync two Drupal sites with Drupal_sync module

texts:
I have two Drupal 7 sites: one, local dev portal (.0.101), and two, remote copy portal (.0.100), which in certain moment was desync. In both there new nodes and users creates, and in dev there are new modules and conf apply too.

I'm trying to use Drupal Sync module (I reached it from here) to sync both, but don't work.

In remote copy, Drupal_sync complains about settings

  Drupal sync settings is wrong. Check settings and site domain here.

, but I revised it a dozen.

Settings (A=dev, B=remote copy):

Domain 1: (A) localhost; (B) localhost

Count http requests (if receive fail) * (A) 10; (B) 10

Frequency of updates * (A) 5 mins; (B) 5 mins

Could of updates per request * (B) 20 ; (B) 20

Sync entities: same marks on both machines.

Site remote: (A) mucharuina_qnap ; (B) local_maclobo

 URL: (A) http://192.168.0.100/drupal7_qs ; (B) http://192.168.0.101/drupal7

Login Same user for two sites.

Contraseña (Idem)

Choose term for sync rules (Idem)

I follow instruction in Drupal sync module but it don't work. After run initial setup, it "say" that there are changes to sync but it don't do.

I see this in register on B machine:

Detalles

Tipo drupal_sync

Fecha Jueves, Agosto 1, 2013 - 17:57

Usuario admin

Ubicación http://192.168.0.100/drupal7_qs/admin/modules/list/confirm

Referente http://192.168.0.100/drupal7_qs/admin/modules

Mensaje Site: 192.168.0.100 has wrong settings.

=============================================

Operación: Update to remote site

Gravedad aviso

Nombre del servidor 192.168.0.101

Operaciones

Detalles

Tipo drupal_sync_initial_setup_error

Fecha Jueves, Agosto 1, 2013 - 18:09

Usuario admin

Ubicación

http://192.168.0.100/drupal7_qs/admin/config/drupal_sync/drupal_sync_ini...

Referente

http://192.168.0.100/drupal7_qs/admin/config/drupal_sync/drupal_sync_ini...

Mensaje

local_maclobo
10
Creación de un diario-e: motivación, intención y temática
array (
8 => '¡Hola Mundo!',
10 => 'Creación de un diario-e: motivación, intención y temática',
)

Gravedad aviso

Nombre del servidor 192.168.0.101

Operaciones

Last, I can't see something in Sync Manager queue section, but relations section shows too much of them.

Anyone can help me with this module? Or, another way to sync two sites?

Thanks in advanced, and sorry for my poor english.

Best regards.

R. Gómez


texts: How to link 'no result behaviour' to node?

texts:
When editing a view, i'm faced with a difficulty.
There's an image field, in the field settings i set the images (submitted when creating the node) to be linking to the node.
The problem is that in set up a default image in the no result behaviour setting.

<img alt="No Image" class="no-img" src="/sites/default/files/img-custom/no-image.gif" height="190px" />

I'd like this 'default image' to be linking to the node as well.

Any ideas on how to do this ?


texts:
I have updated my core to 8.9.0, all modules are Drupal 9 compatible and now I want to upgrade to Drupal 9.0.0. I always did my updates completely manually via FTP/web (swap core/vendor/root files, no SSH/drush/composer).

But for 8 to 9 drupal.org has only instructions using drush or composer, unlike the update instructions for Drupal 8 which had an instruction for how to do it manually.

Upgrading from Drupal 8 to Drupal 9 (or higher)
https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-to-drupal-9-or-higher

Is there no way to upgrade manually, without SSH/Drush/Composer?


texts:
I'm using the Feeds module and entity references heavily on my site to add, update, and link content. Unfortunately, the data I'm using has a number of records that are named the same, which causes issues when matching Entity References through GUID.

Is there a way to import entity reference fields through Feeds but using title and content-type instead?


texts: Difference between theme.info and drupal_add_js ( jquery-2.0.3 )

texts:
On a fairly new drupal (7.23) site I tried including the jquery-2.0.3.js file with the drupal_add_js function in one of my modules hook_init function.  All was working good and well when I was testing the login screen but then I went to some others pages, I got this error in firebug console:

TypeError: $(...).add(...).filter(...).once is not a function
http://XXX/sites/all/libraries/jquery/jquery-2.0.3.js?mw5wsb
Line 1670

(where XXX is my sitename)

So I noticed on one of my other sites the same library loaded fine when it was included in the theme.info file.  So I tried it that way and sure enough jquery-2.0.3 loads fine when I do it that way.  (ie.    scripts[] = js/vendor/jquery-2.0.3.js

Does anyone know why a jquery include would not work with drupal_add_js and why it would work with the theme.info file?

Many thanks.

d


texts: Entity reference field search by custom field

texts:
In my setup, a user can own more entities of a specific content type but the ownership is stored in the entity. The user entity does not 'know' anything about this. I know without context it seems weird but in my case, it made more sense like this instead of having an entity reference field on the user.

Now I'm trying to build an Entity Reference Display for a view so that for certain autocomplete fields I can search for users by either their name or the title of the entities they own. I created a view before that showed all the users and all of their entities so I was hoping I can reuse that field here but it seems like if I set the entity reference field to search by this field as well it just adds this view field's id to the query as if it was a user's field and it gives (of course) column not found SQL exception.

I've also tried to add a join with a view query alter hook but I could not figure out how to get the text entered by the user as that seems to be neither in exposed_raw nor in args.

Any ideas?

Edit:

Here is how my relationship is set up:

Entity -> Field referencing a paragraph that describes the ownership -> field referencing a user

And here is what I tried based on @stevekeiretsu's comment:

I set up a relation to paragraphs that have that field referencing a
user
Then I added another relation to content that has that field referencing this paragraph.
Then I added the Title field of content to the view

The problem is that it still does not show anything. If I set the relations to required I have no results.


texts: Field Collection Data Deletion for particular Content type

texts:
I have one senario where 2 for content type i have added field collection field.

Each content type has around 3k plus nodes data. each nodes has 50+ records of field collections. All content creation done through excel import functionality.

For second content type, the field collection records that i imported is wrong. i want delete all the fields collection items only for second content type.

How to do it? i can't manually since it has 3k+ nodes and 50+ records in each nodes.

Any module which handle these kind of scenario? or any coding documentation which help me here.

as i search i got few related links as below. but none of them completely fit my requirement.

Could anyone please let me know or help me achieve this.

Deleting field collection items : As mentioned on this page i can't play with DB.

Field Collection Value field is not deleting correctly(using programmatically) : looks like i can use it deletion of data. but how for particular content type.

And I have to give one interface on the site where a non-technical guy can handle this if the same mistake happens.

If anybody knows please help.

Thanks in Advance.


texts:
Before working on a site, I take a quick dump of a site via drush arb --destination=/var/backup/latest.tgz --overwrite from the root level /var/www/html.

However, on the rare occasion that I need to restore via drush arr ../backup/latest.rgz --overwrite, I end up with a restored database but the file structure is written to /var/www/html/html.

Would drush arr ../backup/latest.rgz --overwrite --destination=/var/www/ solve this issue? Do I just continue to muddle through withmv /var/www/html/html* /var/www/html?

How can I get drush to write to the actual root level for the default drupal site?


texts: Why view is not firing hook_views_query_alter?

texts:
I'm using Commerce Kickstart 2 and I want to modify the query of the included view collection_products.

As a start, I've added a mymodule_views.inc file with this code:

function jch_utilities_views_query_alter(&$view, &$query) {
  dpm($view->name);
  if ($view->name == 'collection_products') {
    // my code goes here;
  }
}

dpm() fires for 3 times for each view on the page, but not for the collection_products view. Obviously, hook_views_query_alter() is firing, but why isn't that view showing up?

Just to be clear: The view / page display renders fine.

I saw this issue and I wonder if it applies.

Is there another way to modify the query?


texts: View all Blog Entries page not functioning

texts:
I'm brand new to Drupal, and I'm working with an already existing installation.  I'm building a test website in Drupal on the side so that I can learn how everything works, but I'm having some issues with the live site (version 6.22) right now.

Specifically, there are links and pages to view all of a given user's Blog Entries.  (/blog/user_id)  This doesn't work for some users, though.  For some users, it will list all of their blog entries, but for others, the "content" area of the page is blank.

For testing purposes, I created a new article and changed its authorship several times; if the author was one who already had a working Blog Entries page it would appear, otherwise it would not.  The users all have the same role, and it doesn't appear to have anything to do with how long the user has been registered.  The only thing I can find in common is that for all the users that do not have working Blog Entries pages, they wrote their first Blog Entry within the last few months.

This question seems related, but this is working for some users with the role Blogger, and not for others.  Also, on the permissions page there is no "create new content" option, and "create blog entries" has been allowed for these users.

I can post any other information that may be needed.


texts: Change module's weight - by module or manualy

texts:
I am looking for solution how to change particular module's weight in D7. I know that it is possible to do in config tables in database, but I don't know how. Another solution that I found in Drupal.org is to use hooks - but I need more detail explanation or some guidance where I could get some tutorials about that.

The thing that I need to do is to make some priorities of some particular modules higher for it to load faster than other modules as otherwise they will not work. One of the examples is video streaming using Lightbox2 popup watching that on Safari browser on OS X - it's not loading until you change the priority of Lightbox module.


texts: node has term - show all parents of this term

texts: A node has a taxonomy term. My aim is to show  a view on node page, that displays all parents of this taxonomy term and the term as well. Is it possible to acomplish in views? I use views 3 and drupal 7. Thank you.


texts: Date Field: Two Date fields for two dates or using "End date"-property?

texts:
for my hotel rating website, I want to give my users the possibility to write the start date and the end date of their trip into their comment.

For this purpose I'm using the date module (https://drupal.org/project/date). Currently I use the Start date and the end date in one field.

Is it better to create one date field and using the "end date" property or should I create two separate date fields?

The end result should look like this one here: How to style the date module

Are there any alternative modules which also achieve these results?

Thanks for any help.


texts: how to access configuration module from service

texts:
I have module config, something like:

modulename.config.yml:

modulename:
  core_address: 107.101.xx.yy
  core_port: 153759
  core_user: superuser
  core_pass: superpass

And I have module service, something like:

modulename.service.yml:

services:
    modulename.my_service:
        class: Drupal\modulename\group\MyService

MyService.php:

/**
 * @file
 * Contains \Drupal\modulename\group\MyService.
 */

namespace Drupal\modulename\group;

/**
 * MyService.
 */
class MyService{

  public function __construct() { }

  public function getDemoValue() {
    $config =  \Drupal::config('modulename.my_service');
    $core_port = $config->get('modulename.core_port');
    return $core_port. 'asdf';
  }

}

problem is:

that's $core_port return empty value...

and the question is:

how i can get access (read/write) my config from my module service?

not sure if this relevant, but getDemoValue() is called from different module as follow:

/**
 * @file
 * Contains \Drupal\anothermodulename\Controller\MyForm.
 */

namespace Drupal\anothermodulename\Controller;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * MyForm.
 */
class MyForm extends FormBase {

  protected $demoService;

  /**
   * Class constructor.
   */
  public function __construct($demoService) {
    $this->demoService = $demoService;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('modulename.my_service')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() { /** nothing interesting here **/ }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    /** nothing interesting here **/
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state){ /** nothing interesting here **/ }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Display result.
    foreach ($form_state->getValues() as $key => $value) {
      drupal_set_message($key . ': ' . $value . '  ' . $this->demoService->getDemoValue()); // i try to print here but didn't happend
    }
  }

}


texts:
I think this has to be performed when the project is starting and not when the project is running, but, I don't decide that. I'm only the developer. I read a lot about performance in Drupal 7, and I saw modules like (Boost, Devel...) but I'm not very experienced with this.

Devel isn't working for my project (when I enter here admin/config/development/devel the page only stay await for a couple of seconds and return a problem with the server [The connection was reset] and nothing happen). AS of yet, I have not tried Boost.

I want to make performance improvements not only for Drupal way but also for Apache+MySQL. I read something and some guys talked about jMeter to make some stress test and other thing. buy, I want to know what you think, what you use and your experience dealing with performance.

(One answer will be: CACHE, but I'm looking something more than a cache).

So much thanks guys!


texts: Admin Approval for Webform Submitted data

texts:
I am new to drupal , and need functionality like , When any Users submit Webform then i am displaying that submitted data in another page . but in between i need Admin Approval so for that how to change code in Webform module.

I have used all modules like MODR8 , RULES , VBO , Moderation etc.

if anyone knows plz help me becoz i am trying to solve this problem from last 2 weeks.

Thanks in advance.


texts:
I'm looking for a simple way to add classes to nodes. I found this module http://drupal.org/project/node_class but it is Minimally maintained.

Just wondering if is there any alternative to this module.


texts: How can I know if a type of content is moderated?

texts:
I'm trying to find out if a type of content (not a node) is being moderated. How can I determine it?

For example:

function MY_MODULE_form_node_type_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   $content_type = $form_state->getFormObject()->getEntity(); // $content_type is a Drupal\node\Entity\NodeType
}

I can't find a way to find out if this type of content is being moderated by some type of workflow.


texts:
There have been news items in 2013 about weather.com moving to Drupal. I have been reading How to tell if a site is using Drupal 7 and I have been unable to find out if the site is still running on Drupal.

How can I find out if weather.com is still running Drupal?


texts: How can I return the selected radio button text on a form

texts:
I have two radio buttons on a form for example as below:

() Paul

() James

When I use the follwoing code, I am getting the values 0 or 1 depending on my selection. How can I get Paul or James?
Thanks for your help.

$chosen =$form_state['values']['name_options'];


texts: Easy database reconfiguration for migration

texts: I have build a Drupal site on my local development server and I am preparing to move it to my test server and eventually my live server.  I know where to find the database settings in my settings.php file, but there only appears to be one set of database configurations.  I would like to know if there is a good way to include three different database settings in my settings.php file, one for my development environment, one for my test server and one for my live server.  I could simply add a settings section to the file for each and simply comment out the ones that I am not using, but I would like to use an automatic solution, one that can either allow me to specify a setting for all three locations, or tries each setting until it finds a setting that works.


texts: Blocks display in the wrong place and can't be turned off

texts:
I'm experiencing problems: Some of my blocks are appearing in two blocks at the same time. Some blocks appear when disabled, even if I disable the block is still appears in one of the locations. It's happening with several blocks but not all.

This is what the footer looks like:

Drupal 7.34 running locally Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3

The theme is BigWig

Block caching is switched off. I've used the "Flush all caches"
button and deleted everything in the cache DB table.
I only have 4 blocks displaying, the "business info" (currently duplicated), "copyright info" (appearing correctly) and "main page content" and "System help".
I've checked the theme code and the "Powered by Drupal" block is a block and not hard coded. But the block is disabled.


texts: Make all the fields in a form not required

texts:
I know that, when I want to run off the #require property of a field in hook_form_alter(), I just need to set #require property of a specific field to FALSE.

How can I remove the #required property  of all the required fields? I want to make the fields not required when the user has a specific role.

Do you have any idea?


texts: Module Background Image (bg_image) installed, image not showing

texts:
Installed the Background Images module with path of image, but nothing is showing.  I am using 'node/*' to apply image to all pages

Did I miss something?


texts: How can I create an entity reference field to list a subset of roles?

texts:
I want to provide a field in a node to lists a subset of available roles. These roles could be used to decide how the node would be displayed to users with the roles selected here.

Is there a way to create an entity reference field of entity type user role? If yes, how can I restrict the field to display only certain roles? The usual way is to create a view with entity reference display and add conditions in the view to restrict the options. Is it possible to create a view of type user role?


texts: Hiding language names in "Language switcher" block and displaying only country flags

texts:
I would like to hide language names (like "English", "Español", "Magyar", etc.) in the "Language switcher" block, and display only country flags, because I have Language icons module installed, and the flags are unambiguous enough for navigating between different languages.

I already set language elements to be displayed in an "inline" style and hide language switcher block's title in my stylesheet file (in a Zen sub-theme) like this:

#block-locale-0 li{
    display:inline;
    list-style-image: none;
}
#block-locale-0 .title{
    display:none;
}


texts: Additional classes for price based on price components

texts: Is it possible somehow to add classes related to price components to the price container div? So you would be able for example to style a price based on how it is changed by its components. I thought it would be very nice.


texts: How do I add inline-css during hook_css_alter()?

texts:
I have a use-case where I need to dynamically attach inline-CSS (and JS) at runtime.

In hook_css_alter() I cannot see how to attach it and I keep ending up with:

  Exception: Invalid CSS asset type. in Drupal\Core\Asset\CssCollectionRenderer->render() (line 216 of core/lib/Drupal/Core/Asset/CssCollectionRenderer.php).

I have tried this:

/**
 * Implements hook_css_alter().
 */
function MODULE_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $assets) {
  $inline = MODULE_get_inline_css();
  $css[$inline] = [
    'type' => 'inline',
  ];
}

I have managed to get code into the html_head section, but I need this to appear after the styles section.

(This is for migrating the add_to_head module)


texts: CDN, SEO and image styles: 301 on GET request

texts:
Recently I installed the CDN module. To avoid duplicate content I added a RewriteRule to my Apache config:

RewriteCond %{REQUEST_URI} !(^/(.*)(.js|.css|.jpg|.jpeg|.gif|.png)) [NC]
RewriteCond %{HTTP_ACCEPT} !(.*image.*|.*css.*|.*javascript.*) [NC]
RewriteCond %{HTTP_HOST} ^(static1.domain.com|static2.domain.com)$ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301]

This is working, except when I'm using image styles. If the image exists everything works, but when it doesn't exist, I get a 301 to http://domain.com/index.php

These are the current situations using the implemented RewriteRule:

GET static1.domain.com - 301 to http://domain.com - OK
GET static1.domain.com/image.jpg - 200 - OK
GET static1.domain.com/sites/domain/files/styles/.../image.jpg when
file exists - 200 - OK
GET static1.domain.com/sites/domain/files/styles/.../image.jpg when
file doesn't exist - 301 to http://domain.com/index.php - WRONG

How do I force the image style file to be created when browsing to it from a static URL?


texts: How to add v1 when specifying the URL of an API?

texts:
I'm creating an API service using Services (Drupal 7) and would like to create an URL like /api/avu/v1/{id}.

I have api in Path to endpoint and in hook_services_resources() I have $resources['avu'] with

"args" => array(
   array(
     "name" => "id",
     "optional" => false,
     "source" => array("path" => 0),
     "type" => "int",
     "description" => "The id of the course to retrieve."
   )
),

So /api/avu/{id} works but I can't figure out how to add v1.


texts:
Using Drupal 7. I have a view with several page displays, 2 of them being /review and /mentions. I have some exposed filters on these pages visible on a side block of the page.

When clicking the apply button to filter the content, I get redirected to /review?filter=....
whether I am on the /review page or /mentions page.

How can I make the filter work so that
- when filtering the /review page, I land on /review?filter=...
- when filtering the /mentions page, I land on /mentions?filter=...

Thanks for your help,
Jerome


texts: Is it possible to create web service CRUD operations for contributed modules in drupal 7?

texts:
I have using a privatemsg module for chating in our site,

Privatemsg

Services

Is it possible to do a web service CRUD operations through this module?

any suggestions?


texts:
I'm starting to configure frontend search for user search, and I can't find a product if it has a puctuation sign. For example, a product called

The world today: a new adventure

In search box, if I enter world today:, the search doesn't find the product.

Anybody could help me with that?


texts: Starting a views list from the nth element

texts:
I have two views blocks. One displays the latest news item. I would like the other block to list 4 next latest news items starting from the second latest (as I have already displayed the first one).

Can I achieve this via the view's admin interface?


texts: How to append options and classes into a custom attribute in Twig?

texts:
In our twig template we have a need to wrap certain fields with a Link field. In the existing twig template there already exist an attributes variable (accessed by adding attributes), but we have a need to have a custom one. Couldn't find any documentation on if you can pass options and attributes from one field to a custom twig attribute.

Is there a way to append all options and classes from a field's attributes into a custom attribute in a Twig template without any hook_preproceess_hook?

Existing node--article.html.twig

{{ content.body }}

{{ content.field_subtitle }}

{{ content.field_category }}

  {{ content.field_link }} /* has its own options and attributes */

Desired output

/* pass the options and attributes from field_link into the a_attr */
/* This did not result in what we wanted */
{% set a_attr = create_attribute(content.field_link.0['#attributes']) %}

{{ content.body }}

{{ content.field_subtitle }}

{{ content.field_category }}

 {{ content.field_link.0['#title'] }}


texts:
I want to use the base path in a Drupal 8 template file. I tried the following, but I don't get the correct result.

{{ app.request.baseUrl  }}

{{base_path}}

What I need is the absolute path to the node {{ app.request.baseUrl  }}/{{ url }}.

One solution I found is putting  this code in a preprocess hook, and pass it to the theme.

 $host = \Drupal::request()->getHost();
$response = \Drupal::httpClient()

I am looking for a better solution. What could should I use instead of the one I am using?


texts:
Not sure if there's a way out of this problem but...

I have a custom log module which listens for events that could come from multiple sources. All it does is listen for an event, and if it occurs logs an entry in the DB.

But there could be different recorded data coming from different modules and I want to separate concerns so there's no complex web of dependencies.

If Module L is the listener it might get EventA from module A and EventB from module B. The events have a common base but each module stores slightly different data in the log which needs to be set-up in each case.

Option 1) Module L could be set up to listen for "module_a.event" and "module_b.event" and process them separately but that is a "bad thing" because the listener is dependent on each of the other modules. The Listener shouldn't need to know how the data is stored, it doesn't care.

Option 2) Or Module L could have a specialised event "listener.event" that Module A and Module B calls having set up the data in the event correctly. But that means those modules have a dependency on the listener.

I don't like either option because of the dependency requirements in one direction or the other.

Bright idea: Create a plugin in Module L that builds the log structure for a particular module. So Module A has a plugin that handles its requirements, and Module B has another plugin that handles its needs.

There's no dependency in either direction because if Module L is not running then A and B don't care (the plugins will never be scanned or loaded). And if either or both of A and B are missing, Module L doesn't care.

And if I then need a Module C I just give it its own plugin.

But Module L still needs to listen for events from A, B and C (module_a.event, module_b.event and module_c.event). How does it know what events it should listen for?

Easy: Set a value in the annotation of each plugin giving the name of the event to listen for. We can load all the plugin definitions in the EventSubscriber and set it up. Fantastic. Problem solved. No dependency but every event type can be listened for and handled.

Except it doesn't work because: apparently event subscribers are initialised before plugin services.

My "module_l.services.yml" looks like this:

services:
  notifications_log.notifier:
    class: Drupal\notifications_log\EventSubscriber\NotifierSubscriber
    arguments: ['@plugin.manager.notifier', '@entity_type.manager',
                '@current_user', '@logger.factory']
    tags:
      - { name: event_subscriber }

  plugin.manager.notifier:
    class: Drupal\notifications_log\Plugin\NotifierManager
    parent: default_plugin_manager

Which seems fine (doesn't matter which way round they go BTW - I've tried) but we get a fail here, in the EventSubscriber:

  static function getSubscribedEvents() {
    /** @var NotifierManager $notifierManager */
    $notifierManager = \Drupal::service('plugin.manager.notifier');

    $events = [];
    foreach ($notifierManager->getNotifierEventNames() as $eventName => $plugin_id) {
      $events[$eventName] = ['onNotification', 0];
    }

    return $events;
  }

This is a static function so we have to fetch the plugin manager directly, and it can't find it.

Is there any way around this? I could find write some code to find all the plugins myself but that's a lot of faffing about.

What I really need is a way of dynamically adding to the Event subscribers, but I haven't found a way to do that.

If I could carry the plugin_id across as well, that would be useful but it's not a big problem to find the right plugin in the "on Notification" method.)


texts: Drupal views list with the node loading with ajax

texts:
I have a list of articles made with views and its in a  sidebar on the left side of the page i want the article to show up in the content area when its clicked without the page reloading.
i found this website but its old from 2012 and im not sure if this would work.LINK

EDIT:i did just like in the link and it worked my quesion now would be if its possible to do it with a views page and not a basic page content because i want the first item on that page to be always latest


texts: Difference between hook_query_alter and hook_views_query_alter?

texts: I am looking for specific difference in working and implementation of both


texts: Allow user to flag only those node that associated to a particular term of a vocabulary?

texts:
I have content type  "product" term referenced by Taxonomy "Product category" having terms
-Cook tops
-Heaters
-Chimneys

Now if i flagged nodes associated with term "Cook tops" , after that if i flag node associated with "Heater". I should get a error message.

Actually I am using this flag to show flagged item in BASKET(as done in many shopping site). But i do not want to put a "Cook tops" node with "Heater" nodes.


texts: How to put pager between multiple views?

texts: I am finding the way to combine more than one views through pager, I would like to connect them using the pager. And I would like to provide the pager like what is on drupal site(documentation part) as shown in following image. So they show previous and next node. I am searching but did not find the way to combine multiple views. The views default pager is for its own content and can not apply to the direct to other views. Thanks


texts: how to get banner image based on the role?

texts:
I want to have a banner in home page which should change according to the logged in user role.How can i achieve this?
I'm trying edit 'page--front.html.twig'. But i'm not able to fetch logged in users role.How to check user roles inside this twig file?


texts: Get node ID for all results for current view including its filters, disregarding the pager

texts:
I have a view that produces say 70 results with certain exposed filters applied (this is a view that uses Apache Solr indexed content) and I want to get the NID of every result, so I can then send it through to another page in a simple array of NID's.

I've found that all the results NIDS are within the $results array produced by views, but this only has the results that are shown on the current page, is there a way to get all the results disregarding the pager, without removing it entirely. Is this impossible to do without generating a new query based on the active filters? this is what I'm trying to avoid because there are quite a few filters.


texts:
I have articles/?page=2, I need to make it like articles/page/2 or articles/page-2

How to do so?

The Clean Pagination module is enabled and on admin/config/system/cleanpage I added "articles".

articles?page=1 is the second page in the pagination link and it looks like in this screenshot:

The module changes the reference to articles/page/1, although it would be logical to do so also for articles/page/2.

How can it be implemented? What alternative methods are there?


texts: Set entity reference field to 'autocreate' directly in the entity field definitions

texts:
I'm having trouble with the two ways of defining forms for entities in Drupal (the first one being in the entity field definitions and the second one being by defining a custom form class).

Now, in a classic form, all I have to do is add an element with the  entity_autocomplete type and set #autocreate to array('bundle' => 'foo'). I tried replicating this in various ways in my entity, none of which worked out (I tried via BaseFieldDefinition's setSetting or in the display options for the form).

What I don't understand is why the two ways of defining forms are so different? Why can't it just be the same syntax in both places?

I'm aware of the Inline Entity Form module, but there doesn't seem to be a proper port for Drupal 8 yet, and what I'm trying to do works perfectly fine when I define the form manually as explained. I just want to be able to define all this in my entity directly to avoid unnecessary code.


texts: Right to left theme: Bootstrap or Zurb Foundation?

texts: I am developing multilingual site (English and Arabic) in Drupal 8. I want to use bootstrap or zurb foundation, which out of these is good for developing Right to left theme. Site will mainly work in Arabic.


texts: Why does jQuery slideToggle revert back to initial hidden state after running?

texts:
I have a Superfish menu and a simple jquery slideToggle animation attached to each menu item. I am using Drupal 7 & the Superfish module.

The idea is that on click it will show the body content of the site which is initially being hidden. All seems to work fine the click event fires the toggle but after the animation is done, it quickly reversed the animation back to the initial hidden state.

Doing this is seems pretty trivial with straight HTML / jQuery. But it's not quite working within my Drupal theme.

Here is my jQuery:

(function ($) {
Drupal.behaviors.my_fusion_menu = {
attach: function(context,settings) {

$('#content').hide();
$('.sf-depth-1 a' || '.sf-depth-2 a' ).bind(
    'click', function() {$('#content').slideToggle('slow');}
     ) // /click
    }   // /attach
}; // /Drupal Behaviors
})(jQuery);

I am fairly new to working with jQuery. It seems like the answer is pretty simple, but I am not sure how to set this up.

Any suggestions?


texts:
I am absolutely new in Drupal. I am trying to set up my first "Hello world" module and I am playing with it.
Every time I clear cache using Drupal Console, it takes 15 seconds, which is an eternity for me.

Is this normal, or did I need to change setting?

This is the output of drupal site:status.

 Drupal                         8.3.2
 Access to update.php           Protected
 Configuration files            Protected
 Cron maintenance tasks         Last run 41 minutes 54 seconds ago
 Database system                MySQL, MariaDB, Percona Server, or equivalent
 Database system version        5.5.5-10.1.21-MariaDB
 Database updates               Up to date
 Drupal core update status      Not secure! (version 8.7.0 available)
 Entity/field definitions       Up to date
 File system                    Writable (public download method)
 GD library                     bundled (2.1.0 compatible)
 GD library PNG support         bundled (2.1.0 compatible)
 Image toolkit                  gd

 Module and theme update status Out of date

 Node Access Permissions        Disabled
 PHP                            7.1.1 (more information)
 PHP extensions                 Enabled
 PHP memory limit               128M
 PHP OPcode caching             Enabled
 Random number generation       Successful
 Search index progress          100% (0 remaining)

 Trusted Host Settings          Not enabled
 Unicode library                PHP Mbstring Extension
 Update notifications           Enabled
 Upload progress                Not enabled

Web server
 Hash salt                      6X0M4mm-6Ui1Sgovc-emqgqvm2nJ1Ug-fYQYnJfxPniHHwdYMMcBHRBt1xwRtGMRRg7XbK1G3A
 Drupal Console                 1.8.0

 Database connection
 Driver              mysql
 Host                localhost
 Database connection dru
 Port                3306
 Username            root
 Connection          mysql//root:@localhost:3306/dru

 Themes
 commands.site.status.messages.theme_default bartik
 commands.site.status.messages.theme_admin   seven

 Directories
 Site root directory      C:\xampp\htdocs\dru
 Site temporary directory C:\xampp\tmp
 Default theme directory  /core/themes/bartik
 Admin theme directory    /core/themes/seven


texts: Get image width for a styled image in module

texts:
In hook_node_load I need to get the width and height of a styled image, for a given fid.

The image style has only height effect and the width is scaled and calculated by Drupal, so using image_styles() is of no use.

My code so far is like this:

  $field_image = field_get_items('node', $node, 'field_image', LANGUAGE_NONE);
  $img_uri = file_load($field_image[0]['fid']);
  $img_url = image_style_url('mystyle', $img_uri->uri);
  $img_info = image_get_info ($img_url);

$img_info gives me FALSE instead of the info. How to get the width?


texts: drupal jquery mobile datepicker cannot select year

texts:
I'm using drupal 7 with jquery.mobile-1.4.5.

I had created a form with date field, using Inline Datepicker

  $form['body']['dob'] = array(
    '#type' => 'textfield',
    '#title' => 'Date of Birth',
    '#attributes' => array('data-role'=>'date', 'id'=>'dob'),
  );

The Inline Datepicker is showing exactly like the demo in http://demos.jquerymobile.com/1.4.1/datepicker/

However, I would like to have a inline datepicker, with a dropdown menu for user to select year in calendar.
Eg: https://jqueryui.com/datepicker/#dropdown-month-year

I had tried adding in below function but it doesn't work.

$(function() {
    $( "#dob" ).datepicker({
      changeMonth: true,
      changeYear: true
    });
  });

Is there any way I can allow user select year in the inline datepicker?


texts: How to Identify Fields from Field Collection?

texts:
I have a Content Type, which has field collection and I need to load the fields present inside the field collection, Any idea on how to do this?

Very Important Note: There is no content created for this Content Type as yet.


texts:
I am facing a problem and I will try to explain it here and I hope you guys can help me.

I am building a CRM in Drupal and Laravel and I have a module called Partners where I store all the information about the people that are going to work with me.

Inside partners, for now, I have the following actions:

Create partner
List partners
Add users in partners

I have already created a ROLE called partner, so all the users created by the "Create Partner" page will be assigned to that role. The problem is that some partners are NOT allowed do add users, for example.

What I want is to add a custom permission to specific users based on my permissions defined inside my hook_permission().

So for example, I have 3 permissions for now defined on my hook_permission():

Administer partners
See all partners (the list)
Create users in partners

And lets suppose I have 5 users assigned to the role PARTNER but I want only 3 of them to be able to create users and only 1 will be able to administer partners. This way I can use my permission by user.

I have already tried the module User Permissions but it is messing up with all my permissions.

Does anyone know how to do that without any workaround?


texts: Printing the last 6 characters of a field into a confirmation email

texts:
I have a booking system set up using Rooms.

The customer enters their phone number on checkout, which is a 5 number area code, followed by 6 other numbers. E.g. 01234 567 890.

The rooms at the hotel have a secure pin pad entry which is set to the last 6 digits of their phone number for their arrival.

As far as I can see there are two ways of doing this.

Replace the phone nunber field with two fields, one for area code and one for the 6 digits, then send the 6 digits to the customer in a confirmation email. The only downside to this will be the existing customer phone numbers in the database will not fit the new fields, and also the validation of phone numbers used in the "Phone Number" module will not work for a split field.
Create a way to only print the last 6 digits of the data in the phone number field. This seems like the best option, as it doesn't involve me having to edit the data for current bookings.

Can anyone explain to me how I might achieve option 2? Printing the last 6 digits in views etc would be easy enough, but I need to print the last 6 digits into an email template, and then send that email with rules.
I have a token for [commerce-order:commerce-customer-billing:field-phone-number] that I can put into the confirmation email. Is there a way to trim the output of a token?


texts:
I have installed the metatag module but it only works on the node pages and does not generate tags for the views pages.

I have also tried the metatags_quick module which provide the metatags per path but it also did not generate tags on the views pages.

Any other module which will be useful for views pages or any other method?


texts: CSV node import using feeds module on a Mac

texts:
I'm using the feeds module to try to import several thousand nodes, but I'm getting mixed results: sometimes it seems to work, sometimes it doesn't.
I understand there are some sort of issues related with the line endings in the CSV files when they are created on a Mac. I tried saving my CSV for Unix (LF) and Windows (CRLF), but that doesn't seem to fix the problem entirely either.

Does anyone else have this problem? Is there a definitive solution or workaround for this?


texts: Anyone having a problem with Drush 7 and Drupal 8 alpha-11

texts:
On a Linux system I installed Drush with Composer and when I try to use it with Drupal 8 alpha-11 I get this error. I looked around but can't find anything about it.

$ drush st

PHP Fatal error:  Class 'Drupal\Core\Site\Settings' not found in /home/$USER/.composer/vendor/drush/drush/commands/core/drupal/environment.inc on line 278
Fatal error: Class 'Drupal\Core\Site\Settings' not found in /home/$USER/.composer/vendor/drush/drush/commands/core/drupal/environment.inc on line 278
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Class 'Drupal\Core\Site\Settings' not found in /home/$USER/.composer/vendor/drush/drush/commands/core/drupal/environment.inc, line 278


texts: How can I get both "body" and "summary" fields to appear in a new article?

texts: I'm defining a Drupal 7 content type using the "long text and summary" field.  When a new story is created, I'd like both the "summary" and "body" text fields to be present in the creation form, instead of making the user click the "edit summary" link.  Is there a way to do this through the basic Drupal content type tools (I've looked, but can't find anything), or do I need to write a hook_form_alter handler or something comparable for the content type?  Thanks!


texts: What are the main difference between panels and paragraphs?

texts:
What are the main difference between the Panels and Paragraphs module in Drupal 8?

As far as I know both of the modules can be used for creating landing pages.

When to use paragraph and when to user panels?


texts: Render add node form within module output

texts:
I have a content type called “osago”. And I have a module that outputs some things.

How can I output the create this content type form within this module?


texts: Overriding File Entity fields when attached to a Node

texts:
We have a challenging user requirement that I've been puzzling over and wanted to submit this to the community:

We're using the Media 2 + File Entity modules for managing our site's image library.  The Image bundles are fielded with meta data fields e.g. Title, Caption, Source, etc.

So here's the thing-- we need to have a way to override these on a case by case basis but if at all possible without duplicating the File.  For example, with stock photography images, we only want to have one image of the lady with a pregnant belly, but it will be used in different ways throughout the site, and we need to be able to give it a different caption in two different places.

We really don't want to have the same image in the library twice with two separate captions.  This would drive our editors crazy.

Thanks for any ideas!


texts: How to get the parent comments (in a custom module)?

texts:
I'm writing a module that uses flag to handle notifications, and one of the options is to be notified of replies to a given comment.

I can implement without problem hook_comment_publish($comment), but I want to get all of its parent comments so that I can pick up the users that flagged them.

So, how can I retrieve all the parent comments of a given comment (if any)? I noticed that in taxonomy there is a taxonomy_get_parents($tid) but I can't find anything similar for threatened comments.


texts: Support composer_manager AND drupal-composer/drupal-project with contrib module

texts:
Motivation / use case

I maintain the module package https://drupal.org/project/cfr, which currently requires composer_manager to be installed, and where composer_manager is required in the *.info files of some of the submodules.

Now I also want to support sites that install all their modules via composer, e.g. using https://github.com/drupal-composer/drupal-project.

However, the auto-generated composer.json files now require composer_manager, because they are generated from the *.info files.

composer_manager is undesirable in this context and even creates a conflict with composer_autoloader which is required by drupal-composer/drupal-project.

One specialty here is that there is no actual module named 'cfr', all the modules in the package are submodules like 'cfrapi', 'cfrplugin', 'cfrplugindiscovery' etc. This may or may not be a good choice, but it is how it is now.

Technical observations

I found, by looking into ~/.composer/cache/repo/https---packages.drupal.org-7/*, that Composer / packages.drupal.org creates "meta packages" for submodules.

Even if the submodule already has a composer.json file, this is replaced with a generated composer.json file that requires only the module dependencies from the *.info file, not the 3rd party dependencies from the composer.json file.

This means:
- The meta packages do require modules like drupal/xautoload and drupal/composer_manager.
- The meta packages do NOT require vendor libraries like donquixote/annotation-parser anymore.
- The main package 'cfr' seems like a combination of the meta-packages, but still does not require the vendor libraries.

Question

What do I need to do in a contrib module to support both composer_manager AND the full-composer scenario?

How can I avoid the 'composer_manager' dependency in the generated composer.json for metapackages for the submodules?

Especially, with the scenario above?

For my taste it is ok if the root package requires all the 3rd party stuff, so then I only need to prevent to require drupal/composer_manager.


texts:
I'm testing the computed_field module on a taxonomy field. I want to get the number of nodes that have a term reference to the current term:

$tid = 1;
$entity_field[0]['value'] =  db_query("
SELECT count(*)
FROM node n INNER JOIN taxonomy_index t on n.nid = t.nid
WHERE n.type = 'discussion'
and n.status = 1
and t.tid=$tid")->fetchField();

How can I get the tid of the term? Is there a better way of writing the query?


texts: form_state->setRedirect(to_a_new_node_page) from the submitForm function, route "does not exist" issue

texts:
I created a custom module, It generate a custom Form in a page.
When I submit my form, I create a new node.
So, I am redirect to the form page but I would like be redirect to the new node page.

I add this line at the end of my submitForm function :

$form_state->setRedirect('node/'.$mynewnode->id());

But when I submit my form from the website, I get the empty-white-screen-of-the-death. My apache log :

...
Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\RouteNotFoundException: "Route "node/153" does not exist.
...

And then, when I go manually to the node/153 page, there isn't any problem. The page work well.

My question : where is my mistake ? How can I set the redirection after create the new node ? Is it possible from the submitForm function ?


texts:
I have installed varnish load balancer on my pressflow 6.22 website.
i have some custom fields created by CCK.
the original server is X and i have added another server Y to make this load balancer.
now, when the editors try to create any node when they were directed to server Y, they lost all custom fields when they save. however, when they are directed to  original server (X), everything goes fine with them!!
anyone faced such case? any idea about the reason or how can i fix it?
** EDIT **
i have checked in the DB and found that the image path has been saved normally, but when i make node_load, it didn't show this field. also when view or edit this node, the image is not shown as well!!
any idea is highly appreciated
Thanks for your help


texts: GMAP Module map not showing markers after updates with js error: Clusterer is not defined

texts:
I've recently taken a live site down for updates and development. I have updated from core 7.39 to 7.41 and updated numerous modules including jQuery update. After the updated, I noticed that my map was zooming to it's max extent and not displaying markers. The only diagnostic error I get is an Uncaught ReferenceError: Clusterer is not defined.I can confirm the the markers are being loaded by going into console and logging the drupal.settings.gmap.aut1map.markers variable. I don't have a lot of experience with the GMAP module, so any help would be appreciated.
Thanks in advance.

UPDATE: tried to update to dev version, no real change.
UPDATE: From what I can tell, it appears that the GMAP version I have installed is has this patch applied GMAP Clusterer.js issues


texts: How to index only end dates in the aggregated field in the search api?

texts:
I have two date range fields on two different content types. I want to index only the end date of both of the date range fields.
I can do it by simply clicking the plus icon on the field and add the end date only.

But this is not possible in the aggregate fields. In the aggregate fields.
I have a union on both date fields. But there isn't an option to select the end dates only?
Is it possible to index only end dates from both the fields in one field as aggregated field? (


texts: How to show "Add to compare" button in views using "dynamic properties" module in d7?

texts:
I need to list the products to compare using views. I have used "Dynamic Properties" module to compare the products.

On each product node I can see a "Add to compare" button. But how to show this button in views?

I've referred this demo site
http://p.worldempire.ch/products


texts: How do I make a theme require Jquery (for anonymous users)?

texts:
I'm creating a theme for D8 called 'herchel'.I'm trying to get this theme to require jquery on all pages (D8 doesn't load Jquery for anonymous users by default)

Looking through the what little documentation i can find on d.o in addition to the core themes, I created a file called herchel.libraries.yml

I've tried the following... all with no luck:

drupal.herchel:
version: VERSION
  dependencies:
    - core/jquery

-

drupal:
version: VERSION
  dependencies:
    - core/jquery

-

herchel:
version: VERSION
  dependencies:
    - core/jquery

Does anyone have any ideas on what I need to put in this?


texts: Unable to save field collection order of collection that includes entity reference anymore

texts:
I have a Drupal 7 site using field collection and entity reference. The collection includes one entity reference and a boolean checkbox. It is used to related "news" nodes to a page. The checkbox determines if it should show up in a carousel/slider.

We use this collection on a landing page and set it to an unlimited number of these field collections.

This used to work just fine. No idea what changed over the holidays but I came back in today with a message from the client about it. I got on the line with him and he showed it to me. I tried from my admin login and had the same problem.

No errors on the server or in watchdog. I checked apache, php, and mysql error logs. No errors on the page. This is hosted on Acquia for now.

I have cleared cache from the admin and drush. No luck. I am having the same problem with other nodes of this type. We do not use this for any other types of nodes though.

Any ideas as to what could be going on? This did work at one point. And it is clearly not saving these changes.


texts: Install.php available after xcopy deployment

texts:
I created a Drupal 7 site with Sqlite on my dev machine. When I go to localhost/install.php it says: Drupal is already installed.

After deploying the whole bunch to shared hosting (windows) the install.php is available again although the site works. It is even available to anonymous users and when the site is in maintenance mode. What should I do to disable that? Or should I deploy another way?


texts: Send daily automated mails to specific roles programmatically

texts:
I'm working on a D8 project and I want to send every day an automated mail to all users with a specific role, lets say 'custom admin'. The mail should contain the results of a database query.

Rules module is not complete yet so I was thinking to use hook_cron.

Is this the right approach or is there a better way to achieve this?

Thank you in advance for any help/idea.


texts:
If you are familiar with the location module you would know that when creating a location the state/province textfield predicts options as you type. These options come from a file in the Location module.

I need to re-create that for the city field. Can you please point me in the right direction of how to accomplish this? I want to avoid user typos.

Do I need to create a module of my own or do I hack Location.module ???

Thanks


texts:
I have installed the Profile module. I am trying to programmatically load profiles. The code works, but I am not able to access any field value.
class IdCardController extends ControllerBase {

  /**
   * Init id card download.
   */
  public function initDownload(User $user) {

    $user_profile = $this->entityTypeManager()->getStorage('profile')->loadByProperties([
      'uid' => $user->id(),
      'type' => 'personal_information',
    ]);
    kint($user_profile);
  }
}

Using kint(), I can see all methods are protected.


texts:
I've a taxonomy page of a company which should show all nodes pages with this term.

I want that this page list at least 20 or so nodes, then we will need to click 1 or 2 or 3 to go to next levels.

Currently you can see every page is listing only single node. How to change this behavior?


texts:
A while back I made a site for our Operettic society in Holland, after a while I transferred the maintenance to another person who came just recently back at me with a problem.

The site is stuck in maintenance mode, and also the /user/login doesn't work, I also tried the ?q=user possibility, but this also didn't work.

Also made the following query to the database:

UPDATE variable SET value = 's:1:"0";' WHERE name= 'site_offline';
DELETE FROM cache WHERE cid = 'variables';

Anyone some thoughts on this?

Thanks in advance!


texts: A way/module to display a list of Blocks assigned to specific path?

texts:
OK, this is a bit tricky to explain, but I hope you understand what I'm looking for.

I have a lot of nodes created with the 'Basic page' content type, and at least 20 different blocks assigned to each Basic page. I'm wondering whether there is a way (or a module) the display a list of Blocks in the Drupal backend that are ONLY assigned to one node? There are 20 blocks assigned to each Basic page, and lots of Basic pages, therefore it is tricky to identify which Blocks are displayed on which page with the huge list I see in the Drupal Blocks page.

What would be good is if there was a way to filter Blocks on the admin page by path that they are set to, or something like that?

This is what I'm looking for, is there a module?


texts: Is it possible to have a block that shows the node create page for a content type, and which would disappear once the node has been created?


texts:
I've looked at the Bean status module, but that only shows if the bean is published or not. There's no functionality to change the status.

Is it possible with some module to publish/unpublish beans?


texts:
I would like to print the content from a file (/themes/custom/mytheme/misc/info.txt) into the HTML markup using Twig.

Steps already taken:

I have created a module that should handle: open the file, read its content, process and return it.
This is already registered a Twig Extension so I already can write {{ spit_the_content(<path>) }}

Problem:

The <path>. Does Drupal provide Streams, or other functions to resolve paths like: theme://misc/info.txt? If not how does Drupal help me to get valid paths relativ to the active theme, a module or stuff alike?

{{ spit_the_content(path('theme://misc/info.txt')) }}

BTW: I am interested in both: urls (relative/absolute) and filesystem paths.


texts: I have added a custom block to my users' profile page that shows a list of all that user's submissions.  I would like the title to be the user's name then projects so for the user Mike I would like to see "Mike's Projects" as the block title.  Is there a way to do this?


texts:
There seems to be a problem with the Services module of Drupal 7 when submitting nodes using the node create reosurce, for example I can create nodes just fine, even with custom fields, but the problem is with term reference fields, the values never gets to them, here is an example:

var nodeCust={
node:{
  title: 'undefined test 1',
  type:'noticia',
  name: 'admin',
  body: {
    und: [
    {value:'sdasdasd', format:'full_html'}
    ]
  },
  field_custom:{
und:[ {value: 'test placeholder'} ]
  },

  field_theterm:{
und:[ {tid:"1"}  ]
  }
 }
};

This is the object I send in JSON, and it works great the body has its value, the title and the custom field as well, but the "theterm" field is a term reference field in this content type, and it NEVER gets its value :o( , I tried with all the widgets, autocomplete, list etc but that should not really affect this since this is a REST Services call w/JSON.

Any ideas anyone? Thanks


texts:
Is it possible to filter a view by a sub-queue within an entity queue?
My current setup is:

Entity queue with multiple sub-queues created (I've only created 2 sub-queues at this point.)
Setup a view with a relationship filter to that entity queue

What I'd like to be able to do is add a filter to the view based on the sub-queue. Ideally so that users could select the specific sub-queue from an exposed filter. An empty filter would show all items from all sub-queues.
Hopefully I'm missing something simple here.


texts: #ajax elements added in hook_form_alter miss after first ajax call

texts:
I am modifying elements from the multiselect module to add ajax functionality. I wanted to use hook_field_widget_WIDGET_TYPE_form_alter() but I'm stuck in 7.14 and it requires 7.8.

So, I'm traversing the $form in hook_form_alter() to find the modify the 'multiselect' elements:

/*
 * Implements hook_form_alter()
 */
function ajax_multiselect_form_alter(&$form, &$form_state, $form_id) {
  _ajax_multiselect_search_children($form, $form);
}

/*
 * Look for multiselect elements
 */
function _ajax_multiselect_search_children(&$form, &$element) {

  if (isset($element['#type']) && $element['#type'] == 'multiselect') {
    _ajax_multiselect_modify_multiselect($form, $element);
  }

  $children = element_children($element);

  if (is_array($children)) {
    foreach ($children as $child) {
      _ajax_multiselect_search_children($form, $element[$child]);
    }
  }
}

When I find a 'multiselect' element, I add a new 'select' element to the form with the #ajax property copied from the original 'multiselect'.

/*
 * Modify the multiselect for ajax processing
 */
function _ajax_multiselect_modify_multiselect(&$form, &$element) {

  $element['#attached']['js'] = array(
    array(
      'data' => drupal_get_path('module', 'ajax_multiselect') . '/js/ajax_multiselect.js',
    ),
  );

  if (isset($element['#ajax'])) {

    $ajax_element_id = drupal_html_id('ajax_multiselect_element');

    // tell jquery where to find the id of the dummy select
    $element['#attributes']['class'][] = 'multiselect-element-id-holder';
    // transmit the id of the dummy select to jquery
    $element['#attributes']['data-ajax-multiselect-element-id'] = $ajax_element_id;

    $form[$ajax_element_id] = array(

      '#id' => $ajax_element_id,
      '#type' => 'select',
      '#ajax' => $element['#ajax'],
      '#options' => array(0,1),

//      '#prefix' => '
',
//      '#suffix' => '
',
    );

  }

}

Then, in Javascript, I trigger a 'change' event on the new (dummy) 'select' whenever the items in the 'multiselect' are altered.

  // create a new function that incorporates the old function to add/remove options in multiselect
  $.fn.oldAddOption = $.fn.addOption;
  $.fn.addOption = function(arguments) {
    this.oldAddOption(arguments);

    // find the tag that holds the id of the ajax multiselect element
    var tag_with_id = $(this).parent().parent().find('.multiselect-element-id-holder');
    // find the id of the ajax multiselect element
    var ajax_element_id = tag_with_id.data('ajax-multiselect-element-id');

    $('#'+ajax_element_id).trigger('change');
  }

This works for the first #ajax round trip, but after the first #ajax call anywhere on the page, my new (dummy) 'select' elements don't fire the correct #ajax.  In my Drupal Recent Logs, I get

Undefined index: #ajax in ajax_form_callback()

when I use the dummy select elements.

In network activity, I can see that the first #ajax response includes the correct array of commands for the replace action. But, after the first #ajax anywhere on the form, my new 'select' elements only receive a default #ajax settings response with no replace commands.

I think there is something about the way I am building in hook_form_alter that is not adding the #ajax property correctly after the first ajax call, but I can't figure out what it is.


texts: How to prevent multiple logins for administrator?

texts:
I have my Drupal website whose admin account is shared. But I want to limit the multiple logins, that is, only one should be able to login at a time. I have already used Session Limit Module. This works for non-administrator accounts, but not for admin account.

How can I prevent multiple administrators logins?


texts:
I have made some custom fields at config->account settings (manage fields) and I have put them in my registration form but I want some of them display at image I show below under the post count and generally when they create a new topic or replay.

How do I display that field? From a search I did I found that it's inside the module VIEWS. I am searching inside there to find where to add the field.

http://img848.imageshack.us/img848/7913/costumfield.png

Answer
At drupal 7 at Configuration - account settings - right top cornet manage fields you can create custom fields and put them where you like, then the most common to do is to add these feilds in your code with editing the source code just i didnt know how to do it.. i dont thing there is another way..! because i use the module author pane and the best way is too add them to author panel in the module code..


texts: Make an exposed node reference filter to show only nodes created by current user

texts:
I am having a little problem I cannot figure out how to solve.

I have a 3 content types:

campaign
post
publication

Post contains a node reference to campaign. Publication contains a node reference to post. I am making a view that lists all publication and I would like to give user an option to filter them by campaign.

However when I am making an exposed filter that allows a user to select a campaign to filter and it works just fine, but I am not able to figure out how to limit exposed filter options to campaign nodes created only by current user?

I know how to do this through code, but I'd like to figure out if this is possible to do via UI.


texts: How could I use both Rendered Entity and Fields in a view?

texts:
I like my Rendered entity style, but I want to add in just a couple of extra fields.

Under "Fields", it says

  The selected style or row format does not utilize fields.

Is this possible in any way?


texts:
I want a sharded Solr environment so that I can distribute data and query accordingly. Started two solr instances as described here.

Since Solr doesn't support (fully yet) writing automatically into different Solr instances, I have to do it manually.

I'm trying to do it in the following hook:

/* "node" is the module name. */
function node_apachesolr_index_document_build($document, $entity, $entity_type, &$env_id)
{
}

Note that I'm trying to change the $env_id by making it a reference parameter, since that's what I want to change based on certain logic. When the cron is run, I get the error:

  Warning: Parameter 4 to node_apachesolr_index_document_build() expected to be a reference, value given in module_invoke_all() (line 857 of /var/www/drupal-7.17/includes/module.inc)

since it messes up with existing calls.

Any idea how to workaround this? Thanks.


texts: Superfish menu is not responsive for mobile screens

texts:
i'm using drupal 7 and superfish 7.x-1.9, the problem is when i reduce the browser, the menu is not responsive, it still be the same nothing moves, i'm working on it for hours now and nothing

Please any help on configurations ?

Here a screenshot of the desktop menu :

And here the same menu with browser reduced on width :


texts: Form custom with method GET remove form_build_id and op from GET variables

texts:
If I create a custom form with get method:

$form['#method'] = 'get';

When I click the submit button, many variables are populated with GET
Can I remove them cleanly according to the drupal logic?


texts: How to theme specific taxonomy term page?

texts:
Possible Duplicate:
  Theme specific taxonomy page

I have a taxonomy term page that shows all the related terms with their details ... i just need to show the list of the terms as links to node page. Which is the best way to do it?

EDIT: i tried to create taxonomy-term--VOCAB.tpl.php file, it is read but $content variable is empty .... so i don't understand how Drupal handles it.


texts: How do I add a child to an HTML Tag render element?

texts:
I need to reproduce this with render elements:

Can't figure this one out!


texts:
I have an autocomplete field in a custom form which works and returns a pipe-seperated value which I want to then split up and insert into the appropriate form fields.
For example, the autocomplete field returns 'Last|First|ID' such as 'Smith|John|123456789' and I want to assign these values to other form fields and replace the current value of the auto complete field with the last name.

I have successfully gotten the ID and the First Name to be populated using jquery, but the last name in the auto complete field WILL NOT CHANGE.

Some observations: if I first alert the value of the field, it changes. It's as if the script is running too fast and skips over the step to set the value of the autocomplete field. It also appears to work with other event firings instead of .change, such as .blur, or .keyup - but the thing is I need it to be .change or else it won't work for all cases.

Here's my jquery code:

$('#edit-emp-lname').change( function () {
    var empName = $(this).val();
    //alert($(this).val());
    var empArray = empName.split("|");

 //The following line is basically ignored. All other following lines work successfully.
    $(this).val(empArray[0]);
    $('input[name="emp_fname"]').val(empArray[1]);
    $('input[name="emp_uid"]').val(empArray[2]);
});

Update
In order to make this work properly and in IE to boot I had to do some extra code, shown below:

$('#edit-emp-lname').change(function() { doChange(); }).attr("onchange", function() { doChange(); }).blur( function() { doChange(); });
function doChange() {
    var empName = $('#edit-emp-lname').val();
    var empArray = empName.split("|");
    setTimeout( function () {
        $('#edit-emp-lname').val(empArray[0]);
        }, 10);
    $('#edit-emp-fname').val(empArray[1]);
    $('#edit-emp-uid').val(empArray[2]);
}


texts:
Trying to set up a preprocess_field_hook() to send a different css style depending on the node that is loaded for simpler theming. Will not work and been beating my head.

Have this set inside my template.phpand have my tpl pages named correctly (exam: node--node_page_one.tpl.php), which is loading fine with other functions already working. I feel like I need to have it point to the actual element somehow? Or should I be doing this somewhere else like in the preprocess_node_hook()?

Sorry for my noobness.

 function mytheme_preprocess_field(&$variables, $hook) {
      $variables['fieldclass'] = '';
      switch ($variables) {
        case 'node_page_one':
          $variables['fieldclass'] = 'tiny-blue';
          break;
        case 'node_page_two':
          $variables['fieldclass'] = 'large-green';
          break;
        default:
          $variables['fieldclass'] = 'black';
          break;
      }