texts:
I am working on my first multilingual Drupal 9 website, and I face a challenge. I can't seem to get my contact webform elements translated. I am using Webform Version: 6.0.2.
I have enabled translation on the content type, and I can translate the title, body, menu item fields. But I can't figure out how to translate the actual labels & placeholders of the form elements. I have watched this video (D8), but I do not have the Translate tab that he is using: https://www.videodrupal.org/video/20180321/translating-webforms
I suspect that there is some module og configuration setting that I am missing, but I can't figure out what it is, so any help would be appreciated. My available tabs are the same as the ones on the screenshot from the Webform module page: https://www.drupal.org/files/issues/2018-05-19/webfork-wizard-admin.png


texts: How to move nested links in menu edition?

texts:
In Drupal 8 I created nested menu links. After some days I tried  to move them. Eg. one nested link to one parent menu link but the moving got disabled.

I remember that there were small cross icons with arrows in front of each menu link that were handles to move them before. But now they are not present. How to move the links?

There is no problem on chrome but firefox.

See the picture of the problem:


texts:
I've made a fresh Drupal installation, but for some reason I can't get to many administrative functions through links.

For example, this is the translation interface inside that installation:

It should look like the image below:

I've tried changing permissions, but nothing happens. And I can't see the "Permission" tab when accessing the people module either. Anyone knows how to fix this problem?


texts:
I have been looking for a solution on the internet before asking for your help here.

My drupal site was working fine since yesterday when I create a calendar event chain ( this is a custom module) and i clicked "save", then this error appeared:

I have checked from the recent log message and found this

I dont know what have happened since I cleared all the queuing using queue manager. The funny thing is that if I use the backup database, which had backed up before this error happened from the production site to my localhost, then everything works fine and I am able to create the even and save it. So is there any problem with the database ? I wish i could use the backup database on my production site ? :/

Thank you for your replies.


texts: How to change default value of taxonomy term in View exposed filter drupal 7?

texts:
I have created view page to find events from Start date - End date and category(taxonomy terms). I have enabled expose filter on fields. How do I show '-select-' instead of '-any-'

or else is there any other method to show no result until user does not add filter value?


texts: Checking what user a migration is running as

texts:
I have a single migration out of a larger group, that needs to be run as the administrator or an entity reference fails to map the User entity properly.  I'd love ideas on what I might change so that I wouldn't have to be an administrator to entity reference users, but failing that:

How can I check what user the migration is currently running as?  Basically I want to be sure that drush has been invoked with --user=1 or throw an exception with a reminder that this migration needs to be run as administrator.


