texts: Custom language negotiation module not working

texts:
I'm writing a custom module to allow the use of language a language suffix (of the form -eng or -fra) rather than the standard prefix.

I'm using the language's configured prefix and have a number of functions in place.

I've implemented hook_language_negotiation_info, and have a language selector, switcher and rewriter in place.

Paths with the suffix are working except that urls aren't being updated with the suffix when they're printed in the menus, or other places.

I confirmed that the rewriter callback is being called by placing a dsm() call in the function and it seems to be taking "node/45" and returning "page/45-eng" based on the alias.  That aliased path works, but a url to "node/45" prints returns "page/45"

function custom_lang_language_negotiation_info() {
 return array(
    'custom_language_provider' => array(
      'callbacks' => array(
        'language' => 'custom_lang_language_getter',
        'switcher' => 'custom_lang_language_switcher_url',
        'url_rewrite' => 'custom_lang_url_rewriter',
      ),
      'file' => drupal_get_path('module', 'custom_lang') . '/custom_lang.inc',
      'weight' => -10,
      'types' => array(LANGUAGE_TYPE_CONTENT, LANGUAGE_TYPE_INTERFACE, LANGUAGE_TYPE_URL),
      'name' => t('Custom path suffix'),
      'description' => t('Determine the language from the URL suffix.'),
      'cache' => 0,
    ),
  );
}

Thoughts or something I can try?

I may be missing something in the way urls are generated or maybe the path is being reverted somewhere.


texts: Combine all nodes of two content types as table rows / columns

texts:
I have two content types: Ingredients (Butter, Flour, ...) and Units of mesure (Cup, Tablespoon, ...).

Ingredients have Density field (e.g Flour, 0.53g/ml) and Units of mesure a Capacity field (e.g. Cup, 250ml).

Using views, I am stuck trying to create a table similar to:

==================================================
|               | Nodes of "Units of measure"    |
|------------------------------------------------|
| Nodes of      | Math calculation based on      |
| "Ingredients" | "Desnsity" and "Capacity" values
|               |                                |
|               |                                |
==================================================

For example:

==================================================
|         | Grams | Cup  | Tablespoon | Teaspoon |
|------------------------------------------------|
| Butter  | 100   | 0.44 | 7.05       | 21.16    |
| Flour   | 100   | 0.80 | 12.80      | 38.43    |
| ...     |       |      |            |          |
|                                                |
==================================================

I don't know how to generate such a table with two content types titles as rows and columns respectively.

Any help would be appreciated. Thanks!

EDIT:

I read about similar questions that use references and relationships,
but this view should show all nodes of both content types. So, they don't need to be related.
Maybe Units of measure should be a Taxonomy instead of a content type? I am open to answers changing the scenario/context described. How would you create such a table with Drupal?


texts:
I have defined some contextual filters to a View, i need to show a string like "Applied filters: filter_name1:xyz, filter_name2:ykx".
Which is the cleanest way to do it in Views3?


texts: How to get the url of a file field of a given node?

texts:
$node->field_file gives me a FileFieldItemList while the first entry seems to be a FileItem.

$node->field_file->getValue() gives me an integer (I guess the file id). How can I actually get the downloadable file uri from that?


texts: How to pass a value validated in Webform to the User's profile page?

texts:
There are hundreds of users on my Drupal 7 website. I don't want to manually enter the birthday value for each user in their profile. Hence why I created a webform where the user puts the user's birthday.

This value should then after validation by the current user be stored permanently in the user's profile where I created an empty birthday field.

How do I pass the value?


texts: How to theme the table view mode which is showing entities in inline entity form

texts:
I am looking for a D8 solution to theme the table view mode.
To start, I would like to remove the main title (the "Legend" tag of the html fieldset).

Note: I know how to use hook_inline_entity_form_table_fields_alter to add/remove columns, I would like to theme what is outside the table.

After the remove of the title, I would like to remove the headers of the table ("Title", "Status", "Operations"...)

In fact, if someone have a solution, I would like to get rid of this table view mode.. My final goal is to have a very simple view mode showing only one field and the 2 action button..

Here is the solution I found to remove the header and the title: this is to preprocess fieldset and table hooks

/**
 * Implements hook_preprocess_fieldset().
 */
function my_module_preprocess_fieldset(&$vars) {
  //Remove the fieldset title/legend for field_myfield
  //as it is a multiple value field, I check only the
  //first part of the id to target field_myfield
  if (strpos($vars['attributes']['id'],'dit-field-myfield')>0){
    unset($vars['legend']);
    unset($vars['legend_span']);
    $vars['attributes']['style'][]='padding:0';
  }
}

/**
 * Implements hook_preprocess_table().
 */
function my_module_preprocess_table(&$vars) {
  //In my use case, I need to target only table that are
  //generated by ief module. I use the first part of the
  //id to target it
  if (strpos($vars['attributes']['id'], 'ef-entity-table')>0 ) {
    //remove column headers
    unset($vars['header']);
    //adpat layout;
    $vars['attributes']['style'][]='margin:0;border-collapse:separate';
  }
}


texts: Statistics module not logging content views after upgrade

texts:
I recently upgraded my news blog from 8.4.0 to 8.6.1 and the major issue I have is that the statistics module is not logging the content views any more. The old articles seem to have stack in the same count number and the new articles not showing up in teaser links as they are stuck to zero.

Any ideas please?


texts: Some HTML tags are not displaying in body(ckeditor) of content type

texts:
I am trying to put HTML file content into a body part of a content type.

Procedure: When user uploads a zip file I will extract and replace <img src="path" with different path and put that replaced content into body of the content type. This will be done in hook_node_presave().

Code:

               if(trim($unzipped_filename) == 'index.html') {
                    $renamed_filename = $unzipped_path . '/testing.html';
                    //rename the index.html
                    $renaming_index = rename($unzipped_files[0],$renamed_filename);

                    //open file and get data
                    $htmldata = file_get_contents($renamed_filename);
                    //Match all img src tags from html file
                    preg_match_all('/<img\s.*?\bsrc="(.*?)".*?>/si', $htmldata, $matches);
                    $i = '';
                    $replacewith = array();
                    for ($i = 0; $i < count($matches[1]); $i++) {
                     //Store replacing strings in an array
                      $replacewith[] = base_path() . $unzipped_path . $matches[1][$i];
                    }
                    //Replace all img src tags from html file
                    $replacedhtml = str_replace($matches[1], $replacewith, $htmldata);

                    file_put_contents($unzipped_path . 'renamed.html', $replacedhtml);
                    $node->body['und'][0]['value'] = $replacedhtml;

                  }

In the above code $node->body['und'][0]['value'] = $replacedhtml; like this I am placing replaced content of HTMl into body part.

Problem: In database I can see all the Tags: etc. But in content its not displaying these tags. Because of this, its not taking JS and css files to load the content. Below html content is not displaying in body.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEXT Example</title>
<link href="css/Academy-style.css" rel="stylesheet" type="text/css"/>

<script src="js/jquery.min.js"></script>
 <script src="js/css3-animate-it.js"></script>

So where I am going wrong please suggest.


texts: How to obtain the average of the number of a field according to the term of taxonomy?

texts:
I am using the default view Taxonomy term.

I added a "number" field to my article content type.

I would like to obtain the average of the fields of the nodes listed by term of taxonomy.

For example, I have two nodes, which have as fields numbers: 2 and 4, and whose term is common taxonomy: A.

I would like in the view of the term taxonomy A, get the average of the fields "number" of these nodes, namely 3.

I tried views aggregation, add two fields: a field of type "Content: title", with aggregation: Group together, and a field of type "AVG (Content: Note)", with aggregation: "Average".

But it does not work.

I tried to add different relationships, but without success.

Someone would know the right configuration of views to do that? Thank you


texts:
I would like to achieve what Acquia did on https://dev.twitter.com/. When you sign in, you can see the user picture and the user name in the right end of the menu bar and that is what I need.

I made just some basic attempts yet:

First I tried to use the Menu Token module. Tried to put user picture and user name tokens into the title. Then I realized, that you can't put html in the menu item title as it goes through check_plain() (and it is good that way). Other problem with this was, that the menu item was shown for Anonymous users as well, and the user name was "Anonymous".

I'm using the Omega theme.

The twist on the whole problem is, that I would like to use the Superfish module as well (drop-down as on the Twitter site), and it has its own theme function for building/rendering the menu items.

I can think of a possible solution, that would be a custom theme function and a menu link alter, so that I add an image besides the title. But the Superfish module won't handle the image added to the "raw" link. Correct me if I am wrong...


texts: Webform submit button disappearing if I change it from default

texts:
I have a weird issue with the webform module, whenever I modify the submit button (change text, add class) it doesn't show up on the page anymore (nor in the source code). If I delete it, it is back to default (the label in the OPERATION column says customize again) and it works, but it disappear if I change it again.

I didn't do any weird modification beside creating a Twig template for it. But since it works when I leave it to its default value I doubt the issue lies there.
Hopefully one of you guys can help me.

Here is the YAML code:

markup:
  '#type': markup
  '#markup': |
    <h2>
      Je publie une offre d'emploi
    </h2>
job:
  '#type': textfield
  '#title': job
  '#title_display': invisible
  '#placeholder': 'Fonction recherchée*'
  '#required': true
  '#required_error': 'Fill in a valid job'
  '#pattern': '^[a-zA-Z]*$'
company:
  '#type': textfield
  '#title': company
  '#title_display': invisible
  '#placeholder': 'Nom de la société*'
  '#required': true
  '#required_error': 'Fill in a company'
  '#pattern': '^[a-zA-Z0-9]*$'
job_description:
  '#type': textarea
  '#title': 'job description'
  '#title_display': invisible
  '#placeholder': 'Description de la fonction'
  '#required': true
  '#required_error': 'Fill in a description'
contract:
  '#type': select
  '#title': contract
  '#title_display': invisible
  '#options':
    CDD: CDD
    CDI: CDI
  '#empty_value': 'Type de contrat*'
  '#required': true
  '#required_error': 'Choose a contract type'
job_schedule:
  '#type': select_other
  '#title': 'job schedule'
  '#title_display': invisible
  '#options':
    'Full time': 'Full time'
    'Part time': 'Part time'
  '#empty_value': 'Travail à temps...*'
  '#required': true
  '#required_error': 'Select a schedule'
