texts: Managing large volume of content in tree hierarchy

texts:
Firstly I apologise if this has already been answered. I thought it would be a common problem and I'm surprised that I haven't found a general solution anywhere.

I have a large corporate website (about 8000 pages) which is currently organised in our existing CMS in a multi-level tree structure. The navigation menus, breadcrumbs and URLs are all automatically built based on the position of content nodes in the tree. This makes it particularly easy for content editors to create new content in the right place and have the menus, breadcrumbs and URLs always consistent.

We are probably going to move to Drupal 7. What is the standard approach to large, tree-structured sites like this? I don't want to have to create new tag names (taxonomy terms?) for every single section since there are hundreds of 'container' type pages that contain lists of other pages. It seems far easier to just slot the node into a tree.

I suspect there is something obvious I'm missing - I would think it is pretty normal to have a tree like structure of content. Any help much appreciated.


texts: How to Display children on the Taxonomy term page?

texts:
I think my problem is quite simple but I don't manage to find the solution on the internet (I found solution for Drupal 7, but they don’t apply to Drupal 8).

I have a taxonomy like :

  Fruits

       Red fruits

             Strawberry
             Raspberry

       Black fruits

  Vegetables

Using Views in Drupal 8, with the preconfigured Taxonomy term, I'd like that when I click on a parent, it displays all the children terms and the nodes within these children terms. (eg. when I click on Fruits, it display all nodes in Fruits, Red Fruits, Strawberry, Raspberry and Black fruits ; and when I click on Red fruits, it displays all nodes within Redfruits, Strawberry and Raspberry).

Indeed, by default, when you click on a parent term, it only shows nodes within this parent term, but not those who belong to children. (eg. when I click on Red fruits, it only display nodes within Red fruits, but not those in Strawberry or Raspberry)


texts: Redirect to entity ID after entity create form submit with AJAX

texts: I have an AJAX entity create form and I want to redirect to that entity ID after I submit the form and create the entity, I know I can't use goto() because it's AJAX. I have the hook form alter for that entity already for some other customization of the form.


texts: How do I add a non-exposed field to node programatically?

texts:
I need to add a non-exposed field to a node programatically. By non-exposed, I mean a field which users will not be able to interact with. I need to be able to store data in this field through hook_folder_form().

There's always the accepted answer to Add field in hook_node_info();, but that seems to imply that we're talking about exposed fields.


texts: Importing nodes with Node export is creating them in "unpublished" status

texts:
I'm importing content from one D7 site to another using the Node export module. However, when importing the content in the new site, the nodes are getting created in unpublished state. I have to publish them manually.

How can I have Drupal import the nodes in published state?


texts:
I have a table of information displayed on a page. Each row of this table has its own submit button. I need to be able to pass information depending on what submit button is pressed.

The form is built like

function numberSubmit_form ($form, &$from_submit){
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
    );
    return $form;
}

The rows of the table are built like:

$unvalRows[] = array(
            array('data' => '0'.substr($a[0], 2)),
            array('data' => drupal_render(drupal_get_form('numberSubmit_form'))),
        );

How am I able to determine which submit button has been used and pass the applicable phone number?


texts:
I'm a trying to pass a var, in this case the var "$node" to the page.tpl.php.
Tried everything for three days but i cannot make it work despite my code is correct apparently. Tried different ways but when i tried to check with isset if the var exists, it returns false. I really need it, so i can check pages and nodes.

This is my code:

template.tpl.php

  function agn_preprocess_page(&$vars) {
  $node = menu_get_object();
  if ($node = menu_get_object()) {
      $vars['node'] = $node->type;
  }
  }

page.tpl.php

<?php if (isset($node)){
   print "true";
}else{
   print "false";
}
?>

Thanks in advance!


texts: Moving or creating many product variations

texts:
Problem:
many, many product variations.  Think of it as a product configuration tool to customize your item.

I tried this:
https://www.drupal.org/project/commerce_bpc

It did create variations, however there seems to be some issue where they exist only as variations,  they don't get attached to a product (if that makes sense).  Basically, I can only see them under the admin list of variations.

Question 1: What's the most effective way to auto-generate many variations of a product?

Question 2: Can I somehow attach these variations to a product now that they're generated? Happy to do this directly in the database and/or create a standalone script to do so.

I may very well be missing something obvious, this "many variations" problem must be quite common.


texts: How can I get a taxonomy menu into the main menu AND a block?

texts: I've got a taxonomy menu of products in DCommerce which appears in the main menu, but I also need it to show up in the sidebar. I installed menu_blocks but that can only access the main menu that the product menu is within.. and if I make the product menu into it's own menu, I can't get it into the main menu. Can it show up twice??


texts: Views: showing similar terms on term page by another term reference field

texts:
I've got 2 vocabularies, for example, artists and styles.

When viewing one of the Artists term i want to show another artists terms in a block, marked with the same term from styles vocabulary by reference field.

How to achieve it?

I tried to set the relation to Taxonomy Term: Styles (field_styles) and various contextual filters but without success.

Any help is appreciated! Thanks in advance


texts: How do I relocate the "Reset password" form?

texts:
Is there a way to hide and relocate the Reset password form from standard location? The login form needs to be shown as is.

I wasn't able to do what the answer on How to print the local task bar different places depending on the base route? says to do.

I found the No Request New Password module. However, I'd like to still access this form on a special link.


texts:
I have a view that is set up to report breaking news from a "breaking news" text field. But this field is often empty, and in the no results behaviour, we would like to show one of our special offer blocks instead.

I can see an option for "Entity:Rendered Entity" in no results behaviour, but this is only nodes or users, I cant see a way to display a pre existing block?


texts:
I have a multi-step/page webform. It works fine. I have on one page two date fields. One field must be on or after the other and thus I want some validation. No problem I followed the tutorial ( How to add custom validation to a webform element? ) and have a basic validation code/module in place. Code:

/**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    $this->validateArrivalDate($form_state);
  }

  /**
   * Validate Arrival / Dept dates.
   */
  private function validateArrivalDate(FormStateInterface $formState) {

      $arrival_date = !empty($formState->getValue('arrival_date')) ? Html::escape($formState->getValue('arrival_date')) : NULL;
      $departure_date = !empty($formState->getValue('departure_date')) ? Html::escape($formState->getValue('departure_date')) : NULL;

      if (is_null($arrival_date) || is_null($departure_date) || strtotime($arrival_date) > strtotime($departure_date)){
        $formState->setErrorByName('arrival_date', t('Arrival date must be on or before departure date.'));
        $formState->setErrorByName('departure_date', t('Departure date must be on or after arrival date.'));
      }
  }

It seems to work fine if the page with the dates on is the first page/step, but if it is on step/page 3 it kicks up a validation error on the first page/step as soon as I click next. So presumably I need to check what step/page I am on. Thus I added:

private function validateArrivalDate(FormStateInterface $formState) {
    $page = $formState->get('current_page');
    if ($page[0] == "page3"){

      $arrival_date = !empty($formState->getValue('arrival_date')) ? Html::escape($formState->getValue('arrival_date')) : NULL;
      $departure_date = !empty($formState->getValue('departure_date')) ? Html::escape($formState->getValue('departure_date')) : NULL;

      if (is_null($arrival_date) || is_null($departure_date) || strtotime($arrival_date) > strtotime($departure_date)){
        $formState->setErrorByName('arrival_date', t('Arrival date must be on or before departure date.'));
        $formState->setErrorByName('departure_date', t('Departure date must be on or after arrival date.'));
      }
    }
  }

This however doesn't run the validation, I can put what I want on step/page 3, click next and it carries on to page 4. Would appreciate it if anyone could point out what I am doing wrong.


texts:
I'm trying to add google maps into the header of a view, nothing fancy, as I just used the demo code from the google maps page.

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=myKey"
          type="text/javascript"></script>
        <script type="text/javascript">

        jQuery(document).ready(function() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(37.4419, -122.1419), 13);

            var marker = new GMarker(map.getCenter());
            GEvent.addListener(marker, "click", function () {
              marker.openInfoWindowHtml("Hello");
            });
            map.addOverlay(marker);
          }
        })

        </script>

But for some reason I'm getting this error:

  Uncaught TypeError: Cannot read property 'firstChild' of null

I have no idea what is going wrong.


texts:
I have a list field for a custom content type that looks like this:

Field Machine name is: field_app_os

key|label
Win|Windows
Android|Android

I can access the key in Twig template by using content.field_app_os or Twig Field Value and the output of both is Android:

  Twig Field Value allows Drupal 8 themers to get partial data from
  field render arrays. It gives them more control over the output
  without drilling deep into the render array or using preprocess
  functions.
  Filters:
  - field_label : Returns the field label value.
  - field_value : Returns the render array of the field value(s) without the field wrappers.