texts:
I have a form which has 2 values prefilled (values come from a few steps the user has to take to be given the chance to get to the form I'm talking about).
My question is, how do I redirect the user back to step 1 when the form loads if the values are not present?
I have a hook_form_alter() and I have the logic to check whether or not the session variables are set but I cannot seem to redirect. Tried return new RedirectResponse($url) and return new TrustedRedirectResponse($url) also I've checked with the debugger to see if the returns are called and they are but the redirect is not happening and I get to the form when I should not be able to.
If it helps, it is a group/add form (normal entity adding).
Any ideas?


texts: positioning sticky field using hook_form_alter in drupal 7

texts:
I'm trying to remove the sticky option from the option bar and adding it to the user form.

function vacancies_form_vacature_node_form_alter(&$form, &$form_state, $form_id) {
// remove sticky field from default (option) location
unset($form['options']['sticky']);

//create new sticky field
$form['sticky'] = array (
    '#type' => 'checkbox',
    '#title' => 'Top vacature',
    '#default_value' => $form['#node']->sticky,
    '#weight' => -1,
);

dsm($form);

}

Weight of other elements go from 1 to 14 so -1 should put this form element on top.
But with the code above it shows up at the end of the form.

How do I put the sticky button in the middle of my form?


texts: Prevent Entityform Duplicate Submissions

texts:
I have a simple text entityform setup on my drupal website. I was wondering if there was a way to prevent users from submitting a submission that has already been submitted. I am new to using Rules, but my guess would be there is a way to do so using that.

Thanks


texts:
I am trying to create a Drupal 7 quiz site of multiple choice questions. The users should be able to attempt quiz on the desktop site and as well as on an android app developed using Drupalgap module. I have configured Drupalgap and quiz module correctly. I am able to output quiz as JSON in view but it does not have answer options in the body.

{
    "nodes":[
        {
            "node":{
                "title":"On which date United Nations (UN) Public Service Day is observed?",
                "Body":"On which date United Nations (UN) Public Service Day is observed?"
            }
        }
    ],
    "view":{
        "name":"test",
        "display":"page",
        "path":"admin/structure/views/nojs/preview/test/page",
        "root":"nodes",
        "child":"node",
        "pages":1,
        "page":0,
        "count":1,
        "limit":10
    }
}

I am not sure that accessing and attempting quiz of the site from the android app is possible or not. Please guide me in this regard.


texts: How to write page.tpl.php where the HTML files is more than one?

texts:
I'm using Drupal 7 and trying to set my custom theme up.

I usually replace the index.html to page.tpl.php, then I change what I want it to be dynamic on my site. But now I have more than one HTML file which is about.html, blog.html and contact.html

Can anybody explain to me how to write that?


texts:
On D7 and search api I could use hook_entity_property_info_alter() to add custom properties to nodes and these where indexed also by SearchAPI, so that I could fill them with custom values, something like this:

function mymodule_view_entity_property_info_alter(&$info) {
  $info['node']['properties']['custom_property'] = array(
    'type' => 'taxonomy_term',
    'label' => t('Label'),
    'sanitized' => TRUE,
    'getter callback' => '_function_get_value',
  );
}

On D8 there isn't this hook, so how should I add properties to an entity with custom values?

The purpose is to use this custom properties, with calculated values, as facets on some SearchApi views.


texts: specify $form elements to be excluded from display?

texts:
I want to hide certain elements in form using form_alter or a template file. I have read somewhere that in Drupal 7 , we can specify $form elements so it will not display in form, but I can't remember!
Not unset() but some other function!


texts: Submitting a form with AJAX causes page reload but only on mobile

texts:
I am submitting the user profile edit form by hooking the user profile edit form like this:

$form['actions']['submit']['#ajax'] = array(
'callback' => 'user_profile_submit',
'wrapper' => $form['#attributes']['id'],
'method' => 'invoke',
'effect' => 'fade',
);

The callback function user_profile_submit invokes a simple jQuery alert notification specifying if the form was saved successfully. The setup works perfectly on the desktop i.e. the form is submitted with AJAX with no page reload whatsoever. However, saving the same form using mobile devices causes always a page reload. Any idea what might be causing this behavior? Thanks.

Update:

Problem can be observed in Chrome/Dolphin but not in Firefox.


texts: Duplicate breadcrumbs but they're not in the $breadcrumb variable?

texts: I'm trying to remove this duplicate breadcrumb but I don't see what's generating it. Any ideas?


texts: How to create a view to display poll results formatted as a chart?

texts:
By using core module poll, every time somebody participates in it, the poll module creates data representing the selected option of the poll, called 'poll results'.

How can these poll results be transformed using the views module? By creating a view and using a relationship to poll results, I only get 0, no matter what.

After I succeed in showing some tabular format of these results, I want to further enhance this view to display these poll results using some 3rd party charting app. This by using some charting module with views integration, which uses a charting library as its rendering engine.

Thank you


texts:
I have a very important tag list (over 100k) (drupal 8).

I'm using the default view of taxonomy.

I need a form in my navbar that allows me to redirect to the different lists related to my tags generated with taxonomy view.

For example:

I type in the form "term 1",
then appears the list of all the contents tagged with the "term 1", with for url mysite/term-1 (important).

I tried to modify the taxonomy view with an exposed form but it does not work, because it is necessary that the form allows to search in all the site and not to filter the list displayed.

I tried to create a content view with an exposed form to sort by terms of taxonomy, it works but I have url problems not optimal for SEO (ex: mysite/myview?tid=taxonomy+term+(3)).

I thought of an element of type select with autocomplete (as chosen) but considering the number of tags I do not think it is recommended. Creating a menu seems to me also not recommended.

In short, I do not find the solution!

Does somebody have an idea ?


texts: I am creating a field with Field API, and having it shown on user registration form. However, I need its value in order to make validation. For that purpose, I've used dpm($form_state) which gave me the dreadful, dreadful memory exhaustion error. I then used file_put_contents(' sites/default/files/debug.txt', print_r($form_state, TRUE)); which did not produce anything at all. I also tried a few suggestions made on IRC, among which are `$form_state->getValue(['field_tckn']). It seems I can't get what my field's value is, no matter what I do; and all I get is that the field is required when I fill it in; and I'm all out of ideas. Can you recommend anything else?


texts: I've started using the Omega theme, and wanted to apply a vertical gap in between my blocks in the sidebar on the right called sidebar-second. I went into the themes settings, and added an additioanl css in "Additional region classes" but its applied it the whole of the sidebar, and I still have no gaps. I have tried inspecting in firebug, and if I amend 'region-inner' it works but applies to all regions including main content etc. I just wanted the ones in the Sidebar Second. I'm afraid I dont know enough css to - can someone point me in the right direction?


texts:
I have some code in a drupal 7 site that makes repeated requests to an external database using mysqli. To speed up the code, I was hoping that I could store the mysqli-connection object in the cache, like this:

// Check if DB-connection already loaded
$external_db = &drupal_static(__FUNCTION__);

if ( !isset($external_db) ){
    // Check if DB-connection in cache
    if( $cached_db = cache_get('external_db', 'cache') ) {
           $external_db = $cached_db->data;
        }

    // Else make a new connection
    else {
        $external_db = mysqli_connect('someip', 'someuser', 'somepass', 'somedb');
        cache_set('external_db', $external_db, 'cache');
    }
}

However, something spooky happens to the connection object when I fetch it from out of the cache: it seems to have lost most of its properties. For example, the properties client_info and host_infoare being unset.

Any idea what causes this? Does Drupal delete those properties, or is it something built in to mysqli? Are there alternatives to mysqli that are cacheable?

Thanks a lot you guys!


texts: Display Ubercart Attributes and Add To Cart button in separate locations on product node page?

texts:
I need to display my product page as such:

[-----------ATTRIBUTES-----------]
[--------BODY, IMAGE, ETC-------]
[--------BODY, IMAGE, ETC-------]
[--------BODY, IMAGE, ETC-------]
[--------BODY, IMAGE, ETC-------]
[--------BODY, IMAGE, ETC-------]

[------ADD TO CART BUTTON-----]

How can I split the attributes and add to cart button in that way? Is there a way to do so in a tpl file? I'd prefer to avoid absolute positioning.


texts: Front page identification and page--front template not working

texts:
After install URL Redirect module not able to check the current page is front page or not by programmatically. Following code does not return anything:

\Drupal::service('path.matcher')->isFrontPage()

Also page--front.html.twig template getting removed from front page template suggestion.


texts: need to have image dragging option to position images in Gallery

texts:
I have created a image content type and upload few images. And then I created another content type for Gallery and using node reference field, I added several images under a  gallery. I followed the tutorial in youtube https://www.youtube.com/watch?v=MUSpTSTVL0Q

Now I wish I could have dragable like feature, so that I can adjust the serial order of each image in a gallery. Image in 1st order should be cover of the gallery. Please suggest.


texts:
I'm trying to insert a code (a button) from a module to a specific place in a view (between the filters and the array).
Does anyone have an idea of how it can be done ?

Thanks


texts: How can I get the $delta of block created using UI?

texts:
I have a created a block using UI .I want to change the content of the block programmatically.
For this I am using hook_block_view_alter(&$data, $block) for it as follows:
I have just created a block using UI and I am going to assign certain pages which will be able to see that view..

function hook_block_view_alter(&$data, $block) {
if ($block->delta == 'HOW CAN I GET THE $DELTA here') {
$data['#markup'] = 'Google';

}

}


texts: Generate a cookie when user closes a webform block

texts:
I have been tasked with having to setup a cookie that records when an anonymous user closes a newsletter signup webform block so that it no longer appears when reloading the current page or navigating to another page on a website.

Can anyone please advise if there is module that performs this function?

Or can someone please point me in the right direction in terms of the correct code snippet I can use to make this work?

Many thanks!


texts:
I've just noticed that the anonymous user can add staff to the cart but they cannot see the block. Also, I've create a display content view and anonymous users cannot see it.

I've tried to find the right permission but there is not a permission tutorial.

Is anyone has got experience with it?

I would like to leave anonymous users use the cart but then login once they have to pay.

How do i get it?

The problem comes when I add, in the view, the relationship with the product.

Thanks in advance


texts: why am i getting a Drupal\Component\Plugin\Exception\PluginNotFoundException: when the plugin does exist?

texts:
I wrote a custom source plugin and put it in migd8_node_blog/src/Plugin/migrate/source/Node.php
with
<?php

/**
 * @file
 * Contains \Drupal\migd8_node_blog\Plugin\migrate\source\Node.
 */

namespace Drupal\migd8_node_blog\Plugin\migrate\source;

use Drupal\migrate\Row;
use Drupal\node\Plugin\migrate\source\d7\Node as D7Node;

    /**
     * Custom node source including url aliases.
     *
     * @MigrateSource(
     *   id = "migd8_node_blog_node"
     * )
     */

    class Node extends D7Node {

but i keep getting this error when i run drush mim migd8_node_blog Drupal\Component\Plugin\Exception\PluginNotFoundException: The "migd8_node_blog_node" plugin does not exist.
even after flushing the cache and reinstalling the module.


texts: Multiple Product variation type not display all price

texts:
My site has 2 product variation types: pv1, pv2.

Everything works fine, a user can add pv1 or pv2 into cart and buy them
but the price shown is always the last selected by user.

How can I display both pv1 price and pv2 price?


texts: How do I turn off mobile menu collapse for bootstrap 3 theme in drupal 8?

texts:
I am looking to use a different mobile menu solution and replace the default bootstrap 3 mobile menu.

How can I turn off the bootstrap collapsed mobile menu function?


texts: Allow a user to select where to save an uploaded file

texts:
I have installed an Open Atrium, which is based on Drupal 6, but this is a rather general question towards Drupal 6.

In every content type I have an Upload File field which work just fine, but it does not quite meet my requirements.
I have already defined an directory structure on my server, which I would like to maintain as is. Therefore, the functionality I am trying to achieve is to allow a user, who selects a file to upload from local computer, to be able to select the path where to store it (preferably outside of Drupal installation).

To be able to reach an outside directory I have created an alias to the necessary directory (e.g. C:\blalbla\  --> localhost/dev).


texts: How to Create content type per organic group

texts:
Hi i have created a content type and i have 4 groups using organic groups.

Is there any way i can restrict content type to one of the organic group.so other groups cant create any content with the content type.

Please help me thanks a lot.


texts:
We are using Commerce 7 to sell mattresses that may or may not have size variants like Single, Double, Queen, King. We have a facet filter on size that allows us to filter mattresses that are say Single in the /shop view.
We also display the "size-price" in the /shop view. It is always the first variant for the mattress.
However, we would like to dynamically change the size-price in the /shop view so that is a user selected say Single, they only saw Single price, not Double Queen etc.
I would be happy to modify the node--shop.tpl.php file, but it only seems to have one variation.
Any suggestions?


texts: How do I get a plaintext list of tags from a multi value entity reference field?

texts:
I have a module that's making custom RSS feeds for me.

In a content type, I have my tags stored in "field_tags" entity reference field.

My goal is to get the names of all the tags, and ultimately put them into an array, so they can go into a markupless  RSS field.

When I'm pulling the data, I get it with this:

foreach ($this->dbh->selectVideos(self::RPP) as $nid) {
  $node = $this->entityMgr->getStorage('node')->load($nid);

  if (!empty($node)) {
    $data->nodes[] = [
      'title'    => $this->filterTxt($node->title->value),
      'body'     => $this->filterTxt($node->get('field_paragraph')->value),
      'body2'     => $this->filterTxt($node->get('field_paragraph')->value),
      'created'  => date('D, d M Y H:i:s', $node->created->value) . ' GMT',
      'guid'     => $node->id(),
      'img'      => $this->getImgUrl($node, self::IMG_FIELD),
      'keywords' => $this->filterTxt($node->get('field_tags')->value),
      'video'    => $node->get('field_vid_url')->getString(),
    ];
  }
}
return $this->render($data, 'nameoffeed');

}

The problem is that 'field_tags' is an entity reference field, so it's turning up blank.

I had partial success with this:

    if ($node->hasField('field_tags')){
      $entity_ref = $node->get('field_tags');
      if ($entity_ref->count() > 0){
        $tagoutput = entity_view($entity_ref->entity, 'default');
      }

Then setting 'keywords' to equal $tagoutput. This grabs the first tag, which isn't great as I need them all, and then along with it comes a whole html layout enclosure that won't work for an RSS feed.

I'm confused what the correct way is to get a proper list of tag names. In D6 I had this list as plain text, which wasn't great because you wouldn't be able to click on one in the page view and be taken to a list of all pages with that tag, but at least the tags worked on the feeds easily.

Any thoughts?


texts: Alter the wrapper of radios buttons in a custom module

texts:
In a custom module, I have created a custom form. In this form, I need to alter the markup of the radio buttons wrapper and add a new attribute.
After reading many posts and testing, I can alter all the form elements (form-item, first fieldset...) except this wrapper.

This is the markup I am outputting.

<fieldset ...>
  <legend>Mylegend</legend>

    ...

          ...

  </fieldset>

I see that the related system template is radios.html.twig. I tried to copy and paste this template in the templates directory of my module without success. I tried to use theme => 'my custom theme' in the definition of my field. I tried to use a preprocess function in my module.

What is the simpler method to alter this wrapper?


texts: How to assign content to user for manage turns?

texts:
I need to create a system to assign turns to a people register in the site, for this need contemplate:

The administer assign turn to user in specified place.ex(turn 1, place 1, user 1)
There are two turns, morning and afternoon in one day.(turn 1 and turn 2)
The administer cannot assign a turn to user that have turn 1 in place 1 and later turn 1 in place 2, need show only the users that no have turn 1.
The system need show the turn to user in calendar, only need show the turns in the week, ex (Monday: turn 1 place 1, Tuesday: turn 2 place2, Wednesday: turn 3 place 3, etc).

I think make

content type of turns that have

- field date, end and start for statistics support and classify the week.
- turn select: turn 1 or turn 2.
- zones select: place 1, place 2, place3 etc.
- user to assign: user reference field that have all user that i can assign turns.

I want use drupal fields and contrib modules (if exist) to make this, or how to make better with drupal, any suggestions?


texts: How do I remove the default 'my cms' text from my drupal 7 webpage with the bartik theme?

texts:
I have recently created a webpage with drupal 7 and currently have the bartik theme applied. However, I have encountered what I assume is a trivial issue but have been unable to fix it. The site has the default text 'my cms' appearing in the banner across the top of all pages and I have been unable to remove it. I assume it is the site's slogan, but I have not been able to locate where that is set in either the the admin of the site or the files of the site.

Here is the site to show what I am talking about.

Thanks for the help.


texts: How to clear or rebuild a cached block for a specific user?

texts:
I have a block with the cache setting DRUPAL_CACHE_PER_USER.

I want to clear the cache when a user performs a specific action. I want to clear the cached block only for the acting user, keeping the block cache for all other users.

How can I do that in Drupal 7?


texts: hook_apachesolr_process_results having no impact on results

texts:
I've posted this at d.o, but I'm hoping maybe someone here might be able to help. (The documentation on apachesolr for D7 is so far rather depressing.)

I wrote a module for a D6 site implementing hook_apachesolr_process_results to modify the snippets of text shown on the search results page. That worked like a charm. We've now moved on the D7. I've again written a module to implement the same hook. This is a lowest-comment-denominator version of the function:

function mysearch_apachesolr_process_results(&$results, $query){
  foreach($results as $id => $result){
    $results[$id]['snippet'] = "FOOBAR";
  }
  debug_to_file($results);
}

The call at the end debug_to_file is a utility function I use to print_r a variable to a file. That call proves that a) my code IS indeed getting run and b) that the $results variable has been changed internally. However, my search results page has nary a FOOBAR to be found!

Could it possibly be an interaction between apachesolr and another module? Apachesolr and my theme (fusion 7.x-1.x-dev)?

It'd even be helpful here to get an indication of what to try next as far as debugging. Any advice would be useful!

FTR, I'm using Drupal 7 with the ApacheSolr Search and Framework modules at version 7.x-1.0-beta12.