location:
  '#type': textfield
  '#title': location
  '#title_display': invisible
  '#placeholder': 'Lieu*'
  '#required': true
publication_date:
  '#type': date
  '#title': 'publication date'
  '#description': 'Date de publication*'
  '#title_display': invisible
  '#description_display': before
  '#prepopulate': true
  '#required': true
  '#required_error': 'Select a publication day'
  '#min': today
  '#max': '+2 months'
  '#step': '1'
end_date:
  '#type': date
  '#title': 'end date'
  '#description': 'Date limite*'
  '#title_display': invisible
  '#description_display': before
  '#required': true
  '#min': '+2 weeks'
url:
  '#type': url
  '#title': URL
  '#title_display': invisible
  '#placeholder': 'URL: RH ou Plateforme pour postuler*'
  '#required': true
  '#required_error': 'Fill in a valid URL'
phone:
  '#type': tel
  '#title': phone
  '#description': 'Mes informations (pour &ecirc;tre contact&eacute; par BioWin)'
  '#title_display': invisible
  '#description_display': before
  '#placeholder': 'Numéro de téléphone*'
email:
  '#type': email
  '#title': email
  '#title_display': invisible
  '#placeholder': 'Adresse email'
  '#pattern': '^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,10})+$'
actions:
  '#type': webform_actions
  '#title': 'Submit button(s)'
  '#submit__label': Envoyer
  '#submit__attributes':
    class:
      - cta


texts: Create migration stubs of entities for a multiple value reference field?

texts:
I need to import a set of authors as part of a content entity. It is an array in a JSON object of id/name. I have a field in Drupal on the content type to be a user reference that accepts unlimited cardinality.

First of all, I don't know these users ahead of time, no way to query it, so I cannot just create a migration dependency and do that first. This seems to be a popular answer, but doesn't fit any of my use cases.

Second, I think you should be able to take the source data and loop each one, and create a user stub if they do not exist already. How do you do that? If the user does not exist yet they should be created, if they do exist, just look up the uid and put it into the target id per row.

This won't be the only spot I run into this, I will have content related to content that I will need to stub too. I won't know the latter content until I run their migrations later.

Is this even possible in D8?


texts: How do I fix a ReflectionException error (class doesn't exist)?

texts:
I'm new to drupal 8. I would like to extend the user login form by deleting the username field and adding the email field. So I created a custom module, I implemented an Event Subscriber and declared it as a service :

services:
    mdmuser.route_subscriber:
        class: Drupal\mdm_user\Routing\RouteSubscriber
        tags:
             - {name: event_subscriber }

And here's my class RouteSubscriber

 <?php

 /**
 * @file
 * Contains \Drupal\mdm_user\Routing\RouteSubscriber.
 */

 namespace Drupal\mdm_user\Routing;

 use Drupal\Core\Routing\RouteSubscriberBase;
 use Symfony\Component\Routing\RouteCollection;

 /**
 * Listens to the dynamic route events.
 */
 class RouteSubscriber extends RouteSubscriberBase {

 protected function alterRoutes(RouteCollection $collection) {

     if ($route = $collection->get('user.login')) {
      $route->setDefault('_form', '\Drupal\mdm_user\Form\UserLoginForm');
      $collection->add('user.login', $route);
    }
  }
}

I have this error when I want to install my new module :

ReflectionException: Class Drupal\mdm_user\Routing\RouteSubscriber does not exist in ReflectionClass->__construct() (line 31 of core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php).

Any idea is appreciated !

Thanks


texts:
I have used 'use-ajax' class to render login form in a modal.
I want to handle validation errors on same modal without closing it.
On successful login it is redirecting correctly, but when an error occurs it closes modal and redirecting to login page i.e user/login and displaying errors on that page.
I tried to use ajax callback to display error on modal itself by altering the form which is working. But, it is giving me drupal ajax error.
Here is my code :

$form['#prefix'] = '
';
$form['#suffix'] = '
';
$form['status_messages'] = [
    '#type' => 'status_messages',
    '#weight' => -10,
];
//$form['actions']['submit']['#limit_validation_errors'] = array();
$form['actions']['submit']['#ajax'] = array(
    'callback' => 'setMessage',
    'wrapper' => 'modal-form',
);

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

    $response = new AjaxResponse();

    if ($form_state->hasAnyErrors()) {
        $response->addCommand(new ReplaceCommand('#modal-form', $form));
    }
    else {
        $command = new CloseModalDialogCommand('#modal-form', FALSE);
        $response->addCommand($command);
    }
    return $response;

}

The above code giving me session id also but due to drupal ajax error it does not redirect on success by closing modal.


texts: Selected/Restricted Autosubmit with Better Exposed Filters in Drupal

texts:
I'm using the Better Exposed Filters module to manipulate the filters in my view. It works great except for one issue that's affecting the whole layout.

Within my view I have four exposed filters out one is a Search (Search Terms). The auto submit works perfectly with the checkboxes filter but makes the search unusable. It basically submits it on every keypress and that hinders writing the complete word.

Is it possible, that I could have autosubmit on all filters except one (Search Terms filter)?


texts: Posting Image Media into or part of an article and load into a lightbox

texts:
I'm just starting into Drupal and have done some reading into fields and such. I have an article in which I would like to add some images, in one scenario a block of images at the bottom of the article. In Content Types > Articles > Manage fields I have added a field of type "image". When I add/edit an article, I am able to upload images, however I can not get any of the images to appear in my published article.

To be clear, I can get the images to display in the WYSIWIG editor, but want them to be displayed and "Clickable" so the image will open into some kind of lightbox.

I have tried changing display settings but nothing seems to get my images to appear this way. I must be missing something. Any help is appreciated.

Here is how the image field is configured.


texts: Changing the url which the logo links to

texts:
I'm using Zen Theme 5.x and want that the site logo links non to the front page but another page in my base url, like to a contact page. It seems that I can achieve this modifying the page template file but I don't know how to do it. Could anybody help me with this?

Thank you.


texts: Add a limitations to anonymous user for node view

texts:
I have to put a limitations on the number of nodes an anonymous user can view. So I have to set a limitations of 5 after that the anonymous user is made to login by redirecting to the login page.

So I have used hook_nodeapi and under view operation i maintains a counter in cookie for the no of times the user visits the node.So if exceeds the counts it redirects to login page. But some how it doent work and gets redirected randomly..i mean not after 5 but after 7,8,,or some number.Some times it doesnt even increments the counter.
So is it because the cache is enabled or is there some other reason to it.
below is my code used under hook_nodeapi:-

if($user->uid==0){
  if(isset($_COOKIE['anonymousquizview'])){
    $m = $_COOKIE['anonymousquizview'];
    $m++;
    setcookie("anonymousquizview", $m, 0,"/", "www.example.com");
  }
  else {
    setcookie("anonymousquizview", 1, 0,"/", "www.example.com");}
    if ($_COOKIE['anonymousquizview'] >=5) {
      drupal_set_message("To attend more challenges, kindly login.");
      drupal_goto('user/login');
    }
  }
}


texts:
I am working with Drupal Profile 2 . Based on User Input Yes/No . I would like to place the selection fields accordingly .
Like If the experience Field if YES. I want to present Employer details Fields and if no . No Fields displayed.

Please suggest if this is possible or any modules available to do this.


texts: Select entity to display using drop down list

texts:
My problem is that I want to add a drop down list to a node that selects an entity from that node based on its name, and display it.
I am wondering if there is a module that does that; if there isn't, what the best approach is.

So far, I can only think of creating a custom node template to display the entities using JavaScript.

Unless I am mistaken, the Entity reference module won't work in my case; if it does, please clarify.

I have 4 tables in a single node; each table represents a week in a month. I want just a simple drop down list to select which week to display, and display that week's table.


texts: How to redirect to the webform node when it just created?

texts:
I followed the webform cookbook and created a custom module to "automatically create a Webform node when adding a Webform". Moreover, I need to redirect to the Webform Node at the same time, so I add the "RedirectResponse" code, but it didn't work. Following is my code:

function webform_chshb_webform_insert(\Drupal\webform\WebformInterface $webform) {
    $webformnode = \Drupal\node\entity\Node::create([
        'type' => 'webform',
        'title' => $webform->label(),
        'webform' => ['target_id' => $webform->id()],
    ]);
    $webformnode->save();
    drupal_set_message(t('Node %label created.', ['%label' => $webformnode->label()]));

    $nodeid = $webformnode->id();
    $response = new RedirectResponse("/node/$nodeid/edit");
    $response->send();
}

Thank you.


texts: jQuery stops working in a ahah wrapper div returned as json data

texts:
I use #ahah binding to a form element to modify a #ahah[‘wrapper’] HTML div.  It contains a ‘slider’ div for the EasySlider jQuery UI plugin.  This  div contains a list where each list item represents one slide.  When the ahah event is triggered, the wrapper HTML is replaced by a new set of slides.

When the form loads the slider works fine.

Here’s the problem: when the ahah event is triggered  the jQuery no longer works.  The new slides display one below the other, no animation.  Shouldn’t the jQuery function be called automatically, or what is needed to make the call?


texts: Restore hacked website from database without source

texts:
I have a database backup from a hacked drupal site. The source code of the hacked website has been lost. When I try to make another installation of the site working using the old database, I have the following error:

Fatal error: require_once(): Failed opening required 'C:\ampps\www\drupal.fox\drupal/sites/all/modules/date/date_api/date_api.module' (include_path='.;C:\php\pear') in C:\ampps\www\drupal.fox\drupal\includes\bootstrap.inc on line 3168

How could I avoid such errors? is there any way to make drupal runs temporarly without missing modules or even is there a tool that able to download and install missing modules?


texts: File upload hook - how to integrate existing file manipulation code into Drupal

texts:
I want to create a waveform image for every mp3 file I upload in a Drupal 7 website (as admin), and store it as a png for display in the frontend.
I can use this script in order to do that.

I want to know what is the Drupal way of integrating that script, specifically:

I guess that functionality will go into a module; where should I hook? file upload (there will be more than one file types to upload, and I would just want to work on the mp3)?
how should I save the resulting waveform picture (where in the filesystem and how would I attach it as a field to my custom node type)?