/* with use of Twig Field Value module */
{{ content.field_app_os|field_value }}  {# outputs 'Android' #}

 /* without use of Twig Field Value module */
{{ content.field_app_os }}  {# outputs 'Android' #}

However, if I do a simple comparison, the output of both is False.

{% set app_os = content.field_app_os|field_value %}
{{ kint(app_os == 'Android') }} {# outputs 'bool FALSE' #}

Or When I use:

{% set app_os = content.field_app_os %}
{{ kint(app_os == 'Android') }} {# outputs 'bool FALSE' #}

What's wrong in my code?


texts:
I can´t mini panel in panel page because this not showing in content of panels.

I have mini panel module enable but... How can I enable mini panels in content panels??


texts:
Is it possible to make Drupal more secure by making LOGIN page private? I would like to make /user/login page private with Basic Auth so an user and password are needed before I get in that page.

Or is there another ways to make the login more safe? Goal is to prevent hackers to get in. Also if there's some module that helps on this it would be nice.


texts: Does hook_drush_exit() get called for disabled modules?

texts:
I have a module that exposes a drush file that contains an implementation of hook_drush_exit(). This function gets called at each drush command, even though the module is disabled.

Is this behaviour by design, or is it a bug/misconfiguration?


texts: Override Taxonomy Pages without entire page override

texts:
I need to override Taxonomy page (page--taxonomy--term.tpl.php) and wondering if it's possible to just override the content section of the page instead of the whole page.

I don't want to print all other regions again as I will to update different page tpls if I update some other part of the page template.

Cheers


texts: Matching values between two different fields, each of which have multiple values

texts:
I have a content type with an imagefield and a link field. Each of those fields accepts four values; so the user uploads four images and types four URLs in each node.

I want to use Views to create a block based on that node that displays the first image linked to the first URL; the second image linked to the second URL; etc. I don't want to use CCK 3 with Multigroup (if possible) because it seems to sometimes cause weird behavior in Views, Contemplate, etc.

Given the existence of Delta fields, "Group multiple values", etc., it seems like this should be possible. But I can't make it work. Is it possible? Or should I bite the bullet, use CCK 3, and hope it's not confusing as all get-out?


texts: How do I set up an article view that validates both article and category?

texts:
I'm working with Drupal 7, and trying to get a view set up that will display blog categories and articles based on their category.
The category is a Taxonomy - Blog Categories - let's assume it's:

rock-and-roll
pop
jazz
other

I'm hoping for the following path behavior:

/blog/ should list all articles.
/blog/rock-and-roll/ should list articles that have the rock-and-roll taxonomy set.
/blog/non-existant-term/ should show page not found
/blog/rock-and-roll/real-article-title should show the relevant article
/blog/rock-and-roll/fake-article-title should show page not found

I've tried a ton of different combinations of relationships and contextual filters, but I just can't get it to work. The closest I can get is where all of the 'proper' urls work... I get category lists, or I get article displays... but I also still get a page when I go to a path with either an invalid taxonomy term or an invalid article name.
It seems like it should be something with the Contextual Filter validation stuff... but anything I've tried with like validation based on a taxonomy or whatever just stops anything from working. I no longer get listings or articles properly.
I'm not sure what other information to include - I'm trying to avoid adding any modules (because I've basically been told not to) and I'm trying to avoid making it multiple views.
-------- EDIT --------
I've tried some of the stuff suggested by prkos but I'm not having any more success. I've attached some screenshots of my configs... with a little bit of censored stuff. It probably doesn't matter, but I'm expected to be circumspect.
The original URL/Taxonomy I used isn't actually the final stuff, it was just example... so there might be some mismatch there.

So, with these changes in place... now if I go to url/news2/ I get a Page not found. url/news2/all seems to work, but then url/news2/validterm doesn't work. validterm doesn't get any results in the view preview thing either... where it did before.


texts: I don't know if its possible at all but I need something like what is seen in this demo for one of the menus with Hierarchical Select module. This works fine when I use it for a vocabulary with hierarchical terms but don't know how to use it for generic Drupal menus.


texts: How to change the Field Group Horizontal Tab ID names

texts:
I've searched google for an answer to this question but can't seem to find anything.

I have the Field Group module installed, and I am using horizontal tabs.

The URL for each tab displays as.... example.com/business1#node_business_full_group_display_gallery

Whereas I would like it to display as....
example.com/business1#gallery

Looking at the original URL, it is printing the $entity_type, followed by $bundle, then $field_name. Whereas I would like it to just print the $field_name, or even better, the title of the tab.

I am looking in field_group.features.inc as it seems to be where I might be able to change how it displays the name, but I'm a little lost as to which bits to change.

You can view the file here.


texts: Do I need to build a custom page to list nodes by content type?

texts:
Environment

Mac OSX 10.8.2
MAMP
Drupal 7 (just downloaded the stable today)

Objective
Create a menu item in the main menu to list recent and all nodes of a specific content type.
Question
It appears that I'm going to need to build a custom page, and leverage an API, to simply list nodes by content type. I just know I'm missing something. Can somebody point me in the right direction on how to do this?
I ran this Google searche, drupal 7 list nodes of content type, to come to the conclusion that I'm going to need to build some kind of custom code.


texts: How to setup Swift Mailer to send mails using SMTP server and TLS encryption?

texts:
I'm trying to send Drupal 8 emails using Swift Mailer (5.4.8, 8.x-1.0-beta1) and a remote SMTP server. The transport should be encrypted, so TLS should be used. This is my setting:

Unfortunatly when trying to send an email I'm getting a warning:

  Warning: no valid certs found cafile stream: `/etc/apache2/ssl/certs/' in Swift_Transport_StreamBuffer->startTLS() [...]

And this error afterwards:

  Unable to connect with TLS encryption

Without the encryption I'm able to send mails using the remote STMP server.

A test of the connection using TLS from the server where Drupal is installed looks fine (I guess):

openssl s_client -connect mail.example.com:25 -starttls smtp

The response (excerpt):

CONNECTED(00000003)
[...]
---
No client certificate CA names sent
---
SSL handshake has read 4369 bytes and written 586 bytes
[...]

So where do I get further details about the connection error? And what could be the cause of the problem?


texts: Using hook_theme() when there is a preprocess

texts:
We had a outside company help us with our Drupal version of our site. They created the code below.

Since then we have hired another company that seems to be more professional about there code and standards.

The code below is the entire code of the module. The new company suggested that we "Implement hook_theme and create a template for alerts, move markup from
hook_preprocess_page to the template."

I understand a bit about Drupal modules, but I'm unsure how to accomplish what they are suggesting.

Can someone help me in this regard?

<?php

function foo_alerts_preprocess_page(&$vars) {
  $vars['alerts'] = '';

  if ($nid = foo_alerts_check_alerts()) {
    $node = node_load($nid);

    if (isset($_COOKIE['alert'.$node->nid]) && $_COOKIE['alert'.$node->nid] == 'closed') {
      return;
    }

    $html = '
nid.'">
';
    $html .= '
News Alerts:
';
    if (isset($node->field_link['und'][0]['url'])) {
      $html .= l($node->title, $node->field_link['und'][0]['url'], array('attributes' => array('title' => $node->field_link['und'][0]['title'], 'class' => array('alert-link'))));
    } else {
      $html .= '' . $node->title . '';
    }
    $html .= '';

    $html .= '

';
    $vars['alerts'] = $html;
  }
}

function foo_alerts_check_alerts() {
  return db_query("SELECT nid FROM {node}
    LEFT JOIN {field_data_field_dates} ON entity_id=nid
    WHERE type='alert' AND field_dates_value < NOW()
    AND field_dates_value2 > NOW() AND status = 1 LIMIT 1")->fetchField();
}


texts: Manual Ubercart Views Taxonomy Order (D6)

texts:
Client wants the parent taxonomy view page to be ordered in a manual arrangement just based on his belief of which products are most popular (this isn't a field in the database; nor do we have this information in the database).

Is there anyway to order the view page based on a weight?


texts:
How do you translate custom theme settings in Drupal 8?
I use hook_form_system_theme_settings_alter to add custom settings to a theme. One setting is the text string (e.g. 'Menu') to display beside the menu icon for a responsive menu. How can I integrate with the configuration translation system to allow the text to be translated?
All of the examples I have found describe how to translate a custom module's settings. I have not found any examples about how to translate a themes's settings, but there are a few hints in the Drupal code base that suggest it should be possible to create a THEME.config_translation.yml file.
I have taken a lead from this article on Gábor Hojtsy's blog and created the following files:

config/install/mytheme.settings.yml
config/schema/mytheme.schema.yml
mytheme.config_translation.yml

The schema is valid (tested using Configuration Inspector) and I have managed to get a Translate button for my theme's settings to show up on the Configuration translation admin page (/admin/config/regional/config-translation). That's as far as I've got.
I don't know what to use for base_route_name in mytheme.config_translation.yml. Here's what I have:
mytheme.settings:
  title: 'My Theme Settings'
  base_route_name: system.theme_settings

For base_route_name I used system.theme_settings which results in a Translate button that links to /admin/appearance/settings/translate, but clicking on it leads to an Access denied, I assume because there is no translate page for theme settings. Also, I think the base_route_name should be system.theme_settings_theme and the Translate button should map to /admin/appearance/settings/mytheme/translate, but I get an error when I try that.
Am I on the right track? How would I go about creating a /admin/appearance/settings/mytheme/translate page and integrate it with the config translation system?


texts: Is it possible to set time interval between adjacent operations in Batch API?

texts:
I need to send several thousands of e-mails via Amazon SES. As it turned out, Amazon SES can send no more that 14 e-mails per second. I can send to it no more than 14 e-mails per second - it's a requirement of Amazon SES.

I send e-mails to Amazon via Drupal Batch API. Could you clarify me, is it possible to set time interval between adjacent operation upon creating the batch command ?

That is, current batch command is sending 14 e-mails, then a time interval is appears before executing the next command.

Is it possible to realize it ?


texts:
I'm trying to change the background color of a Colorbox (in which nodes are presented) based on the clicked node. See https://stackoverflow.com/questions/18173943/change-background-color-of-colorbox-using-js-based-on-node-id?noredirect=1#comment26626591_18173943

This doesn't work, although I've confirmed it working for others, and on Fiddle: http://jsfiddle.net/nevster/YSgMx/

Why doesn't this work?

The site is built on latest Zen and I've added the JavaScript code in the script.js file (inside the function that says I should put it there) and added the file in the theme .info file.

JavaScript:

$(document).ready(function () {
$(".colorbox-color").colorbox({
    onComplete: function(){
        var bg = $.colorbox.element().data('bg');
        $('#cboxWrapper').css('backgroundColor', bg);
        $('#cboxLoadedContent').css('backgroundColor', bg);
    }
});
});

I'm using Drupal 7 with Views to show the nodes, together with Colorbox and Colorbox Node.


texts: How to set header and footer for any drupal_mail messsage?

texts:
I am working with drupal 7 site.

I would like to know how to create email template for any email sent from drupal system?

Is there any hook or template should I implement in my custom module or override to make it beautiful like any newsletter emails are received.

I want following emails should be theming.

User Activation User
Password reset
Comment Notification etc...

Email template should looks like

<header>
Dear <User>
<Message Body goes here>
Thanks
<footer>


texts: How Do I Replicate Computed Field Functionality In Drupal 8?

texts:
I have a question regarding Computed Values in Drupal 8. I currently use Computed Fields in Drupal 7 to perform mathematical operations on certain fields and save that calculation in another field. I am attempting to recreate this functionality in a Drupal 8 install.

I recently saw an article that said Computed Fields would be depreciated by the functionality of Drupal 8 core. However, it is not clear to me how to recreate this in Drupal 8. Could someone explain how I take one integer field and multiply it by a percentage to get a decimal number?

I would appreciate any help provided.

Thanks,

Chris


texts: Programatically change exposed filter value based on another exposed filter

texts:
I have 2 exposed filters in my Drupal 8 view - both are select dropdowns. I want the value of the 2nd filter to change based on selection of first filter
Here are the filters
$filters = $view->display_handler->getOption('filters');

$filters['country'] and $filters['states'].

Problem is that I always get an empty value when I try to access country filter in my views_pre_view hook.

dpm($filters['country']['value']) always prints empty.

How do I solve this please?


texts: How do I render the view of an entity reference?

texts:
I have a custom view which has a field that references another view. How do render the referenced view. I can't see the Render View option.

Below is an attached image for clarity. The top screenshot shows my current setup, while the bottom image shows my expected result.

Also both screenshots are taken from different sites and running the same version of Drupal 8.5.3


texts:
I have a webshop made with drupal commerce kickstart and use it as a POS in a bar. The people pay with cash. What i want is a calculator with 2 input fields: field 1: the "Order total" from checkout automatic comes in this field. Field 2 is the amount of cash the customer pays with. So i can see how much i have to return to the customer.
I have webform calculator installed. But the big question is how to automatic place the value from Order total in the calculator.


texts: Language specific settings for field formatters

texts:
I've created a custom field formatter widget for numeric fields. The formatter has A LOT of settings to customize the visual output of that number, to whatever designers/marketing wants (adding a lot of HTML markup, with[out] leading/trailing zeros, zeros as dash, one or two fractions, rounding, prefixes/infixes/suffixes,... ).  Some of those settings are language-dependant though, so I'd like to enter different formatter settings in

/en/admin/structure/types/manage/MY_CONTENT_TYPE/display
/de/admin/structure/types/manage/MY_CONTENT_TYPE/display
/fr/admin/structure/types/manage/MY_CONTENT_TYPE/display

I've noticed that there is a $langcode parameter in
FormatterInterface::viewElements(FieldItemListInterface $items, $langcode)

but I don't know how to make
FormatterInterface.php FormatterInterface::settingsForm(array $form, FormStateInterface $form_state)
language-aware.

Is it possible at all to have language-specific settings in a field formatter? If yes, how to I store and retrieve those settings in the correct language?


texts: Is it possible to pass a Field value Via URL when creating a Node?

texts:
This may be posted elsewhere but I was having trouble finding anything answering my question directly.

I have a content type called Ticket that I want to have different fields based on what page a user is on when they push the button to create new ticket.

I am doing this because I would like a grand overview of all tickets entered, but there is different information needed from the user based on what queue they are entering a ticket for.

If there is a better way to do this I am open to suggestions.

Thanks in advance


texts: I would like to set a taxonomy for a view. I have Taxonomy called "CMS Templates" and under that I have "Drupal". I would like to set Drupal for a view which is displaying Drupal templates but I don't know how. I tried to put field taxonomy and all taxonomies but I don't have possibility to set it there.


texts: Second Product variant image in fb share is not coming

texts:
I am using [node:field-product:0:field_images] metatag image.
With which I am getting top level variant image always. How can I get my second product variant image in facebook share, when I select second product variant from the variant selection dropdown on product display page.


texts: Notice: Undefined variable: node in eval() and Notice: Trying to get property of non-object in eval()

texts:
After upgrading to Drupal 7, I get the following error on my recent log messages:

  Notice: Undefined variable: node in eval() (line 24 of /home/scode/public_html/modules/php/php.module(74) : eval()'d code).
  Notice: Trying to get property of non-object in eval() (line 24 of /home/scode/public_html/modules/php/php.module(74) : eval()'d code).

The user accessing the page is "Anonymous (not verified)."

Do you have any idea?


texts: How to get comment votes using raw sql query?

texts:
In a D7 site, comments are voted using rate module.

I'm wondering how to get the rating of all comments of 'story' content using raw sql query?


texts: field_view_value() with product reference field only display specific attributes

texts: As previously being asked and suggested in field_view_value() with product reference field doesn't display attributes it shows all the attributes for the product [size, colour, etc] I want to only show a specific attribute for instance size within the custom product display. Is this possible and what syntax?


texts: How to find/download latest drupal version via bash?

texts:
I'm trying to pull up the latest Drupal release, and download it via a bash script.

I don't have any idea on how I can do that, except that I found out I can list the files on the FTP server, and get all the filenames containing Drupal, like so:

lynx --dump http://ftp.drupal.org/files/projects/ | awk '/http/{print $2}' | grep drupal-7 > latest.txt

How I can pull the latest version from that list, and download it?


texts: Do I need a cron task for processing a queue?

texts:
I've got a task that takes about 45 minutes to complete and needs to happen every day (synching users to several external database, etc).

To handle the work, I've set up a cron queue with hook_cron_queue_info() as follows:

function mymodule_cron_queue_info() {
  $queues = array();
  $queues['update_users_queue'] = array(
    'worker callback' => '_mymodule_process_user_queue_item',
    'time' => 120,
  );
  return $queues;
}

I fill the queue using this function:

function mymodule_queue_all_users_for_synching() {
  //...query for users...

  $queue = DrupalQueue::get('update_users_queue');
  foreach($users as $user) {
    $queue->createItem($user);
  }
}

The queue-filling function gets called as a cron task. I use Elysia Cron, so my implementation of hook_cronapi() is:

function mymodule_cronapi($op, $job = NULL) {
  $items = array();
  $items['queue_users_for_synch'] = array(
    'description' => 'Queue all user accounts for synching.',
    'rule' => '0 3 * * *', // Run this job every day at 3am.
    'callback' => 'mymodule_queue_all_users_for_synching',
  );
  return $items;
}

The worker function for each queue item, defined in mymodule_cron_queue_info is like:

function _mymodule_process_user_queue_item($item) {
  //...synchronize user ($item)...
}

My question is, when is cron actually going to start processing the queue?

Say I fill the queue every day at 3am, and want to process it 120 seconds out of every 30 minutes until it's done--do I need to create another cron task?


texts: How to stop a Views block from displaying to administrators, such as user/1?

texts:
I created a view and put an access role of anonymous user. When I log in with normal user account I don't see it, but when I log in with my admin account I see the view.

I would like to not see it. Is there a way to stop it from displaying to admins?

BTW, I tried un-checking Bypass views access control in the permissions, but it didn't work.


texts:
I am building a web-service which will register user for my drupal site from android device. For Registration I am inserting data in the 'users' table of Drupal database.
But the problem occurs with the "uuid" column in the "users" table.I don't know using which logic I can insert data in 'uuid' column while registraion. Please help me.


texts: How can I associate an advanced forum with an organic group?

texts:
I am trying to set up a site which has forums and organic groups.

I want to set it up so the specific forum for a group appears only on that groups page.

By keeping tight control on group creation I can ensure that when a group is created I also create a forum for that group with the exact same name - this allows me to show the forum for that group on the group page by parsing the URL and then filtering by the group name to check it matches a forum name - then displaying that forum in the view on that groups page.. so far so good..

I have also added a group reference field to the forum topic content type, so topics show in the recent group content etc..

When adding a new forum topic, I'd like to automatically populate this field so the topic is assigned to the correct group, rather than give the user a choice, which they could then change. Hopefully this shouldn't be too hard as if a topic is added in the 'football' forum it will be the 'football' organic group that it should be associated with.

How do I go about doing this?

(if there is an easier way of doing the whole thing I'm open to suggestion there too! ie if the group name and forum name will always be the same anyway, it should make things easier all round, no?..)


texts: User roles by Taxonomy term - webservice

texts: I am very newbie to Drupal (I know how to write code in Java way) but this task has Java and PHP in one solution. So, I need to write some webservice to manage the taxonomy terms by user roles. I mean I have one vocabulary for each user role and in GUI way I can easily click some terms and update those dependencies (publish term for role). But in webservice way it is more complicated for me now. I have the Taxonomy Access Control Lite module and my question is: what is the easiest way to do it? Is there some function in Drupal 7 to do that? And how does taxonomy term is connected with user roles in standard Drupal 7 DB? I will be happy to have any advice from you guys. Thanks in advance.


texts:
how to create a block for user profile page which will show add new store form
in store tab?

I am using commerce market place.

I am new to drupal can any one help me plz.


texts: How to use hook_theme and hook_block_view correctly

texts:
The following code works - the block_view calls the theme function and the correct variables get passed.

Is this the right way to use these functions when you have a block and you want it themed with variables and using a specific template?

Thanks,

function youtube_pull_block_view($delta = '') {

    switch($delta){

      case 'youtube_pull':
      $block['content'] = theme('popular_analytics', array('videos' => get_most_popular()));
      break;
    }

return $block;
}

function youtube_pull_theme() {

return array('youtube_pull_listing' => array(
             'variables' => array('videos' => NULL),
             'template' => 'youtube-pull-listing',));
}


texts: Can webform conditionals require filling one of two fields?

texts:
The snippet below is one of the ways I attempted to require that the user fill out at least one of phone no. and/or email using webform conditionals. This one came closest to working. The logic is both fields default to required but that requirement clears when the other field is filled out. It fails because webform interprets it as a circular reference.

Any suggestions? I don't have the technical wherewithal to attempt the answer to question 87889 so looking for a way to do this using webform conditionals. Question 63912 looked promising until I realized it dealt with Drupal fields and not Webform fields.


texts: Print the error message returned from the SQL query

texts:
I created a custom module where I am querying the database, for example with code similar to the following one.

$query = db_select('node', 'n');
$query->fields('n', array('nid'));
$nid = $query->execute()->fetchField();

I want to print the warning, error, and success messages after the execution of the query. How can I achieve this?


texts: How to convert rules token into variable for doing some calculation?

texts:
I have a rule in which i have wrote a php code to set the data in node field.

 <?php echo "
" . t("Bid amount : "); ?>[flagged-comment:field-bid-amount]

But i wants to do something like this :
    [flagged-comment:field-bid-amount] token

 <?php echo "
" . t("Bid amount : "); ?>[flagged-comment:field-bid-amount]
 <?php $a=[flagged-comment:field-bid-amount]; ?>
      <?php echo "
" . t("commision amount : ").$a/10; ?>

while doing the above its generating fatal error .


texts: Attach js to the module using libraries with inline property

texts:
I have a module in which I have created a libraries.yml file and have attached it to the module:

$var[$delta] = array(
  '#theme' => 'example_theme',
  '#attached' => array(
    'library' => array(
      "example_theme/example-styling",
    ),
  ),
  '#file' => $output,
);

I want to provide a variable to the js defined in libraries.yml

How can I achieve this?

drupal_add_js('example = "' . $example . '";', 'inline')


texts: How to change template file name and destination for some blocks?

texts:
For example: I want to change default login block template.

My current template file is — /sites/all/themes/{theme_name}/templates/block--user--login.tpl.php

But I want — /sites/all/themes/{theme_name}/templates/system_blocks/login-block.tpl.php

How can I do that?


texts: How to disallow users with a username containing test to login?

texts: I created a module but I'm looking to have this module to intercept a user log in. I want to prevent any users with "test" in their login name from using the site. Is there a way to do this?


texts:
I'm looking to display a list of staff grouped by department.  I've figured out how to do this just fine with one exception.

I have a few staff who's time is split between 2 departments.  However, when I edit their department field and enter more than one department, they show up in a new section.  For example.

  Outreach

    Joe Smith

    jane Smith

  Technical Services

    Joe Johnson

  Outreach, Technical Services

    Jane Johnson

Instead of having this separate display, I want Jane Johnson to be listed twice, under both Outreach and Technical Services.

Any ideas?


texts: How to use node reference to link images of referenced node?

texts:
I created a blog content type. In this content type I added a field "blog detail". I have a custom module to fetch data using node_load() in blog page. Now I want, when I click on a particular image, that this image's basic page would open using node_reference().

How can I do it?


texts: Views: filter content by two taxonomy terms

texts:
I have vocabulary with these terms:

Sport

Soccer
Hockey
...

term

subterm
...

And I have content where is chosen one of those subterms.

Then there is a second vocabulary (countries):

France
GB
...

I need to create view that will show content by path.

For example: /sport/soccer - this will show content with soccer term. (This is done by default)

But I need also this: /sport/soccer/france - content with terms soccer and france.

I know that I have to user Views with contextual filters. I am using Drupal 7 with Views 3.

Thanks for your help.


texts: Enable Password and Confirm Password fields in Registration form

texts:
i want to have registration form in my drupal site, but that is limited to the fields email and username.

I also want to have fields "Password" and "Confirm Password" in the registration form, so that the user does not need to check his email for his password and can login to the site directly after registration.

How can i achieve this?


texts: Paragraph of text in webform generated email is split into multiple lines rather than presurving single line of text

texts:
I am using a webform to send an email. The webform contains a textarea field.

I have noticed that if I enter a paragraph of text in the textarea field, then that same text is split into multiple lines in the email I receive.

So rather than being a single line of text which is wrapped within the email, it looks like the paragraph is split into separate lines (as shown in following image):

This is puzzling since if I check the body of the email using hook_mail_alter() the paragraph appears as a single line of text:

I can't work out why this is occurring. I am not sure if this is something that webform is doing or if it is something being done by the mail server itself (could it be something to do with plain text email protocal perhaps?). Was hoping someone would be able to enlighten me on the likely cause of this issue and how to solve it?


texts: Need help understanding Contextual Filters in Views

texts:
I would consider myself a novice Drupal user, and I am just beginning to learn more programming in general. One thing I never really understood was contextual filters (formerly "arguments") in Views. Now that I'm learning more about programming in general, I'm beginning to understand contextual filters more, but I have a question.

So, I just set up a View page that takes an argument from the URL. We'll call the path example.com/word/%. Then in the filters for the View, I have the usual

Content: Published (Yes)

Content: Type (= Article)

along with the one in question:

Content: [Field] (= %)

My goal is to create a page that only displays nodes that have the argument (%) as the [Field] value. So,

example.com/word/boogle

should take you to a page where the value of [Field] is, for example, "boogle."

I noticed (as you probably already know) that this does not quite work. What I get is a page that, from what I can tell, essentially lists all articles on the site. To make it work properly, I also have to set Content: [Field] in Contextual Filters. I don't quite understand why this is.

To me, it seems like if I'm telling the View to look for the argument provided in the URL, that should be enough to filter the results to articles that have that argument as the [Field] value. To me, I'm passing an argument from the URL to the Filter Criteria, and it should simple as that.

I'm sure I'm skipping an obvious step of logic in my thinking, however. Can someone explain to me why it is necessary to set the Contextual Filter as well, and why it is not enough to simply tell the URL to look for an argument and then tell the View filter to use that argument?

Thank you for your help.


texts: How to use db_select and apply a condition for another table's data?

texts:
I know this is probably the dumbest question ever but I'm just not getting warm with SQL.

I am writing this function which loads all users that have a role assigned:

function mymodule_get_users_by_role($rolename) {
  $role = user_role_load_by_name($rolename);
  $uids = db_select('users_roles', 'ur')
      ->fields('ur', array('uid'))
      ->condition('ur.rid', $role->rid, '=')
      // ->leftJoin('users', 'us', '(us.uid = ur.uid AND us.status = 1)')
      ->execute()
      ->fetchCol();
  return user_load_multiple($uids);
}

But I only want those users which's status = 1. I could do it afterwards but I really hope there is a way within the QuerySelect to add this filter beforehands. The commented line just produces a white screen of death so I'ma go with a nope. I dont even know if leftJoin is the right thing to do.

Thanks!


texts: Is it possible to make a particular column in a tablefield readonly?

texts: Since in my case I have three columns A, B and C. A and B holds a data and C stores the summation of those data. I wrote a custom javascript to do that and also tried to make column C readonly through javascript but the problem is while in a table rebuild the data in column C clears out but if I didn't apply readonly on column C then data remains. Any suggestions in this case will be highly appreciated.


texts: Non-autocomplete Widget for Term Reference Fields on Content Type

texts:
The available options at the moment are Autocomplete term widget (tagging), Select list and Check boxes/radio buttons, but I'd like to use a widget without autocomplete.

Thanks in advance.

EDIT: To clarify: I'd like to use a widget where you're able to add comma separated tags, just like the current one, but without ajax.


texts: programmatically saving a node doesn't add any record to dblog

texts:
When I call node_save to save a node, no record for "a new node has been saved.." is added to watchdog.

Is this normal? If yes, how do I also add a watchdog record? (without calling the watchdog function directly)


texts:
I am using my logo with the Corolla theme but its give me the following error:

  No setting detected for Mobile first or Desktop first. Please review "Settings > Mobile first or Desktop first" and select an option.

What do I have to do? How can I resolve this error?


texts: When term is not selected, output specific text

texts:
I have a content type, Article with a field 'Category' as term reference to 'category' taxonomy.

Category taxonomy has 2 terms, 'Live' and 'Outdoor'

Field's widget type is 'Check Boxes'.

When Live is checked, it should say 'Program is Live'
When Live is NOT checked, it should say 'Program is NOT Live'

When Outdoor is checked, it should say 'Program is outdoor'
When Outdoor is NOT checked, it should say 'Program is indoor'

Creating a terms view and using conditional field in view, I can check either value is empty or not, and can out put the desire result if there is only ONE term. But cant be done using multiple terms in the vocab.

When both are selected or not, every time both conditions are called for each term. And the output is true or false every time.


texts: how to create a view that filters on different fields depending on the content type

texts:
How can I create a view that contains events and news and filters on the event date if the content is event, and the expiration date if the content is news?

I dont see where to choose both simultaneously in the filter criteria.


texts:
I have been looking for a solution that allows me to add tabs to my website something similar to this page.

So far I have been using HTML inside of ckeditor to write all my content. However, now I need to be able to have a form and tabs.

Can someone provide me a module or a solution to have tabs and form ?

Thank you in advance

H.


texts:
I am in the process of recovering from a catastrophic hard disk failure on a completely new machine. I am fortunate to have both a database backup and a backup of the folder with the D7 code that was running on the original machine.

After restoring everything to the original state the site at first appeared to be running well. All nodes that I clicked on worked perfectly and showed the data I expected. The problems began when I tried to login. It looks as if submitting any form whatsoever (including the login form) does not have any effect. I couldn't even login until I generated a one time login link with drush uli. Using that link I was at last able to login with the admin user, but whenever I try to change something in the admin area I simply can't do it - the page is reloaded after I submit the form and my changes disappear. There are no error messages 1) in the web UI, 2) in the Apache log files, or 3) in the watchdog database table.

Things that I tried without any effect:

Clean the cache tables. All of them, both with drush and with phpMyAdmin
Set up a completely new site using the same codebase (Drupal 7.14). The new site works perfectly, after the setup I can login and create content without problems. The original site still doesn't work. This shows me that neither the Drupal code I am using is the problem, nor the Apache setup (the vhost for the new site is practically identical to the vhost for the problematic site).
Upgrade to Drupal 7.44
Disable all modules (only disable, not uninstall)
Enable tracing using the xdebug PHP module, but the result gave me information overload. I'm no PHP hacker.

I am now pretty desperate. I must overlook something essential, but for the life of me I can't find what it is. I am aware that this is all pretty vague, but I hope that someone with more experience than me can offer me a hint what I am doing wrong.

Info on my environment

Server

Debian jessie
Apache 2.4.10-10+deb8
php5 5.6.20+dfsg-0+deb8u1
MySQL 5.5.49-0+deb8u1

Client

Mac OS X 10.11.4
Firefox 46.0.1 and Safari 9.1 on Mac

Configuration

Drupal 7.14 and 7.44
SSL-enabled vhost


texts: Is there a successor project to Omega 4?

texts:
I'm a big fan of the Omega base theme, trying to make sense of what's going on with that project.

What I'm trying to do, is work with something similar to Omega 4 that is actively maintained on both 7 and 8 and will be capable of being upgraded to Drupal 8 in future.

I've read that there was a public falling out among the maintainers and that Omega 5 is progressing in a very different direction with different aims to Omega 4. I've also read that the Omega 4 maintainers are giving it minimal maintainence with many hints that their efforts will be focussed on other projects under other namespaces, and there have been no new dev releases since July 2015:

  Omega 4.x is still minimally maintained (I am committing bug-fixes and other critical / major patches). However, I am not interested in further moving on with anything under this namespace as stated previously in other issues. The reasons for that are well known and have been publicly discussed... There won't be any extended effort from me (and probably not from Matt either) to expand on the existing functionality of 4.x or even work on a new version... I will keep maintaining the 4.x version of course though so you can totally feel safe when using that at least.

Is there a new project that continues what Omega 4 was trying to achieve under a new namespace, that will be actively maintained on Drupal 7 and 8?

I've seen Khan described as "the omega 4.x successor for drupal 8", but it's had no work since 2014 and its project page is... baffling. It looks more like a Drupal community in-joke than a serious project. There's a thread with many people asking about this, but no clear answers.


texts: Static vs. Dynamic Queries in Drupal 7 and the Right Syntax to Use

texts:
Does anyone know of a good tutorial that explains, not with just one example of an easy query, how to create complex select queries in Drupal 7 that uses the preferred method of query writing?

I've written some complex queries in my custom module that use pretty elaborate and long, basic query syntax (a select clause, order by, where, etc.). I'd like to write them in the preferred format for Drupal 7 that I BELIEVE is supposed to look something like this:

https://www.drupal.org/dynamic-queries

I don't find that to be a very useful primer however. I want some actual guidelines for putting together complex statements with all the various options (if something like this exists).

And is it always better to write the queries like this?

I'd like to add a pager and this seems to be the only way to that.

I hope this question isn't too ambiguous. I'm really just looking for a tutorial on constructing these types of queries.
Thanks!


texts: How to create a block that shows recently viewed products/nodes for users?

texts:
I want to make a block that shows last viewed products for users (logged and anonymous), using Drupal 7 with Ubercart 3.

First, I tried to use the Recently read module. I don't why, but it's not working! Any changing in admin options (number of showing products and type of nodes) doesn't have any effect. And this block always shows ALL of my pages and products for all users.

Then I tried to do this using modules Flag + Rules + Session API. I found only a manual for Drupal 6.  But in section "Select the condition to add - Check a truth value" and Views configure it's not similar to Drupal 7.

Can anybody help me to implement this functionality? Maybe you know, why the Recently read module seems to not be working in my case, or maybe it causes some conflict? Or how to configure modules Flag + Rules in Drupal 7?


texts: FullCalendar does not display events except in the current month

texts:
I successfully got FullCalendar to work on a local test site (D7.26).  It worked great with events of this month, and I can even go to next month and return back in my view and now I don't get errors.  BUT when I make events for next month, the calendar will not show them when advancing to that month.  I don't get any errors as others reported, but I just get a totally blank month.  I can search for the events and sure-nuff, they're there in the database or list of events. It doesn't make any difference if I gave it an end date/time or not.  They all just will not show when I go forward to next month in my view.  Any help would be greatly appreciated.  I'm near the time that this site needs to go live.

Dave N


texts:
I'm new to Drupal and created a basic page in which the clean url is

/todo

If I want the todo's for a certain month I can do

/todo?month=januaray

However what I would like to do is provide a clean url which looks like

/todo/januaray

I tried modifying my .htaccess file like explained here

RewriteCond %{REQUEST_URI} ^/todo/(.*)$
RewriteRule ^.*$ /todo?month=%1 [L]

But that didn't seem to work. Is there any easy way to achieve this?


texts: Changing value of min / max resolution for an image field dynamically based on a previous select list

texts:
Does anyone know if there is a way in Drupal 7 to change dynamically the value of minimum / maximum resolution for an image base on a previous select list.

Example :

I have a select with 3 elements :

Square
Portrait
Landscape

When I select Square, the min / max resolution would be set to 200x200, if Portrait 200x400 and landscape 400x200.

I could create 3 different image field but in the future I'll have more type of layouts and I'd rather have only one image field (for database and theming purpose)

I was thinking State API but no solution there.


texts:
I am setting up a pre-process function to add the title of an OG group to the title of the image field of the same group. The idea is to have the name of the group show when the mouse cursor hovers above the group image if no title is given to the image when the group is created.

Here is what I have thus far:

function MYTHEME_preprocess_image(&$vars) {
  if (empty($vars['attributes']['title'])) {
  $vars['attributes']['title'] = $group_node;
 }
}

Somehow I cannot grab the name of the group node. What am I doing wrong? Is there a particular way group names are handled?


texts: How do I correctly setup caching for my custom block showing content depending on the current node?

texts:
I have this very basic block which just shows the current node's ID.

<?php

/**
 * @file
 * Contains \Drupal\mymodule\Plugin\Block\ExampleEmptyBlock.
 */

namespace Drupal\mymodule\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\Cache;

/**
 * @Block(
 *   id = "example_empty",
 *   admin_label = @Translation("Example: empty block")
 * )
 */
class ExampleEmptyBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $node = \Drupal::routeMatch()->getParameter('node');
    $build = array();

    if ($node) {
      $config = \Drupal::config('system.site');

      $build = array(
        '#type' => 'markup',
        '#markup' => '<p>' . $node->id() . '<p>',
        '#cache' => array(
          'tags' => $this->getCacheTags(),
          'contexts' => $this->getCacheContexts(),
        ),
      );
    }

    return $build;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    $node = \Drupal::routeMatch()->getParameter('node');
    return Cache::mergeTags(parent::getCacheTags(), ["node:{$node->id()}"]);
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return Cache::mergeContexts(parent::getCacheContexts(), ['user.node_grants:view']);
  }

}

But once cached, the block stays the same, regardless which node I visit. How do I correctly cache the result per node ID?


texts: hook_menu() item is not showing in primary-links even it exist in menu_links and menu_router tables

texts:
I'm using hook_menu() in my module which defines a menu item in the primary-links.

I flushed the cache and refreshed the modules page but the item didn't show in the primary-links.
I checked the menu_links and menu_router tables and the item was defined it them.

function mymodule_menu() {
  $items['newuser'] = array(
    'title' => 'Register',
    'menu_name' => 'primary-links',
    'page callback' => 'register_browse_page',
    'access callback' => 'newuser_access_callback',
  );

  return $items;
}

function newuser_access_callback() {
  global $user;

  if ($user->uid == 0 && user_access('access content')) {
    return TRUE;
  }

  return FALSE;
}

function register_browse_page() {
  $form = drupal_get_form("newuser_form");
  return theme("newuser_form_page", $form);
}

What is the problem? How do I fix it?


texts: Faceted search show tid instead of taxonomy name

texts:
I need to create a facet search using taxonomies, I have as a index the taxonomy term name but when I go to search, in the facet I see the tid and not the taxonomy term name. I follow a tutorial but I can't found the solution.

Search Index

Facet

Search

There is one issue in drupal.org talking about a TranslateTaxonomyProcessor callback processor but I don't know how to use it. Another issue talkin about the same processor: https://www.drupal.org/node/2673888

This is the list of my Processors:


texts:
I have a json file with 572 items. I have created the migration script and it runs ok, except that the end results says

  processed 572 items (1 created, 571 updated)

It looks like instead of creating one node for each item, only one node is created and then overwritten, so that only the last item shows.

I am guessing that I have problems with the item_selector: nlm from my json file with starts with

{
  "nlm": [
    {RECORD # : .....},
    {RECORD # : .....},
    ...
  ]
}

But changing the item_selector to anything else gives an error and the script doesn't run.

Any idea of how to get the script to create 572 nodes will be helpful.

Thanks

Edit:
my migration script looks like this:

langcode: en
status: true
dependencies: {  }
id: importjson3e
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: null
label: 'New JSON migration'
source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json
  include_raw_data: true
  urls: 'http://example.com/json/nlm_0119.json'
  track_changes: true
  item_selector: 'nlm'
  fields:
    -
      name: year_added
      label: YearAdded
      selector: YearAdded
    -
      name: month_added
      label: MonthAdded
      selector: MonthAdded
    -
      name: record_number
      label: 'RECORD # '
      selector: 'RECORD # '
    -
      name: Title
      label: 'TITLE '
      selector: 'TITLE '

  ids:
    record_number:
      type: text
process:
   type:
     plugin: default_value
     default_value: new_books
  title: Title
  field_year_added: year_added
  field_month_added: month_added
  field_record_number: record_number
destination:
  plugin: 'entity:node'
migration_dependencies: null


texts:
I would like to be able to let people submit abstracts with the Conference Organising Distribution. Is there a way already implemented? I did not see this.

The idea would be that people can enter information about themselves, the abstract and upload the tex file and select the session/track that they want to present in.

AND that we can approve the abstracts and add them to the schedule.

Is there an easy way for this? Seems like a pretty (academic) conference requirement.

Thanks!


texts:
I'm using the Superfish library in my Drupal 8.7.x project. I included it in composer.json like this:

 "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "name": "mehrpadin/superfish",
            "version": "2.1",
            "type": "drupal-library",
            "source": {
                 "url": "https://github.com/amclin/Superfish-for-Drupal.git",
                 "comment": "use amclin because of pull request 29",
                 "type": "git",
                 "reference": "c11a5ac10f8c99f809858c0384a4c415411778ce"
            },
            "require": {
                 "composer/installers": "~1.0"
             }
         }
    ]
.....

Now I found a patch to a problem I have, so I'd like to apply the patch to the JS file automatically. Much like the way I can apply patches to Drupal modules.
Specifically this one:

https://www.drupal.org/files/issues/smallscreen_patch.diff

Any idea how to do that?


texts: Print taxonomy term name in node.tpl.php

texts:
How can I print the taxonomy term name in node.tpl.php?

The following prints the name as a link, but I just want to print the name as text so I can make it a <div> class.

<?php print $terms ?>


texts:
In my theme I have link to social network. So, I would like to have field in theme settings where administrator can put link what would be use in all place where is {{link-social-network}}.

I also read that theme settings default values can not be set in a theme's info.yml files.

The theme's config/install/THEME.settings.yml file should have that information.


texts:
How do I load the Bootstrap theme (css, js, fonts) locally?

I've searched around the drupal stack exchange, but every suggestion I've come across doesn't solve the problem. It seems like the other option is to create a sub-theme, but I'm not even sure if that will load all the necessary files for bootstrap locally/offline. The whole purpose of this is to load the bootstrap theme and its css/js/fonts without using any internet.

The issue is that I'm seeing the error as another user did like this:
https://www.drupal.org/files/issues/screenshot_218.jpg

There are answers like these below, but there has to be a way to do it without more installation other than drupal modules:
https://www.drupal.org/node/1978010
Using own Bootstrap 3 files


texts: How to create a module to allow for multiple instances of the same module with different variable parameters

texts:
How do you create a module to allow for multiple instances of the same module block with different variable parameters. I know how to create global parameters but that will apply to that block across the site.

this is an image of opening up the settings for the block on the panel


texts: Adjust search system - return all nodes, but exclude a specific node type if a field is less than current date

texts:
I am hoping to adjust the search system results. It works great, but i have an issue with some of the results. When a user searches "Training" I pull up all node's that have "Training" in their titles, bodies, tags, etc.

I want to continue to pull up all node types. But if one of the node types (calendar_item) pops up, I got to check one of it's fields for a value, if it has a particular value then we exclude it. I found the best way of checking if the field has a value is by going to a different table (field_data_field_date) for a value in it's field (field_date_value2). To join that table to our current query we check entity_id field (in field_data_field_date) and compare it to the node.nid. Below is an example, the only issue is it actually excludes all other node types, so the only thing I bring up is calendar_items. Anyone know How to still bring up all nodes, but if it's this particular node type do the conditional check?

Please and thank you!

function mymodule_query_search_node_alter(QueryAlterableInterface &$query) {
 $u_alias = $query->join('field_data_field_date', 'fd', 'n.nid = fd.entity_id'); // No idea what the field is called, assuming 'search.date'.
 $query->fields('fd', array('field_date_value2'));
 $query->condition("{fd}.field_date_value2", '2016-03-08T21:30:00', '>=');

}

EDIT #1:
I have now adjusted the code to the following:

function mymodule_query_search_node_alter(QueryAlterableInterface &$query) {
    $u_alias = $query->join('field_data_field_date', 'fd', 'n.nid = fd.entity_id');
    $query->fields('fd', array('field_date_value2'));
    // OR clause. The default is AND. To use or, you need to use:
    $db_or = db_or();
    // Add the conditions for the OR clause
    $db_or->condition("{$u_alias}.field_date_value2", '2016-03-08T21:30:00', '>=');
    $db_or->isNull("{$u_alias}.field_date_value2");
    // Pass the Or clause to the query object.
    $query->condition($db_or);

}

If I replace

$u_alias = $query->join('field_data_field_date', 'fd', 'n.nid = fd.entity_id');

with

$u_alias = $query->leftJoin('field_data_field_date', 'fd', 'n.nid = fd.entity_id');

I get no results! But just a simple join gives me only calendar_items.


texts: What is the best way to delete or disable ( most expected) the field of a content type?

texts:
We have several content types (features) on our Backend, now site Administrators (authors) and content managers need some field to be disabled when creating content. How I can manage it?
I heart about the 'field_permission' module but I'm not sure if that module can solve my problem.
What could be the best way to disable these fields? Is there some module or could some one explain where I should start?
Pseudo code are Welcome
Thank you in advance
Hermann


texts: Obtaining the node type being added with php

texts: Other than pulling the information from the url itself, is there a way to retrieve/obtain the node type that has been selected in the add content area. ie: www.mydomain.com/node/add/article... using PHP? I have been able to do this when updating/editing a node using menu_get_object() in a template file but not when adding a node.


texts: Issue a Conditional Redirect in Drupal 7

texts:
I have a custom payment form that redirects to a 'Thank You' page on success. The page is just a Page type node, so someone can control the content of the page.

What I wanted to do was add a little extra, and prevent the page from being seen unless they had just come from the form.

I tried using 3 functions. hook_node_view, hook_node_view_alter, and hook_init.

I thought the first two would allow me to check the node path or nid, and redirect if I needed to, but they did not seem to be called. Additionally, I tried

mymodule_init() {
  global $user;
  krumo($user);exit;
}

That was not being hit, either. The rest of the module works fine, custom menu item, custom form, validate/submit/mail hooks. I am stumped.

How can I check a node value when loading, take action, and furthermore, why is hook_init() not dumping/exiting?


texts:
Is there any method to override this function theme_file_widget.

I tried to to do the following in my module.

function mymodule_file_widget($variables)

and also in my theme

function mytheme_file_widget($variables)

but did not work. I cleared the cache also. Is there any method to override this function?


texts: Batch delete users and the content they created

texts:
When I received this Drupal 7 site to manage, it has had years of being open for people to make accounts and now I have ~ 300 PAGES of users with names like ismehacker1234568 and such, with under a dozen legitimate accounts I need to keep.
Once, on another site long ago I tried removing the users from the database table using a SQL query.  That was a disaster and broke the entire site.  I want to avoid that this time around.
I also need to delete any content they made, but not anything the legitimate users made.


texts: Auto remove white background and add alpha channel to images?

texts:
I use Drupal 7.41 and created a "customers" view. This view get's nodes from the content-type (also called) "customers".

When I add images, some of them contain white background that conflicts with the sites gray-brick background; Is there a way to automatically make all uploaded images' white background removed and added an alpha channel so there won't be such a conflict?

Note: I can do that process manually with GIMP\Photoshop but looking for a module that does that automatically.

Thanks.


texts: Question about D7 Organic Groups, Memberships, and Views

texts:
I have been using OG and Views on Drupal 7. I think it's great but am having one problem. Here's the situation: I am creating views of content, and am wanting to show which group each piece of content is a "member" of. To do this, I bring in a "group membership" relationship and then another group relationship, which then lets me show the GID, title, etc., from the Organic Group.

But here's the problem: as soon as I introduce the "OG membership" relationship into the mix, it begins to show each piece of content twice (or 3 or 4 times) if that content is posted into 2, 3, or 4 groups. I think this is because in the og_memberships table, each membership has its own ID.

What I'd like to do is show each piece of content once, but have a "multiple" type setting on the OG field area, the same way I can show multiple imagefields or Taxonomy terms that are all related to one node.

Anyone got experience with this?


texts:
Is it possible to generate a year-wise archive of blogs using views?I need years listed like 2001,2002,...2012 and clicking on the year should display list of blogs for that particular year.
I added a contextual Filter Content: Created year also , but it this query only SELECT DISTINCT node.nid AS nid, EXTRACT(YEAR FROM((DATE_ADD('19700101', INTERVAL node.created SECOND) + INTERVAL 0 SECOND))) AS created_year, COUNT(node.nid) AS num_records
FROM
{node} node
WHERE (( (node.status = '1') AND (node.type IN  ('blog')) ))
GROUP BY created_year, nid
ORDER BY created_year ASC .So this results in duplicate value for years


texts: Views page redirect to current page with parameter

texts:
in drupal 7, I use drupal_goto function for the redirection. I'm trying a few methods in d8, but couldn't make it work.

If I visited a certain page for example /views-page-example, I would like to redirect users to the same page, but with parameters. Once visited, the users should be redirected to /views-page-example?name=value. I'm using template_preprocess_page to trigger the redirection.

This is the current code I have so far:-

use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;

function THEME_preprocess_page(&$variables) {
  $current_path = \Drupal::service('path.current')->getPath();

  if ($current_path == '/views-page-example') {
    $path = "/views-page-example?name=value";
    $route_name = url::fromRoute($path);
    $response = new RedirectResponse($route_name->toString());
    $response->send();
  }
}


texts: Drupal Commerce, Search API DB and Views | How to display the product variation accordingly to the attribute being applied as filter?

texts:
SCENARIO:

A Size attribute field has been added to a Product Type at /admin/commerce/products/types/PRODUCT-TYPE/fields and "Enable this field to function as an attribute field on Add to Cart forms." option has been checked.
Two products have been created at admin/commerce/products/add/PRODUCT-TYPE. Size attribute Large at a price of $20 and Small at a price of $10 respectively.
One Content Type display node has been created at node/add/CONTENT-TYPE. The two sized product variants were attached to the Product Reference field.
A Search API Index for the product nodes has been created at admin/config/search/search_api/index/PRODUCT-INDEX.
A Search API - Product Index View has been created at admin/structure/views/add.
The Size Attribute has been added as an Exposed Filter Criteria to the view. One could also use the Size Facet.

ISSUE:

The filtering works just fine. The issue lies on the product field values displayed, like price for instance, that do not align with the filtering criteria.

Regardless of which size has been applied as filter, the price displayed on the view represents the first product attached to Product Field reference on the product display node.

In our case scenario, the Large size product is first on the list of products attached to the Product Field Reference. If size Small is applied as filter, it displays the price of $20 on the view display. This is troubling because $10 should be displayed instead.

Is there a way to fix it? That is, the price + other product fields will display the variant values accordingly to size attribute being applied as filter?

UPDATE:

This question here addresses the same issue wrapped into a different context.


texts: Best approach to move content between different instances/installations

texts:
As most of us are, I am involved on a project where we have different environments.
I have created a profile for the initial installation and we are working with Features to maintain all environments with the same Content Types definition, views, rules, ... When we need to do a change, then we recreate the feature and put in the other environment.

Sometimes I have found I can't do a revert of one feature due to existing data, so I feel interesting and needed to have a very strong mechanism to extract, delete and put again into the site created content.

Also, in the case the customer will use the preproduction environment to start using the application, they will want these contents will be placed into the production environment without the need to create them again.

So I am looking for a strong solution to keep all the contents of the site, easy to backup and move between environments.

I have been playing with:
 - node_export
 - node export dependency
 - field_collection_deploy
 - bulk_copy

But I can't achieve to have a strong copy of the content. One of the content types has Taxonomy references and field collections those are not exported/imported, and at the end of the import I have several Notices as:

Notice : Trying to get property of non-object dans field_collection_field_get_entity() (ligne 1679 dans /users/cve00/web/html/sites/all/modules/contrib/field_collection/field_collection.module).

Please, I'll appreciate if anybody could point me to the best procedure to accomplish this common need or guide me to do it with these modules if I am missing some operation.

Thanks in advance.

PS.- Even if someone will remove this sentence by editing the post, I feel grateful for your reading :)


texts: Drupal doesn't output list of children on custom module page

texts:
I am on Drupal 7. I want to create a page that lists its children, the same way you see the list of links in 'admin/structure' (Blocks, Content types, Entity types ...).

I have modified child 1 and child 2. They aren't really important for this example.

on mymodule.module I have inside function mymodule_menu():

  $items['admin/mymodule'] = array(
    'title' => 'My module parent page',
    'page callback' => 'mymodule_admin_page',
    'access callback' => 'mymodule_admin_list',
    'access arguments' => array(1),
    'file' => 'mymodule.admin.inc',
  );

  // Child 1
  $items['admin/mymodule/child1'] = array(
    'title' => 'Child 1',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('mymodule_something_01', 1),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'mymodule.admin.inc',
  );

  // Child 2
  $items['admin/mymodule/child2'] = array(
    'title' => 'Child 2',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('mymodule_something_02', 1),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'mymodule.admin.inc',
  );

Then, on mymodule.admin.inc, I have this function:

function mymodule_admin_page() {
  $item = menu_get_item();
  if ($content = system_admin_menu_block($item)) {
    $output = theme('mymodule_admin_list', array('content' => $content));
    // This gets printed on the page
    drupal_set_message('This gets printed on the page');
  }
  else {
    $output = t('You do not have any administrative items.');
    // This doesn't get printed on the page because my base page has children.
    drupal_set_message('This doesnt get printed on the page because my base page has children.');
  }
  return $output;
}

Finally, according to documentation I have read, I should add a function like the one below:

function theme_mymodule_admin_list($variables) {

  $content = $variables['content'];
  $output = '';
  // This doesn't get printed on the page...
  drupal_set_message('this doesnt get printed... Why???');

  if ($content) {
    $output = '
';
    foreach ($content as $item) {
      $output .= '
' . l($item['title'], $item['href'], $item['localized_options']) . '
';
      $output .= '
' . filter_xss_admin($item['description']) . '
';
    }
    $output .= '
';
  }

  return $output;
}

Check my drupal_set_message above. Messages on function mymodule_admin_page get printed, but messages on theme_mymodule_admin_list don't get printed... Actually, admin/mymodule responds as a page, but instead of displaying links to its children, it will display a blank page...

I must be missing something, but I really don't know what. Thank you!

========

SOLUTION

I am posting the solution below. Thank you, Geoff, for your comment. It did the trick! I was missing one of the pieces in this puzzle, which was the mymodule_theme function.

function mymodule_theme($existing, $type, $theme, $path) {
  return array(
    'mymodule_admin_list' => array(
      'variables' => array('content' => NULL),
      'file' => 'mymodule.admin.inc',
    ),
  );
}


texts:
I've been trying to redirect the password reset page to my custom login page by creating a small custom module; however it's not resolving properly.

Has anyone done this before with success?  The code that I'm trying to use is:

function m2f_password_reset_form_alter(&$form, &$form_state) {
  if ($form['#action'] == "/user/password"){
    $form['#submit'][] = 'user-pass';
  }
 }
/**
* Redirects user after password reset form is filled
*/
function m2f_password_redirect(&$form, &$form_state){
  $form_state['redirect'] = 'node/20';
}


texts: How to make work Restfull /user/register?_format=hal_json

texts:
I am trying to access. All required modules are included, rights granted. so does not work.
/user/register?_format=hal_json

I get a message:

{"message":"Not acceptable format: hal_json"}

In RestUi settings, hal_json format is enabled.

And in the log:

Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: Not acceptable format: hal_json in Drupal\Core\EventSubscriber\RenderArrayNonHtmlSubscriber->onRespond() (line 30 of .../web/core/lib/Drupal/Core/EventSubscriber/RenderArrayNonHtmlSubscriber.php).

Drupal 9.0 and Drupal 8.8.4


texts:
I have a custom content type with  "Set custom language as default for new content" and "Require language". Custom default language is Current language.

Entity translation is defined with "Current language" as "Default language"
and "Exclude Language neutral from the available languages" enabled.

I have 24 languages enabled but when creating a new node, only English appears as a language. But I need to be able to set any of the 24 languages

What am I  missing?


texts: How to make Drupal Commerce tokens available in the Commerce Message module?

texts:
In addition to the Drupal Commerce module, I installed the Commerce Message module for Drupal 7. Everything works fine so far.

I created a new Rule to send a billing e-mail in addition to the order completed e-mail to the customer.

But now I have the problem that I can not apply any tokens that give me the address or full name of the customer. It seems, that the standard Drupal Commerce tokens do not work in the Commerce Message module.

I looked through the files of Commerce Message and I can only find a few tokens that do not help at all.

According to law I need to send billing information to the customer. Including the customer's full name and address.

How can I use the Drupal Commerce standard tokens with Commerce Message?

Also despite saying that it would be able to use multiple html tags it does not. Whenever I use  (for example: italic) it does not include such  in the e-mail (for example: it only includes  /italic/).

Any help?


texts: different templates for print and deafult version of the node

texts:
I've faced with a problem of differentiating node templates for print-version (I'm using "print" module) and default node's default template.

I have a <div> which should be present in node--node_type.tpl.php but not in print-version (it contains info that is not required when viewing the page not on the display).

Currently I'm solving this with adding

<?php if (arg(0) == 'node'): ?>
<div>.....</div>
<?php endif; ?>

But it seems to me that this kind an awkward way.

Can you offer any Drupal-alike and more convenient way to gain that?

Thank you.


texts:
So, I have a view that has multiple exposed filters.  If someone selects one of the filter options, I need the rest of the exposed filters options to change dependent on what was selected in the first.
For example three of the filters are: instruction, video duration, learning level.

If a specific instructor is selected, the video duration and learning levels should change to shown only the videos of that instructor. (These are not based on taxonomy.)

I am using Drupal 6 and Views 6.x-2.


texts: How can I prepopulate a field when creating a new node with the values from a field collection?

texts:
I am creating an inventory management system in drupal. I have two different content types: and item and a purchase order.

An item has a name, style code, Colors (this is a field collection with a color name and color code), and a range of sizes (3 to 15 for shoes and XS to 4XL for shirts). Some items don't have colors and some don't have sizes.

In a purchase order, there is a purchase order number and any number of items ordered (a field collection with an entity reference to the item, a field for the number of items ordered, and field for the number of items received). Each item ordered will have one color (one of the colors that the item is available in) and any number of the sizes that was selected in the given item.

My question is how I can populate the color selection (probably a dropdown) with the colors that are in the field collection of the selected item (entity reference). I would also need to populate the sizes list with the sizes that were selected from the item, as well.

I am still pretty new to drupal, and I realize that I may be going about it the wrong way or that I may not have explained everything that someone would need to know to help me. But I am open to new ideas or different solutions. I haven't done much module development, but I would be willing to learn if needed.


texts:
I have a project that is using Views PHP, and I'd like to figure out which views are using PHP from this module. This will help me determine if I can easily remove the dependency on the module.

Is there a query or something else I can use to figure out what views are using this module?


texts: how do I make rounded borders around everything in a drupal 7 site?

texts: I have a site which is supposed to have rounded corners. what I need is a boarder that covers everything, but has rounded corners. right now, even with rounded corners, the boarders are square, and cover past the header. what am I doing wrong? I am using  border-radius 20px 20px 20px 20px; in the css


texts: How to lock a piece of content form being edited by specific roles?

texts: I'm using Drupal 7. Right now, all users can create certain content. the way I have it set it is that all content has to be approved by users of the "editor" and "administrator" roles. Once the content is edited and approved I want to lock out the author so that he can not edit it anymore.


texts:
can any one help me how to expose the taxonomy term filter in view in drupal 7. I have created a view with

   Fields:

     1. Title

     2. Body

    FILTER CRITERIA:

     Has taxonomy terms (with depth)

when i expose this filter it is not getting exposed.

can anyone help me how to expose the taxonomy term field.I need to see the content get filtered based on the taxonomy term.


texts: How to create a list of FULL Nodes without titles (Views)

texts:
I would like to create a list of FULL nodes with comments but no titles (with the module Views) is that possible?

Currently I have already a list which shows the FULL node with comments. But also the title which is even an URL.

Can someone explain me how I can do this with Views? If it isn't possible, is it then possible to have the title listed as plain text instead of an URL (duplicated content etc.)?

Using Drupal 6.x

Thanks in advance!

Ps: Just thinking, or should this be done with theming?


texts:
How do I create a node from an existing content type on front end? Let's say we have a article i need to associate tags with it in a fashion.
For example a book of tags which a user can view . Either we can create a book or we can add tags to an already existing book. Those books are binded to a user also.


texts: How do I submit call handler on radio button selection?

texts:
I use the advanced polls module in Drupal 7. I am trying to alter the behaviour so that the vote is submitted as soon as the radio button is selected (without having to hit Vote).

The module is using an ajax callback:

$form['submit'] = array(
'#type' => 'submit',
'#ajax' => array(
  'callback' => 'advpoll_form_submit',
  'wrapper' => 'advpoll-form-' . $values->nid,
  'name' => 'submit1',
),
'#id' => 'edit-submit-advpoll-' . $values->nid,
'#value' => t('Vote'),

);

How can I invoke this callback with radio buttons?

I am happy for a quick and dirty javascript/jQuery solution as time is a real factor.

I have tried a jQuery solution:

$('input[type="radio"]').change(function() {
  $('#advpoll-form-296').trigger('click');
});

However this is not invoking the action as expected.

I cannot call submit() as I don't want to cause a page reload.

I have managed to get my original code to fire by adding a click event to the ajax array in the .module file.

advpoll.module:

function advpoll_choice_form($form, &$form_state, $values) {

$form['submit'] = array(
'#type' => 'submit',
'#ajax' => array(
  'callback' => 'advpoll_form_submit',
  'wrapper' => 'advpoll-form-' . $values->nid,
  'name' => 'submit1',
  'event' => 'click', //Added click event
),
'#id' => 'edit-submit-advpoll-' . $values->nid,
'#value' => t('Vote'),

);

I am aware I should not override code within the module. How would I go about getting this into a theme hook?


texts: How can I use regex in a migration query condition?

texts:
I have data in a table that looks like this:

|-------------------------------------------------------|
|ID|              Data                                  |
|--|----------------------------------------------------|
| 1|{"key":"value",...,"image":"1234567",..."key:value"}|
| 2|{"key":"value",...,"image":"",..."key:value"}       |
| 3|{"key":"value",...,"image":"9876543",..."key:value"}|

In my migration I only want to import items that have an image ID in the Data column.

Previously I was doing this in my migration class query() method:

class myMigration extends SqlBase {

  public function query() {
    return $this->select('data_table', 'd')
      ->distinct()
      ->fields('d', ['ID', 'Data'])
      ->condition('Data', '%' . db_like('"image":') . '%', 'LIKE');
  }

  public function fields() {

    $fields = [
      'ID' => t('ID'),
    ];

    return $fields;
  }

  public function getIds() {
    return [
      'ID' => [
        'type' => 'string',
      ],
    ];
  }

This was also selecting rows where the image value was empty in the Data column.

This query in SQL works for selecting the correct data, but I cannot get it to work with the query() method in my migration:

SELECT ID, Data
FROM data_table
WHERE Data REGEXP '"image":"\d*[^>"]';


texts: Show custom fields with Search API Database Search + Views

texts:
I'm indexing the title from one content type using Search API.

When I try to create a Search API Database Search + Views, I can't render the other fields of that content type, I just can render the title. I tried with all custom fields available in the views options, but the view only shows the label for those fields.

Then, I also tried indexing other fields, an image field to be specific. But I got the same results just the labels are showing, something like "The image file. (indexed):" or "Image:".

Is there some way to show in the results of the Search API + Views a custom field like an image field?

Thanks!


texts: How to publish content based on a Date field in custom content type in Drupal 7?

texts: I have a Date field in a custom content type in Drupal 7. I would want to control the publishing of the content instance based on that particular Date. I want the job of the Scheduler module but have it as a field in my content type and access it accordingly. Is there a way to do it using triggers or Rules? Any thoughts on this would be really useful.


texts: Displaying articles created by user in profile page using views

texts:
I want to display the articles created by user in user profile page. It should also display to anonymous user also.

For example : twitter.com/google displays all tweets by google.

Like that I want to display xyz.com/john. I want to display all articles created by john in user profile page.

I also want to know how to add that view to profile page.


texts: Altering a URL alias without using a module

texts: Is there a way to alter a URL alias without using a module? Somebody told me to write a record into database table, but I don't know how to do it.


texts:
Am using webforms and under the email handler, I have the following as email body:

Submitted on [webform_submission:created]

Submitted values are:

Name:&nbsp;[webform_submission:values:name]

Surname: [webform_submission:values:surname]

Email: [webform_submission:values:email]

Mobile: [webform_submission:values:mobile]

Date of Birth: [webform_submission:values:date_of_birth]&nbsp;

Country: [webform_submission:values:country]

Region: [webform_submission:values:region]

Enquiry: [webform_submission:values:enquiry]

Message: [webform_submission:values:message]

&nbsp;

Under the advanced section, I clicked the option to send email as HTML. However, the following is what I see in the email body:

Submitted on Wed, 04/22/2020 - 09:21 Submitted values are: *Name:* MyName *Surname:* MySurname *Email:* myexample@example.com [1] *Mobile:* 0212212254 [2] *Date of Birth:* Wed, 12/12/1990 - 00:00  *Country:* AO *Region:* GP-P Enquiry: [webform_submission:values:enquiry] Message: hvnbvnm   [1] mailto:myexample@example.com [2] tel:0212212254

How do I fix this?


texts: How to set webform value in action while creating rules

texts: I want to set the web form fields value ones certain condition satisfy. Please let me know how i can do this.


texts: How to display parent term name of a term located in a paragraph?

texts:
I have a vocabulary for employees, which has a paragraph field. In this paragraph entity, I have two fields. One for date and one for the job title. The hierarchy goes like: company > department > job title. I've created a view where I list all employees and what I want to accomplish is not to show what their job title is. I want to display in which department they work.

Any help is appreciated.


texts: How to prevent from getting spammed in a contact form

texts: I have the captcha image module and an email address keeps spamming me in a website feedback contact form.  I do not know how to get their IP address and I do not want to take down the form for the public.  Any suggestions?


texts:
I have a website which is AJAX enabled for a great part.

My client now of course wants the browser buttons to behave as expected, which means the page should revert to the previous states when the 'back' button is pressed and so on.

I know there are solutions for this use case, the most interesting one being (seemingly) history_js and its fellow Statehandler module.

I didn't test it yet, because it seems to be heavily based on coding - which I could handle - but I wonder if there is a more elegant (mean : abstract) solution.

The following points are mandatory :

It must work with AJAX Views, including dynamic filters.
It must work with custom AJAX links.
It would be wonderful if it worked with popups (Colorbox style for example), but I think it's a lot to ask for so I could do without it.

What is your experience with AJAX browser history in Drupal 7 ? Any hint on the pitfalls you encountered would be very appreciated. A working solution or a good tutorial would be amazing.


texts:
I have Lightbox2 installed on my Drupal Project. I am trying to use lightbox2 through links, for example:

<a href="/absolute-path-to-image" rel="lightbox">
   Link
</a>

It works only when I turn on the Lite version. How can I make it work on normal one? I have read that there is a possibility of wrong path. Already checked all of the possibilities and I can confirm it's not that. Is it possible that it collide with jQuery?

Thanks.


texts: Button in multiform make it go to different steps

texts:
Well I have an issue with a multiform. I have use the example files in
https://www.drupal.org/project/ms_ajax_form_example as a base for what I have to do in a Drupal 8 site.

Everything runs perfect, but I need in the first step to validate if the user selects a radio button, and depending in the selection of the radio make the user go to different steps in the form.

So I have my radio button in my first step:

$form['inquiry_type'] = array(
        '#type' => 'radios',
        '#title' => t('Is your inquiry regarding Parcels or Mail?'),
        '#default_value' => 0,
        '#options' => array(
            0 => t('Mail'),
            1 => t('Parcels'),
        ),
    );

The pre selected value of the radio is Mail, if the user leaves it like that the code will take him to the step number 2. But if the user selects Parcels the code should take him to step 3.

Here is how the instance of the class of the next button is done in the same class.

public function getButtons() {
    return [
      new StepOneNextButton(),
    ];
  }

And the build function in the StepOneNextButton class.

public function build() {
    return [
      '#type' => 'submit',
      '#value' => t('Next'),
      '#goto_step' => StepsEnum::STEP_TWO,
    ];
  }

I'm really new to Drupal and all of this has been an interesting journey. But I'm not sure how to evaluate the selection of the radio before the user clicks the button.

Hoping you guys can give me some insights of how this should be done.


texts:
I'm trying to create a webform that generates a new page filled with that submission data. So certain users can add/edit new pages easily.
Is there a certain webform setting I'm missing for this? I've looked around and have only managed to get the data to display on a single view in a table.
Thanks!


texts: I can no longer set a base color in Mayo theme in Drupal 7

texts: I've been using the Mayo theme for a while now, but I was adding content one day and the base color suddenly went to white, and there is no longer a slot for setting a base color in the Appearance settings.


texts: Rewriting the output of a file download field

texts:
I have a content type with two fields, one pdf field which will be downloaded using the Download File module which provides a formatter (file download) to automatically download the pdf file with one click and one image field linked to the pdf field, using the Linked Field module. This works in the node without problems.
The problem is when trying to rewrite the results of the image field in Views.
I set the file field with the "File download fomatter" and exclude it from display.
Then, I try to rewrite results of the image field like this

{{ image_field }}

or

{{ image_field }}

but this is not working.

The files are stored in the folder

[root]/file-download/download/public[node:field_file_download:entity:fid]

What am I missing?


texts: How can I avoid clearing caches when CSS changes are made?

texts:
Every time I make the slightest CSS change, I need to clear cache to see the changes.

What can be done about this?


texts:
In my drupal site I need to restrict the access of a view to certain users.
The senario is like, each user will be assigned to a certain Item. Each item is a view.
The users relation to the items is defined in a mysql table.
Now what I need is, When ever a user clicks on a pirticular view (item) I need to check if he has access to that. Where can I write the code for this ?


texts:
There is a module in the D8 core - Layout Builder. The functionality is enough for my needs. I need initiate the settings by a profile and also have possibilities to move configurations from stage to stage. If layout builder is configured for every content type it is possible to move the settings by the configuration or features. In my case the layout builder is configured for every node. So this is the content entity. I tried a module default_content to move content to the configuration. But it saved an empty field. It was related with a serialization problem. Serialized node does not contain layout data
Is it possible to attach the layout builder to a configurable entity?


texts: Trim whitespace from Float fields before validation

texts:
I have a content type with a Float field. When my users accidentally enter (or copy/paste) a value with trailing whitespace (e.g. "11 "), drupal gives them the ugly error message:

  Only numbers and the decimal separator (.) allowed in Weight.

But this should be a very easy thing to solve and is not something to bother the user with. However, I can't seem to figure out how to interject code from my module at the right place in order to trim() the value before drupal does its field validation.

Help?


texts: Where should I define the "drupal_stale_file_threshold" Drupal variable?

texts:
I want to delete my CSS and JavaScript files every day. Where do I define the "drupal_stale_file_threshold" variable?

In the template.php file with variable_set('drupal_stale_file_threshold', 86400);
In the settings.php file with $conf['drupal_stale_file_threshold'] = 86400;