texts: Recommended module or method for a generic map/media embed field?

texts:
I'm aware of lots of modules for embedding media (especially https://www.drupal.org/project/emfield) and for embedding or generating Google Maps, but what I'd like is one general purpose field in which the user can paste any valid embed code, and it will get rendered in the page. (Possibly resized, if I can dream a little.)

Is there any good module for this? Or should I build the field myself and make a template for its display? If so, how should I configure that in Drupal 7? I know how to make a template for a field in general, but my PHP is pretty shaky.


texts: I can't translate description of front page in my multilingual site

texts:
I have a multilingual drupal 7 site.

I want to translate my description metatag of my English frontpage version of my site. Any other page show ok in site Greek and English.

The problem is it only show the Greek version.

I have i18n and metatag module.

What i have try is to navigate to en/admin/config/search/metatags/context
and add my English url (www.mysite.gr/en) so i can add manually the description there. But it didn't worked.


texts: How to index Drupal Commerce 2 products for the search?

texts:
The products in Drupal Commerce 2 could not be found through Drupal's default search form.

Modules like Commerce Search are available only for Drupal 7.

How can I index product titles or SKUs and add them to the search in Drupal 8?

Thanks!


texts: why cannot I edit admin permissions for the permission page in D8?

texts:
All permission boxes for administrators are disabled "greyed out".

I can do it via drush but not through the UI.


texts: How do I re-run updates (change module schema version)?

texts:
I'm working on a module, and I changed a couple field types in the schema. I didn't take a backup before testing it and messed up the DB (it's just a dev site). Anyway, I reinstalled everything, and the schema version is set to that of the highest update. However, I actually do need to run the update; a View I have wouldn't install if I had the updated schema in the module code, so I figured this would be a good way to test that update.

How do I reset the schema version of my module to a particular version? In Drupal 7, I would have done this:

drush sqlq "UPDATE system SET schema_version=8102 WHERE name='flllpdf' AND type='module'"


texts: Filter to display only modified content in Views

texts:
I created a view that displays the number of nodes modified by each user on a specific month.
I check the "modification date". The problem is that I also obtain nodes that have never been modified but have been created on that date.

In the node table, "created" and "changed" fields have the same value when the node is created. How can I only retrieve the nodes that have been modified but not created on a specific month ?

Maybe a way of doing this is to check if node.changed <> node.created, but how can I do that in views ?


texts: Add specific CSS class to form elements from the address field

texts:
I try to add a custom css class to a form element inside my address field for e.g the postal_code field and another class to the given_name and family_name field.

I tried it with a my_theme_theme_suggestions_form_element_alter. But then I have to extend all the twig files like form-element--equal-width-column.html.twig, for just adding the css class.

function my_theme_theme_suggestions_form_element_alter(array &$suggestions, array $variables, $hook) {

  if (in_array($variables['element']['#attributes']['class']['0'], ['family-name', 'given-name'])) {
    $suggestions[] = $hook . '__equal_width_column';
  }
}

Is it possible to just add a css class to specific form-elements div's, so I don't have to extend all those twig files?


texts: How to serve the same page for all URLs?

texts:
I am using Drupal 7 as an API to send JSON data to a Backbone application. It is a single page site with its HTML markup in html.tpl.php.

Everything works fine with the Backbone router when I start on the homepage and navigate with internal links but when I refresh a page or type a URL directly I get a Drupal 404 error.

How can I make unknown pages to serve the same page all the time?

The .htaccess redirects to index.php so it's not a browser 404 but a Drupal 404.


texts: Drupal multi-site Aegir caching strategy

texts:
We are migrating many sites from various content management systems onto a single Drupal/Aegir platform. We used to have a high density of sites on the same servers and Aegir definitely makes managing high density Drupal sites easier. Unfortunately having the same density of Drupal sites on scaled up hardware is leaving us with slower response times for the same amount of traffic. The platform/codebase is itself a bit of a beast, with some sites having 250+ modules enabled and response times stretching to 30+ seconds with Drupal caching disabled. The shared codebase acts as a sort of menu for business divisions to be able to choose features/themes from. With APC, Drupal cache and memcached running we still struggle on ocassion.

I think it makes sense to look at building up a caching layer in front of Apache-Drupal-Aegir before we start scaling the application layer horizontally. Aegir brings a big benefit to managing multiple sites and ending up with multiple Aegir instances takes away some of that benefit. In particular I like the idea of being able to cache some/all of the dynamic content for anonymous users in case the Aegir server is unavailable for any reason.

The options as I see it are:

Drupal boost module. Probably the easiest to setup but unfortunately does not appear to work with Aegir without some manual patching.
nginx as a reverse caching proxy. SSL support, easier to configure
Varnish as a reverse caching proxy. No SSL support, more difficult to configure
Ditch Apache and run Aegir on nginx/PHP-FPM. I prefer running Aegir on Apache at this stage as it will be easier for other engineers to troubleshoot.

We also have an HAProxy installation which load balances (actually failover/fault tolerance) for other applications, so we could always terminate the SSL at HAProxy and failover across multiple nginx or Varnish instances, with a single Drupal application server at the back. Though that means requests jumping through 3 layers to potentially hit the back-end, which doesn't sound too great.

Questions:

I'm tending to go for nginx as the reverse caching proxy because of simple configuration and management by other users and a single entry point for SSL management.
Is there any reason why I should choose Varnish instead?
Is nginx able to serve cached "dynamic" content to anonymous users in the eventuality of the back-end Drupal server being down?
Or is it purely restricted to static content such as images, JS, CSS etc?
What about having HAProxy on top of that, so we can failover between multiple nginx instances?
Or is it insane to have requests potentially going through 3 layers of proxy to reach the Apache/Drupal back-end?


texts: Disable translations update on module enable

texts: I have large site with 15 languages, when working locally If I enable some module over UI (or reinstall it) auto update of translations kicks off and this last for some time. I really don't need that while developing things, how could I disable this feature?


texts: How to resize images in a slideshow for a Responsive Theme?

texts:
I am using a responsive theme in which I have a slideshow on the homepage of the slide. I am creating the Slideshow as a Block using Views.

Question: How do I make the slideshow (i.e. the images) re-sizable as the screen size is changed?


texts: Memory-saving cache-clearing strategies for large sites?

texts:
One of my Drupal 7 sites has thousands of fields, a bunch of content types, more than 25 views, and hundreds (soon to be thousands) of profile types. Because of this, I'm using a core patch that better caches entity field info (http://drupal.org/node/1040790), and the -dev version of Views which better caches views by display (instead of having one HUGE views cache row with all views data in it).

This has helped most pages on the site to load with 20-30MB of RAM used, rather than 160MB+ (instead of pulling up cache_* table rows for fields and views that were 10MB+, the patches help keep cache_* data much more efficient).

This introduces a problem, however, in that cache rebuilds take a really long time. Usually more than a minute or two. And during this time, Drupal simply won't load any pages (since the caches that it's trying to read from are not yet built, other requests have to wait).

During low-traffic cycles, this isn't a big deal; a hundred or so users will simply have to wait a minute before the page loads. But during high-traffic cycles, the Apache server starts going crazy, with 40+ CPU load, and the memory quickly fills up because all the worker threads sit waiting, and max out their memory, causing swapping. It's kind of a death spiral. A restart of httpd will clear things up, but it takes 5-10 minutes for things to get back to normal.

My goal is to make it so cache clears don't bring the site to its knees. For one, if I use admin_menu's individual cache clearing functions (like "CSS and JS", then "Menu", then "Theme registry", etc.), things go smoothly until I hit the "Page and else" option. That's when views' cache is reset (a very CPU and database-intense operation with the number of views that need to be cached), and when the field info cache is reset (which is also CPU and database-intense on this site).

So... my questions/ideas:

Using drush and/or other shell scripting, is it possible for me to clear caches in a more intelligent way than "blast all caches at once, and hope for a clean rebuild"?
Can I block http requests while the cache clearing is happening so apache doesn't get clogged with a bunch of cache-stampeding requests?
If I can clear caches outside of Drupal/normal httpd request, I could presumably set a higher PHP memory_limit for the cache clear operation, and back off my universal memory_limit (right now set to 256MB, in case any individual httpd thread needs to clear caches...).

Basically: Is there any intelligent and graceful way to clear all caches with Drupal besides simply clicking the button in the UI, or using drush cc all?

