texts: How do I find the user ID  knowing the username, when using drush?

texts: That would be much more handy to use Drush rather than executing a SQL query to find a user ID. So I am wondering what drush command can be used that takes a username, and returns the equivalent user ID.


texts: Conditionally display taxonomy terms with count from one vocabulary based on nodes tagged with term from another vocabulary

texts:
I have been beating my head against the wall with something that I thought would be fairly straightforward.  I have a client who needs a classifieds-type site comparable to Craigslist in the way that you must first choose a location before you can see listings.  I have two vocabularies set up, the first is Cities and the second is Categories.

What I would like to do is, if a user clicks into City A, they will see something like the following:

Clothing (25)
 - Hats (12)
 - Gloves (6)
 - Shirts (7)

Housing (5)
 - Apartments (4)
 - Shared (1)

etc, but the count would be different if they clicked into City B.  The Advanced Taxonomy Blocks module perfectly handles the way I want to display terms in that it displays hierarchical terms with node count, but there is no way (as far as I can tell) to filter the results based on terms from another vocabulary.  I have looked at dozens of modules and have experimented with many but can't seem to achieve the desired result with them or views...  If anyone has any insight, or has done anything similar, I would be very very grateful!

Cheers,

Danielle


texts: get value from content type B, in a view of content type A

texts: i have a content type named songs. among other fields, it has a field named title of the song, which has as its field type the Node reference. i also have a second content type named songsTitles which keeps all songs' metadata, where there is for instance the duration of the song, the producer, etc. how can i retrieve in a view that i have created for the content type songs, instead of the node reference value, for each song, its duration instead? I would prefer to do it via the Views gui, since whatever i tried with code was not successful.


texts: Ajax pager won't work after other ajax event

texts:
I have a View called 'example' with the Pager turned on and Ajax turned on.

I have a script that refreshes the View by providing a path as an argument.

    $('.view-example a')
        .live('click', function(e) {
            e.preventDefault();

            var trigger = $(this),
            arg = trigger.attr('href');

            $.ajax({
                dataType: 'json',
                type: 'GET',
                url: '/views/ajax?view_name=example&view_display_id=block_1&view_args='+arg,
                success: function(data) {
                    $('#container').html(data.display);
                },
            });
    });

That all works fine. Although once the Ajax event has succeeded the View's pager doesn't work as expected. Instead it displays the json data of the view.


texts: Single content type with urls that can differ

texts:
A site I am working on has a content type called property with a large number of fields within where the data is brought in from a 3rd party API.

Currently we use pathauto for generating alias urls of our content and has admirably filled our needs, except for the property content type which has a number of conditions which can determine what its url is and I am unsure that pathauto can do what is required.

We are using Drupal 8, latest version.

A properties url will contain the location, the listing type (sale, rental, auction or new-home) and the title of the property in its url.

So for example, a property with title ABC which is been sold in henley would have a url along the lines of http://example.com/property-for-sale/henley/abc.

But a property xyz on auction in basingstoke would be along the lines of http://example.com/auctions/basingstoke/xyz

Is there a hook/module or Drupal way (Views?) of handling this please? IF I remember Drupal 7 had hook_url_inbound_alter but I cannot find this in the D8 API.

Any enlightenment would be appreciated.

Grateful Grasshopper/John


texts: In Responsive Bartik, add collapsible menu toggle to wide screen?

texts:
Does anyone know how to enable the collapsible menu/menu toggle functionality that is part of Responsive Bartik on small screens to large screens?
It doesn't seem to be done solely by media queries.


texts:
I have an entity line_item with the following fields:

id
uid (entity reference)
product (entity reference)
...

I would like to get all distinct products (product ids) for a specific user.

I tried with entity query:

$query = $this->entity_query->get('line_item');
$query->condition('uid.entity.name', $username);
$entity_ids = $query->execute();

Unfortunately this results in all line_items from the given user, with multiple times the same product. But what I am interested in is just getting all different products for the given user.


texts:
I'm using Drupal 8.3.0-beta1 and I need to write a custom module to customize breadcrumbs in some cases. On of this cases consists in customizing the breadcrumb in path taxonomy/term/% but with my current code there is a problem:

When I visit taxonomy/term/% the "applies" callback of my custom implementation of BreadcrumbBuilderInterface doesn't get executed. However, it gets called on taxonomy/term/%/edit. Maybe that's the reason why the core breadcrumb builder only returns "Home /" in this case. Do you think this is a core bug or I have done something wrong?

Notice I have another implementation of BreadcrumbBuilderInterface for nodes which works well. This is my code:

custom_breadcrumb.info.yml

name: 'Custom breadcrumbs'
description: 'Custom breadcrumbs implementation'
package: 'Custom'
# core: 8.x
type: module

version: '8.x-1.0'
core: '8.x'
project: 'custom_breadcrumb'
datestamp: 1443649740

custom_breadcrumb.services.yml

services:
  custom_breadcrumb.breadcrumb_blog:
    class: Drupal\custom_breadcrumb\Breadcrumb\BlogBreadcrumbBuilder
    tags:
      - { name: breadcrumb_builder, priority: 101 }

src/Breadcrumb/BlogBreadcrumbBuilder.php

<?php

namespace Drupal\custom_breadcrumb\Breadcrumb;

use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Link;
use Drupal\taxonomy\Entity\Term;

class BlogBreadcrumbBuilder implements BreadcrumbBuilderInterface {
  use LinkGeneratorTrait;
  use StringTranslationTrait;

  /**
   * @inheritdoc
   */
  public function applies(RouteMatchInterface $route_match) {
    // This breadcrumb apply only for blog taxonomy terms of vocabulary 'categoria_blog'.
    $parameters = $route_match->getParameters()->all();

    /*
     * CORE BUG? applies callback gets called on "taxonomy/term/%/edit" but not in "taxonomy/term/%"
     * https://www.drupal.org/node/2622840
     */
    if (isset($parameters['taxonomy_term'])) {
      $term = $parameters['taxonomy_term'];

      if ($term->getVocabularyId() == 'categoria_blog') {
        return TRUE;
      }
    }

    return FALSE;
  }

  /**
   * @inheritdoc
   */
  public function build(RouteMatchInterface $route_match) {

    $parameters = $route_match->getParameters()->all();

    if (isset($parameters['taxonomy_term'])) {

      $term = $parameters['taxonomy_term'];

      // Breadcrumbs set up (cache settings are so important!).
      $breadcrumb = new \Drupal\Core\Breadcrumb\Breadcrumb();
      $breadcrumb->addCacheContexts(["url"]);
      $breadcrumb->addCacheTags(["taxonomy_term:{$term->id()}"]);

      $breadcrumb->addLink(Link::createFromRoute($term->getName(), '<none>'));
    }

    // Reverse order for this to work!!!.
    $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
    return $breadcrumb;
  }
}


texts: Programatic block with default configuration form?

texts:
We're using features on our Drupal project. We would like to specify few blocks NEED to be present in the database and their settings. Imagine block named "sidebar advertisement". That block has certain settings (display on certain content types like "Basic page", or certain URLs). We don't really care about the block's contents. That's admin's responsibility.

Is there a way to enforce the existence and settings of this block, but keep the rest the same (the editing form, etc.)? There are ways to create blocks programatically using hook_block_info(), but that requires implementing custom persistence for the block's contents using hook_block_configure().


texts: Drupal isn't picking up my custom action

texts:
I wrote a couple of actions for my Drupal page, but for some reason, Drupal isn't picking them up... Nevertheless, it's a copy/paste of the Drupal.org website...

   function publicatie_omgeving_action_info() {
      return array(
        'publicatie_omgeving_publish_action' => array(
          'type' => 'node',
          'label' => t('A'),
          'configurable' => FALSE,
          'behavior' => array('changes_property'),
          'triggers' => array('comment_presave', 'comment_insert', 'comment_update'),
        ),
        '_mijn_organisatie' => array(
          'type' => 'user',
          'label' => t('AA'),
          'configurable' => TRUE,
          'behavior' => array('changes_property'),
          'triggers' => array('comment_presave', 'comment_insert', 'comment_update'),
        ),
        'publicatie_omgeving_menu' => array(
          'type' => 'comment',
          'label' => t('AAA'),
          'configurable' => FALSE,
          'triggers' => array('comment_insert', 'comment_update'),
        ),
      );
    }

I only get the first one, A. Is there something wrong with this code?


texts: Why does in Drupal 8 there are two different namespaces for test cases?

texts:
In Drupal 8 core modules tests are under two different namespaces which maps to two different directories under the module.

\Drupal\Tests\<mymodule>\<TestSuiteType> => <mymodule>/tests/src/<TestSuiteType>
\Drupal\<mymodule>\Tests => <mymodule>/src/Tests direcotry.

For example in field_ui module.

\Drupal\field_ui\Tests\FieldUIDeleteTest => field_ui/src/Tests/FieldUIDeleteTest.php
\Drupal\Tests\field_ui\Functional\EntityDisplayModeTest => field_ui/tests/src/Functional/EntityDisplayModeTest.php

Can someone please explain the reason behind this and any advantage of writing test cases under two different namespace for the same module?


texts:
I have a view that has several decimal fields. I want to output the fields based on their value.

Can I use a view template overwrite and twig if statement for that? Specifically

Output the field value in a variable.
Check the value of field
Based on value add different span around the field output.

Is template overwrite the best approach or maybe I should use a hook?


texts: How to display a list of users tagged with taxonomy term, but taxonomy term already used in another display

texts:
I have a taxonomy vocabulary . I already have a view set-up that displays each committee's page using the '/taxonomy/term/%' display. This works great.

Committee:
   - Committee #1
   - Committee #2

My issue is that I would like to have another display that shows committee members (set up as drupal users) that have been tagged with a committee using the term reference field.

Committee #1

Committee #1's Users

Committee #2

Committee #2's Users

How would I get this work. I can't use the path '/taxonomy/term/%' again.

Thank you in advance for any help!


texts:
I pritty messed up my site by updating my 8.2.6 site as followed.