As I'm new to Drupal (but experienced with PHP), I would appreciate a detailed response, but if you know of a module that already does that - I couldn't find it - that would be the shortest answer possible. :)

Thank you!


texts:
I am trying to print the articles tags in the meta area of the html. I am able to print them, however, they contain all the markup, where as I just need the plain text, comma separated list, much like it prints when using the meta module.
Here is what I am using.

function mytheme_preprocess_html(&$variables) {
if ($node = menu_get_object()) {
  if ($node && isset($node->nid)) {
  $node = node_load($node->nid);
   node_build_content($node);
   $variables['field_tags'] = render($node->content['field_tags']);
   }
 }
}


texts: Admin User Redirect Loops with Secure Pages - Self Signed Certificate

texts:
Problem

I'm trying to mimic my production environment on my dev server.

(Setup: LEMP server, Ubuntu Server LTS 12.04)

On my production site I use an SSL certificate from Gandi, it all works fine.

On my dev environment I created one myself following the instructions here:

I'm using the Secure Pages module to secure the admin area however when I enable HTTPS for a role (Administrator) I get a re-direct loop for all my pages which locks me out of my site.

HTTPS does however work fine for single pages.

Any ideas what I could be doing wrong? Could this be a config thing?

Instructions I used to generate an SSL

sudo openssl genrsa -des3 -out server.key 1024
sudo openssl req -new -key server.key -out server.csr
// Leave all options blank, except put 192.168.1.95 address into common
sudo cp server.key server.key.org
sudo openssl rsa -in server.key.org -out server.key
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Possible Relevant Nginx Config

/etc/nginx/sites-available/mysite

 server {
      listen 443;

        root /srv/www/mysite/public
        ...
        ...
        ssl on;
        ssl_certificate /etc/nginx/ssl/testssl.crt;
        ssl_certificate_key /etc/nginx/ssl/testssl.key;

        location / {
           index  index.html index.htm index.php;
           error_page 404 = @drupal;
        }

        location ~ \.php$ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            if ($uri !~ "^/default/files/") {
                fastcgi_pass 127.0.0.1:9000;
            }
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /srv/www/mysite/public$fastcgi_script_name;
        }

        location @drupal {
            rewrite ^(.*)$ /index.php?q=$1 last;
        }


texts: How to upgrade my Zen sub-theme so that navigation and most of the blocks are no longer missing?

texts:
I have been looking quite a bit for a "step by step" for what people did to upgrade their Zen Sub-themes from its 6.x version to the 7.x-5.x version.

I did not make the sub theme I'm working with and I am not familiar with the process (last webmaster made it).

The issue I am having: the front page and all other pages don't have navigation and almost all the blocks are missing.

In my searching I saw that the .info file and template.php file have something that needs to be done. Haven't been able to really get a good outcome at all.

This is how my 6.x regions look like:

regions[sidebar_first]  = First sidebar
regions[sidebar_second] = Second sidebar
regions[navigation]     = Navigation bar
regions[highlight]      = Highlighted content
regions[content_top]    = Content top
regions[content_bottom] = Content bottom
regions[header]         = Header
regions[footer]         = Footer
regions[page_closure]   = Page closure

regions[footer_col1]   = Footer Column 1
regions[footer_col2]   = Footer Column 2
regions[footer_col3]   = Footer Column 3
regions[footer_col4]   = Footer Column 4

regions[homepage_col1]   = Homepage Column 1
regions[homepage_col2]   = Homepage Column 2
regions[homepage_col3]   = Homepage Column 3

Any suggestions about how I should proceed?


texts: Giving users control of who sees their information?

texts:
On our rebuilt site we have an "about me" field attached to the user account.
We want to give people the ability to specify who can see this information (or their whole user profile):

Anyone (anonymous users)
Authenticated users only
paid Members of the organisation only (a role).

What's the best way of doing this?


texts: Theming a custom user field on register form

texts:
I have added a checkbox list field on the register form and I want to change the template for that field.

I have used field--field-checkbox-list.tpl.php and MYTHEME_field__field_checkbox-list() function, but with no luck on user_register_form.


texts: How to display module ouptput in a page with content

texts:
I would like to display my module otuput in one page. The only solution I found till now is to use iframes. Is there some better solution?

I created a module to display a map with branches, branches are stored in DB. But before and after this map there should be some content, like text or pictures.

I hope there is a posibility. Maybe with blocks?


texts: What could cause a View template to ouput wrong row index?

texts:
Context
I have a weird issue on my live environment that I have never seen on my local environment. Cache bins are disabled on my local environment and enabled on live server.
When clearing all caches on live server, the problem disappears for some time, then reappears. When disabling cache bins on live server the problem doesn't seem to happen anymore.
Issue
In my custom theme, I use a simple "Single field" template to override a given view field.
/**
 * @file
 * Theme override for a single field in a view.
 *
 * Available variables:
 * - view: The view that the field belongs to.
 * - field: The field handler that can process the input.
 * - row: The raw result of the database query that generated this field.
 * - output: The processed output that will normally be used.
 *
 * When fetching output from the row this construct should be used:
 * data = row[field.field_alias]
 *
 * The above will guarantee that you'll always get the correct data, regardless
 * of any changes in the aliasing that might happen if the view is modified.
 *
 * @see template_preprocess_views_view_field()
 */

In the output HTML of this field, I need a simple incremental id from 0 to n where n would be the total number of rows in the view results. Something like below for a View with 5 results:

...

...

...

...

...

So in my field template, I use:

...

This works fine, except on some occasions, only on my live server with caching enabled where the output will be for example:

...

...

...

...

...

Important notes:

I sometimes get indices such as 19 when there are only 10 or 15 results in the view so that number seems to come out of the blue.
This happens when the view is filtered using a single taxonomy term.

Question
Am I wrong assuming that row.index should give me an incremental sequence of integers for every view, with or without caching? If I am wrong, then what should I be using? And if not, what could cause this behavior?


texts: How do you remove the search box on the search results page?

texts: I'm working on customizing my search results page. By default, the results page contains another instance of the search box at the top. I have the search box in a block at the top of every page, so it's just cluttering things up on the results page. I have already overridden the two template files, but I don't see anything in there that outputs the second search box. How can I remove it?


texts: How can I (programmatically) display a custom block with user profile links in dropdown?

texts:
I would like to display a custom block with some links for authenticated users like drupal.org does.

I would like to display username next to user's picture, and custom menu items. For example, "My contents" where url is something like this: "/user/{uid}/my-contents".

Do you have any idea how to create that?

Ps: I tried "menu_token" module but it didn't work for me correctly.


texts: Render image programmatically based on field content

texts:
I am templating a resource page that has 5 different types of resources. I want to display a specific icon based on the type of resource. I want to do this programmatically so that later, users can upload a document, choose what type of resource it is, and the icon will automatically be displayed.

Now I'd like to be able to complete the logic of this inside the node--resource-asset.html.twig template using a for or if statement.

This is the kint display for the field_resource_type array. I want to generate the icon based on the markup string. This is what I've tried

{% for markup in content.field_resource_type %}
{% if markup == 'Datasheet' %}

{% elseif markup == 'Whitesheet' %}

{% else %}

{% endif %}
{% endfor %}

Nothing renders. Any suggestions on what I should be using as the key to call the correct part of the field?


texts: If I use Panels and Views, do I need to use Blocks at all?

texts: My understanding is that if I go the full panels route (i.e. every node is a panel) then I only need to worry about prepping views to populate the panels. Is this the right way to think about it? Or am I missing something in regards to where blocks are still relevant for site building under an all-panels site?


texts: Extract the CSS class depending on the user type

texts:
Is it possible to extract the PHP string for user type, when the user is not an administrator user?

I need to discern between staff or non-staff users. I am aware of $is_admin, but in this case I would need something like $is_staff.
I need this so I can apply CSS styles to hide/show some fields that I want to be visible only to staff users.

Is anyone aware if there's anything that might help me?


texts:
I created a custom Drupal 7 module that creates a custom content type. It looks like this:

$type = node_type_set_defaults(
array(
    'type' => 'featured',
    'name' => t('Featured'),
    'description' => t('The description of the featured item.'),
    'base' => 'node_content',
    'locked' => 0,
    'custom' => 1,
    'modified' => 1
)
);

node_type_save($type);

I have a nl.po translation file that contains the following entries:

msgid "Featured"
msgstr "In de kijker"

msgid "The description of the featured item."
msgstr "De beschrijving van het in de kijker item."

The description gets translated as I expect when switching between languages. The content type name does not get translated at all, only English is shown.

Any ways to fix this?

Thanks in advance.


texts:
I have a question about tabs. I'm using a content type hotel with all the information about a hotel for example, hotel residence, location, food, spa, sports ... At this moment this is just one big list of text. I was trying to make tabs for it because this is I think the solution. I was trying it with the module quick tabs but there I have to use nodes or views to make the tabs so i don't know what to do know because it's impossible to put every element (location, food,...) from every hotel (40) in a view.
Do you guys have any ideas?
Thanks for your help.


texts: How can I have a view  tag render markup correctly?

texts:
Objective : show a link on the column heading of the table so that the user can reach an explanation page on the content of the column.
I am having trouble figuring out how to add a link to a  tag in my View, simply.
So I need a field label to contain HTML.
For example if I enter My field label in Field configuration label input, the resulting table header is not a link and the markup is visible (plain text).
Table Format settings : no sticky headers and no sortable columns.
Any tip here?
Views Field Configuration:

The result:


texts: is there a way to make template for set of nodes?

texts:
Is it possible to make a template for set of nodes in Drupal 7
for example page--node--[601-602-603-604].tpl
and if so what is it?


texts: single exposed filter for two displays in same view

texts:
I have three displays in same view. Every display has exposed form filter and in every pages ajax was set yes. How to use a single exposed filter for these three displays in same view?

I placed these three displays in to three quick tabs. For example, the three quicktabs names are test1, test2, test3. If I apply filter in test1, it should apply all other displays (test2, test3) also.


texts: What is the relationship between the node and the node revision table in Drupal 7?

texts:
I am trying to optimise the code in a Drupal 7 website by replacing node_load functions to retrieve only the title with custom SQL queries.

So far, I have been successful in retrieving the same values. However I just cant seem to get the gist of getting the title from the latest revision of a node or retrieve any other value from the associated fields.