[Edit for clarification: The main problem I have is cache rebuilds, which (a) take a while, and (b) block all other requests until the rebuilds are complete. I would like to find a way to make it so the rebuilds aren't quite as deadly during high-traffic times.]


texts: How to debug rules that are not being run?

texts:
I have few rules bound to the Event: Completing the checkout process

After completing the checkout process these rules should run - but they do not work...

I am using Devel module to debug the Rules and in the dblog there is nothing about these rules - There are only rules that are actually being run upon other events.

How can I debug this ?


texts: Why don't {{ product.body }} and {{ product.field_specifications }} return values in custom commerce-product.html.twig file

texts:
I am using Commerce 2.0 on Drupal 8.4.

I have sub-themed Bartik and placed a commerce-product.html.twig file in the sub-theme's /templates folder to experiment with theming a Commerce2 product page.

My product-type has a custom field called 'specifications'.
The Manage-display for the product-type places both 'body' and 'specifications' in the Content portion (not disabled).

An example product of this product type was given the following values.

title = "Product 1 title"
body = "Product 1 body"
specifications = "Product 1 specifications"

The product-display page for Product 1 displays the following for the corresponding twig commands:

{{ product.title }} displays "Product 1 title"
{{ product.body }} displays nothing
{{ product.field_specifications }} displays nothing

{{ product_entity.title.value }} displays "Product 1 title"
{{ product_entity.body.value }} displays "
Product 1 body
"
{{ product_entity.field_specifications.value }} displays "
Product 1 specifications
"

Seeing that

{{ product.title }} and {{ product_entity.title.value }} agree.

why does

{{ product.body }} display nothing while {{ product_entity.body.value }} displays something.

and

{{ product.field_specifications }} display nothing while {{ product_entity.field_specifications.value }} displays something.

(An informative discussion of the field variables available in commerce-product.html.twig is here)


texts: How would I go about having a feature for customers to create their own accounts on my Drupal? Will I need PHPMyAdmin and some SQL?


texts:
Part 1: How do I add a form element (ie checkbox) to the field of a specific type (ie all image fields) inside the admin Views UI.  What code do I need include in a custom module.

Part 2: How do I save it to the database.

This is not a default view.
I am not creating a need field.  I am trying to alter an existing field.


texts:
I have one content type with entity reference as one of the fields in the content type.
For example say that content type is 'Books'

When I open content add page for content type 'Books' its working perfectly. But the issue starts when I try to open edit page with content type 'Book' that node is having more than 17k+ users assigned as entity reference. This page stops loading after some time.

Please suggest me way to optimized this database query.


texts: Setting custom block cache max-age to 0 breaks jQuery change event

texts:
I have a custom block in which I read a session value and display the result as the selected value of a select form element. Since the value can change based on the users selection, I'm setting cache max-age to 0.

return [
  '#type'     => 'inline_template',
  '#template' => $markup,
  '#context'  => [],
  '#cache'    => ['max-age' => 0],
];

I also have a jQuery change event defined on the same select form element to submit the selected value via ajax and change the session value.

The problem is that setting the cache max-age to 0 breaks the jQuery event. When I reload the page the jQuery event does not fire. Only after reloading again does the jQuery event start working again. If I don't set the cache max-age to 0 the jQuery event fires everytime but the content of the block does not update to reflect the new session value.

jQuery:

jQuery("select.user-location").on('change', function() {
    event.preventDefault();
    selectedLocationID = jQuery(this).val();
    console.log(selectedLocationID);
    jQuery.ajax({
        url:"/ajax/setselectedlocationid",
        method:"POST",
        async:true,
        data:{"selectedLocationID":selectedLocationID},
        dataType: "json",
        showLoader: true,
        success: function(data){
            console.log(data);
        }
    });
});


texts: How to limit access to content for which the Content Access module doesn't limit access?

texts:
I run a small business, and have created a website in Drupal 8 (should have used 7, bit late now, oooops).

Part of the website is designed to be behind a subscription, which I've got working and works well. Only problem is, the content types I want to only be visible to people who have paid, are visible to everyone.

I installed the Content Access module and have set it up thus:

As you can see, "view any checklist content" is set as only "subscriber - bronze" which is currently the only role that'll need it.

When logged out, the page is visible; when logged in (as admin or a test account using that role) it's visible.

Rebuilding permissions is a pain (~20k nodes), but using Drupal Console I can do so and it runs successfully, but no change to the page's permissions.


texts: How to rename address labels on Address field module?

texts:
I wanted to know if it's possible to change the input labels on the address field module 'Address 1' and 'Address 2' without using the string overrides module?

I want to be able to change them to say 'Address line 1' and 'Address line 2'.

Can this be done in a template preprocess function?


texts: Feedback module block doesn't follow visibility rules

texts:
I'm using the Feedback module on my Drupal 6 but I found out a strange behaviour about its block's visibility.

The module appeared even if the block was in the disabled region, not assigned to any site space, and moreover it still appears even if I set for example a PHP code which returns false, or if I set it to appear only on listed pages without giving it any valid page.

If I move the block to different regions it still appears on the bottom right corner, so I have no control on how it works.

Am I missing something or is it a wanted feature of the Feedback block to be always there?


texts: When programmatically adding file field, how to set allowed file extensions?

texts:
I'm trying to add a custom node type in hook_install() for my custom module. I've been able to add the fields I want but can't seem to find a way to set the allowed file extensions for file fields. (it defaults to .txt)

The example below shows how I create my file field. I have tried setting both allowed_file_extensions and file_extensions in the settings array but that does not seem to work.

How would I set the allowed file extensions for a file field?

    field_create_field(array(
        'field_name' => 'xxx_video',
        'type' => 'file',
        'settings' => array('allowed_file_extensions' => array('mp4', 'avi', 'mov', 'wmv', '3gp', 'mpeg', 'mpeg2', 'mkv')),
        'entity_type' => array('node'),
    ));
    field_create_instance(array(
      'field_name' => 'xxx_video',
      'required' => true,
      'entity_type' => 'node',
      'bundle' => 'xxx',
      'label' => t('Video'),
      'description' => t('Video to play in smartbox.'),
    ));


texts: How to show, in a view, content depending on user language or default?

texts:
In one of my Views, showing a preview of some nodes, how can I set the nodes to be shown to be the ones in the user language or, if the user has no language set or is anonymous or the language is not set for the node, the ones in the site default languages?

I can do the two thing with 'filter criteria' separately but not together...


texts: How to display a custom block inside a custom page

texts:
I have a custom page (in code) already built and routed. It's running a single function that renders some content to the page. I also have a custom block (in code) that I need to reference or include in the custom page.

I am not sure what the best way to combine or reference the block from the custom page.


texts: Views "Content: Title" as a select list exposed filter?

texts:
Now I know how to display the "Content: Title" exposed filter field as an autocomplete widget, but can I output this field as a select list too?
Are there any modules to do that?

(I know this can be too resource consuming, when having lots of nodes in a given content type, but currently I only have some of them, so now I'd like to display it as a select list.)

This topic has been closed, linking to this one, but maybe there's already a module to do that since.


texts: Views Long query execution time serious problem

texts:
I got some serious issue with the views performance. I am just fetching 9 items using the Tagadelic list with 3 filters and 3 sorting criteria. It says query build long query execute time like 46147.48 m, Which is really frustrating.

Query build by view is as below:

Can you please help??


texts:
I have 3 non-drupal tables : items, item_actions, actions.

 items(id, title, body, published_at);
 item_actions(item_id, action_id);
 actions(id, name);

I were able to migrate items to drupal 7. Now i want to migrate actions but since i don't know the node_id of the newly migrated items just the legacy id it is throwing an error.
How do i find the node_id knowing the legacy_id so that it finds the right node and migrate related content.

$query = Database::getConnection('default', 'for_migration')
  ->select('actions', 'actions')
  ->fields('actions', array('id', 'name'))
  ->orderBy('id', 'DESC');
// Join values from the action_items.
 $query->leftJoin('action_items', 'ai', '(actions.id = ai.action_id)');
 $query->addField('ai', 'item_id', 'item_list');

Here is the error:

The referenced entity (node: 123456) is invalid.

update
   The migration was done with the migration module. So i had to write class migration and use queries like the one above to migrate to D7 the items table.
Can i create a table in the drupal DB and add the ids(old and new) for example: migrate_nodes(legacy_id, drupal_node_id) .
How do you capture the node_id?
I am new to drupal so this is still a learning process, thanks.


texts: How to set a url in drupal database or settings.php?

texts:
I had created a controller in  custom module using drupal 8.

 public function subscribe(Request $request) {

        $url='https://username:password@someurl.com/v1/subscriptions';

}

I am using git for development. This url is actually for Razorpay subscriptions. These url might get changed according to the mode in razorpay. So the url subscriptions in razorpay for test mode and live mode is different. I have to change url every time in this custom module while managing git.  Can I define this"$url" somewhere in backend in db or settings.php?


texts: Can I use hook_views_query_alter() to alter datetime?

texts:
With Drupal 6.28, a client has pulled an ical ( with parser_ical ) feed using a Feeds Importer and wants a calendar display view. This is working just fine. Although the feed and server sit in the same city (and timezone), at some point, it assumes the iCal feed is a GMT and is recalculating for central time. Thus, appointments show up about 5 hours too early.

I'd love to automatically add +5 to those DTSTART and DTEND on import.

Where is the best place to do so?

Is hook_views_query_alter() the right approach?
Is manually editing the feed returned by the iCal feed parser module an option? It's "minimally
maintained" and this install will live on Drupal 6 for a while.
Is editing the parser_ical/includes/ParserIcalFeedsParser.inc file that comes with the the iCal feed parser module a possible solution?

The ical feed starts with the following.

BEGIN:VCALENDAR
PRODID:-//SRC//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-TIMEZONE:America/Chicago
BEGIN:VEVENT

A sample sequence would be something like the following.

SEQUENCE:0
DTSTART:20131001T120000
DTEND:20131001T160000
DTSTAMP:20130823T000000
SUMMARY:Fall Internship & Job Fair
LOCATION:Anytown, MO
DESCRIPTION:JOB CATALOG ONLHY AVAILABLE ONLINE! ....
UID:443535@domain.tld
TRANSP:OPAQUE
URL:http://...
ORGANIZER;CN=...
CREATED:20130823T000000
STATUS:CONFIRMED
LAST-MODIFIED:20130926T172212
PRIORITY:0
CLASS:PUBLIC
END:VEVENT
BEGIN:VEVENT


texts: ctools_ajax_command_redirect is no longer working to redirect ajax form on successful submit

texts:
My ajax callback function which is changing a form did redirect properly in the past, but now with no change to this code it does not work anymore.

function node_create_callback($form, &$form_state){
    module_load_include('inc', 'node', 'node.pages');
    node_form_validate($form, $form_state);
    if (!form_get_errors()){

      //on success submit form and redirect
      node_form_submit($form,$form_state);
      ctools_include('ajax');
      ctools_add_js('ajax-responder');
      $commands =  array(ctools_ajax_command_redirect("node/"));
      return array('#type' => 'ajax', '#commands' => $commands);
    }
    else
    {
      //on error display errors on form without refreshing page
      $commands = array('#type' => 'ajax', '#error' => FALSE, '#commands' => array());
      $output = drupal_render($form);
      $commands['#commands'][] = ajax_command_insert(NULL, $output);
      // Prepend status messages to the node form.
      $commands['#commands'][] = ajax_command_prepend(NULL, theme('status_messages'));
      return $commands;
    }
}


texts: How to make mmenu work with Omega 4 sub theme?

texts:
I've used Omega 4 to create a mobile sub theme for my website and now would like to add a sliding menu. Mobile sliding Menu looks like exactly what I need but I can't make it work with Omega 4. When I follow the same steps with Bartik it works like a charm.
Can somebody share experience in using mmenu with Omega 4 or can at least point me in the right direction?

Any form of help is greatly appreciated.


texts: Why is my custom theme template not found?

texts:
In my theme's template.php file, I defined a new theme hook using hook_theme():

function MYTHEME_theme() {
  $hooks = array(
    'custombody' => array(
      'template' => 'custombody',
      'variables' => array(
        'content' => array(
          'body' => '',
        ),
      ),
      'path' => drupal_get_path('theme', 'MYTHEME') . '/templates/custom',
    ),
  );

  return $hooks;
}

I also placed a file named custombody.tpl.php under templates/custom.

But I can't get this template working. It's not found from Drupal. I keep getting this warning in the log:

  Theme hook custombody not found

Details:

I am trying to use this template to style the body part of HTML emails. I'm using Swift Mailer to send HTML emails and I want to theme the body part with my custom theme. There is no problem on the swiftmailer part.

Normally swiftmailer.tpl.php prints the body text as it is:

<?php print $body; ?>

I've changed this in my own implementation of swiftmailer.tpl.php in my theme folder like that:

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

And I'm sending a render array as $body, instead of a string, what normally would be expected.

The array I'm sending is:

$variables['body'] = array(
  '#theme' => 'custombody',
  '#content' => array(
    'body' => 'Actual body text here',
  ),
);

What am I missing, that my custombody template is not being found?

UPDATE:

I also created a theme_custombody() function in my template.php file to test it, but it also doesn't work.

function theme_custombody($variables) {
  return 'TEST';
}


texts: Large unknown margin-left for Views blocks

texts:
I have a lot of fighting against some unknown large margin-left , around 30px in all themes I start to work with (Zen, Adaptive Theme) - I think it's for Blocks generated by Views...

I haven't found yet where exactly this margin is generated - but I can see - my Main menu of 100% width starts at the front page's edge; if I made a custom HTML block - it starts with the page;

But when I insert several Views blocks - they doesn't start with the page, but some 30px from left of the page;

So, to even them out - I have always remember to put them some negative margin-left, at least some -10 or -20px to somehow even them out....

What it is? What exactly is creating this huge margin-left on the front page for Views blocks?


texts: Display data from web service using views

texts:
I need to query data from a web service and display it in a view without storing the data in Drupal database. I am using WSData module for this purpose but I am unable to figure out how and when the webservice is getting invoked. My web service doesn't have any parameters passed and it returns a list of items. I would like to display the list as a table using views.

It would be of great help if I can get any samples or references.


texts: How do I tell hook_block() about placement

texts:
I may have a disconnect and I'm just not sure if what I'm asking is possible. I'd like to tell Drupal where to place a block. So far I'm using a Context with a path condition to user/* and stream.

Can't I accomplish the similar thing with the following?

function hook_block($op = 'list', $delta = 0, $edit = array()) {

  if ($op == 'list')
  {
    $blocks[0] = array(
      'info'      => t('Social Login Block'),
      'region'    => 'sidebar_last',
      'pages'     => 'stream\nusers/*',
      );

Is this possible or is it better form to just let the maintainer set the block manually? Or a larger question, how might I translate this context rule into code?


texts:
I have a taxonomy list like so...

Parent One
    Subitem One
    SubItem Two
       SubItem Three
Parent Two
    Subitem Four
Parent Three
    SubItem Five
    SubItem Six

I also have a content type that uses subitems in a field, along with other fields.

I need to have a view that will show the parent taxonomy terms in addition to the other fields in the CCK.  Something like

Parent Fields
      Title
      Book
      Subotem 1
   Parent Two - SubItemsTwo
      Title
      Book
      Subotem 3

Please advise


texts: Email notifications for disqus comments on a node

texts: I setup a blog in drupal and used the disqus module to integrate it with the disqus commenting system.  The drupal commenting system isn't used.  When someone posts a disqus comment on the node, I'd like drupal to email the node author a notification of the comment.  Disqus' system is setup to notify a primary administrative account when a new comment is posted but not the node author, as that information lies within Drupal. How do I go about this?


texts: How to prevent Migrate from creating null fields?

texts:
I'm writing some migrations classes using Migrate module. Some of my source fields does not have data for migration but the Migrate module creates Drupal fields with null values anyway. How to prevent that? I only want to create fields if there are non-null values for them.

This comment suggests that it should be enough to just unset field from source row (for example inside prepareRow), but that doesn't work for me - the field with null value is created anyway.


texts:
I am using ECK (Entity Construction Kit) to create my custom entities. Now I want to create custom url for various operation on my entities such as create (example.com/my-entity/create) or view (example.com/my-entity/view/custom-unique-field)

I have tried pathauto but it seems I cant define custom patterns for my own entities. Any help towards this step is highly appreciated.

Thanks,
Naveen


texts: Organic Groups let users with a particular role Edit/Delete content only in the group(s) they belong to

texts:
I am using Organic Groups and have a custom role say "A". I want users with "A" role to be able to "edit/delete" any content only in the groups they belong to.

I have tried setting up with base System and OG permissions and also using Field Permissions, OG Role Override modules, but can't get exactly what i want.

Any direction on this is appreciated.

Thanks!


texts: Can I use AddressBook values to populate a webform field?

texts:
I am currently trying to make lots of things work together. I'll try to put it simple without annoying details.

I work on a lawyer's site with drupal commerce installed, as well as AddressBook, Webform and FillPDF.

Outside the commerce functionalities (selling legal templates), my client wants her users to share loads of necessary informations with her (about the case she needs to work on).
Among these information are… you guessed it: name and address.
These informations might be used (many times) in pdf generated from forms (like mandates etc.)

Do any of you know a way…
to pick an address already stored in AddressBook to re-use it in a WebForm, (let's say, via a token)?
---OR---
to fill The AddressBook values as well as user informations from data typed in a WebForm which I could grab later on (the other way round suits me fine).

The aim being to provide a unique place to register all the necessary infos,  in order to keep the site super-simple for middle aged people.


texts: Hide if source (computed token) field is empty

texts:
I am setting up an event registration for an existing D8 website.

I have added content type Event with fields start date, end date etc.
And I have a webform for event registration with computed token field set.

Which hook should I use to run a pre-render validation on event date and hide the webform.

PS: I don't want to close the webform as it will be reused for multiple events in future.

I did check this (and many), but its marked as outdated does it mean functionality is there in the webform module?
https://www.drupal.org/project/webform/issues/2877082


texts:
The redirect field within entityform doesn't seem to have any effect. I'm using the entityform block module, if it makes any difference.

I have also tried using hook_form_alter to copy to default submit action and hardcode it in, which also doesn't work:

function custom_edit_form_submit(&$form, &$form_state) {
   $form['actions']['submit']['#submit'][0] = 'custom_edit_form_submit';
}

function custom_edit_form_submit(&$form, &$form_state) {

$entityform = entity_ui_controller('entityform')->entityFormSubmitBuildEntity($form, $form_state);
  // Add in created and changed times. This must be added before preview to get time.
 if ($entityform->is_new = isset($entityform->is_new) ? $entityform->is_new : 0) {
global $user;
$entityform->created = time();

$entityform->uid = !empty($user->uid) ? $user->uid : 0;
}

$entityform->changed = time();
$entityform->draft = $form_state['clicked_button']['#entityform_draft'];
// Save the entityform and go back to the list of entityforms.
$entityform_type = entityform_type_load($entityform->type);
if (!empty($form_state['clicked_button']['#entityform_change'])) {
$form_state['entityform_preview_entity'] = $entityform;
$form_state['rebuild'] = TRUE;
drupal_set_message(t('Re-enter'));
return;
 }
else {
// If this entityform type has preview mode and we are in submit store preview.
if (empty($form_state['clicked_button']['#entityform_after_review'])
     && !$entityform->draft
     && !empty($entityform_type->data['preview_page'])
     && $form_state['entityform_form_mode'] == 'submit') {
  $form_state['entityform_preview_entity'] = $entityform;
  $form_state['rebuild'] = TRUE;
  return;
}
}

$entityform->save();
if ($form_state['entityform_form_mode'] == 'submit' || !user_access('edit any entityform')) {
if (empty($entityform->draft)) {
  $redirect_path = $entityform_type->get_path_property('redirect_path', $entityform);

  if (!empty($redirect_path)) {

    $form_state['redirect'] = 'my/path/here';
    // print_r($form_state); die(); This fires which shows that the function is being called
  }
  else {
    global $user;
    if (empty($user->uid)) {
      // For anonymous users we must store the id of their submission in the session.
      drupal_session_start();
      $_SESSION['entityform_submission'] = $entityform->entityform_id;
    }
    $confirm_path = entity_ui_controller('entityform')->confirm_path($entityform->type, $entityform->entityform_id);
    $form_state['redirect'] = array($confirm_path[0], $confirm_path[1]);
   }

  drupal_set_message($entityform_type->get_prop('submit_confirm_msg', $entityform));
  }
  else {
  // Saving a Draft.
  $form_state['redirect'] = $entityform_type->get_path_property('draft_redirect_path', $entityform);
  if (empty($form_state['redirect'])) {
    // Redirect to standard draft page.
    drupal_set_message(t('Your draft submission has been saved.'));
    $form_state['redirect'] = entity_ui_controller('entityform')->draft_path($entityform->type);
  }
  else {
    // Redirecting away from standard draft page. Show text as message.
    drupal_set_message($entityform_type->get_prop('draft_save_text', $entityform));
  }
}
}
else {
$info = entity_get_info('entityform_type');
$form_state['redirect'] = $info['admin ui']['path'] . "/manage/{$entityform_type->type}/submissions";
drupal_set_message($entityform_type->get_prop('submit_confirm_msg', $entityform));
}
}


texts: Is there a way to pass a form #value to the form #action in Drupal 7 form API?

texts:
In the example below I want to take elements from the form and include them as part of the URL that I am submitting the form (using #action) so the submitted URL would look like http://example.com/name_storage/John/Lewis/123412341234.

    <?php

function my_module_menu() {
  $items[‘testform’] = array(
    'title' => 'First Last Name',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('my_module_form'),
    'access callback' => TRUE,
    );
  return $items;
}

function my_module_form($form,&$form_submit) {
  $form[‘first_name’] = array(
    '#title' => t(The first name of the person),
    '#type' => 'textfield',
    '#required' => TRUE,
  );
  $form[‘last_name’] = array(
    '#title' => t('The first name of the person'),
    '#type' => 'textfield',
    '#required' => TRUE,
  );
  $form['passcode'] = array(
    '#title' => t('Passcode for this domain.'),
    '#type' => 'textfield',
    '#value' => '123412341234',
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#value' => ‘Submit,
    '#type' => 'submit',
    );
  $form['#action'] = url('http://example.com/name_storage/' . $form['first_name']['#value'] . '/'. $form['first_name']['#value'] . '/' . $form['passcode']['#value']);
  return $form;
}
?>


texts: How to display the profile page in Modal window

texts:
By using ctools, i am able to display a form in modal window.
Now i wish to display a page(the profile page) in modal window.

Below is the sample code (call by menu page callback) to display a html content in modal window, but how to display a page (user/1/profile) , i know i almost there..

any ideas?

function mymodule_profile_modal(  $user,$js)
{
  $output = t('
Lorem ipsum dolor sit amet...
');
  $title = t('Modal example');
  if ($js) {
     ctools_include('ajax');
     ctools_include('modal');
     ctools_modal_render($title, $output);
     // above command will exit().
   }

 }


texts: How do I get image styles to function on the original node page?

texts:
I go to create a content type.
I add an image field and in the "manage display" section I change the
format so that it uses the image style that I want.
I then save it and it, I get the "changed save checkmark up top" and
it  says Image style: medium on the image section
When I create the content and post it, I go to view it and it shows the image at the
original size, not scaled and cropped like the image style that was
suppose to be applied to it.

Any idea what I could be doing wrong?

NOTE:  This image style works on views, but for some reason not on the original content page/node.


texts: custom module to create multiple forms with pop-ups

texts:
I am working on a custom module to create a form. Functionality of the module is as follows: The first form has an url, on clicking the url it should show another form as a pop-up.
How can i call these forms in the hook menu.
Does tools_js has any significance?

<?php

function patient_menu() {

$items['patient_add/mainpage'] = array(
    'title' => 'New Patient',
    'page callback' => 'patient_form',
    'page arguments' => array(),
    'access callback' => 'user_is_logged_in',
    'type' => MENU_CALLBACK,
);
//a link to add patient diseases

$items['patient_add/%ctools_js'] = array(
'page callback' => 'patient_callback',
'page arguments' => array(1),
'access callback' => 'user_is_logged_in',
'type' => MENU_CALLBACK,
);

return $items;
}

 // a function to make a  link
function _patient_make_link($link_text = '') {

 return '
' . l($link_text, 'patient_add/nojs', array('attributes' => array('class' => 'ctools-use-modal'))) . '
';
}
//first form

function patient_form($form, &$form_state)  {
ctools_include('modal');
ctools_modal_add_js();

$form['p_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#size' => 30,
    '#maxlength' => 128,
    '#required' => TRUE,
);

$form['age'] = array(
    '#type' => 'textfield',
    '#title' => t('Age'),
    '#size' => 30,
    '#maxlength' => 30,
    '#required' => TRUE,
    '#attributes' => array('placeholder' => t( 'in Years' )),
);

$form['submit'] = array(
    '#value' => t('Add Patient'),
    '#type' => 'submit',
);

_patient_make_link('add disease details');

return $form;

}

//Ajax menu callback

function patient_callback($ajax) {
if ($ajax) {
ctools_include('ajax');
ctools_include('modal');

$form_state = array(
  'ajax' => TRUE,
  'title' => t('disease details'),
);
$output = ctools_modal_form_wrapper('disease_form', $form_state);
if (!empty($form_state['ajax_commands'])) {
  $output = $form_state['ajax_commands'];
}
print ajax_render($output);
drupal_exit();
}
 else {
  return drupal_get_form('disease_form');
  }
}
//second form
function disease_form($form, $form_state){
  $form['disease_ids'] = array(
    '#type' => 'select',
    '#title' => t('Disease IDs'),
    '#multiple' => TRUE,
    '#options' => array(
        'Cancer' => 'Cancer',
        'Dengu' => 'Dengu',
        'Viral Fever' => 'Viral Fever',
        'Malaria' => 'Malaria',
    ),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;

}

function patient_form_submit($form, &$form_state) {}


texts:
I'd like my JSON:API responses to return the e-tag header so that consuming remote sites can determine (e.g. with a HEAD request) if they need to ditch their cached responses and re-fetch.  There is no last-modified or e-tag headers being sent at all - for any Drupal page for that matter.  How can I enable this?  Thanks!

I do see X-Drupal-Dynamic-Cache and X-Drupal-Cache headers, but this isn't enough to go on.

Running Drupal 8.6.10 and JSON:API 8.x-2.4.


texts:
How can I order by weight using node_lode_multiple and the weight module ?

   <div id="photos_inner">
         <?php
           $type = "staff";
           $nodes = node_load_multiple(array(), array('type' => $type));
           foreach($nodes as $staff):
         ?>


texts:
I want to import about 50,000 users using the feeds module. Does anyone know if I need to break that file into smaller rows, say 5,000 records at a time? Is it better to bring the site locally and run the module or can I do this without problem on the server? The reason I ask is because I'm not sure if I will run into memory or execution time limits.

Thanks


texts: Get node author's real name in views or convert username

texts:
I currently have a content view that displays a list of nodes for a blog. I would like to display the node authors real name (John Smith) at the top, but currently I am only able to display their username (john_smith) by creating a relationship to Content: Author and then adding User: Name.

How can I grab some fields from the node authors user profile?

The fields I need are $field_first_name, $field_last_name, $field_position.

FYI: I realize that there are modules that might be able to fix this problem such as Real Name, but I am hoping to do this without it.


texts: Getting error after fresh install "Redirects to external URLs are not allowed by default"

texts:
Playing around with a new install on localhost.

Error Happens when I click on a submit button, for example installing new modules.

  Redirects to external URLs are not allowed by default, use
  \Drupal\Core\Routing\TrustedRedirectResponse for it.

There are some fixes, like this one but I don't know how add new hooks and where as I'm a total Drupal newbie.


texts: Custom facet processor not displaying on facet setting

texts:
We have a custom module,mymodule, where we create a custom facet processor for a facet we created (myfacet). When we enable the module and cleared the cache we are not seeing the new processor display.

Question:

How to get custom facet processor to display

Setup

Add Article's Category (taxonomy term) to be indexed for search
Created a View (myview) with Page display.
Created facet where facet source = myview and field = Category >> Taxonomy Term >> Name
Name = myfacet

What we tried:

When we navigate to /admin/config/search/facets/myfacet/edit, the processor is not showing.
Disabling module, enabling, and clearing cache, but nothing.

Here is the code we tried for mymodule, but it is not showing. It was following Facetapi-processor-blogpost, but it is not showing as an option.

mymodule/src/Plugin/facets/processor/MyModuleProcessor.php

<?php
namespace Drupal\mymodule\Plugin\facets\processor;
use Drupal\Core\Form\FormStateInterface;
use Drupal\facets\FacetInterface;
use Drupal\facets\Processor\BuildProcessorInterface;
use Drupal\facets\Processor\ProcessorPluginBase;
/**
 * Provides a processor that hides results start with a configurable character.
 *
 * @FacetsProcessor(
 *   id = "mymodule_replace",
 *   label = @Translation("Hide start with some letter"),
 *   description = @Translation("Hide all results that start with a configurable character"),
 *   stages = {
 *     "build" = 40
 *   }
 * )
 */
class MyModuleProcessor extends ProcessorPluginBase implements BuildProcessorInterface {
  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet) {
    $processors = $facet->getProcessors();
    $config = isset($processors[$this->getPluginId()]) ? $processors[$this->getPluginId()] : null;
    $build['character'] = [
      '#title' => $this->t('Character to hide'),
      '#type' => 'textfield',
      '#default_value' => !is_null($config) ? $config->getConfiguration()['character'] : '',
      '#description' => $this->t("All results that start with this character will be hidden."),
    ];
    return $build;
  }
  /**
   * {@inheritdoc}
   */
  public function build(FacetInterface $facet, array $results) {
    $processors = $facet->getProcessors();
    $config = $processors[$this->getPluginId()];
    $char = $config->getConfiguration()['character'];
    /** @var \Drupal\facets\Result\ResultInterface $result */
    foreach ($results as $id => $result) {
      if (strpos(strtolower($result->getDisplayValue()), $char) === 0) {
        unset($results[$id]);
      }
    }
    return $results;
  }
}

mymodule/config/schema/mymodule.schema.yml

plugin.plugin_configuration.facets_processor.mymodule_replace:
  type: mapping
  label: 'Settings for the hide-starts-with processor'
  mapping:
    character:
      type: string
      label: Character


texts: Drupal to Salesforce - Check if record exists before create

texts:
I am using the Salesforce Suite to push Entity Registrations to Salesforce in our commerce workflow. The problem I am experiencing is that there is no checks to first see if the registrant exists before creating a new one. At the moment every registrant is a duplicate.

How can I make it do the following? Seems like it should be pretty straight forward but isn't there...

Check to see if Registrant exists based on a set of fields (email, first name, last name)
If so, update that record with information that is different and obtain the SFID
If not, create and obtain the SFID

This should be available regardless of record type, you should be able to check if something exists based on a series of fields.

If it needs to be done via a hook, I have been looking for documentation on how to use the Salesforce hooks to handle this but I can't find anything, so if you have any examples of how this can be done it would be awesome if you could share!

Looks like some work was done here for D6, https://www.drupal.org/node/507800 but it doesn't look like the changes were applied to the D7 rewrite.


texts: How can I dynamically remove an entity constraint?

texts:
I'm working on a single-sign-on module for D8 and would like to disable the password fields on the user edit form, since passwords should be managed by the outside identity provider and not through Drupal.

Drupal adds a "current password" field to the edit page which is required if the user wants to change their email address. I can remove the field easily in a hook_form_alter, but there's a form constraint, ProtectedUserFieldConstraintValidator, that runs and fails validation if the password field is not filled out.

How can I remove this form constraint dynamically?

Things I've looked at so far:

In my hook_form_alter setting $form_state->getFormObject()->getEntity()->_skipProtectedUserFieldConstraint = TRUE. This is a property that this constraint checks and when TRUE will skip it, but changes to the entity here are tossed since ContentEntityForm::validateForm rebuilds the entity just before validation.
Looking at the BaseFieldDefinition class to see if there's a way to remove an existing constraint, but there are no API methods available to do so.

EDIT: It seems once possible approach is to extend ProfileForm, overwrite the buildEntity method to set _skipProtectedUserFieldConstraint = TRUE, and then tell core to use my forms instead. Thought a downside here is that I'm just disabling the constraint in the context of a form, but not in other contexts where the entity may be updated, like in a REST API.


texts:
I've created a new Drupal 7 module, which has been installed and enabled.

I have this function in the module.

function remove_entries_cron() {
  $query = "INSERT INTO {search_dataset} (sid,type,data) VALUES (22061986, node, hello)";
  db_query($query);
}

I have cleared the cache, and ran the cron manually but the record doesn't appear in the database.

Is there a way to check if the cron hook is working?


texts:
How I can allow two html tags <sup> and <sub> in node title of all content types.

Or may be is there some module for BB tags which allow using BB-codes in title?

Or my ba is there some hook for preprocess all titles?


texts: Drupal CKeditor image-upload plugins don't delete unused files

texts:
In my Drupal travels, I've used a number of CKeditor instant image-upload plugins; IMCE, Media, and another one (don't recall the name).