Step 1: I edit my composer.json file. I replaced the replace to require
"replace": {
        "drupal/core": "~8.3" to

"require": {
        "drupal/core": "~8.3"

Because I wanted to update core and vendor I did this composer command
step 2: composer update --with-dependencies

step 3: Site was broken unexpected error (500) using WAMP 2.4.23, php version 7.0.10 and mysql 5.7.14.

Do I have to update to 8.3.0 first before I can update to latest stable release?
- example: composer require drupal/core:8.3.0


texts: Is it possible to theme a node based on taxonomy the same way you can theme a node based on its content type (something equivalent to node-news.tpl.php for example) or do I need to organize my content by content type to achieve this?


texts:
I am working on a new content type. I created a hook that loops through a .csv file on its load, and makes a table from it.

What I want to do now is including this new table automatically in the CKEditor field, in the same form.

How can I do this? You don't have to tell me exactly what to do. Just some hints on which function to use would be appreciated.


texts:
Drupal 6: Basically I have two content types connected by the Node Reference module. One is "Questions," the other is "Answers".

In the view there are 10 content items under "Questions." When the user clicks the link the title of the "Question" they see the page with the question and the link to create a related answer. I have a rule that sends the user back to the view filled with "Questions" after they save their "Answer."

My goal is to remove the recently answer "Question" from the list of available "Questions" on the view. That way they only see "Questions" they have yet not created "Answers" to.

Using the Relationships option and an Argument based on the UID of the currently logged in user I have been able to filter the "Questions" down to those that have "Answers" attached to them that the user has created. However, what I'm looking for is the opposite. Hide those, and only show the ones that don't have "Answers" that the user has created.

Has anyone ever done something similar to this?


texts: Print custom product variation field in order email confirmation

texts:
Added custom field ('field_secretkey') under Commerce - Product variation (admin/commerce/config/product-variation-types).

I am able to get this value in Orders view by adding the "Product variation" relationship.

I just want to print this value in order confirmation email (commerce-order-receipt.html.twig) It can have multiple items with different values.

Please advice.

Example:

No | Product Name | Custom field

1 | Product 01 | XYUSNMAI

2 | Product 02 | AYUSSAAA

3 | Product 03 | PAUSNPPP

Updated: RESOLVED - TRY BELOW

URL - {{ order_item.getPurchasedEntity.field_custom_field.0.uri }}

TITLE - {{ order_item.getPurchasedEntity.field_custom_field.0.title }}


texts:
Passing a context from the panel to the view.

Need the view to accept the context and then consume an RSS feed.

For example: visiting /stock/MSFT would pass in MSFT to the view. The view would then hit http://finance.yahoo.com/rss/industry?s=MSFT and consume that RSS content.

I know you can consume a static feed with the Aggregator or Feeds module but what about a dynamic one. Any ideas?

Thanks!!


texts: What should be used instead of raw filter?

texts:
Drupal 9 theming documentation indicates that the Twig raw filter is deprecated in favor of verbatim.
The ds-field-expert.html.twig template uses raw to render the input in the prefix and suffix field, which is often HTML.
{{- settings['prefix']|raw -}}

verbatim in the Twig 2 documentation is not a filter, but instead wraps around content in the template, so wrapping the line of code does not actually go and get the prefix/suffix content. It just renders the twig.
What should I use instead of raw in this case so the markup I enter into the prefix and suffix field of a Display Suite expert field template renders as HTML and not plain text?
Will this template break in Drupal 9?


texts: How to delete all nodes of a given content type?

texts: I have several thousand nodes of a particular content type. Using the web interface (example.com/admin/content), I can only delete about 50 at a time. How can I quickly delete them?


texts: How can I see the created date of a node in a view? I don't see it as an option.


texts: Backup_Migrate Module able to Create Backups but NOT Restore them

texts:
Using Drupal 7.37, Omega4-SubTheme
Acquia Dev-Desktop Stack (Development)
Windows 7 HP
Using Backup_Migrate-3.1.

I set up my Backup and Migrate settings to back up my entire website-code and the corresponding Database.

This is set to copy the Backup to a subfolder in my C:\ Folder directory.

Back up and Migrate saves the Backups fine and I can see them when I navigate to my Backup-Folder.

They are saved as Zipped-Files.

If I try to restore using one of my Backups, I get an error (next item).

Exception: Unable to create directory 'C:\Drupal-Temporary/backup_migrate_556bb93614fe3/docroot/C:' in Archive_Tar->_error() (line 635 of C:\Users\Chandra Swa\Sites\drupal-7\modules\system\system.tar.inc).

There appears to be some problem in reading a "Temporary" directory, not my actual saved Backup directory.

What is causing this error; what does it even mean; is there a fix?

Thank you for your time to read this.  I have tried to be as thorough as possible.


texts:
i have created a views filtring contents. i want to use custom tpl and get values of $row variable. How can i extract these valuse?

for example:

<?php foreach ($rows as $id => $row): ?>
   <div class="<?php print $classes_array[$id]; ?>"><?php print $row; ?>

<?php endforeach; ?>

i have tried

<?php print_r($row); ?>

but no solution.


texts: Isotope and Views Load More error - Javascript breaks on some Ajax calls

texts:
I've created a view with Views Isotope and Views Load More contributed modules.

The objective is to have a Isitope grid that we can zoom in/out on items.

After long time to get it working I got a strange bug:

When I load the page it works fine.
When I click on load more first time the grid breaks.
When I click on load more second time the grid works fine.
When I click on load more third time the grid breaks.
And so on...

See it working here.

This is my javascript:

(function ($) {
Drupal.behaviors.skeletonthemeCustomBehavior = {

attach: function (context, settings) {

  // $grid.isotope('destroy');

  var $grid = $('#isotope-container').isotope();

  $grid.isotope({
    masonry: {
      columnWidth: 10
    }
  });

$grid.on( 'click', '.isotope-element', function() {
  if ($( this ).hasClass( 'gigante' )) {
    $( this ).toggleClass('gigante');
  } else {
    // change size of item by toggling gigante class
    $( '.isotope-element' ).removeClass( 'gigante' );
    $( this ).toggleClass('gigante');
  }
  $grid.isotope('layout');
});

$('#destroy').bind( 'click' ,function(e) {
  event.preventDefault(e);
  $grid.isotope( 'destroy' );
});

  $('.relayout').bind( 'click' ,function(e) {
    event.preventDefault(e);
    var $grid = $('#isotope-container').isotope();
    $grid.isotope({
      masonry: {
        columnWidth: 10
      }
    });
    $grid.isotope('reloadItems');
  });

  $( document ).ajaxComplete(function() {
    var $grid = $('#isotope-container').isotope();
    $grid.isotope({
      masonry: {
        columnWidth: 10
      }
    });
    $grid.isotope('reloadItems');
  });
}

};
})(jQuery);


texts: Blanket CCK Field Permissions for Specific Content Type?

texts:
I am creating a rather large (100s fields) form using CCK. I would like access to edit the fields to be give to anyone who has access to create the content type rather than by role.

For example, I can allow an anonymous user to edit the field_phone using user permissions, but I do not want the anonymous user to have such permission on other content types, only the custom form.

Also, since there are 100s of fields, managing the edit permission individually kinda drags.

thanks, tom


texts: Adding validation to existing forms using #element_validate

texts:
Problem

I'm using #element_validate to validate an input on a custom form which creates a node. I'm using element_validate_integer_positive as the function to validate. It works perfectly.

It partly works when I try to hook the same code into the existing node edit form. The form still breaks and displays the correct message but it also throws two errors due to missing values. How can I remove these errors?

So far

Here's the form code from my custom module. This works as expected.

$form['field_total_vacation'] = array(
  '#type' => 'textfield',
  '#title' => t('Total Vacation'),
  '#size' => 5,
  '#element_validate' => array('element_validate_integer_positive'),
);

Here's my hook into the node edit form:

function viewspagehack_form_alter(&$form, $form_state, $form_id) {
  if ($form_id === 'job_advert_node_form') {

    $form['field_total_vacation']['#weight']             = 19;
    $form['field_total_vacation']['#element_validate']   = array('element_validate_integer_positive');
    }
  }

If I enter a non-positive integer into field_total_vacation on the node edit form, it still breaks and throws the correct message: "Total Vacation must be a positive integer" but it also throws:

Notice: Undefined index: #value in element_validate_integer_positive() (line 4190 of C:\XAMPP\htdocs\drupal\includes\form.inc).
Notice: Undefined index: #title in element_validate_integer_positive() (line 4192 of C:\XAMPP\htdocs\drupal\includes\form.inc).

This is because element_validate_integer_positive() takes $element as it's first input and the function then calls:

$element['#value']
$element['#title']

But this error doesn't throw on my custom form which also doesn't take an input. What's going on?

EDIT

I moved #element_validate to here, this means it now has access to #title:

$form['field_total_vacation']['und']['0']['#element_validate']   = array('element_validate_integer_positive');

This removes the title error but leaves the value error. I can't understand why this function takes #value from $element.

function element_validate_integer_positive($element, &$form_state) {
   $value = $element['#value'];

None of the form elements have #value, #value only seems to appear in $form_state. But yet it works in my custom form and not on the node edit.


texts: Menu Rendering before styles are applied. Webkit Browsers only, possible reasons why?

texts:
I am working on a project for a client. The site is large, with a lot of scripts and for non-disclosure reasons I can't add a link.

The probably seems to be only in Webkit browsers. Before the page is loaded the menu appears completely unstyled before jumping to the styled version.

The menu is rendered as a block, but I have also tried adding it via the template to no avail.

I have moved the navigation css to render immediately after the system.css files.

No other blocks/views are behaving like this. When the site goes live it will have it's own opcache and cloudflare for extra speed and caching but we'd like to eliminate the problem prior to that.

Can anyone suggest what may be the issue? Or has anyone come across anything similar? Any advice would be appreciated.


texts: Workbench Moderation: need new update notification

texts: The module Workbench is working great on Drupal 7. I need to add notes or notify user to change or update, so I installed the module Workbench Moderation Notes. The only issue I have with this module is no "New note" notification(see screenshot for detail). Is there a way to add that feature or any module can replace this? Does Workbench Email work better?


texts:
what I am trying to achieve is to filter the site's search results and produce results of 5 content types. Search API has helped me do that and very well I must say. There is one more thing though that I need to do and I am wondering it already supports such behaviour and/or if it can be solved by theming OR if I have to create a custom solution; so here it is:

Say my aforementioned content types are: Alpha, Bravo, Charlie, Delta, Echo. I want my facets to be produced in this manner:

All (23)
Alpha (10)
Bravo (4)
Charlie (0)
Delta (1)
Echo (8)

So what i need furthermore than the options your module provides is the "All" option as long as showing Facets which yielded no results.

Apart from that, I also need to bypass the "filter-like" functionality the module provides by default, where I have to click the "-" sign next to the link to go back to the main selection, and make clicking the link filter the results while leaving the other options there for clicking. So if I was to switch from "All" to "Bravo" i'd just had to click Bravo, something like a contextual filter of Content Types in a View, oh and yes, my results are in a view-page.

Thanks in advance.


texts: How to create a custom field that gets URL counts from LinkedIn on external articles?

texts:
My site has a content type named News, which receives news from external RSS feed. Therefore, content type News has the following fields:

Title = article title (i.e. Hapag-Lloyd orders five container ships for more Panama Canal trade)
URL = external url field (i.e. http://www.reuters.com/article/2015/04/20/hapaglloyd-ships-idUSL5N0XH3XQ20150420)
Source = external website source (i.e.Reuters)

I would like to create 3 fields in the content type that shows count of article has been shared on LinkedIn in using the following function:

http://www.linkedin.com/countserv/count/share?url=http://www.reuters.com/article/2015/04/20/hapaglloyd-ships-idUSL5N0XH3XQ20150420&format=json

Return

{"count":28,"fCnt":"28","fCntPlusOne":"29","url":"http:\/\/www.reuters.com\/article\/2015\/04\/20\/hapaglloyd-ships-idUSL5N0XH3XQ20150420"}

Fields to be displayed:

count (i.e. 28)
fCnt (i.e. 28)
fCntPlusOne (i.e 29)


texts: Is there a way to display primary tabs vertical in separate block?

texts: In Drupal 7 I want to rearrange standart drupal tabs (eg. 'View' and 'Edit') as vertical and move it to sidebar. Is there a way to do this?


texts: Slow page loads - unable to determine the cause

texts:
I am experiencing ~ 6 second page loads on every page of my Drupal 7 site. All of my scripts are loading from cache and relatively quickly except one, which will take 5.6-5.9 seconds to load (I am using FireBug to monitor):

Originally it looked to be the overlay.js javascript file, so I disabled the module. Then it was contextual.js with the exact same load time with everything else being quick. When I disabled that module it was yet another js library taking the same amount of time. This leads me to believe it has nothing to do with the libraries and is some other issue with the pages / rendering. I tried aggregating the JS and CSS, but the same issue was happening. All the queries showing up in my MySQL logs are executing relatively quickly (total of all query execution time is less than .5 seconds).

I am honestly at a loss for what to try. I suspect there is some problem here unrelated to loading any of the js files and that firebug is just reporting the delay as part of the last loaded file. This happens on both my custom pages and core drupal pages (like the modules and people screens). Is there any way to tell what is causing the long delay if it is not the javascript library?

EDIT: Details from the header for the script:

Request Headersview source
Accept  */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection  keep-alive
Cookie  Drupal.toolbar.collapsed=0; __utma=163199651.1343774579.1355785168.1378243005.1379453429.30; __utmz=163199651.1378243005.29.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _ga=GA1.2.360149903.1357234390; SESSb5e5274d127f94079db0dc72d78d2200=AnQQv9Tp-NQT-b3YcVfOKzEnVSL-3cBexxbp2jY70D0; has_js=1
DNT 1
Host    example.com
If-Modified-Since   Wed, 03 Apr 2013 21:29:52 GMT
If-None-Match   "bcc-4d97b8dea7400"
Referer http://example.com/drupal/?q=peopleace/form/14172
User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0

Response Headers From Cache
Accept-Ranges   bytes
Content-Length  3020
Content-Type    application/javascript
Date    Wed, 02 Oct 2013 19:26:36 GMT
Etag    "bcc-4d97b8dea7400"
Last-Modified   Wed, 03 Apr 2013 21:29:52 GMT
Server  Apache


texts: Simplenews Scheduler - only send newsletter when attached EVA view contains results

texts:
Simplenews Scheduler is working well for me to send a weekly email which contains an attached view (using EVA) of nodes.

I would like the newsletter to only send if the attached view contains nodes, so that empty newsletters are not sent.

I can see that this should be possible using the 'Additionally only create newsletter edition if the following code returns true' field on the Newsletter > Send newsletter according to schedule page.
I am currently using this (which always produces a newsletter regardless of whether nodes are displayed in the view):

if(views_get_view('job_type_c_list')) {
      return true;
}

I have tried using the overall length of the node body to try to work out if a view is present. (I don't know if the tokens can be used in this field or not):

if(views_get_view('job_type_c_list')) {
     $myvar = [node:body:?];
     if(strlen($myvar) >= 30) {
           return true;
      }
}

When i was working with PHP in the body of the node I was able to evaluate whether EVA was returning nodes by using

<?php
    $view = views_get_view('job_type_c_list');
    $printedview = $view->preview('default');

    $myvar = (string)$printedview;

    if(strlen($myvar) >= 1000) {
           print "VIEW ATTACHED";
    }

    else if(strlen($myvar) < 1000) {
           print "NO VIEW ATTACHED";
    }
?>

The above code is clearly not the most elegant, but it worked in the node itself. Unfortunately it didn't work in the 'Additionally only create newsletter edition if the following code returns true' Simple news scheduler field.

I have struggled with this for quite some time and would really appreciate some help.
Code suggestions would be great, but failing that knowing 'If I can use tokens in the field?' and 'why does the PHP in this field behaves differently to PHP the node itself?' would also be very helpful.

I have had an issue open in the module issues page for a few days now, but it has not received any responses.


texts: Query fieldCondition for custom content type

texts:
I am attempting to query a custom content type called players (machine name) in a Drupal 7 module and it seemed to be working fine up until an hour ago. Nothing has changed on my side but now the 'Select' works ( with no fieldCondition, but when I add a fieldCondition I am getting empty results.

Here is my query:

$query = new EntityFieldQuery;
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'players')
  ->fieldCondition('field_email_address', 'value', $email_address)
  ->fieldCondition('field_password', 'value', $password)
  ->range(0, 1);

$results = $query->execute();

I have verified and reverified the bundle name, each machine name for the fields, and the values being passed in, but when I dump and die the query results, they come up empty.

Any ideas?


texts:
In template_preprocess_mimemail_message() I checked that mail key is mimemail_message__subscriptions_mail__node-type-post, but none of these templates is using in the email:
mimemail_message__subscriptions_mail__node-type-post.tpl.php
mimemail_message--subscriptions_mail--node-type-post.tpl.php
mimemail-message--subscriptions-mail--node-type-post.tpl.php

What I'm doing wrong?


texts:
I have created views called 'Awards' and in these award views they reference 'food item' nodes. Within the view a food item can be 1st, 2nd, 3rd, depending on certain filters/reasoning to create this list.

So, if a food item is 1st in an Awards view, how can I automatically put this on a 'food item' node to show that this food item has won an award?

More info on the views

They are created and sorted/filtered by specific things, one view might be 'Most calorific meal' and then it just lists meals by calories in them. Then I get a 1st, 2nd, 3rd. So if hamburger comes up as 1st, I want to put a badge on the hamburger food item node saying it's 1st in the Awards section for: Most calorific food item.


texts:
I had an error (related to Date module I think? Can't remember.) on my site so I tried to do an update. Caused a WSOD so I svn reverted. Didn't help. Manually disabled each module in the database. Didn't help. Fixed some permissions. Helped... sort of.

Now I get this:

  Drupal already installed To start over, you must empty your existing
  database. To install to a different database, edit the appropriate
  settings.php file in the sites folder. To upgrade an existing
  installation, proceed to the update script. View your existing site.

Running the upgrade script gives this error:

  PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL
  server through socket '/var/lib/mysql/mysql.sock' (2) in
  drupal_get_installed_schema_version() (line 150 of
  /public_html/includes/install.inc).

Any other page redirects back to install.php.

So it seems like it can see the database to know that it's not empty, but can't really connect to it... what does this mean? What do I do about it.


texts: Add CSS class to view image_field in twig

texts:
In my custom view fields twig file views-view-fields--search--product_result.html.twig I try to theme my view item.

{{ fields.field_images.content }}

{{ fields.title.content }}

How do I add a CSS class to my image field {{ fields.field_images.content }}?


texts: How can I output the absolute URL as link text for internal links on link fields?

texts:
When using a link field without a link text and just with the URL, Drupal 8/9 outputs the relative path as the link text for internal links. How can I change that to either output the absolute URL or (even better) use the title from the entity in the link as the link text?
I am using the "Separate link text and URL" formatter provided by Drupal core.


texts:
I need to link/sync a paragraph with another field on the parent node of this paragraph.

Background:

All my nodes have some node-type-specific fields for strict-structured data (e.g. a product node has product image & price; a location node has a geolocation field). All nodes share one huge, repeating paragraph "generic content" field with a lot of paragraph types for unstructered data (marketing texts, emotional images, bullet points,...). Basically that paragraph is used as a sort of site building tool.

Requirement:

I now need to display the node's structured data fields within the "generic content" paragraph field, so that editors can mix and move the structered content with the generic content paragraphs.

Didn't work:

My initial idea was to create a paragraph with an entity reference to field types where editors could select the basefield. However, that didn't really work because I can't limit the autocomplete to fields of the current node, leading to a unusable list with a lot of invalid entries.

Question:

Is there any way to create references to fields within a node? It has to be a mouse- and editor-friendly solution, my editors are trained in the Drupal Admin, but they have no access to code.


texts: admin content overridden view not displaying

texts:
I have updated Drupal 6 using drush and all my admin views stopped working.
I create a new view but when I display it the server takes too long with no response. I tried to track error log to see if something is wrong but the only error I got was php timeout error.

note: the main view node under admin/content/node is working fine and display all the content as usual. but all other views like admin/content/node2 not displaying at all.

What may cause this?


texts: Panels problem modal form continuous loading

texts:
I have a problem in panels.

When I choose layout and want to add content to it(also when I go to layout designer) nothing appear it just open the content window and continuously loading.

I am wait too long time didn't appear any thing.

I deleted the panels module and install it again ,clearing the cache ,changing browser but the problem still.

How can i solve it?


texts: Page title with substitution on views page

texts:
I have a view page that requires a dynamic page title. It is a simple substitution of the label field.

If I use {{ label }} it works fine for the title displayed on the page, but it doesn't substitute the label for the actual page title (in meta)

I was able to fix this by using hook_views_post_render using the following code

// Set the route title.
$route = \Drupal::routeMatch()->getCurrentRouteMatch()->getRouteObject();
$route->setDefault('_title', $title);

$view->setTitle($title);

However, the title only works if the page is not cached. For the cached pages, the page title is missing. This feels like a bug in drupal, but I am hoping that there is a simple way to get this done.


texts:
I'm building a new Drupal 7 and brought over the user table at the beginning of the project from another Drupal 7 site. All has been good with that except that when users save their profile, they get the following error, which I believe is related to our custom Avatar builder module. I am wondering what I can do to suspend the error message so that it doesn't show for now during our testing phase.

  Notice: Object of class stdClass could not be converted to int in
  drupal_write_record() (line 7340

Here is the section of code from the .module that I believe that relates to this error:

/**
 * Implements hook_user_insert().
 */
function my_avatar_selection_user_insert(&$edit, $account, $category) {
  if (isset($account->picture)) {
    $usage = new stdClass;
    $usage->uid = $account->uid;
    $usage->fid = $account->picture;
    drupal_write_record('my_avatar_selection_usage', $usage);
  }
}

/**
 * Implements hook_user_update().
 */
function my_avatar_selection_user_update(&$edit, $account, $category) {
  if (isset($account->picture)) {
    $usage = new stdClass;
    $usage->uid = $account->uid;
    $usage->fid = $account->picture;
    $has_rows = (bool) db_query_range('SELECT 1 FROM {my_avatar_selection_usage} WHERE uid = :uid', 0, 1, array(':uid' => $account->uid))->fetchField();
    if ($has_rows) {
      drupal_write_record('my_avatar_selection_usage', $usage, 'uid');
    }
    else {
      drupal_write_record('my_avatar_selection_usage', $usage);
    }
  }
}

The module works by saving the data from jcarousel into the data field of the user table and when the profile is saved, it creates a graphic that looks like the options the users selected. As far as I can tell, there are no issues with saving the avatar, it just generates this error. I took this module from the old website 7.50 so maybe there is a component I don't need on the new site 7.54.


texts: Construct the src in a javascript tag from node fields

texts:
I have a drupal 7 instance where I would like to create nodes that call reports from a separate site using javascript.

Currently I construct the HTML tags myself which look something like this:

<script type="text/javascript" src="http://URL.goes.here/JsAPI?reportUUID=[REPORTID]&amp;yfFiltera5d74aca-4396-41c2-9376-d68fd57de81a=[FILTERVALUE]&display=[DISPLAY]&canChangeDisplay=[CANCHANGEVALUE]&showPageLinks=[SHOWPAGESVALUE]&showInfo=[SHOWINFOVALUE]&showFilters=[SHOWFILTERSVALUE]&showSections=[SHOWSECTIONSVALUE]"></script>

Note that there are a bunch of parameters in the url shown in square brackets: [VALUE]

What I want to do is have a node creation interface for admin users that allows them to set all of the parameter values and constructs that URL, then constructs a string using those parameters and uses it as the node's output when viewed.

I haven't been able to find any kind of module for this, maybe I am describing it wrong - or maybe it's a very rare use-case.  Any ideas would be wonderful, even if it's 'hire a developer, this has never been done before'.


texts: Design query for job site using subdomains

texts:
I'm designing a job site in D7. Ideally for better SEO each state or city should be in separate subdomain(this what I've learnt).

For city Paris it'd look like: paris.myjobsite.com

I'd post jobs using taxonomy categorization e.g. city,state, zip code, field, salary, qualifications.

Now I can host a new Drupal site on each sub domain so for 100 city/states it'd have 100 separate Drupal databases using multi site setup.

The other solution is to have a rewrite rule translating subdomain to site's internal url.

I'm unable to think beyond this.

I'd appreciate help as to how this design issue can be met in Drupal.


texts: Overriding the search block module output to add a custom wrapper

texts: My problem is fairly simple. I have written a theme_form() to override the default but I want it to kick in only in the search block. How can I do this with Drupal 7? Thanks


texts: how to make unsortable header colmn in theme_table drupal 6

texts:
I m using Drupal 6
I m using pager_query and theme_table
How can I make any column unsortable, by default it is making all columns sortable

$tableHeader = array(
        array('data' => ''),
        array('data' => 'Article','field' => 'a.title'),
        array('data' => 'From date','field' => ''),
        array('data' => 'To date','field' => ''),
        array('data' => 'Perpetual','field' => ''),
        array('data' => 'Access type ','field' => ''),

        );

here first column shows check boxes along each row so don't want this column sortable
Thanks


texts: How to import content to Drupal 8 site by inserting it directly in the database?

texts: As I was not able to find any working way of importing content from csv, I decided to export it to .csv from the old site (database) and import it then into the Drupal 8 database. However, after I updated tables node, node__body and node_field_data I was not able to access the content overview page anymore.


texts: How to apply coupon in commerce order programmatically?

texts:
I'm working on creating web services for mobile applications to use drupal as backend. When ever the user applying a coupon code through mobile application, I'll get the coupon code through web services as JSON data.

So, How can I validate and apply the coupon to the order programmatically.
I found the below answer from StackExchange (programmatically add line item of commerce_discount type to order). But, what value I need to pass for $discount_name. And how can I get it?

commerce_discount_fixed_amount(EntityDrupalWrapper $wrapper, $discount_name);


texts:
I write a small module which calculate 2 values out of nodes and print it in a block with two form fields. One with the value as markup and the other is a ajax checkbox that switch through the two values.

Now I want to count up it with jquery. Onetime if the position of the form is reached and than when the checkbox is clicked. I don't get it. Everytime the value is wrong after clicked the checkbox or the value is emty after running the script. The script works well with a single value or the first given value, but not with the ajax callback.

    $(window).scroll(onScroll);
    $(document).ready(onScroll);
    var squareMeters = $('.square-meters').text();

    //Drupal.behaviors.mymodule = {
    //attach: function(context, settings) {
        //$('#counter input').click(function() {
        $( document ).ajaxComplete(function() {
            squareMeters = $('.square-meters').closest('#counter').find('.square-meters').text();

                $('.print-counter').countTo({
                    from: 0,
                    to: squareMeters,
                    speed: 4000,
                    refreshInterval: 50,
                    onComplete: function(value) {
                        console.debug(this);

                    }
                });
        });
        //});
    //}};

    function onScroll(event){
        //EDIT
        squareMeters = $('.square-meters').text();
        // EDIT END
        if(scrollPos <= posSM) {
            $('.print-counter').countTo({
                from: 0,
                to: squareMeters,
                speed: 4000,
                refreshInterval: 50,
                onComplete: function(value) {
                    console.debug(this);

                }
            });
        };

};


texts: Feeds importer pass header values when fetching feed

texts:
We have been importing nodes with feeds importer from XML for awhile on this website and now the feed has been changed to a new XML but this time it's password/username protected. The XML feed is literally the same with the exception of a couple new fields.

When I used this XML feed inside of a custom module, I simply pass the username/password into a header of the curl call to authenticate. I currently cannot find the appropriate area to pass header values in within feeds import.

My question would be, is there any support for username/password authentication when pulling in a XML file with a HTTP Fetcher, with Feeds import? Are there any contrib modules that could extend feeds importer to provide the functionality i desire?


texts: How do you add a prefix to an existing drupal database for single site use?

texts:
I have a drupal 7 site running on a webserver, it is currently using a database that was created with out a prefix.

I am attempting to restore that database to a new drupal instance from a shared hosting provider. I am using the Backup and Restore Module to move the database.  One thing I have no apparent control of is that their "quick install script" creates a new drupal database with a "drupal_" prefix.

Do I need to convert my existing database to have that prefix, because as it seems now my migrated changes are not even being read since it probably has both sites data sitting side by side, and the  database information I want to be reading  entries  from don't have the prefix? Is that reasoning correct? If so how do I convert my Drupal database to the same one but now with the necessary prefix applied throughout?


texts: Views: Treat my custom timestamp field as a date the same way as core timestamp fields like Node: Created

texts:
When using Views, if you add a Node: Created filter to the Filter Criteria, you get two options for Value type:

A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.
An offset from the current time such as "+1 day" or "-2 hours -30 minutes"

These are the same options you get when filtering a Date field, but in the database, the node creation date is stored as a timestamp, not a date.
I added a custom field of type Timestamp to my node using Field UI. However, when I added my custom field to Views as a filter, I don't get the date options; instead, I get the standard options of operator "is equal to", "is less than", "is greater than", etc.
I don't understand why core timestamp fields are treated differently than timestamp fields created with Field UI.
In the Views code, in web/core/modules/views/src/EntityViewsData.php, I found this:
// Set up the field, sort, argument, and filters, based on
// the column and/or field data type.
// @todo Allow field types to customize this.
// @see https://www.drupal.org/node/2337515
switch ($field_type) {
  // Special case a few field types.
  case 'timestamp':
  case 'created':
  case 'changed':
    $views_field['field']['id'] = 'field';
    $views_field['argument']['id'] = 'date';
    $views_field['filter']['id'] = 'date';
    $views_field['sort']['id'] = 'date';
    break

The linked issue states:

Views integration works for config fields created in the UI, but not
for base fields added to the entity types in code.

My field was created using the UI, but it's still not working...


texts: Hook function for admin/structure/taxonomy/your_vocaburary form (Save and Reset to alphabetical)

texts: I'm looking for a hook function to interact with the buttons "Save" and "Reset to alphabetical" on taxonomy term hierarchy. Does anyone know how to override this functionality?


texts: How do you swap position of Order Total Components in Checkout Pane?

texts: In Commerce Shopping cart contents checkout pane, how do you swap the position of order components? We want the Sales Tax to appear -below- the Shipping.


texts: Get a file URL from a custom entity referenced on a user profile

texts:
I have an entity called CV which is used to store uploaded CVs. The entity is created and referenced on the user profile using inline entity form. I need to get the fid for the cv so I can do this:

$uri = file_load($fid)->uri;
$file_name = file_load($fid)->filename;
$path = file_create_url($uri);

I've tried to use entity_metadata_wrapper, but I'm not sure how to actually access the correct field. This is an example of what I've been trying:

$wrapper = entity_metadata_wrapper('candidate_cv', $cv);
$cv_file = $wrapper->field_candidate_cv->value();

Which returns this error:

EntityMetadataWrapperException: Unknown data property field_candidate_cv.

Update:
I have managed to get the title of the entity using this:

$cv_wrapper = entity_metadata_wrapper('user', $user);
$cv_upload = array();
foreach ($cv_wrapper->field_cv->value() as $index => $feature) {
    $cv_upload[] = $feature->title;
}
echo title[0];

But I can't get to the fid of the file field which is field_candidate_cv.

$cv_wrapper = entity_metadata_wrapper('user', $user);
   $cv_upload = array();
   foreach ($cv_wrapper->field_cv->value() as $index => $feature) {
        $cv_upload[] = $feature->field_candidate_cv;
    }
    $fid = $cv_upload[0]['fid'];

$fid prints nothing.

However, in this $fid prints Array:

 $fid = $cv_upload[0];


texts: How to set ajax event to onkeypress event?

texts:
$form['name'] = array(
        '#type' => 'textfield',
        '#title' => t('Name'),
        '#size' => '27',
        '#inline' => 'true',
        '#required' => TRUE,
        '#prefix' => '
',
        '#suffix' => '

',
        '#ajax' => array(
          'effect' => 'fade',
          'callback' => 'ajax_textfield_callback',
          'wrapper' => 'ajax-display',
          'event' => 'onkeypress',   /////////////////Want to add event
        ),
    );

Here in example i have to add event (slashed location). By Default it takes on change event. I want to change that event to onkeypress event.


texts:
This may not be Drupal specific, but does Drupal have a module that can fetch the correct world time from any remote time server, which can help me in keeping the time shown in my Drupal site correct?

I don't want to use my system time which may be inaccurate.


texts:
I have a template in which I've manually built a form. It renders some variables that come from a controller.

I've looked over the Form API and I think I should build the form using that. But I'm not quite sure how to go about it.

I'm relatively new to Drupal 8 and to be perfectly honest the Documentation is good, if one knows what to look for. It's not the case here.

Basically what I'm asking, is it possible(or rather advised) to somehow grab the form in the controller, and instead of passing the variables to the template, simply pass the created form to the template?

I'm assuming it would be better to do that, although I'm note quite sure that's the case.


texts: is there any general or universal way to change Drupal's objects CSS?

texts:
In some cases, when I install new themes, some regions\ blocks\buttons are too near to each other, and I need to start adding margins between them individually with css. This takes much time...

Is there a way to automate this process? Is there some kind of a general\universal ID or class for all regions\blocks\buttons that I might be able to use to space all of regions\blocks\buttons "In one piece" and with much comfortability? It could also help me save time that could go on other things.


texts:
I am using Panels 3 and Ctools to structure my pages and pass arguments both via context as well as inputs on pane settings (fixed text as well as keyword substitutions).  The "input on pane settings" is very important to me.

I need to fill some block regions from the theme, and if possible I would like to do this via the page manager in order to keep selections and variants in one place.

I am aware of mini-panels and that they can be placed in blocks.  But they would require to replicate all selection and context logic from the ctools page manager.

Panels Everywhere seems to go quite deep and I cannot predict whether it will actually allow me to modify the existing non-PE theme within a reasonable time.

Alternatively, I was thinking of modifying the theme's CSS and adding css-classes in page manager or to use javascript to replace the blocks with regular panes.  Unfortunately, this would require separate variants per theme.

Are there any suggested ways to fill blocks from the page manager?  I am using D6, but suggestions for D7 are good as well.

Clarification:
I am looking for ways for filling a themes' block regions (eg. sidebars, headers etc.) from the page manager, in contrast to eg. mini-panels added and configured on the blocks screen.  I am now trying to backport bricks, but ideally the block content should be defined within page manager.


texts: How to show a block on specific content type and combine it with path restrictions

texts: How do I show a block on all nodes of content type A, without restricting it to other "pages"? I already have some restrictions based on the path. The problem is that by using the settings under Visibilty > Content Type, the block disappears from other places where the block is defined. I want to combine it with showing this block on all nodes of Content Type A.


texts: When using Views Bulk Operations, the options for Rule Components are not shown in the VBO drop down for all users

texts:
When I am logged in as the root admin, I am able to create Rule Components (rule and rule sets) and have them appear in the View Bulk Operations (VBO) settings menu as an option for a VBO view table column.  As the root admin, I can also navigate to the view's page and successfully perform the Rule Component on table entries using the VBO interface.

However, when I log in as another user (seemingly regardless of role or permission) The Rule Component options which were enabled for the VBO column are no longer available.  It appears that some sort of permission is blocking them.  It is not obvious which permission (or if it is a permission) is blocking the Rule Component Options so they don't appear in the VBO list.

Does anyone have experience with this problem and knows a way to get Rule Components to appear in the VBO drop down in a view for all users?


texts: Add a class to a Drupal table cell containing ['data']

texts:
In Drupal 8,  rendering Tables is still a lot like Drupal 7.  You build out  multi-dimensional arrays of rows and columns in PHP that Drupal transforms into a <tr> and <td>s respectively.  There is still this confusing Drupalism known as 'data' that lets you add render array elements as cell data (not to be confused with data attributes).

I've been given a site where the developer chose to use 'data' to render the contents of the cell, but I cannot figure out how to add a class to the <td> around the data.

I've read the source code and documentation for Table.php and I'm aware of the new #wrapper_attributes  but I cannot crack this.

I've tried at least four ways to add the class, and none work.

$table['row-' . $row_id] = [

  // Option 1: Class appears on <tr> tag
  '#attributes' => [
    'class' => ['option-1-row-attributes'],
    'id' => 'row-' . $row_id,
    'no_striping' => TRUE,
  ],

  // Option 2: Class appears on <td> tag of first column.
  'item' => [
    '#markup' => $row['my_item']->label(),
    '#wrapper_attributes' => [
      'class' => ['option-2-markup-wrapper-attributes'],
    ],
  ],

  // In the following section, the only item that works is
  // the class on the <a> tag.
  'edit_operation' => [
    'data' => [
      '#type' => 'link',
      '#url' => Url::fromRoute('my_module.my_route', ['item' => $row_id]),
      '#title' => $this->t('Edit'),
      '#attributes' => [
        // Option 3: Class appears on the anchor tag
        'class' => ['use-ajax', 'option-3-link-attributes'],
        'data-dialog-type' => 'modal',
        'data-dialog-options' => Json::encode([
          'width' => 700,
        ]),
      ],
      // Option 4: Has no effect.
      '#wrapper_attributes' => [
        'class' => ['option-4-data-wrapper-attributes'],
      ],
    ],
    // Option 5: Update: This appears to be the correct solution!
    // Class appears on the <td>.
    '#wrapper_attributes' => [
      'class' => ['option-5-wrapper-attributes'],
    ],
    // Option 6: Has no effect.
    '#attributes' => [
      'class' => ['option-6-attributes'],
    ],
    // Option 7: Has no effect.
    'class' => ['option-7-attributes'],
  ],
];


texts: drupal_goto() not remove url path of 404 page

texts:
I have a search form which returns to search page.

drupal_goto('/searchyour/trips', array('query' => $query));

this is work fine if a user in active page. search url will replace as eg: example.com/searchyour/trips

But if user in 404 page (example.com/nopage) and click search, search url will set to example.com/nopage/searchyour/trips I want to change this to example.com/searchyour/trips.

I'm new to drupal. Help me to solve this. :-)


texts: Table Drag problem with Jquery Update to jquery 1.4 and highers

texts:
I want to use some jquery plugins that need jquery 1.7.x
But as you know jquery update in drupal 6.x only support jquery 1.3.x and lower.

if we copy jquery 1.7 to jquery update folder, it cause problems in table drag function.

Is there any way to repair table drag bugs with jquery high versions?


texts:
I use Putty to apply cloze module patch. Here are my steps:

I go to this directory: sites/all/modules/contrib/cloze
I save the patch: wget https://www.drupal.org/files/issues/cloze-report_form_quiz_compatibility_fixed-2216049-1.patch
Save as: cloze-report_form_quiz_compatibility_fixed-2216049-1.patch
I apply patch: git apply cloze-report_form_quiz_compatibility_fixed-2216049-1.patch (nothing happen. no error)
I check the status: git status

Result:

  fatal: Not a git repository (or any of the parent directories): .git

How come?


texts: How to retrieve GET parameter in Twig template

texts:
I'm attempting to retrieve a GET request variable for use in a twig template.
For instance if you go to the page myurl.com/node/64?name=Dave I want the page to render

Dave

However I'm having trouble retrieving this variable. I've attempted

{{app.request.get('name')}}

In my twig template but it turns up empty.
How would I retrieve a GET variable from within a twig template?


texts:
I use make files for a number of different flavours of sites that I build, then manually insert my own profile into the site/profiles/ directory.  Can drush make download and automatically insert the profile folder into the correct place?

Thanks

Kieran


texts: What is the best caching solution for website with a lot of content?

texts:
We are building a website with over a million nodes. Those nodes also have paragraphs which increases the number of entities. Therefore, the cache tables are getting bigger and bigger, especially the cache_entity and cache_render tables.

What is the best way to avoid the database to get too big (we're talking hundred of gigabytes) ? Is memcache a solution here or is it just deporting the problem of disk space ?

The basic cron task doesn't clear the tables. We were also thinking about setting a cron task to execute "drush cr".

According to that post and that issue, Drupal 8.4 will have a better cache table management.


texts:
I've written the following testcase to send an email. In test results output it says

  "1 e-mail was sent during this test."

but acutally it's not.

I tried another way, I put the function in menu callback (test-mail) it's sending mail when I access the URL. But if I access the URL in simple testcase like
$this->drupalGet('test-mail'); the result still says the same "1 e-mail was sent during this test." but was not.

So is it by design? Is there any other way to send mail?

 public function testSendMail() {
  $this->sendmail();
 }

function sendmail() {
  $from = 'fromaddress@gmail.com';
  $to = 'toaddress@gmail.com';
  $message = 'testcase mail';
  $language = 'en';
  $module = "test_mails";
  $key = "notification_mail";
  $send = TRUE;
  $subject = t("subject line goes here", array(NULL),array('langcode'=>'en'));
  $params = array(
    'body' => 'hello from krishna',
    'subject' => $subject
  );
  $result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
  return 'Mail sent succesfully';

  }

 function test_mails_mail($key, &$message, $params) {
 switch ($key) {
   case 'notification_mail' :
     $message['subject'] = $params['subject'];
     //the email body is here, inside the $message array
     $message['body'][] = $params['body'];
     break;
 }
}


texts: Core's ClassResolver cannot find my custom module class, gives InvalidArgumentException

texts:
TL;DR:  see error message at the bottom.

Yes, this is the very basic question on "How do I make a simple custom form" using Drupal 8.1.  I have read through 3 different sites and still having trouble.

My steps are to create these files:

Routing

./sites/all/modules/testmodule/testmodule.routing.yml

testmodule.fruit_form:
  path: '/testmodule/ask-user'
  defaults:
    _title: 'Fruit Form'
    _form: '\Drupal\testmodule\Form\FruitForm'
  requirements:
    _permission: 'access content'

Info

./sites/all/modules/testmodule/testmodule.info.yml

name: Test Module
type: module
description: Sample module that defines a route and form callback.
core: 8.x

Form File

./sites/all/modules/testmodule/src/Form/FruitForm.php

<?php
namespace Drupal\testmodule\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class FruitForm extends FormBase {
  protected $accepted_domains = ['gmail.com', 'yahoo.com'];
  /**
   * {@inheritDoc}
   */
  public function getFormId() {
    return 'fruitform';
  }
  /**
   * {@inheritDoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $fruits = ['Apple', 'Banana', 'Blueberry', 'Grapes', 'Orange', 'Strawberry'];
    $form['favorite_fruit'] = array(
      '#type' => 'select',
      '#title' => $this->t('Tell us your favorite fruit.'),
      '#required' => true,
      '#options' => array_combine($fruits, $fruits)
    );
    $form['email_address'] = array(
      '#type' => 'email',
      '#title' => $this->t('What is your email address?'),
      '#required' => true,
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Submit!'),
    );
    return $form;
  }
  /**
   * {@inheritDoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    if (!filter_var($form_state->getValue('email_address'), FILTER_VALIDATE_EMAIL)) {
      $form_state->setError($form['email_address'], 'Email address is invalid.');
    }
    if (!$this->validEmailAddress($form_state->getValue('email_address'))) {
      $form_state->setError($form['email_address'], 'Sorry, we only accept Gmail or Yahoo email addresses at this time.');
    }
  }
  /**
   * {@inheritDoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    drupal_set_message($this->t('@fruit! Wow! Nice choice! Thanks for telling us!', array('@fruit' => $form_state->getValue('favorite_fruit'))));
    $form_state->setRedirect('<front>');
  }
  /**
   * Check the supplied email address that it matches what we will accept.
   * @param $email_address
   * @return bool
   */
  protected function validEmailAddress($email_address) {
    $domain = explode('@', $email_address)[1];
    return in_array($domain, $this->accepted_domains);
  }
}

Contents of the above files are here

For tutorial I used search the web for "technical-guide-drupal-8-forms"

I then go to http://domain/testmodule/ask-user

and nothing.  It says Page Not Found

How do I make it found?

Enabling the Module

After enabling the module I got

Uncaught PHP Exception InvalidArgumentException:
"Class "\Drupal\testmodule\Form\FruitForm" does not exist."
at core/lib/Drupal/Core/DependencyInjection/ClassResolver.php line 24


texts:
I have a content type calles survey, When admin deletes a survey, the survey results should still be accessible and not deleted as well. So I want to unpublish the node when click on the delete button(it will be better to change this delete button to unpublish button). but I dont know how to unpublished a node.
Any solution / alternative / suggestion will be greatly appreciated.


texts: Javascript is not loading in Zen custom theme

texts:
I'm not able to get my custom theme to run javascript on all pages. My code is as follows. My Custom module is enabled, and Component Libraries module is installed and enabled.

custom_theme.Libraries.yml

scripts:
  # If this library had JavaScript you could specify it like this:
  js:
    js/script.js: {}
  dependencies:
    - core/jquery

global-scripts:
  version: 1.x
  js:
    js/script.js: {}

custom_theme.info.yml

    libraries:
  - custom_theme/base
  # @TODO Remove these libraries and use attach_library() for all component styles.
  - custom_theme/scripts
  - custom_theme/global-scripts
  - custom_theme/box
  - custom_theme/comment
  - custom_theme/header
  - custom_theme/hidden
  - custom_theme/inline-links
  - custom_theme/inline-sibling
  - custom_theme/print-none
  - custom_theme/responsive-video
  - custom_theme/wireframe
  - custom_theme/autocomplete
  - custom_theme/collapsible-fieldset
  - custom_theme/form-item
  - custom_theme/form-table
  - custom_theme/progress-bar
  - custom_theme/progress-throbber
  - custom_theme/resizable-textarea
  - custom_theme/table-drag
  - custom_theme/nav-menu
  - custom_theme/navbar
  - custom_theme/pager

script.js

/**
 * @file
 * A JavaScript file for the theme.
 *
 * In order for this JavaScript to be loaded on pages, see the instructions in
 * the README.txt next to this file.
 */

(function (Drupal) {

  'use strict';

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

      console.log("Hello World");

    }
  };
})(Drupal);


texts: How to have a required profile2 on user registrations, but allow admin-created users without a profile?

texts:
Profile2 allows to give access to a profile based on user role. This works naturally when creating a profile is optional for privileged users with an extra role. How can you achieve what is more or less the reverse? That is,

Visitors can create a user account, and a main profile2 profile must be filled out on the user registration form (it has some required fields)
But, admins should be able to create users without this main profile (e.g. new admin users). This does not seem possible with the usual configuration options...

What is the best way to achieve this?


texts: How to prevent duplicate URL patterns and not have "-#" appended to the URL alias?

texts:
We have a situation where we need to prevent the same URL from being generated within the same language.

Current situation (all for en):

Create nodeA with a URL alias of "page/node-title"
Create nodeB with a URL alias of "page/node-title"
Create nodeC with a URL alias of "page/node-title"

Results of current situation

nodeA generates "page/node-title"
nodeB generates "page/node-title-0"
nodeC generates "page/node-title-1"

Expected results:

get created as expected
user is prompted to modify the url since for the en language, that alias already exists
user is prompted to modify the url since for the en language, that alias already exists

That is not the expected results however. When nodeB and nodeC are generated, then the user should be prompted to let them know that the URL alias is a duplicate and thus it must be changed so it is unique. We have reviewed a lot of the documents for URL generation in Drupal but cannot find the correct configuration to prevent duplicate node alias from being generated.


texts: How to modify Solr files from Drupal UI?

texts:
I'm looking for a module that allow you to manipulated Solr files  (synonyms.txt, stopwords.txt, spellings.txt, solrconfig.xml, protwords.txt) content without actually modify those file  from Drupal.

Why ? I'm currently Pantheon which support Solr; however, solrconfig.xml and synonyms.txt cannot be modified and I would like to alters that content but with a module.


texts: PHP error 500 when including a left join on a pager query in db_select()

texts:
I've got a query which is causing a PHP error 500 whenever I add a left join:

  PHP Fatal error:  Call to a member function orderBy() on a non-object

Here's the query:

$query = db_select('my_table', 'mt')
         ->extend('PagerDefault')
         ->fields('mt')
         ->fields('u', array('name')
         ->leftJoin('users', 'u', 'u.uid = mt.user_id')
         ->orderBy('mt.my_table_id', 'DESC')
         ->limit($results_per_page);

$result = $query->execute();

The query is to be used with a table + pager. If I remove the jeftJoin() and respective fields() the query works perfectly. Can anyone shed some light as to why this might be happening?

Many thanks


texts: How do I add a page preview image to the admin panel that highlights the edited portion of the page?

texts:
I'm working with a website that has multiple content types per page and when you are editing a content type instance, it's not clear where that information will end up on the page. I didn't make this website. The guy who will be maintaining the content isn't really tech savvy so I'm trying to make it as easy and intuitive for him as possible.

In the admin panel when editing a content type instance, there would be an image on the right side of the screen that would show an image of the page you're editing. When you click to edit a particular field, it would highlight the corresponding section of the website being edited.

I don't know a lot about modules but would it be possible to do this? If so, what hooks would I probably be using? I was thinking that the highlighting functionality could be done by changing the background-color of the website portion with css and then taking a screenshot of that and displaying it on the admin panel.


texts:
So, this is a simple form, and what the ajax call back does here is that it returns the value of a field that's being changed.

The problem is that, only the value of the first change is returned. If i change the value a second time, the returned value is the same as first.
I'm not sure what is happening here, it needs a better pair of eyes.

Here's the code

<?php

    //Create raffle form
    function raffle_create_form($form, &$form_state)
    {
        dpm($form_state);
        //Basic raffle info
        $form['raf_raffle_name'] = array(
            '#type' => "textfield",
            "#prefix" => "
Raffle information

",
            "#title" => "Raffle Name:",
            "#required" => TRUE
        );

        $form['raf_allowed_number'] = array(
            '#type' => "textfield",
            "#title" => "Number of allowed members",
            "#required" => TRUE,
            '#element_validate' => array('element_validate_number')
        );

        $form['raf_start_now'] = array(
            "#type" => "checkbox",
            "#title" => "Start raffle now?"
        );

        $form['raf_end_date'] = array(
            "#type" => "date",
            "#title" => "When to close this raffle?",
            "#required" => TRUE
        );

        $form['raf_prize_type'] = array(
            '#type' => "select",
            "#options" => array('gift' => 'Steam Gift', 'hardware' => 'Gaming peripherals'),
            "#title" => "Prize type",
            "#required" => TRUE,
            "#ajax" => array(
                'callback' => 'raffle_create_form_type_steam',
                'wrapper' => 'steam_options',
                'event' => 'change',
                'method' => 'replace',
            ),
        );

        $form['raf_prize_name'] = array(
            '#type' => "textfield",
            "#title" => "Prize name",
            "#prefix" => "

",
            "#required" => TRUE
        );

        $form['raf_prize_about'] = array(
            '#type' => "textarea",
            "#resizeable" => true,
            "#title" => "Prize description"
        );

        $form['raf_prize_thumb'] = array(
            '#type' => "file",
            "#title" => "Prize thumbnail"
        );

        $form['raf_prize_link'] = array(
            '#type' => 'textfield',
            '#title' => "Link to product"
        );

        $form['raf_raffle_create'] = array(
            '#type' => 'submit',
            '#value' => "Create Raffle",
        );

        $form['#submit'][] = 'raffle_create_form_submit';

        return $form;
    }

    function raffle_create_form_validate($form, &$form_state)
    {
        dpm($form_state);
    }

    function raffle_create_form_submit($form, &$form_state)
    {

    }

    function raffle_create_form_type_steam($form, &$form_state)
    {
        return $form_state['values']['raf_prize_type'];
    }**


texts:
I'm trying to build a menu which has term id(tid) token in it to the views pages I have created. Menu links work when on taxonomy/term page but when menu links are clicked and url is changed to the views page, menu token can't get term id(tid) from that page, so menu links don't work. Basically menu structure is like this;

Menu on taxonomy page:

   views page 1 (url: /project/%1/venues) menu path: /project/[term:tid]/venues
   views page 2 (url: /project/%1/program) menu path: /project/[term:tid]/program

Contextual filter used: taxonomy term id from url where %1 is term id.


texts: Why are Active Forum Topics and New Forum Topics visible only to Administrator?

texts:
I have set up forums in Drupal 7 with the Forum Access module enabled and the Active Forum Topics block and the New Forum Topics block enabled on the home page. Everything works as it should except that those two blocks show content only to the Administrator user. The titles of the blocks appear to other users, but no content under the titles. Authenticated users are able to view and add content to the forums directly, but these two blocks on the home page show them nothing. I have looked high and low, rebuilt permissions, and tried changing many different permissions, but I have not been able to fix this problem. Any suggestions, insights, fixes?

OK. So I returned to my site after about 8 hours and the two blocks now show the new forum topic to everyone. After a little more experimentation, it appears that cron must be run to make new topics visible to anyone besides the administrator or to stop showing topics that have been deleted to everyone including the administrator.


texts:
We're leveraging Permissions By Term to limit access to various content. We are hitting some performance issues, though, so I'm attempting to add a patch that allows/denies access to nodes given certain conditions. PBT implements its access controls via hook_entity_access.

However, when a user hits a node and I allow/deny access to it, hook_entity_access continues to run its checks for every other entity present on the page (which is bad because that's what's causing the performance issues in the first place). Is there a way to choke hook_entity_access() and just accept access for the first page and skip everything else?


texts: Cannot Upload Image or Cannot Display Image

texts:
I am new in using Drupal.

First, I downloaded and installed a Drupal free template on my localhost. Everything works fine.

However, when I duplicated the site from localhost to sharedhost for testing, the image cannot be uploaded nor displayed in the test site when I am adding or editing contents. I went to check with the sharedhost provider, so far, it concludes that "safe mode off", and no error notice nor message is shown in the report.

I copy the reply:

"I am not sure if the paths set are the problem. I noticed your temporary directoy was set to C:/xampp/tmp and I have changed this to simply tmp for you as well as created the directory on the server with complete read/write permissions. It does not appear to have corrected the issue but will be good to have set down the road.

I beleive the issue is with the way Drupal handles image uploads. Unfortunately, it does not appear their are any error messages being generated or logged when an image is uploaded. This leads me to beleive Drupal is not attempting to generate the thumbnail instead of trying and failing.

I recommend creating a post in the Drupal forums regarding the issue. I am going to continue to investigate form here but perhaps someone on the Drupal team will have more insight into what could be causing this."

I just try to upload an image in a new content type and change an image in an existing content.  The error log shows:

"[Mon Aug 19 04:44:09 2013] [error] [client 218.102.131.79] File does not exist: /home/jwbb26i2/public_html/favicon.ico"

We have no idea about this problem. Can everyone help me know or solve this problem?

Thank you very much.


texts: Module configuration lost after some hours

texts:
I have a D7 web and I have installed Yoast module and Scheduler module. I have enabled those modules for blog content type, and when you create a new blog content you can use real-time seo (yoast) and you can schedule the post to be published. It works good but I don't know why It loses the configuration of this module after some hours, and if you create a new blog post, neither the real-time seo nor scheduler are shown. I review the blog content type and they are enabled. Even administrator can't see those sections in the new blog post page.
I have to run update.php and after that, all works good again, even if there is nothing to update. I have update drupal core to latest, but the problem still persists. I don't know why it loses the configuration and why It is recovered after running update.php.


texts: Field depandancy module can not work for textfield in field collection

texts:
I am using field dependency module for use only 1 field

I have 2 fields text and image user can use only 1 field text or image if user can select text field other will be hidden or invisible
same case with image to text field

here is conditions:

case 1:

Dependent:Image (field_image)
Dependees:Text (field_text)
Description:Image is invisible when Text is filled.

case 2:

Dependent:Text (field_text)
Dependees:Image (field_image)
Description:Text is invisible when Image is filled.

case 1 is working perfectly but case 2 is not working.


texts: Drupal Commerce dynamic shipping/payment checkout pane

texts:
I am building a shop with Drupal Commerce with multiple shipping and payment options configured with Rules. I have both on a single checkout pane and want to update each other when user makes a choice based on defined rules.

Can this be configured in UI or I need some custom AJAX?


texts: Vimeo Video Browser While Creating New Page In Drupal

texts:
I'm new to Drupal, learning it from past few days.

I want to create a vimeo video browser field widget while creating a page content type. Is there any module available which could help me achieve this?

I have installed various modules like vimeo media module, media embed field which enables me to add the vimeo video URL while creating the new page, I want to make an addition to this functionality like a vimeo video browser window to be opened and I could select the video from the same. Any idea as in how I could accomplish the same?


texts: How can I filter content with conditional taxonomy terms?

texts:
I have created a vocab (called like apple) that contains;
iOS: iPhone, iPad, iPod
Mac OSX: Mac pro, Macbook air, iMac...

Now I need/want to create a page/view; when my customer select 'iOS' from first drop-down, they can select iPhone, iPad etc. from second drop-down. And my page will be loaded with chosen values.

İt will like a multi-conditional boxes.

How can I do that, could you help me please?

Regards.


texts: Multiple local Drupal sites for development on WAMPServer?

texts: I'm still very new to Drupal.  I'm hoping to create multiple site instances via my local WAMPServer WAMP stack.  I have one.  I realize that Acquia makes this very simple via their DAMP stack, but have heard that it can be very painful upgrading and/or transferring these to a server due to the non-standard paths that Acquia uses for some of its files (some of its modules specifically).  So I'm wondering how I can emulate what DAMP does, albeit without their Dev installer app.  I've searched here and googled, but can't seem to find anything...


texts: Drupal 7 Calendar - How do you modify link from day number?

texts:
When I click on the day number, it currently goes through to day page.  I'd like to customise this to go to a specific event page for that day.

I can't find a hook for this.  Is there one?


texts: Path breadcrumbs based on several product fields

texts:
I am using the Path Breadcrumbs module to create breadcrumbs for products. The problem is that these products can belong to several different categories (which can be set via special fields on a product page), say, flowers, animals and shrooms. When I make a rule for flowers ( 0 => '%node:field-flowers:0:pb-join:name') solely, it works only for flowers, of course (the flower products are shown as main -> flowers -> rose, but, say, animals are shown as main -> tiger). When I add another breadcrumb for animals, and its weight is smaller, it doesn't work at all. If I put it up to the 1st place, it works, but now flowers stop working.

I don't fully get how to use PB arguments & selection rules (if my question has anything to do with them). Where should I look?


texts: What are the major differences between Views Datasource and Views data export?

texts:
I'd like to create dynamic XML feed export using View based on my content type nodes.

There are two huge modules: Views Datasource (17k usage) and Views data export (67k usage) which sounds pretty similar.

On Views data export homepage we can read that:

  Views Datasource allows exporting to XML/JSON among many others, but is geared towards small exports.

Does it mean Views Datasource should be used only for small exports?

In other words, what are the main differences between these two modules? And what are the preferred ways (use cases) of using one over another?


texts: Commerce Node Checkout set node to sticky or front page

texts:
I recently converted from MoneyScripts Pay-to-Publish to Drupal Commerce and am looking to re-create some of the functionality. I would like to have a Commerce Node Checkout plan that sets nodes to "sticky at top of lists" or "promoted to front page" upon payment.

I imagine it can be done with rules, but I have been unable to figure it out. Has anyone implemented similar functionality? If so, how?


texts: Loading products to galleries in the desired order

texts: I have some menu choices that open specific galleries. I have now created a new gallery called Women and linked my Women products to in (in product edit mode) in the order I desired. Drupal does not obey this ordering and I am not sure what the default ordering is ...and can't change it either? anyone know how what happens here because I wanted my own products to appear first in this gallery? I'm on Drupal 7.35


texts: Cannot access responsive image sources from Twig

texts: In Twig I am unable to retrieve the file source for each responsive image style on a ImageItem. How should I be getting this information?


texts: Trying to edit the breadcrumbs or title for taxonomies in views

texts:
I'm trying to show breadcrumbs and taxonomies title in browser tab with Drupal 6, but not getting the result, I'm having issues generating a custom breadcrumb.

I put a php code in views>header like:-

global $base_url;
$path = $base_url."/topics/".arg(1)."/".arg(2);

$title = ucfirst(str_replace("-"," ",arg(2)));
drupal_set_title($title);
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l($title, $path);

drupal_set_breadcrumb($breadcrumb);
print views_embed_view('article_tag_name', 'default', array(arg(2)));

But this code showing a term id at breadcrumbs and browser tab. How would I go about adding a breadcrumb and title to a view?


texts: Apply settings to all display overridden and default in views 3

texts:
I want to add a field to a views having around 10 displays, I want to apply it for all display but I get two option 1) this page 2) all display except override! How can apply it for all display either overridden or not?

Note, If I apply it all display it only applies to default displays and I still have to do this for overridden displays. I need a quick way to add a field to all displays whether its overridden or not.

Thanks


texts: How do I post a node to PayPal after node insert/update?

texts:
I have an option in my node to "upgrade".

If the user selects this option either when creating a new node or updating an existing node, I would like to post the node data (which includes some Paypal html elements) to Paypal so that it can process a payment.

The node should be inserted/saved regardless of the payment result. I need to specify via Paypal what the return URL is and with inserting node's I wont know that until after the node is inserted.

Is there a way to post to 2 places? I know that doesnt really make sense but im just looking for a solution.


texts:
How can I use mysql SET variables while using my PDO queries?

db_query('SET @x := 5,SET @y := 6, SELECT * from mytable')->fetchAll();

I have tried this and many variations of this statement with and without ':' etc, but it doesn't work.


texts: User module functions undefined in custom module

texts:
I am attempting to use the user_password() and user_save() functions from user.module in my custom module file, but I only receive the following:

  Fatal error: Call to undefined function user_save() C:\xampp\htdocs\drupal-7.38\sites\all\modules\(modulename)\(modulename).module on line 1037

I get a similar error if I comment out all of my code, leaving the module file as

<?php
user_save();

As far as I know, if the only problem was the lack of parameters, it chould be an entirely different error, not 'Call to undefined function'.

The function in which I'm trying to use user_password() and user_save() is as follows:

function create_user_by_id($id){
    $password = user_password(8);
    $info = soap_info($id);
    $fields = array(
        'name' => $id,
        'mail' => $info['mail'],
        'pass' => $password,
        'status' => 1,
        'init' => 'email address',
        'roles' => array(
            DRUPAL_AUTHENTICATED_ROLE => 'cas authenticated user'
        )
    );
    $account = user_save('', $fields);
    drupal_mail(
        'user',
        'register_no_approval_required',
        $info['mail'],
        NULL,
        array('account' => $account),
        variable_get('site_mail', 'noreply@example.com'));
}


texts: Drush can't connect to local MySQL through socket on WAMP

texts:
Trying to set up Drush with in a local dev environment on Windows 7 and can't get MySQL properly configured. A test command I've been running via Cygwin, with the resulting error, is as follows:

$ drush sql-query "SELECT * FROM erg_node WHERE nid=3"
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I can run the same SQL statement in phpmyadmin and it works fine. I can run the same drush command with a remote site and it also works, so it seems like it must be related to how MySQL is configured with WAMP and Cygwin. When I check which mysql via Cygwin, I get back /usr/bin/mysql instead of the path for WAMP's mysql. But the WAMP mysql path is set in my system environment PATH variable, so it should be accessible.

I've tried changing my.ini to include host = 127.0.0.1, copied the my.ini file to /etc/my.cnf, and run chmod -R 755 /tmp/. I'm not sure if there's something else I need to do to ensure drush uses the WAMP mysql command? Any help would be appreciated. Thank you!


texts: Checkout a specific dev version of module using git

texts:
I want to checkout a specific dev version of the feeds module using git.  I have a site which is using feeds 7.x-2.x-dev.  On the modules admin page the module version number is reported as 7.x-2.0-alpha8+99-dev.

I have cloned the feeds module repo but can't work out how to checkout that specific version.  I tried using git checkout 7.x-2.0-alpha8+99-dev, but it didn't work.  I guess if I knew the commit number I could check it out, but not sure how to easily work this out other than manually reviewing the commit log and working out what was the 99th commit after alpha8.  I am hoping there might be an easier way.

Would appreciate any suggestions.


texts: How many web pages can the Panels module handle?  What's the performance impact?

texts: I'm creating new site in Drupal 7, and I must use about 400 panel pages with Views.  I'm wondering how many panel pages I can use in my site without affecting performance? Can Drupal/Panels handle 400 panel pages?


texts: Drupal views override stopped working for no reason

texts:
I have a normal website, where I override the views templates for one view. When I go into the views UI, and check Other->Theme , it clearly indicates it is using the custom templates. But when I check the website, the templates are not used.

I think this happened when activating cache. (Yes, I cleared it already, and many times).

I saw that suddenly, altough the theme still worked, it got deactivated. So I reactivated it, but still the views templates are not used in frontend.

Can anyone please shed a light on this?

It is only one template file that doesn't work anymore.


texts: Unable to see view page when click page link in Drupal admin views created list section?

texts:
I have created a view both page and block both are working in with out admin login section in my home page but after login when I click page link not getting view list page.

Please find below screen-shot make sure path module is enabled.is there any plugin missing?

Please help me.

Thanks,
Parvateesam.


texts: Can I remove the experimental module warning from /admin/reports/status?

texts:
My drupal 8 site is showing a experimental modules enabled warning under /admin/reports/status. I vaguely remember to have them enabled at a certain time, but I forgot where.

I don't use any of them, how can I remove the warning and disable the experimental modules again?

I have currently no experimental module enabled, but the warning is still displayed:


texts: Workflow - Accepting/rejecting individual changes

texts: Is there a way to accept/reject individual changes in the workflow process? If so, how and/or what modules are the best to do this?


texts: Making some Views Exposed Filters auto-submit but not others

texts:
Background

I'm using Views and Better Exposed Filters and Search API. I have my filters set to 'autosubmit' so when a user makes a change to a filter it auto-updates the search result.

What I want to accomplish

This is cool but I only want the results to auto-update when CERTAIN selections are made. Otherwise I want the user to have to click the 'search button'.

Example

For example, I want the user to have to click the 'search button' for some things such as the text boxes and some of the radio buttons, but for SOME of the checkboxes I want the search results to auto-update when a new selection is made.

Question

Is this possible programmatically (or I suppose in Views itself) and if so, how?


texts:
I'm trying to target on the Menu (Bootstrap) a _blank attribute.

This is my code. It works on my local machine.

if ($variables['url']->isExternal()) {
  $variables['options']['attributes'] = ['target' => '_blank'];
}

The HTML target.

    MySite

BUT,

In here is not working because of the "class="first".

    Example link 1

    Example link 2

    Example link 3

I'm missing something, any help? I don't want to install a module for this.


texts: Page template for specific path: page--about.html.twig

texts:
I have a page with the path /about that I would like to have a different page layout from the rest of the site.

I have created page.html.twig as my general page template, and page--about.html.twig as the template for this specific page. Both files are in the /templates directory of my theme. However, only the general template is getting used.

Yes, I have cleared the cache.

Appreciate any help!

James


texts: Drush How to sync between local and server?

texts:
I always deploy drupal locally, install need modules, and then write the theme. Then I upload the local site to my server.

But when something needs a update or change, I will modify the local site, and I re-upload the local site to server.

It's very troublesome.

I want to:

  sync my local site to my production site, so that when my local site is changed, the updates are uploaded to the server automatically.

It seems that Drush can sync between local and server, and might be useful for this issue, but I can't find useful post explaining how to do this.

Thanks


texts: View Revision log message with display suite

texts: In drupal 7, Is there any way, with or without Display suite, to show the revision log message at the bottom of a view node page?


texts: How do I get the current path alias or path?

texts:
How can I get the current alias and/or path in Drupal 8?

In Drupal 7 I did this with drupal_get_path_alias(). What is the equivalent code I should use in Drupal 8?


texts: Resetting/reverting a custom module's update 'N value'

texts:
In my custom module's install file I have a hook_update_N function. Let's say it's mymodule_update_7100. However, I've noticed that I've done it wrong and I want to change a line of code within this function. Seeing as I've already run updb/update.php the changes won't be picked up and I'd have to rename it to either mymodule_update_7101 or create a new function after it with that name. I'd really rather not have to do this, so I was wondering if there's a variable that tells Drupal exactly what "version number" a module is currently at and whether I can reset it to trick it into allowing me to run the update script again.

The actual effect the function has had on the database isn't important because it's just generating a taxonomy term that I can easily delete through the front-end afterwards.


texts: How to redirect programatically using a route with parameters?

texts:
I am trying to use the Passwordless module API to redirect the user on login.

I want to redirect the user to a specific node edit page (node/12/edit).

In hook_passwordless_login_redirect(), the module redirects the user with this code:

return $this->redirect($redirect);

So here is my implementation:

function MYMODULE_passwordless_login_redirect_alter(&$redirect) {
  // You can use hasPermission() with currentUser, but need to load for hasRole()
  $account = \Drupal\user\Entity\user::load(\Drupal::currentUser()->id());
  $test = \Drupal::service('path.validator')->getUrlIfValid('node/12/edit');
  if (!($account->hasRole('admin'))) {
    $redirect= $test->getRouteName();
  }

The problem is that I get this error:

  Some mandatory parameters are missing ("node") to generate a URL for
  route "entity.node.edit_form".

The missing route parameter is the node id, which I can get with $test->getRouteParameters().  But how do I pass this to the redirect?  (How do I call the redirect and give it both the route name and the route parameters?)


texts: How to redirect a user to the profile of the user they just created

texts:
I have a situation where my users of role 'Operator' are in charge of creating new user accounts. Right now, when they create a new user account it just sends them back to the user/create page and displays a confirmation message.

I would like to have drupal redirect the user to the profile page (user/%) of the user that they just created.

I was looking here (http://drupal.stackexchange.com/questions/14993/how-can-i-do-a-custom-form-redirect-on-the-user-registration-form) but can't figure out how to get the user id of the user that the 'Operator' created and not the user id of the 'Operator' them self.


texts: Template file for Views exposed filter block

texts:
Views has a great feature where you can expose the exposed filters as a block (Exposed form in block under Exposed form).

So what's the "standard" way to theme these?  Is there a Views template for this (I couldn't find one), or do I theme it with a renamed block.tpl.php?


texts: How do I connect to an external database and specify the schema to use?

texts:
I want to connect Drupal to an external Database and I need to specify the schema on the settings.php file, otherwise Drupal schema module connects by default to the 'public' schema. I tried, without success, with the following code.

 $databases['conservation']['default'] = array(
   'database' => 'conservation',
   'schema' => 'projects_test1',
    'username' => 'xxxxxxxxxxx',
    'password' => 'xxx',
    'host' => 'xxx.xxx.xxx',
    'port' => '5432',
    'driver' => 'pgsql',
    'prefix' => array(
      'default'   => 'projects_test1.',
      'users'     => 'shared.',
      'sessions'  => 'shared.',
      'role'      => 'shared.',
      'authmap'   => 'shared.',
    )
  );

I have done some googling, but I haven't found anybody trying to do this.


texts: I want to be able to add a comment comment to a view , through comment.tpl.php as I have tried to add the comment counter through the admin area and it doesn't work


texts: don't allow multiple users with same email

texts:
I've got a site using Commerce. On checkout a user is created to allow access to files, order history etc.

I just had a customer that couldn't find his files and discovered that he had two accounts registered to the same email address. So it seems my system isn't checking for accounts already registered to the same email address.

How can I make sure that

There's only registered an account in the event that the email used
for the order haven't been used on the site before?
If the email has been used before the new order is attributed to the
existing user?

Edit

After reading @Neograph734's answer below I checked my rules. And they look right to my eyes, so I'm a bit confused as to what can cause this:

Weight 1: Assign an anonymous order to a pre-existing user

Weight 2: Create a new account for an anonymous order