Can anyone point me out regarding the concept of revisions from a table point of view?


texts: How do I modify the content of a select list field?

texts:
I have a content type with a Node Reference field, so the user can select from a list of node titles. I need to filter out some nodes from the list (those that have a date field older than the current date).

I know that hook_form_alter() can be used to modify the display and validation of form fields, but probably not change the query that the field uses. So I think I need to write some kind of preprocess function for this field, that does a second filter on the contents?

Any pointers on how to do this would be great - thanks.


texts:
I'm working on my first module. I'm setting up hook_menu() to register several URLs. Some of the parameters may be raw strings with slashes in them. For example, "Round 1 / Heat 1" as one parameter. Now, I know that I can make my javascript encode the slashes when constructing the URL, but it makes me wonder if I'm Doing It Wrong™.

It feel natural to me to be able to use GET params, but I don't see any way to access those in menu callbacks.

Am I doing It wrong with these URL-based parameters?
Is it possible to just POST these parameters, and access them in menu callbacks?


texts: How do I set permissions for user roles in the install profile

texts: I have a content type which I am creating on install profile, and I want to create a user that has permissions to edit that content type. How do I create user roles and permissions for those roles in the install profile?


texts: How to implement a set of images / diagrams in a website?

texts:
I am an experienced PHP developer but am just finding my feet with Drupal.  I am creating a personal website using the Bootstrap theme and want to upload some images/diagrams as part of it.  They will be publicly available.

My question is, should I just create a directory in the web root, ftp the images there, and put raw <img> tags in my pages?  Or should I install a module and get it to do the work for me?

I am very happy to use the first (i.e. manual) method, but I'm thinking that there might be hidden advantages in letting a module handle it for me.  For example, if a module does the uploading, it would presumably have particular css classes that it would apply to the <img>.

At this stage I will be the only one creating content.


texts: Contextual Shared comments on nodes that are clones of one another

texts:
I'm creating a Drupal 8 system where I need commenting to be shared across cloned nodes. When cloning a node the new node is assigned with a new nid, but the title contains the cloned title of the previous node. I was thinking I can use that as a contextual variable to show the shared comments, but I'm unsure of how to go about this.

Or maybe there is better way of solving this approach to display shared commenting?


texts:
Here is my situation

We have 2 websites: domain.es (use Spanish language) and domain.co.uk (English).
Customer asked us to register new domains: domain.mx (Mexico, so Spanish language) domain.com (English language).

We do not want let domain.mx see content from domain.es, but that what will happen, because our views (like all other stuff) are dependent on language.
We are considering to filter content by domain using https://www.drupal.org/project/domain however since we never used it before we are not sure if it will cover our needs.

I want to get your opinions guys, how would be best to manage content based on domain level but not a language. So domain.mx and domain.es are completely 2 independent websites and do not share values to each other.

Thanks!


texts: Rules not firing at user creation for non default language

texts:
I created a rule that delete a user when a profile field contains a particular, troll specific pattern. It works perfectly when registering with the default language (fr) as current.

When registering in the alternate site language (en) as current, the rule does not fire at all, even when removing all conditions, trying different actions.

Other non-rules modules perfectly handle that event (for user registration notification for example), but Rules silently fails.

Other events are normally handled whatever is the current language

I tried to disable all path related modules without change

Any idea where I shall look at?

Many thanks in advance for suggestions.


texts:
I wrote service to get all necessary data for my page. Now I wanted to load them with translations. But whey I try, I got error:

  InvalidArgumentException: Invalid translation language (id of language here) specified.

When I open page in default language it works fine. Does it mean that I need to translate all of the things in order to make it work?

My service:

namespace service;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Url;
use entity\Entity;