The three of them doesn't delete unused files (Like Drupal imagefield does automatically) and thus I sometimes need to upload the same file with them 6 or seven times and these duplicated can whey much gb's in a cumulative way.

Is there any way to make one of the CKeditor instant image-upload plugins delete the files automatically? or at least? Have you cam across something that does delete unused image files automatically? Thanks,


texts:
I want to send email to the users of my site, individually or to all of them  at once.
Is there any available module?

I am using Drupal 6.


texts: How can I allow a filter in a view to be modified by a site admin without granting full permission to alter the view?

texts: I have a module with a view and some other functionality. I want to give site managers the ability to change the filter on the view (this isn't an exposed filter) but not give access to change the view.  I know how to make a form for the module but what would I use to get the information from the view and return the information.  I assume it is one of these:  https://api.drupal.org/api/views/views.api.php/group/views_hooks/7.x-3.x


texts: The simplest way of get an emerging modal window

texts: I want to open a modal emerging window, with some HTML on it and a close button. It should open when the user visits the page. What is the simplest way of doing that and what modules should I use? I have tried with CTools and a javascript (jQuery) emulation of click on a hidden link, but that gives me problems and seem so convoluted to me. Is there any simplest way?


texts:
I've been away from drupal for 2-3 years. I just came back around and installed drush via composer (like the drush site recommends) and now every time I try to use drush I get a message telling me that I should be using composer:

~/sites/d7 $ drush version
 Drush version : 9.0-dev-gd4a3872
~/sites/d7 $ drush dl drupal-7.x
 [notice] dl has been deprecated. Please build your site using Composer. Add new projects with composer require drupal/[project-name]. Use https://www.drupal.org/project/composer_generate to build a composer.json which represents the the enabled modules on your site.

I downloaded drupal 8 following these instructions for installing drupal via composer, but when I try to use drush in that project I get this message:

~/sites/cfbtv/web $ drush dl devel
This codebase is assembled with Composer instead of Drush. Use `composer update` and `composer require` instead of `drush pm-updatecode` and `drush pm-download`. You may override this error by [error]
using the --pm-force option.

Is there something wrong with my local env, or is drush a thing of the past now?


texts: How to create a view showing the products from a user's company?

texts:
I'm trying to create a relationship between a field on a user profile and a field on a content type.

User Profile
Company Name - This is an entity reference that pulls names from a Company content type.
Product - contains a field company which also pulls from a Company content type.

I'm trying to create a view which will show a user products his company carries.  So the view is a user view.  Contextual filter is the UID of the logged in user. Now trying to create the relationship to pull in fields from the product content type.

Basically, I'm trying to create a query that will show products where the product.company is equal to the user.companyname.


texts: How can I filter related content types in Drupal?

texts:
I'm building out a project management/project organization site with Drupal. The basic content types will be:

Projects
Milestones (which belong to a project), and
Tasks (which belong to a milestone)

I've built the Project content type. That was easy. I built the Milestone content type, and using the Node Reference module, I was able to access all of the Projects right in the from. Nice! But now Tasks get a bit tricky. Using the same technique, I could reference all of the Milestones in the Tasks form, but I really only want to see the Milestones that are associated with a specific Project. It seems that I would need to employ some kind of filter. How?

What's the best approach here? I have no module restrictions and am using the most current version of Drupal (7.8).


texts: Ubercart Module for handling subscriptions?

texts:
Trying to figure out the best UC module to use for this...

Essentially, I'm trying to create a site where users may purchase subscriptions.  There are about 15 different subscriptions a user may purchase.  The first subscription (regardless of which one it is) will sell at $20.  Every additional subscription purchase after that will cost $10.

Not sure which module to use (or if one even exists) to accomplish this.  There appears to be so many contributed modules, and the descriptions "kinda sorta" seem like what I need, but a lot of them sound very similar...

If someone knows a good way to accomplish this, that'd be great...


texts: Undo to Taxonomy term system path unset with _menu_alter

texts:
I have a question about taxonomy term system path.
I have run this code:

function MYMODULE_menu_alter(&$items) {
  unset($items['taxonomy/term/%taxonomy_term']);
  unset($items['taxonomy/term/%taxonomy_term/view']);
  unset($items['taxonomy/term/%taxonomy_term/feed']); // If you want to hide the feed as well.
}

Now I want to know how to reverse this for the future need. How can I set system paths for all taxonomy terms.
Thanks in advance.

edit:

Hi David

In first place I have a problem how to forbid anonymous access to all taxonomy terms (eg. mysite/vocabulary/term). I don't want anonymous user to see this pages. I was searching for answer whole day and I found the alter_menu snippet as the only suitable answer, because for now I don't need terms links from outside world.

So, if I put this script in custom module and run once it clears all system paths for all taxonomy tearms (as it can be seen from admin/URl aliases/list). This is good solution, but I don't think the best one. I need a proof that in the future if I will need this system paths, I can rebuild them. I don't know how to do it!?

I have tried to comment that hook_menu_alter snippet but what next I have to do. I mean, system paths will not be automatically rebuilded. Am I right?

Also, i didn't find suitable module to control access to taxonomy terms from outside for anonymous users. Some modules can control that, but my site is using terms thru views and with that modules views are also invisible for anonymous users (eg. Taxonomy Tools module, access part).


texts: Pathauto URL alias Node taxonomy term translation

texts:
How can i get pathalias to get the translated taxonomy term for the path alias?

The pattern:

[node:field_glp_product_types]-[node:field_glp_address:city:?]

[node:field_glp_product_types] is a taxonomy reference field.

The following tokens are available, but only the node:field_glp_product_types token gives output, but not translated.


texts: Password Gets Reset when executing user_save

texts:
I have a function that sets a user to confirmed after they login to my site for the first time. However, whenever I run this function and I log out and try to log back in the password doesn't work anymore and I have to do a manual reset in the database. I can't seem to find what would cause a change in the password. Any advice?

Note that I am using mongodb.

function update_profile($uid,$attribute_name,$attribute_value,$arrayaction=NULL)
{
    // update some user property
    $existing = user_load($uid);
    $edit = (array) $existing;

    //Update profile iformation
    if(!empty($arrayaction))
    {
        if(strtolower($arrayaction) == 'push')
        {
            array_push($edit[$attribute_name]['und'][0],$attribute_value);
        }
        else if (strtolower($arrayaction) == 'unset')
        {
            if(($key = array_search($attribute_value, $edit[$attribute_name]['und'][0])) !== false) {
               unset($edit[$attribute_name]['und'][0][$key]);
            }
        }
    }
    else
    {
        $edit[$attribute_name]['und'][0] = $attribute_value;
    }

    //Make the changes to the user
    user_save($existing, $edit);
}

function module_user_login(&$edit,$account) {
    if ($account->access == 0) {
        update_profile($account->uid,'field_confirmed',array('value'=>1),NULL);
    }
}


texts: How to add a class to menu items that are not expanded (or don't have children) in the navigation Twig template?

texts:
How do you add a class to menu items that are not expanded (or don't have children)?

    {% for item in items %}
      {%
        set classes = [
          item.is_expanded ? 'menu-item--expanded dropdown panel simple-dropdown',
          item.is_collapsed ? 'collapsed',
          item.in_active_trail ? 'active',
        ]
      %}
      <li{{ item.attributes.addClass(classes) }}>
        {{ link(item.title, item.url) }}
        {% if item.below %}
          {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
        {% endif %}
      </li>
    {% endfor %}

Edit: Can anyone point me into getting the answer provided, implemented in my example?


texts: Paginate views by first letter of Node title

texts: I'm creating a View of staff profiles. It's a simple list of Node's Title filed (which happens to be the person's name. Instead of paging by number of items, I want to group them by first letter of first name. How should I start this?


texts:
How do i change the visibility of an existing block programmatically?

I created the block using yml, here's the configuration:

uuid: 67105709-2648-445e-9ddd-8b830a854d8d
langcode: en
status: true
dependencies:
  module:
    - pixelpin_openid_connect
    - system
  theme:
    - bartik
id: openidconnectlogin
theme: bartik
region: content
weight: 0
provider: null
plugin: pixelpin_openid_connect_login
settings:
  id: pixelpin_openid_connect_login
  label: 'PixelPin OpenID Connect Login'
  provider: pixelpin_openid_connect
  label_display: visible
visibility:
  request_path:
    id: request_path
    pages: /user/login
    negate: false
    context_mapping: {  }

The block visibility will change depending on whether a checkbox is checked so i cannot modify the existing block using yml (if that's even possible) unless you can call it in code.


texts: How do I enable an onclick event in a link on a form?

texts:
I am using the following code.

 $form['test'] = array(
        '#type' => 'link',
        '#href' => "javascript:;",
        '#title' => t('Show'),
        '#attributes' => array(
            'onclick' => "show_this();",
            'onsubmit' => 'return false',
        ),
        '#id' => 'myid',
  );

Its output is the following.

Show

The onclick event is working properly. I want to disable href.

How can I achieve this?


texts: Is it possible to override/replace an event subscriber

texts: I would like to replace an event subscriber. Is there any way that I can write my class implementing EventSubscriberInterface which would replace another existing event subscriber instead of being performed earlier or later that the one existing.


texts:
I'm trying to create a table which aggregates all full date (Year-Month-Day) values into the Year. The issue I'm facing is that, even though I managed to achieve that, view still somehow sees day and month of the date field, and shows them as 2 different records.

In the end I'd like to plot that data into the charts module and receive a result of Number of Items vs their Age

These are the screenshots of my view as I have it right now.


texts: How can I migrate pdf repository with file titles?

texts:
I've a large amount of files to be migrated, stored in a folder under my Drupal root folder.
My source schema is a Mysql table like this:

id (PK)
dmname
dmfilename
tid
dmdate_published

I want to store them like entities of type 'file' and bundle 'document' and they will be not attached to nodes. The bundle document has a taxonomy custom field.

I wrote this migration class in a Migrate custom module:

class TabellaDocmanMigration extends Migration {
    public function __construct(array $arguments = array())
    {
        parent::__construct($arguments);
        $this->description = t('Migrazione base dati componente Docman di Joomla.');
        $query = db_select('jos_docman', 'j')
            ->fields('j', array(
                'id',
                'dmname',
                'dmfilename',
            ));
        $query->addExpression("UNIX_TIMESTAMP(dmdate_published)", 'dmdate_published');
        $query->innerJoin('docman_pivot', 'd', 'd.id_docman = j.catid');
        $query->fields('d', array('tid'));
        $query->condition('published', 1, '=');
        $query->condition('approved', 1, '=');
        $query->orderBy('id', 'DESC');
        $query->range(0,2);
        $this->source = new MigrateSourceSQL($query);
        $this->destination = new MigrateDestinationFile('document');
        $this->map = new MigrateSQLMap($this->machineName,
            array(
                'id' => array(
                    'type' => 'int',
                    'not null' => true,
                    'description' => 'ID del file originale',
                ),
            ),
            MigrateDestinationFile::getKeySchema()
        );

        // My source directory
        $this->addFieldMapping('source_dir')
            ->defaultValue('sites/default/files/dmdocuments');

        // My source file.
        $this->addFieldMapping('value', 'dmfilename');

        // My destination.
        $this->addFieldMapping('destination_dir')
            ->defaultValue('public://media-root');
        $this->addFieldMapping('destination_file', 'dmfilename');

        // My fields
        $this->addFieldMapping('timestamp', 'dmdate_published');
        $this->addFieldMapping('field_folder', 'tid');
        $this->addFieldMapping('field_folder:source_type')
            ->defaultValue('tid');

        $this->addFieldMapping('uid')
            ->defaultValue(1);

        $this->addFieldMapping('preserve_files')->defaultValue(FALSE);
        $this->addFieldMapping('pathauto')->defaultValue(0);

    }
}

The class works well but I can't migrate file name (as title). Ex:

id (PK) -> 842
dmname -> My file name like a title
dmfilename -> my_file_uri.pdf
tid -> 18
dmdate_published -> 1486371655

How can I solve this?

Thanks


texts: Hide whole edit content link column to users

texts:
I'm using drupal 7 and have a view with column edit content link. I want to hide a whole column edit to users and only administrator who can see that column.
How can I achieve that without coding since U don't have the permission to access that.

I already tried using Field Permission module but i can't find the solutions either..


texts: Am I missing a step with using Features?

texts:
I've made changes to a Panel variant on my local site and wish to push it to the remote site, but I am having trouble doing this - the changes to the variant are not appearing on my remote site.

Here's what I am doing:

In Features I find the Page Manger section with my variants. I check them all, increment the version number and hit download.
I unzip the downloaded .tar file and place the Feature files within my folder structure: modules>>features>>module_name. I overwrite the existing files in there.
Using Git, I push these to my remote site (all's good with this step - I see the CSS changes I pushed as well)
On the remote site I access features and see that my module's features are overwritten. I check it's check box and hit Save Settings.

But nothing changes when I look at my variants - my changes do not appear.

Is there a step I am missing here?


texts: How to change background image based on current node?

texts:
I am trying to change the header background image of my website based on the current node. I have added an image field to my content type, field_hero_image, and, in preprocess function mytheme_preprocess_page(&$variables), I get the image url and try to inject it in the page, as inline css:

function mytheme_preprocess_page(&$variables) {

    $node = $variables['node'];
    if ($node) {
           $path = file_create_url($node->field_hero_image->entity->getFileUri());
            $variables['page']['#attached']['css'] = array(
                'data' => '.header-wrapper { background:url(' . $path . ') center center no-repeat !important; background-size: cover;}',
                'type' => 'inline',
            );
    }
}

or

function mytheme_preprocess_page(&$variables) {

    $node = $variables['node'];
    if ($node) {
           $path = file_create_url($node->field_hero_image->entity->getFileUri());
           $variables['#attached']['library'][] = array(
            'data' => '.header-wrapper { background:url(' . $path . ') center center no-repeat !important; background-size: cover;}',
            'type' => 'inline',
        );
    }
}

None of this works.

Is there a way to inject css from the preprocess function? I know that I can get the path value, put it in $variables and use it in twig. But this doesn't seem a clean solution to me.


texts: how to redirect users to a page after login only when a specific menu item is clicked?

texts:
I have a link "Add a Post" (url: /node/add/mypost) which is not directly accessible to users.

I want to display a menu item titled "Add a Post" so that when users click on it, user goes to login page and THEN goes to "/node/add/post"

I have tried using "logintoboggan" and "rules" modules but these redirect user to "node/add/mypost" EVERYTIME a user logs in - I also have a "log in" only link where I just want the user to come back to home page after logging in.

Question Summary: How to have redirect users to a node add form based on a menu item that they clicked on? (menu item here = separate than the "log in" link)


texts: Rule to delete other node of same type before saving content

texts:
I have designed one content type which can be created by registered users via "Form Block" Module. I am now trying to create a rule which will allow each user to only have one existing node of that content type. If they decide to create a node of that content type again, the previous node should be deleted.

I'm having trouble with the rule that would accomplish this. There are no errors, but nothing appears to be being deleted.

Event =

Before saving content

Conditions =

Content is of type (Parameter: Content: [node], Content types: NeuroTrans pt1)

Data comparison (Parameter: Data to compare: [node:author:uid], Data value: [site:current-user:uid])

Action =

Delete entity (Parameter: Entity: [node])

Here's an export of the rule that I have created:

{ "rules_delete_previous_neuro_pt1" : {
"LABEL" : "Delete current user\u0027s previous NeuroTrans pt1",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "node_presave" ],
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "neurotrans_pt1" : "neurotrans_pt1" } }
    }
  },
  { "data_is" : { "data" : [ "node:author:uid" ], "value" : [ "site:current-user:uid" ] } }
],
"DO" : [ { "entity_delete" : { "data" : [ "node" ] } } ]

}
}

**Using the "code" entry mode for this post doesn't appear to preserve the formatting quite perfectly.

Any guidance would be much appreciated. Thanks!!


texts: OAuth Connector Facebook - how to get email, address, and other user details for registration?

texts:
I'm using OAuth Connector on my Drupal Commerce websites to register users using their Facebook accounts.
I found out how to set user name for the registration field, but I can't do the same with email.
How to get Facebook email for the user registration form on my websites?


texts:
Is it possible to create content types with Drush? Such as a new Galery content type?

I created a content type manually via web interface and checked the changes in database. However, there are quite a lot of changes - some changes are also in blob fields.

How do you do this?


texts:
I was working with the Multistep module.

While working with this module I found that it creates a node of the corresponding CCK after the first step itself and then keeps editing the node. Is there any setting or any other method by which this can be stopped?

I want my CCK node to be created only after the last step of the multistep is finished. Is there any other way to acheive the required without using the module?


texts: I have a cck field in a node. I bring this value out in some other form and alter its value, But i am unable to save it back to DB. How should i write it back to table such that node changed date also gets changed. please show some code for this.


texts: How to exclude an external js from a particular node?

texts:
How can we remove an external js from a particular node!

For Ex:
Remove http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js from home page.


texts: Drupal 7 Ubercart Rest Services Module (API)