class PostTypeService
{
    public static function getEntititiesByPostType($postType, $entities = array(), $nid = NULL)
    {

        if ($nid != NULL) {
            $nids = \Drupal::entityQuery('node')
                ->condition('type', $postType)
                ->condition('status', 1)
                ->condition('nid', $nid)
                ->execute();
        } else {
            $nids = \Drupal::entityQuery('node')
                ->condition('type', $postType)
                ->condition('status', 1)
                ->execute();

        }

        $nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
        $returnValues = array();
        $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
        foreach ($nodes as $index => $node) {
            foreach ($entities as $entity) {
                $type = $entity->type;
                $entity_name = $entity->entity;
                if ($type == 'image') {
                    $returnValues[$postType][$index][$entity->entity] = file_create_url($node->$entity_name->entity->getFileUri());
                } else if ($type == 'url') {
                    $returnValues[$postType][$index][$entity->entity . '_uri'] = $node->$entity_name->uri;
                    $returnValues[$postType][$index][$entity->entity . '_title'] = $node->$entity_name->title;
                } else if ($type == 'list') {
                    foreach ($node->$entity_name as $list_item) {
                        $returnValues[$postType][$index][$entity->entity][] = $list_item->value;
                    }
                } else {
                    $translation = $node->getTranslation($language);
                    $returnValues[$postType][$index][$entity->entity] = $translation->$entity_name->$type;
                }
            }
            $returnValues[$postType][$index]['node_id'] = $index;
            $options = array('absolute' => TRUE);
            $url = Url::fromRoute('entity.node.canonical', ['node' => $index], $options)->toString();
            $returnValues[$postType][$index]['node_url'] = $url;
            $returnValues[$postType][$index]['lang'] = $language;
        }
        return $returnValues;
    }


texts: Forcing file migration after deleting field

texts:
I have a situation where I am working on Drupal 6 to Drupal 7 migration.  The migration is being done in stages, and stage one is now live.

I am working on stage 2, and have run into a snag file file migrations.

We had a content type 'foo' with field 'field_bar'.  It was originally created as File, but should have been image.  We ran migrations, and everything went OK (all files were part of original migration).

'foo.field_bar' got deleted and recreated as Image.  When we re-run migrations, the files aren't being attached.

As far as I can tell, is that the source/destination pair exists in {migrate_map_files} but the fid doesn't exist in {file_managed}, more than likely because it got deleted during garbage collection when cron ran.

What is the best option to force these migrations to run again?  Is there a way to do this with the Migration classes, or should I delete the bad rows from {migrate_map_files}?


texts:
How to prompt user to download a file in browser from custom module php code?

I tried first the php way

<?php
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
readfile('original.pdf');
?>

It silently fails. Then I realized there is a "drupal way" to do it.
So I tried

drupal_add_http_header('Content-Type', 'application/octet-stream');
drupal_add_http_header('Content-disposition', 'attachment; filename='.$fname);
drupal_add_http_header('Content-Length', filesize($fpath));

but still not working.
I think one possible reason for failure is that I am not sure at each step which is the correct path I should use.

Should it be
'/home/mysite/public_html/sites/default/files/pdfs/'.$filename.'.pdf'

or just the part that starts in the drupal root
'/sites/default/files/pdfs/'.$filename.'.pdf'

or even just
'public://pdfs/'.$filename.'.pdf'

as I see it in some other threads. I wonder why it has to be so complicated.


texts: Can I make a content type for a single user's blog entries?

texts:
I would like site announcements to appear in a block on the sidebar.

I can do that with a content type, but Admin has a blog and I was wondering if/how to automatically give all blog posts of Admin (and no other user) be of a content type


texts: A way to override the  tag inside WYSIWYG field

texts:
Facts:
 Media 7.x-2.0-alpha4+30-dev, File Entity 7.x-2.0-beta1
 Media WYSIWYG and Media WYSIWYG View Mode enabled

The source:

<video class="media-element file-default" controls="controls" data-fid="3" data-media-element="1"><source src="myvideo.avi" type="video/x-msvideo"></video>[[{"fid":"9","view_mode":"preview","fields":{"format":"preview","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":"","field_caption[und][0][value]":""},"type":"media","attributes":{"height":"180","width":"180","class":"media-element file-preview"}}]]

I need to override the video tag by a certain hook in order to have a jwplayer as the default player.
Impossible to display it with media API hooks: as hook_media_wysiwyg_token_to_markup_alter.

UPDATE
I am able to set a new view mode using media wysiwyg view mode, however I need a custom display to help me customize the output.


texts: Webform submission edit - redirect after edit

texts:
I have a webform where I expect users to edit their submissions from time to time.  I want to redirect users upon submission of the submission edit to another node - say node/2 - (back to another node which lists their previous submissions in a view).  How can I acheive this redirect?

Note - this is not about redirecting after the initial submission of the webform.  It is about redirecting after editing an already existing submission.


texts:
I am currently assigning a theme using hook_custom_theme and just allowing the pathing system for .tpl files to override displays that I want to edit by using custom .tpl files. I CANNOT find the correct file name for this path:

(base url)/admin/content/node/article   <-- Where in admin, it is displaying all node content types of 'article'.

I think I've tried every combination possible of page, node, article, admin... think I'm going crazy, please help. Other overrides are working just fine. Thank you for sanity check!


texts: Replicating a Node with Replicate UI Leads to an Incorrect Hreflang Tag

texts:
we are using the Replicate UI module to replicate nodes and then changing the new replicates language to build up our site in different languages.

However, we are seeing an issue with our Hreflang tags where the hreflang tag gets the correct url of the new node, but keeps the old language code.

So let's say the old node was in English and the new one is in German - the hreflang tag still says that the new version hreflang that still contains "en" rather than "de" like that:

<link href="https://de.website.com" rel="alternate" hreflang="en" />

The question is, how can we change the hreflang code once the page is replicated? We have multiple pages that we do not want to create from scratch.


texts: webform block in a page template , inside a colorbox - validation does not show

texts:
I created a page tpl for a view where using colorbox inline i`m displacing a webform block and some additional text.

My problem is that the error messages are not showing. The submission is working but the messages are not shown.

Here is a part of my code inside a view.tpl

                   <?php  print $content; ?>

                   <?php
                       $block = module_invoke('webform', 'block_view', 'client-block-15');
                       print render($block['content']);
                   ?>

I activated the webform ajax and no redirect after in order to stay in colorbox after submission.

Thanks


texts: Exported feature, panelizer fields are unknown when installing in another environment

texts:
I can't seem to find out why my panelizer default layout is not being installed correctly after being exported using features. I am exporting a content type, with some default panelizer settings.

When I install it on another test environment, my panelizer layout settings are not set and many similarly named fields are shown, but shown as "Unknown." I have looked at all of my exported code, everything, I have even looked at tables that might have these configuration settings in the database.

No luck. Any panels/panelizer/features help is appreciated.

I'll post a few screenshots.

First image shows how the feature is being imported. Note the "Unknown" fields. Second image shows how the content type layout is setup before I export and install on another environment.


texts: I'm trying to use the Medium module, but for some reason it just shows "placeholder" when I click on the Configuration > Content Authoring > Medium Editor. Could you point me to any solution for that?


texts: Data not returned / rendered in simple module

texts:
I built a simple module to find the files in a folder and display them.  However no "content" is rendered and I get warnings from a core-include file.  Here is the module file:

<?php
function composer_example_menu() {
    $items = array();

    $items['composerExample/composer_example'] = array(
        'title' => 'Composer Demo',
        'page callback' => 'get_current_files', // 'call_back_function_name',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}

/**
 * A utility function to return the array of current SplFileInfo objects
 */
function get_current_files()
{

  require __DIR__.'/../../../../../vendor/autoload.php';

    // the "files" directory
    $dir = drupal_realpath(file_default_scheme() . '://');

    $finder = new \Symfony\Component\Finder\Finder();
    $finder->in($dir)
        ->name('*.txt')
    ;
    $files = array();
    foreach ($finder as $file) {
        $files[] = $file->getFilename();
    }
  return $files;

The Warnings  I get:

  Warning: Invalid argument supplied for foreach() in element_children() (line 6583 of /Applications/MAMP/htdocs/drupal-7.51/includes/common.inc).
  Warning: Illegal string offset '#children' in drupal_render() (line 6040 of /Applications/MAMP/htdocs/drupal-7.51/includes/common.inc).
  Warning: Illegal string offset '#children' in drupal_render() (line 6050 of /Applications/MAMP/htdocs/drupal-7.51/includes/common.inc).
  Warning: Illegal string offset '#children' in drupal_render() (line 6088 of /Applications/MAMP/htdocs/drupal-7.51/includes/common.inc).
  Warning: Illegal string offset '#printed' in drupal_render() (line 6095 of /Applications/MAMP/htdocs/drupal-7.51/includes/common.inc).


texts:
I'm trying to alter the text of a menu item dynamically based upon certain variables.

I'm using hook_menu_alter like this:

function mymodule_menu_alter(&$items) {
  $items['toggle-review-process']['title'] = 'asdf';
}

Problem is, it does nothing. That menu entry is in there, but it has no title normally, and adding the key isn't doing anything. How can I change the text of this menu item dynamically?


texts: How do I enable and weight fields through .yml?

texts:
I have a custom module where I succesfully created a field for videos. But I want the field to be enabled and weighted on by default. I supposed active and widget->weigth and display->weight was the way to go but it's disabled.

id: media.field_video_alt_text
field_name: field_video_alt_text
entity_type: media
bundle: video
label: 'Alternativ tekst'
description: 'Kort beskrivelse som vises under videoen. Lad feltet være tomt, hvis dette ikke ønskes.'
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: string
active: true
widget:
  weight: 2
display:
  weight: 1
  label: hidden


texts:
I called krumo() inside hook_node_load().

function mymodule1_node_load($nodes, $types) {
    krumo($nodes);
}

It works on my front page, but not on a node page. I get this error message:

  Fatal error: Call to undefined function krumo() in C:\wamp\vhosts\mydrupal72\sites\all\modules\my_customs\mymodule1\mymodule1.module on line 126

Why can't I run krumo() on a node page?


texts:
I have a problem with the Drupal cache. The cache remembers session and cookie values. Everything works fine when I'm logged in or when I completely turn off any cache.
Is it possible to use cookies and avoid they are cached for anonymous users?


texts:
I have several custom content entity types that have relationships to each another. The fields used are defined as base fields and I am using $fields['FIELD_NAME'] = BaseFieldDefinition::create('entity_reference').

Views doesn't currently implement reverse relationships for base fields, which is a feature request.

I need to define the relationship in the module with EntityViewData::getViewsData()  or hook_views_data().

Using the examples provided, I was able to define a reverse relationship for an entity reference field with cardinality of 1 (where the field is created in the entity's base_table), but I can't figure out how to do it when the cardinality is higher than 1, or unlimited (where the field is created in a separate table).

None of the examples on the documentation pages (or that I have been able to find googling)  defines a relationship between two entities that requires an intermediary table.

Views defines an EntityReverse class that I have looked at for ideas.  It has a $first_join and a $second_join.  I can confirm that if the field is added to the entity using the normal UI, then the view provides both relationships, to the related entity and the reverse relationship from the related entity.

I am not sure at all how to translate the EntityReverse class into a definition I could pass to getViewsData().

And How to do a Reverse Entity Reference? is not the answer.

Does anyone know a solution?


texts:
I am trying to POST a node to my site and make it group member.

POST body looks like this:

{
   "title":"Update",
   "type":"mesurement",
   "uid":"4",
    "og_group_ref": {
        "und": [{
            "target_id": "20"
        }]
    },
    "field_records": {
        "und": [{
            "value": "22"
        }, {
            "value": "25"
        }, {
            "value": "65"
        }, {
            "value": "12"
        }]
    }
}

Yet every time I get an error saying:

{
    "form_errors": {
        "og": "You must select one or more groups for this content."
    }
}

Edit:

Field settings are:

Default widget type: Select list

Administrator widget type: Autocomplete

Number of values: 1

Mode: Organic groups


texts: Webform Fields not hidden anymore after update to 8.x-5.0-rc19

texts: After updating to Webform 8.x-5.0-rc19 fields that should be visible only after filling another field, are instead always visible. I guess this has something to do with "Elements, containers, and pages that are hidden using conditional logic will have their submission data cleared when a webform is submitted" (https://www.drupal.org/node/2956589), but I do not understand how.


texts: The Organic Group membership Entries in the Registration form is showing all the translated entry

texts:
My Organic Group is translatable In several languages.

Right now, the problem is that If someone want to register on the website and this user is viewing the website in french, he seen all the organic group list in both languages.

How display only the French Entries ?

Thanks a lot


texts: How to make the Rules module block flagged users from sending entityform submissions?

texts:
I am trying to create a simple block user functionality on my site. I have a "Block/Unblock User" Flag that other users can block and unblock so they stop getting contact emails from (via entityform)

The entityform is set up like (logged in users):

NodeReference: Points to content they are interested in. I use tokens to fill in the authors name, email, etc...
Message: Text message to email field_nodereference:author:mail

So I am trying to create a rule (using the Rules module):

Event: Before saving a entityform submission

Condition:
NOT User has roles: entityform-unchanged:user is administrator (admins can bypass rule)

Entity is of bundle: Parameter: Entity: [entityform-unchanged], Entity type: Entityform Submission, Entity bundle: Contact Article Creator

Entity has field: Parameter: Entity: [entityform-unchanged], Field: field_nodereferencearticle

User is flagged
Parameter: Flag: Block/Unblock User, user: [entityform-unchanged:user], User on whose behalf to check: [entityform-unchanged:field_nodereferencearticle:author

Actions:

Page Redirect to site:url
Show Message: Warning: Was unable to send messsage. The Recipient has blocked you from contacting them.

So the basic premise of this is if a user blocks another user, this rule will preprocess all Contact Article Creator eforms and see if the potential recipient has blocked the user. If so, redirect to the front page with a warning stating the user blocked them.

EDIT 1: However, every eform I submit goes through. I can't get the rule to not submit.

EDIT 2: Here is the actual exported rule.

{ "rules_block_user_from_sending_message_if_user_blocked_them" : {
"LABEL" : "Block user from sending message if user blocked them",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "entityform", "flag" ],
"REQUIRES" : [ "rules", "flag", "entityform" ],
"ON" : { "entityform_presave" : [] },
"IF" : [
  { "entity_is_of_bundle" : {
      "entity" : [ "entityform-unchanged" ],
      "type" : "entityform",
      "bundle" : { "value" : {
          "contact_seller" : "contact_seller",
          "contact_seller_anonymous" : "contact_seller_anonymous"
        }
      }
    }
  },
  { "entity_has_field" : { "entity" : [ "entityform-unchanged" ], "field" : "field_listing" } },
  { "flag_flagged_user" : {
      "flag" : "block_unblock_user",
      "user" : [ "entityform-unchanged:user" ],
      "flagging_user" : [ "entityform-unchanged:field-listing:author" ]
    }
  }
],
"DO" : [
  { "redirect" : { "url" : [ "site:url" ] } },
  { "drupal_message" : { "message" : "Was unable to send message. ", "type" : "warning" } }
]

}
}


texts: Cascading taxonomy term selection widget

texts:
To be honest, I'm not sure if cascading is the right term, and if it's not then this can just be edited in the future for clarity.

I need a taxonomy term widget that is a drop-down list, and all that is initially populated are the top-level taxonomy terms in the particular vocabulary associated with the widget.  After selecting a top-level term, another drop-down list is added next to the previous (the one you just selected from) with all of the children of the selected term.  The parent drop-down list is then disabled.

You should be able to click a link to go "up a level", basically removing the right-most drop-down list at the time and re-enabling the right-most list after that.

For example, say I have the following structure:

A

AA
AB
AC

B

BA
BB
BC

C

The initial drop-down list would just contain: A, B, and C.  You now select 'A'.  The list with A, B, and C would then become disabled, and another list would be added directly to the right of it with the terms: AA, AB, and AC.

The term submitted along with the form would be the term represented by the right-most disabled list's selection at the time.

Is there anything that exists with this functionality (or similar)?  If so, I haven't seen it (and I'm looking hard).  Otherwise I guess I'll just have to code it up myself, but I'm hoping I don't have to invent a new wheel.


texts: Form Validation: Let the comma as separator to be valid in integer field input

texts:
I'd like to let my users use separator (Comma) while entering values in an integer field such as price for instance.

I know that we can alter the validation of fields with element_validate_integer API, but seems like that I can't get it working.

I appreciate any helps, thanks.

Also note that I'm using Clientside Validation module as well.


texts: Limit the number of uploads per image field depending of role

texts:
I need a hook (or something similar) where I can set the number of image uploads depending of the role of the user.

In the settings of the field there is no way to set the maximum number of values users can enter, just one value for all roles. For example, for role #1 I want the users can upload just 3 images, for role #2 just 5 images.

I tried several ways but none worked. I tried using #element_validate but the validation never worked.

Is there some way to do that? I forgot to mention is for Drupal 7.


texts: Styles in CSS ignored following switch to multisite structure

texts: Following a switch from a single site structure to a multisite structure, many of the styles in my theme stylesheet (including overridden styles from various module themes) are now being ignored. Is there any way I can make sure my theme stylesheet takes precedence over anything else?


texts: How can I include Guzzle as a library in a distribution?

texts:
I'm working on Open Atrium 2 and we'd like to include Guzzle with the initial install so that we can build some integration features on top of it.

Usually, including a library just means adding the library to the drush make file, but Guzzle is more complicated because:

it has a few dependencies.
it's meant to be installed by Composer or Pear, not by direct download.
it's not on the packaging whitelist on Drupal.org, but I can request that it be added since the license doesn't conflict.

So how can I make this happen? Is there a pre-bundled-and-ready-to-use package somewhere that includes all dependencies, in which case I can just request that that be whitelisted for Drupal.org and use that? Or is installing Guzzle tricker than just including a bunch of files that can be placed in sites/all/libraries?

Any ideas?


texts:
We have hosted one of our Drupal 7 site at Acquia.

How do I find site root directory - /mnt/www/html/mysite/docroot/?

  I'm using dpr(shell_exec("drush status")); command in devel/php

Is there anyother way to find it?


texts: Detect when a user clicks file download link

texts:
I Have a view that outputs nodes, and also a link to download files that are attached to these nodes. I'd like to know when a user clicks one of these links, so that I can log the event.

All attached files are files in drupal's public file directory, inside a directory at sites/default/files

Is there good approach for detecting a click or file download in this case?


texts: Commerce line item not referenced by the orders

texts:
We have a strange situation here where some Commerce Line Items exist in the database, referencing orders through their order_id property, but that aren't referenced by the order through it's field line_items (field_data_commerce_line_items table). Views listing line items show these although when looking at their respective orders they aren't appearing. It is causing wrong calculation of these view.

Is there any explanation as why these line items still exist and can they be deleted safely?

I can display these line using the following SQL request :

SELECT * FROM `commerce_line_item` cli
LEFT OUTER JOIN field_data_commerce_line_items fdcli on fdcli.entity_id = cli.order_id AND fdcli.`commerce_line_items_line_item_id` = cli.line_item_id
LEFT JOIN field_revision_commerce_line_items frcli ON frcli.`commerce_line_items_line_item_id` = cli.line_item_id
WHERE fdcli.entity_id IS NULL;

[EDIT]
I changed the the request to reference to revision table. It does happens that some lines are referenced in a revision, but most are not.


texts: Add views arguments to search index and sitemap

texts:
I've spent a lot of time searching drupal, this site, google etc and cannot find the answer. I need to have views arguments treated as pages, indexed by search and shown in the sitemap. In my case the nodes themselves are never shown to the user.

Use case:
Content type property contains all the information of a property. This could be one or more of the following (giving 3 for example):
- description and general info
- photo gallery
- floor plan
- virtual tour

We never show the property node to a user because we never display all of that information in one place. Instead they use views to drill down by taxonomy to a photo gallery,  a floor plan or a virtual tour, all of which show the description and general info. If the property with the photo gallery has a floor plan also it will show a link to the view with the floor plan, if it doesn't no link is shown. So you end up with something like this:
site.com/photos/property1
site.com/photos/property2
site.com/floorplans/property1
site.com/floorplans/property3
site.com/virtualtours/property2
site.com/virtualtours/property3
etc

This works, and the user never accesses site.com/property/property1 - the content type is removed from indexing and there is a rule set up to redirect if a user or search engine happens upon it (i'll probably add this to robots.txt deny too).

But - none of the above links are indexed by search or added to the sitemap, despite being able to drill down to them on the front end. I could conceive of search indexing the property content type, but it would then have to know whether to direct the user to a photo gallery, a floorplan or another view - it would make much more sense to have it just index the content as it appears to the user.


texts: How to disable breadcrumbs by default and enable only particular ones with Path Breadcrumbs module?

texts:
I'm using Path Breadcrumbs module for displaying breadcrumbs on particular pages.

Is there a way to set breadcrumbs not to display by default for ANY page and enable only particular ones using rules created with Path Breadcrumbs module?

In module there's an option to disable breadcrumbs by creating a rule for each URL pattern and setting breadcrumb and title to "" but how can I trigger rule for ANY drupal URL - nodes, taxonomy, views, panel pages etc. And then make rules only for those URLs which really need breadcrumbs to be displayed?


texts: drupal overlay text when you hover over the image views

texts:
I have the content type with image, title and text fields.
I deduce views. I want to hover over the image appear the title and text field and a button with link.
Example http://demo.weebpal.com/#onepage portfolio section

how to do it?


texts: Sort a View by whether content has a user reference

texts:
I have a view that lists all users that have flagged a piece of content (using the Flag module). Also, for that content, I have certain user references attached (using the References module).

So:

User can flag a piece of content.
Content can reference user.

I want to be able to have the view show all users that have flagged the piece of content (I have that working correctly), but also show them in the order of:

Users that are referenced by the piece of content.
Username, alphabetically.

I think I just have a mental block from getting this done. Any pointers or advice to help me get this kind of sort working? Note: I also need to have everything done in one display, since it needs to be sortable and filterable.


texts:
I try to call a SOAP web service before an users authentication. I've try this

function beneficiaire_user_login(&$edit, $account){
    die('hello from login override'); }

Unfortunately, if my SOAP request is bad I cannot prevent the authentication.

What I want to do is:
click the login > check via a WS is the user exists > if yes create the user on Drupal, else show an error message.
Can I perform this action before the session opening ?

With a form_alter hook, it doesn't works, I do not see the "form alter" text

function beneficiaire_form_alter(&$form, $form_state, $form_id){
    exit('form alter');
}

Thanks


texts:
I have a little probleme with my cache block.

This is my build function :

return [
  '#markup' => time(),
  '#cache' => [
    'max-age' => 10
  ]
];

I found this specification for block cache.

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return 20;
  }

Because in parent class we have $max_age = Cache::PERMANENT;

So, when I'm connected my rendered cache refresh each 10 seconds.
But when I'm a anonymous user my rendered block never change.

I don't find the solution.

Big pipe isn't install, I have aggregations css and js but I don't have max age in admin/config/development/performance.

Finnaly I want a block without cache because this block will rendered message with close button. When the user click on the close button, I set a cookie for return an empty bluid in my block.

Do you have an idea ?

Thank you


texts: How to create regular (monthly) reports from users?

texts:
There are several users with a customized role - Sales managers, who need to provide monthly reports on sales. A Content Type - Sales Report was configured in the system.

The users will need to login and if the report is not yet provided for the last month, they need to have an option to create a new one and submit it, if the report was provided - they need to have the option to edit the report.

After the report is submited, a user with the role Department Manager will have to approve the report or send it back to Sales managers to be update.

How do I organize/configure this with Drupal?


texts: My drupal site isn't sending email for some reason. What are some ways to debug this issue of mail sending?


texts:
I am trying to create a rule which fires after modifying node content. Specifically I want to modify the entity reference field values of all the node entities provided by VBO. So I created a rule and a component as shown in the images below.
My problem is that I can not find a way to empty the entityref list of all node entities before the loop, maybe my whole approach is wrong.


texts: Building a view with arguments from a search select list

texts:
I have a block with custom search options based on taxonomy terms (hierarchical dropdown).
When you submit the form, it renders the ID of the taxonomy terms. I want to have a query in another block on the same page which renders all nodes containing the taxonomy terms.
How can I link the IDs?
Is this possible to do it with Views? Should I build a custom view through a hook, or is there another way to achieve this goal?

I am using the 7.x-3.x-dev version of Views.


texts: How to replace node_form() with my custom form callback?

texts:
In my module, I want to override the call to node_form() for a specific node type called superpage, because I want this specific node form to allow for a confirmation step before saving.

In drupal_retrieve_form(), every node form is built by the function node_form(), which adds everything you'd expect from a node form.

I want to add an extra step to my form: First, the node form should be rendered normally; then, when the user clicks Save, I am using a custom submit handler to set $form_state['rebuild'], and to set a custom flag, signaling the need for confirmation. Now I want to rebuild the form not through node_form(); instead I want to display a confirm_form().

This means that the process starts over in drupal_retrieve_form(), which simply calls node_form() again, because the node module implements hook_forms() and defines that callback for all node forms.

I would like to replace the form callback for my custom content type, so that it returns a normal node form if confirmation is not needed, or a confirmation form if needed.

Implementing hook_forms() in my module didn't help.

/**
 * Implements hook_forms().
 */
function superpages_forms($form_id, $args) {
  $forms = array();
  if ($form_id == 'superpage_node_form') {
    // Adding this callback crashes drupal_retrieve_form().
    $forms[$form_id]['callback'] = 'superpages_wrapped_node_form';
  }
  return $forms;
}

function superpages_wrapped_node_form($form, &$form_state, $node) {
  // Build for special case: a confirmation form.
  if (!empty($form_state['values']['confirm_is_needed'])) {
    $confirm = t('You should be careful with this. Are you sure?');
    $confirm_form = confirm_form(array(), $confirm, 'node/' . $node->nid);
    return $confirm_form;
  } else {
  // Build a normal node form.
    return node_form($form, $form_state, $node);
  }
}


texts:
I'm looking for a module which adds Views into tokens. E.g within some content, I want to be able to use [view-vid], or something similar.

Is there anyway for me to do this without needing to write custom code?


texts: I want to save data using ajax. But AJAX callback function replace method not working ? why?

texts:
THIS MY CODE:

function form_test_permission() {
    return array(
        'submit_form_test' => array(
            'title' => t('Submit_form_test'),
            'description' => t('Submit the form_test form'),
        ),
    );
}

function form_test_menu() {
    $items = array();
    $items['production'] = array(
        'title' => 'Production',
        'type' => MENU_NORMAL_ITEM,
        'access arguments' => array('submit_form_test'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('form_test_form'),
    );

    return $items;
}

function form_test_form($form, &$form_state) {
    $form['production'] = array(
        '#title' => t('production'),
        '#type' => 'hidden',
        '#value' => '1',
    );
    $form['production1'] = array(
        '#title' => t('production1'),
        '#type' => 'hidden',
    );

    $form['production_date'] = array(
        '#title' => t('production_date'),
        '#type' => 'hidden',
        '#value' => date('Y-m-d'),
    );
    $form['production_time'] = array(
        '#title' => t('production_time'),
        '#type' => 'hidden',
        '#value' => date('H:i:s'),
    );
    $form['production23'] = array(
        '#title' => t('production23'),
        '#type' => 'hidden',
        '#value' => '1',
    );

    $form['button2'] = array(
        '#value' => 'UNDO',
        '#type' => 'submit',
        '#prefix' => '
',
        '#suffix' => '
',
        '#submit' => array('form_test_form_button2'),
    );

    $form['button1'] = array(
    '#value' => '  ADD  ',
    '#type' => 'submit',
    '#prefix' => '
',
    '#suffix' => '
',
    '#submit' => array('form_test_form_button1'),
    '#ajax' => array(
        'callback' => 'ajax_example_submit_driven_callback',
        'method' => 'replace',
        'effect' => 'fade',
        'event' => 'click',
        'wrapper' => 'countvalue',
        )
    );
    return $form;
}

function ajax_example_submit_driven_callback($form, $form_state) {
    $result = db_query("SELECT * FROM  form_test WHERE production_date='2014-02-10' and production_time between '01:00:00' and '02:00:00'");
    $prod_1 = $result->rowcount();
    $form['#tree'] = TRUE;
    $form_state['rebuild'] = TRUE;
    return 'count value is:' . $prod_1 . '';
}

function form_test_form_button1($form, &$form_state) {

    $ft_id = db_insert('form_test')
        ->fields(array(
            'production' => $form_state['values']['production'],
            'production_date' => $form_state['values']['production_date'],
            'production_time' => $form_state['values']['production_time'],
            'production1' => $form_state['values']['production1'],
        ))
        ->execute();
    $form_state['rebuild'] = true;
}

I have to mentioned in wrapper id in page.tpl.php file.

i want to save data using ajax. But i wrote query in AJAX callback function. AJAX Append method is worked fine. But  AJAX replace function not working ? why?


texts: admin/commerce/orders/{orderId}/payments/add "You are not authorized to access this page."

texts:
When I try to add a new payment to an order (either created by a customer or via the backend) I always encounter the "You are not authorized to access this page." error.

My user has the administrator role.

I'm running core 8.6.7 and commerce 2.11.0


texts: How to alter command being run by drush_invoke?

texts:
When you run drush features-revert-all command, it can be altered using hook_drush_command_alter (&$command).

However during run it's invoking another command by:

drush_invoke('features-revert', $features_to_revert);

It seems I can still use drush_hook_pre_COMMAND and drush_hook_post_COMMAND to perform some additional checks.

However I'd like to alter the list of arguments (features) being passed into features-revert which are not available as part of the main command.

Is there any Drush hook which I can use to achieve that?


texts:
I would like to create "related item" with paragraphs.

I have 2 content type using paragraph field. This paragraph field has different options, like "quotes, related items, slider" etc.

I want to get some fields from "related item". "Related item" field is a "Entity reference".

Inside paragraphs type I have one called "related item"

Inside this I have a field type "entity reference"

I have different pages where I can add this paragraph and choose the entity.

I want to get specific fields from this entity type.

I know I can acomplish this with a view, relationship and contextual filters, but I don't how to do this with a paragraph or if it is possible.


texts:
The breadcrumbs in my Bartik theme work perfectly. However, in my Zen subtheme are skipping a level!

I just noticed that there is no Breadcrumb settings section in the Settings for the Bartik theme.

I am using the Menu Breadcrumbs module for both sites...


texts:
Currently the path where the files are saved looks like this: www.mysite.com/sites/default/files/[date when the file is uploaded]/[filename].

Is there anyway to remove the "date when the file is uploaded" directory and save it directly on the files directory?

Thanks!


texts: Why adding a relationship breaks my view?

texts:
I have a Drupal 7.26 site with the latest Organic Groups module. Every user of the site will be in one group, and one group only. My groups have two different group content types -- schools and classrooms -- and both of these group content types are private, i.e. users can only see the nodes that belong to their group.

It's important to note that classrooms are tied to schools via an entity reference field, and that each classroom has an integer field for the number of students in the classroom.

I created a view that will display a table listing all of the schools that belong to the group, and total number of classrooms per school. This works: Users can only view this table in the group that they belong to.
However, I want to add one more column to this table: total number of students in the partner. To do this, I have to add a "classroom" relationship to the view, since the number of students is an integer field on the classroom node, not the school node, so it's one level deeper.

When I do this, the table will only show schools which the user created/authored. Without that relationship, the user can see ALL of the schools in the group, even ones they didn't create, which is what I want.

Why adding the classroom relationship to my view restricts the output to the content types the user authored?


texts: Didn't we used to be able to type "entity:node/####" in a typeahead field?

texts:
When using any Drupal 8 link field to dynamically link to a node, I start typing the title and the typeahead function starts providing options to chose from. These are Drupal field types such as Link or Entity Reference.

For various reasons, sometimes the correct title doesn't appear and I can't choose it using what's in the typeahead choices. In those cases, I always just used:

entity:node/[node_id_number]

I'm trying to do that now, and Drupal isn't recognizing it as a valid entity. I keep getting the error message:

There are no entities matching "entity:node/6491".

I've tried typing it every which way I could think of, figuring I just forgot the correct syntax. I tried:

/entity:/node/6491
/entity:node/6491
entity:/node/6491
/entity: node/6491

and more.

Can anyone tell me what I'm doing wrong? Or was it all just a fever dream and I was never able to fill in a typeahead link field using 'entity'?


texts:
I want to do (in Drupal commons version 6.25) some kind of bulk OG-Management.

On How to programmatically assign/add new groups to the OG in Drupal Commons 6.25, Fuzzy76 says:

  Doing this through PhpMyAdmin will probably be very cumbersome. You would need to add records to node, revisions, any CCK-tables (if your group nodes have CCK fields), og, og_uid (for group memberships) as a minimum. For addding content to your groups, you would need to add to node, revisions (CCK-tables if necessary) and og_ancestry.

  It is a bit easier creating a group programmatically:

$groupnode = new stdClass();
$groupnode->type = 'gruppe'; // Group node type
$groupnode->status = 1;
$groupnode->uid = $owner_uid;
$groupnode->title = $title;
$groupnode->body = $body;
$groupnode->og_selective = $group_acces_level;
$groupnode->og_register = OG_REGISTRATION_NEVER;
$groupnode->og_directory = OG_DIRECTORY_CHOOSE_FALSE;
$groupnode->og_private = variable_get('og_private_groups', OG_PRIVATE_GROUPS_CHOOSE_FALSE);
$groupnode->{_integration_cGroupType}[0]['value'] = $cGroupType_content; // CCK field

node_save($groupnode);

if ($groupnode->nid) {
  og_insert_group($groupnode);

  // Set space (if spaces_og is used)
  //$ogspace = spaces_load('og', $groupnode->nid, TRUE);
  //$ogspace->controllers->variable->set('spaces_preset_og', $spacepreset);

  og_save_subscription($groupnode->nid, $owner_uid, array('is_active' => 1, 'is_admin' => 1));
} else {
  dpm('OG creation failed :(');
}

Can anybody help me to port over the code (above) to a module?


texts: How to create popup for email link with major email provider links?

texts:
Check out this new feature craigslist implemented. WHen you click on this button (like in the link below) that says "reply to this post", it pops up with this popup that shows the different email providers options (for web browsers, and local clients like Outlook).

How can this be done for Drupal?


texts: how to hide the main menu which is not listed in a block

texts:
I downloaded a theme which automatically puts my main menu in the header region.  However, when I look at my blocks you can't edit that region.

I would like to BLOCK ALL unauthenticated users from seeing the main menu.  How would i do this?  thanks!


texts: How to create a chart for tracking Product stock over some period of time using Ubercart?

texts:
Does anybody know about a good solution for tracking Product stock in a certain timespan?

It is nice to see the stock numbers of products, but I find quite handy to see product performance over time.

My Questions: Is there any module for this? Or is it more appropriate to create such Product stock tracking using views?

Edit: Maybe it's possible to record some "Product stock"-field into some database?


texts: Access front page node only by front page link

texts:
I have a problem with front page node redirection. I have created a node which I want to be a front page (let's say it's path is node/6). I have also set "Default front page" path with path of my node. The problem is that my node is accessible by two links now:

http://example.com/
http://example.com/node/6

How can I make my node to be accessible only by front page link?


texts:
In a template I'd like to get an html tag from a field:

<?php print '<' . render($content['field_headline_format']) . '>'; ?>

This should render  or  depending on the value of the field. But before the value it renders 2 spaces: <  h2>.

I have no idea where it comes from.


texts: How can I moderate user's edits of user profile?

texts:
I need to create approval for editing a user's profile - I want all revisions to a profile to be subject to moderation.
I have found module called User Revision, but that is not a solution for me as it's only revisioning.
Is this possible with Workbench or something similar?
I am not using Profile 2; and I am working on the newest Drupal 7 version (7.23 at time of writing).


texts: Feeds module will not unpublish old feeds

texts:
how can I have the Feed Importers, from the Feeds module, delete or remove feeds after it updates them with a new RSS feed.
Right now it will refresh feeds but not delete or unpublish feeds that are not in the xml file.


texts: Increase weight range for child pages in book outlines (Book module)

texts:
When a child page is added to a book via "Add child page" (node/add/{content-type}), the Weight drop-down field in the Book Outline tab has a range of -/+ 15. This is due to line 191 in web/core/modules/book/src/BookManager.php:

$form['book']['weight'] = [
  '#type' => 'weight',
  '#title' => $this->t('Weight'),
  '#default_value' => $node->book['weight'],
  '#delta' => max(15, abs($node->book['weight'])), // line 191
  '#weight' => 5,
  '#description' => $this->t('Pages at a given level are ordered first by weight and then by title.'),
 ];

When a child node is initially added, $node->book['weight'] is always 0, resulting in a #delta value of 15. #delta controls the min and max values in the Weight drop-down field mentioned above. There is no way to assign a weight higher than 15.

To simplify the work of non-technical editors repetitively adding chapters to books, we tell them to set the Weight value to the chapter number. This doesn't work for books with more than 15 chapters (which happens).

QUESTION: What is the correct, non-core-hacking way to set the limit to say, 25 in Drupal 8? (see my answer below)

AMENDMENT ADDED 2018-11-24

In addition to the issue expressed above, a related issue is that on the book outline reorder page (admin/structure/book/{book-nid}) there is a drop-down field for the weight of each child page. Child pages with a current weight within the range -/+ 15 get a range of -/+ 15 in their drop-down fields. Child pages with weights outside that range get a drop-down with the range increased to include their current weight.

This is due to lines 202, 203, and 235 in web/core/modules/book/src/Form/BookAdminEditForm.php:

$count = count($tree); // line 202 - count of all child pages for the book
$delta = ($count < 30) ? 15 : intval($count / 2) + 1; // line 203

$form[$id]['weight'] = [
  '#type' => 'weight',
  '#default_value' => $data['link']['weight'],
  '#delta' => max($delta, abs($data['link']['weight'])), // line 235
  '#title' => $this->t('Weight for @title', ['@title' => $data['link']['title']]),
  '#title_display' => 'invisible',
  '#attributes' => [
    'class' => ['book-weight'],
  ],
];

The challenge with varying the weight range based on current weight is that it's not possible to assign a weight greater than 15 to a child page whose current weight is 15 or less because its drop-down allows a maximum of 15. I can add several child pages with weight 0, but I can't change any of them to 16. Maybe I'm missing something in the current user interface?

All of this said, there seems to be a fairly straightforward solution to both of these problems, explained in my answer below. Not knowing every detail of how the Book module works, there may be flaws in what I suggest. I'm using it right now and it seems to work well, but I welcome corrections or suggestions for improvement.


texts:
I want to add some more fields to some of the existing checkout panes, but have found little information on that topic. So far I've found plenty on how to create my own panes, but I don't want to reinvent the entire pane just because I want to add more fields.

I have found no way to edit the panes via the UI, so I expect this has to be done programmatically, with a hook.

What hook should I look for, for modifying existing checkout panes?

Specific details
I want to add fields to the Shipping and Payment Information panes, specifically I want to add fields to the address fields already present in those panes.
The address forms should have a checkbox in the top, which determines the visibility of the other fields (basically if it's a private person or a company, if company is selected then additional fields are displayed using drupals field state api)


texts: Use a twig variable inside a twig render

texts:
I am rendering a node field (which is an url to an image) in the node template file like bellow

Works as its supposed to, but i have some logic which tests which exact image field to render and i would like to render the field name from a variable, like so bellow (WHICH DOESNT WORK obviously :) ).

Where MYVARIBLE is the name of the field. Is this even possible in twig?
I know i can archive this with an conditional clause since there are only 2 possibilities for the field name, but this way is more


texts:
I created a custom search plugin for a custom entity. I would like to change the link that is presented to the user on the list of results. I had originally set it to the canonical page using $entity->url(‘canonical’), but now I want to use Url::fromRoute(), to a custom controller.

I made the appropriate changes to the plugin class, cleared cache and ran cron a few times and the search results still point to the admin canonical page. Is there something else I need to do to push the change through?


texts: Dynamic Radio options return An illegal choice has been detected. Please contact the site administrator

texts:
I am using Drupal Commerce 2 and have created a CheckoutPaneBase for shipping methods that we get from an internal service. I am not using Ajax and when the user adds their shipping address, they go to the ShippingServicePane.
in the buildPaneForm, I call out to the service and then create an array of options that appear in a radio button input. They show correctly but when I hit continue to go to the preview pane, it gives me a 'An illegal choice has been detected. Please contact the site administrator.' All the issues I am finding online seem to relate to an Ajax call, which my site is not using, or a missing value, which my options are not missing.
Here is my buildPaneForm
  public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
    $service= new ShippingServiceRepository();
    $options = [];
    $shipping_methods = $service->get_shipping_methods();
    $i = 0;
    foreach ($shipping_methods as $shipping_object) {
        $options[$i] = $this->t($shipping_object->Name.' - '.str_replace('USD ','',$shipping_object->TotalCharge));
        $i++;
      }

    $pane_form['shipping_service'] = [
      '#type' => 'radios',
      '#default_value' => 0,
      '#options' => $options,
      '#required' => FALSE,
    ];
    return $pane_form;
  }

which generates a radio field like this:

        <input data-drupal-selector="edit--shipping-services-custom-pane-shipping-service-0" type="radio" id="edit-shipping-services-custom-pane-shipping-service-0" name="shipping_services_custom_pane[shipping_service]" value="0" checked="checked" class="form-radio">
        UPS Ground - $12.06

I saw and tried adding '#required' => FALSE but it also didn't solve the issue.
When I hardcoded the options, it works fine:
$options = [
  0 => $this->t('Free Shipping $0'),
  1 => $this->t('Next Day $15')
];


texts: How do I add updated timestamp to a file url to ensure people download the latest version?

texts:
I'd like to add the last updated timestamp to the uploaded file name e.g. my.pdf?ver=123413414

The file is uploaded on a regular basis and I'd like people to access the latest version.

I can't see a module/formatter to do this.

I can write
- javascript to add the timestamp to the end but the file would never be cached.
- write a file formatter that adds the last updated timestamp to the end of the download link.
- write something that calls "theme_file_link"

what is the best approach?

Thanks


texts: Am I able to use dynamic parameters in libraries configuration files?

texts:
I have hard coded GMaps API key in URL inside in the libraries.yml file.

Would I be able to use a dynamic parameter for this key?


texts:
I have a webform that allows users to upload their CV/Resume's. The webform is sending me the file ID. I know that the URL for accessing those files is https:// example.com/sites/default/files/webform/myfilename.

Can I access the file using the file ID instead of its name, for example https:// example.com/sites/default/files/webform?fileid=1502?


texts: Display Local tasks from one page to another

texts:
I have a menu structure like this:

$items["foo"] -> MENU_NORMAL_ITEM
$items["foo/bar"] -> MENU_DEFAULT_LOCAL_TASK
$items["foo/something"] -> MENU_LOCAL_TASK
$items["foo/bar/bazz/%"] -> MENU_CALLBACK

I want to have the tabs (local tasks) from page foo/bar displayed on foo/bar/bazz/% as well but I don't want to have another local task for this new page.

Any ideas on how can I achieve that? Thanks.


texts: Configuration export not working for sub-theme that has underscore in name

texts:
Had a strange issue today where I have a sub-theme (bootstrap) called 'rrre_theme'. I can confirm I have not made any errors throughout my sub-theme in terms of naming. I position blocks and generally go about drupal business. When it comes time to export my config i run drush cex vcs where vcs is a default config directory defined in my settings.php. So far so standard. However I am noticing that config-export is changing the name of my theme. Here is an example git diff on a config file after i have run cex:

diff --git a/config/default/block.block.propertystyle.yml
b/config/default/block.block.propertystyle.yml
index 1351c6b..363abda 100644
--- a/config/default/block.block.propertystyle.yml
+++ b/config/default/block.block.propertystyle.yml
@@ -1,4 +1,4 @@
-uuid: 211de5b8-0385-4d83-b57d-d965abe2df8e
+uuid: 7f3fedfd-098d-4fe6-ad74-ac056c64627d
langcode: en
status: true
dependencies:
@@ -7,11 +7,11 @@ dependencies:
   module:
     - facets
   theme:
-    - rrre_theme
+    - rrre
 id: propertystyle
-theme: rrre_theme
+theme: rrre
 region: content
-weight: -7
+weight: -3
 provider: null
 plugin: 'facet_block:propertystyle'
 settings:
@@ -22,7 +22,7 @@ settings:
 visibility:
  other_facet:

You can see that the post cex file has changed my theme name?!

Can anyone explain why this is the case? In the meantime I have renamed my theme to: rrretheme and will report back here if that fixes it.


texts: Is it possible to do a user search by taxonomy?

texts:
my question is because I have users with a taxonomy field and what I want to do is search for those taxonomies.

Example: a user in his profile chose a taxonomy, let's say soccer.
I want to make a search engine in which users search for soccer and all users who have a soccer taxonomy appear.

I do not know any module for this and I do not know if it is possible to do it with a view.

•Drupal 7
•Views 7.x-3.20

Any help?


texts: Class name must be a valid object or a string error while voting advance poll

texts:
We have some features where we are awarding X points to user on action ex: like a story.

For like functionality we are using rate module and to award points to user using userpoints module.

By using voting rules it works perfectly but it conflict withAdvance poll module and in result poll functionality is not working.

So now, I am looking for work around to achieve below functionality-

likes on story(node)
voting on poll (developed using advance poll module)


texts: Building a dynamic menu based on taxonomy terms

texts:
I'm new to Drupal and I am currently using Drupal 7. I need to know if what I am trying to do is even possible. If so I am going to need some pointers on how to implement it.

I have two vocabularies: Category and Brand. I have products that are tagged with a brand and one or more categories. I want a mega menu, dynamically built based on these terms. Basically, if there is a product tagged with category "A" and brand "X", a link should be created in the menu under products. So the menu would look like Products >> A >> X. Is there a way to accomplish this? I was thinking that I could create a custom module that would find all nodes of type product and create a category link for each new category it finds; then create a brand under the proper category.


texts: Can't track why Boost-Crawler doesn't work

texts:
I use Drupal 7.38 and Boost x - 1.0.7, and I Can't get the Boost Crawler to work... Boost itself is working fine (verified formation of cached webpage files at root/cache/...).

Seemingly, I did all I need to active the crawler submodule:

I enabled the module.
I went to Admin > Configure > System > Boost > Crawler, and ticked the checkbox to enable the crawler to run on cron.

After I did these stages, I ran Cron and went to root/cache/... and found only 3-4 cached files that where created by anonyous surfing either way... If the crawler module was working I guess I should have seen at least 60 cached-webpages there.

Since I'm not yet a programmer I have no idea how to even start dealing with this problem. The least I can do is to put here a print screen of my Recent log messages... I could paste everything seem relevant to you from there...

I very much need this submodule to work, please help!,