texts:
I'm looking for the best way to retrieve Ubercart orders and customers from a remote server.
I'd like to plug in a connector the same way it works with Magento.
I've played a little bit with Services but didn't figure out how it works with Ubercart.

Does anybody knows where I can find the right module and documentation ?


texts: Migrating files from local source are not found

texts:
I am migrating from Drupal 7 to Drupal 8 (8.6.9).
Both the Drupal 7 and the Drupal 8 site currently run on my local machine.
The migration of the public files goes well using:

source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: 'http://www.oldsite.com/'
process:
  fid:
    -
      plugin: get
      source: fid
  filename:
    -
      plugin: get
      source: filename
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - filepath
    -
      plugin: urlencode
  uri:
    -
      plugin: file_copy
      source:
        - '@source_full_path'
        - uri
...
destination:
  plugin: 'entity:file'
migration_dependencies:
  required: {  }
  optional: {  }

The private files are not found using the site URL as source_base_path  so I switched it to /absolute/path/to/private. However, the files are still not found.

When I check the migration messages it says File '/absolute/path/to/private/filename.png' not found for each private file. However, if I copy the path and search for the file in the terminal, it's there so the path is correct.

At first I thought it was due to spaces in the filename but it also happens with files without spaces. For completeness: there are no spaces in the path to the private directory.

Note: not all files are images, many are PDFs.

When searching for this problem I find configurations like above, so I'm out of options.


texts: Store age from Date of birth when use registration

texts:
I am having a date of birth field in my registration form.

I want to add the age in user data when the reregistration form is
submitted.
How can I update the age in the field when crone is run.


texts: How to filter a node reference field in content type form

texts:
I have a node reference field (User groups) in my content type; i would like to apply a filter on that field to show only the Groups belonged to the current user.
How can i apply that filter in the content type insert/edit form?


texts: How to inspect a css file generated by Less?

texts:
I just get running Less in a drupal site. I was exited until I try to inspect a css file generated by a less file.

The line numbers in the generated css file don't match the the line numbers in the less file.

Even though this is very understandable since the css file is a generated file, this is a big problem to me. I'm very used to inspect (using Chrome) to look for the line number of the style of the inspected element,then I would go to css file to look for this line and make the changes I need.

Now with less this is imposible

How do you manage this?


texts:
In Drupal 6, I have the "Player" content type that has a field reference to the "Team" content type.
I want to make content type for sports match.

It has two referencing field for teams:

field_host_team
field_guest_team

I want to make a relationship for players that played, but I want the users to be able to choose only players that have a reference to the selected (home/guest) team such as:

field_host_players (only players from team selected in field_host_team)
field_guest_players (only players from team selected in field_guest_team)

Do you have any idea on how to do this?


texts: How do I make a mini-panel pane a title?

texts:
I've been replicating some work, in mini-panels, that's already on my site. On one of the mini-panels there is a custom-content pane that is acting as a header. In the gear icon drop down there is a little option called 'Panel Title' that can be selected.

However, I cannot find this option for other custom panel panes I create.

The content of the already-made title page is simply a Title input.

Would anyone know how I can create this?