texts: Can multiple users edit a node to create several different revisions without being able to publish them?

texts: I want to create a Wiki style website where many users can edit a document but can not publish their edits. Imagine having four users -- an administrator and three normal users. The three users can't publish anything they create or edit. So... one user creates a node. The administrator publishes the node after reviewing it. Then a second user edits the node and it's saved to a draft and after the third user edits the node and it's saved to a different draft. Now there is a published node and two different drafts of the node from two different users waiting for the administrator to publish one of them. Is there a clean Drupal solution for this?


texts: How can I validate that a date is available before prompting the user to complete the rest of a webform?

texts:
I have a webform that contains a date field. I need to run some code that checks to make sure the date is not already in use (i.e. that no one else has submitted a webform with that particular date). I already have the webform validation module installed, and I know I could use that (create a custom module with custom validators), but the validations don't run until the form is submitted. Because there's a required file upload, I'd rather be able to allow the user to check if the date is available before doing the upload.

Is this possible? How would I go about it?


texts:
Using kickstart 2-rc4 I seem to miss some Dutch translations (I used the 2.x translation file).

If 'Add a product' ('Voeg een product toe') is translated, then why would 'Manage products' not be translated? The Dutch .po file does indeed not contain a translation for this, but it seems weird, if you would translate the one, why not translate the other?

Am I doing something wrong here?


texts: colorbox custom caption via field collection

texts:
I want to have a content type with a field collection of an image and a text field. The image is to be displayed via Colorbox, the text field is to be used as the caption for the image.
I am sure I achieved this without problems before.
When I want to chose the relevant token for the custom image caption in cbox, the token browser does not allow me to use the other field. Only the current date, page use, files, random and site information token groups are available (see image below).
What am i doing wrong?


texts:
I am trying to implement the solution given in this question.

I want to have custom templates for 4xx pages.

I am using Drupal 8.3.1

I have tried the code as given in the above link to create the page suggestions in my theme's .theme file:

/**
 * Implements hook_theme_suggestions_page() to set 40x template suggestions
 */
function MY_THEME_NAME_theme_suggestions_page(array $variables) {
  $path_args = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
  $suggestions = theme_get_suggestions($path_args, 'page');
  $http_error_suggestions = [
    'system.401' => 'page__401',
    'system.403' => 'page__403',
    'system.404' => 'page__404',
  ];
  $route_name = \Drupal::routeMatch()->getRouteName();
  if (isset($http_error_suggestions[$route_name])) {
    $suggestions[] = $http_error_suggestions[$route_name];
  }

  return $suggestions;
}

It does not appear to work.

page--404.html.twig or page--system--404.html.twig are not being used.

404 and 403 pages are not set inside the admin of the page.

What else am I suppose to do to get this working?


texts: Database administration site on Drupal: entities vs. manual programming

texts:
I've been asked to build a small database administration site based on Drupal. The site should have basic editing possibilities of the existing database with several tables. (The structure is not complicated).

To get it more clear, one table contains books being sold in the publishing center. The book has a set of identification numbers, title, e.g. The structure of book is very similar to basic node with fields.

The question is: Is it a good idea creating a custom entity with described architecture and process data in terms of 'book'  entity (and therefore the database will be automatically modified according to current architecture) OR it's better to implement simply some interface and update database manually using db_query etc. ?


texts:
How do i get field type (e.g textfield, option, etc.) from $form_state in below method.

public function validateForm(array &$form, FormStateInterface $form_state)


texts:
My question is rather simple, but I didn't manage to find anything that can help.

Summary of my setup :

Pathauto
Views
Entity Reference

So I have various custom content types, which I want to organize using views. But for SEO reasons, I want them to use simplified URLs, generated by Pathauto.

These content types are all cross-referenced using Entity Reference, and when I try to configure my View "Page" using the node ID as contextual filter, it works. But when I try to use Pathauto, nothing happens.

So how can I use Views, basically when going to http://example.com/fruits/banana and pass "banana" argument to Views, to filter my content ?

I am searching for it for almost a week, and I am lost.


texts: Additional Information pop up box next to a variation in drupal commerce

texts: I am creating a commerce site using Drupal Commerce, there are some variations for products that I would like to inform the customers about. Theres the option of having a sticker finish that is a variation and I wanted to have a "What is this?" text field right next to the select list that then launches a colorbox/fancybox/popup that displays additional information about that variation. Something similar to this:


texts: Using hook_form_alter(), how do I write a multi-select field?

texts:
So I have a field that displays locations a list of multi-select locations.

The select has a name of field_location

I want to turn access to this off, and then rebuild the field with a limited list of  locations that I will populate.

function rm_report_form_alter(&$form, &$form_state){
    if (arg(0) == 'node' && $form['form_id']['#value'] == 'c_node_form') {
        $form['field_location']['#access'] = FALSE;
    }
}

The problem:  Not sure how to rewrite a multi-select field.


texts: Rendering a 'google_map_field' when referenced via entity reference field

texts:
I have a content type with an entity reference field to another content type. We'll call the first content type A, and the other B.

In my node level template for A, I need to output a google_map_field (https://www.drupal.org/project/google_map_field) from referenced entity (B).

I'm outputting other fields from B by using:

node.field_entity_reference.entity.field_example.value

However, this does not work for the google_map_field. Lots of errors spit out, regarding parts of the google_map_field, such as lat, lng etc. I'm guessing this is because the module usually does some processing of this field, which isn't being done due to the nature of how I'm outputting it?

I need to work out how to tell Drupal to render it as a GoogleMapFieldType (I beleive).

Any guidance on this would be highly appreciated!

Thanks in advance.


texts: How can I delete in bulk the submissions on a workflow

texts:
I have 400 some odd responses to a woprkflow i would like to delete.  I dont want to delete them individually.  How can i do it in bulk?
Tha


texts:
I'm looking for a Views exposed filter for node creation date that:

Shows a calendar (not popup)
Highlights days corresponding to existing node creation dates
Allows to click those days to see nodes created on that day

Does such a thing exist?


texts:
How do I set a WYSIWYG's value with javascript? does the WYSIWYG module provide an api for this?

I don't know which editor user is using, so I can't use the api of editors.


texts: pass result of Rules loop to variable to use outside loop

texts:
In Drupal Commerce, i have created a rule that calculates the price by adding some fields (custom line items), and then sets a result.

Now i want to make a loop (to pass over fields of a Field Collection with unlimited fields, so for each field collection set), and then set a result.

The question is: how can i get the result available to use outside the loop? (as a Data Selector value for a normal action)


texts: Why isn't this Config API Code saving options?

texts:
I can see the form, using the Config API, and submit it. However, it doesn't save the changes. Here is my code:

    <?php

namespace Drupal\my_config\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

class MyConfigForm extends ConfigFormBase {

  public function getFormId () {
    return 'my_config_settings';
  }

  protected function getEditableConfigNames() {
    return [
      'my_config.config',
    ];
  }

  public function buildForm (array $form, FormStateInterface $form_state) {

    $form['author_config'] = array(
      '#type' => 'textfield',
      '#default_value' => \Drupal::config('config.factory')->get('author_config'),
      '#title' => 'Author of Config',
      '#required' => TRUE,
    );
    $form['language'] = array(
      '#type' => 'radios',
      '#title' => 'Language',
      '#options' => array(
        'EN' => t('English'),
        'SP' => t('Spanish'),
        'FR' => t('French'),
        'DE' => t('German'),
      ),
    );
    $form['drink'] = array (
      '#type' => 'select',
      '#title' => 'Select your drink',
      '#options' => array(
        'RB' => t('Root Beer'),
        'SD' => t('Sunny Delight'),
        'WR' => t('Water'),
        'OJ' => t('Orange Juice'),
      ),
    );
    return parent::buildForm($form, $form_state);
  }

  public function submitForm (array &$form, FormStateInterface $form_state) {

    \Drupal::service('config.factory')->getEditable('my_config.config')->set('author_config', $form_state->getValue('author_config'))
     ->set('language', $form_state->getValue('language'))
         ->set('drink', $form_state->getValue('drink'))->save();
    parent::submitForm($form, $form_state);
  }

}

This is my routing file:

my_config.settings:
  path: '/my-config/config'
  defaults:
    _form: '\Drupal\my_config\Form\MyConfigForm'
    _title: 'Configuration Form'
  requirements:
    _permission: 'administer site configuration'


texts: I am using D7 and views for one of my sites. In views I am using contextual filters to get the result based on the url arguments. My question how to display a text like "No results found" in the views if I don get any match based on the url.


texts: Show commenter IP address to admins (Drupal 7 / AdaptiveTheme)

texts:
Once upon a time, with an older version of AdaptiveTheme, I got this to work by patching templates/comment.tpl.php.  The patch I was looking looked something like:

-      print t('Submitted by !username on !datetime',
-      array('!username' => $author, '!datetime' => '<time datetime="' . $datetime . '">' . $created . '</time>'));
+      if ( function_exists('user_access') && user_access('administer site configuration') ) {
+          $authorstring = 'Submitted by !username on !datetime from !hostname';
+      }
+      else {
+          $authorstring = 'Submitted by !username on !datetime';
+      }
+      print t($authorstring,
+      array('!username' => $author, '!datetime' => '<time datetime="' . $datetime . '">' . $created . '</time>', '!hostname' => $comment->hostname));

That was for a much older version of AdaptiveTheme (7.x-1.x, I think).

Thanks to hints from Laryn, I now have a working patch that does what I need.  Here it is:

From 8c064aca6e2fd35da411473c5e50ce471d30d3cf Mon Sep 17 00:00:00 2001
From: Zed Pobre
Date: Tue, 4 Nov 2014 02:54:21 -0500
Subject: [PATCH] Administrators see submitter IP addresses in comments

---
 at_core/inc/preprocess.inc |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/at_core/inc/preprocess.inc b/at_core/inc/preprocess.inc
index ef50fda..ba9b45e 100755
--- a/at_core/inc/preprocess.inc
+++ b/at_core/inc/preprocess.inc
@@ -832,13 +832,23 @@ function adaptivetheme_preprocess_comment(&$vars) {

   $vars['datetime'] = format_date($vars['comment']->created, 'custom', 'Y-m-d\TH:i:s\Z'); // Generate the timestamp, PHP "c" format is wrong

-  $vars['submitted'] = t('Submitted by !username on !datetime',
-    array(
-      '!username' => $vars['author'],
-      '!datetime' => '' . $vars['created'] . '',
-    )
-  );
-
+  if ( function_exists('user_access') && user_access('administer site configuration') ) {
+    $vars['submitted'] = t('Submitted by !username on !datetime from !ipaddress',
+                           array(
+                             '!username' => $vars['author'],
+                             '!datetime' => '' . $vars['created'] . '',
+                             '!ipaddress' => ip_address(),
+                                )
+                          );
+  }
+  else {
+    $vars['submitted'] = t('Submitted by !username on !datetime',
+                           array(
+                             '!username' => $vars['author'],
+                             '!datetime' => '' . $vars['created'] . '',
+                                )
+                          );
+  }
   // Unpublished?
   $vars['unpublished'] = ''; // Initialize for backwards compatibility
   if ($vars['status'] === 'comment-unpublished') {
--
1.7.10.4


texts: How to modify the class names of socialmedia module

texts:
I am using social media module. When I inspect the page in chrome, I see some div classes. My css is conflicting with module css classes. I was thinking to modify module's div classes. I was looking for the tpl file inside social media folder but I could not find it.

Which file in social media module has the div classes so I can modify the div classes?


texts:
Is there any module that works with views and slide images like the following image?

so far I've found about 13 image slider in Drupal but non of them does such thing.


texts:
I have an installation with lando. On the project, we have a directory drush with an aliases file for the project. This file defines aliases with the root specific for the lando architecture.

In my home directory, I have an aliases file in my .drush directory with the same name which define the same aliases but with a root different, specific for my local computer, outside from lando.

Both aliases files are detect by drush but the problem, the aliases file from the project is always take in priority, inside or outside from lando. But outside lando, files are never find like the root isn't correct.

The weird thing is my colleagues haven't had this problem and the root is aliases file is correctly choice when they are outside from lando. We're thinking we have forgotten a configuration somewhere but we don't see what.

I'm using Drush 8.2.3, my colleagues are using Drush 8.1.16. I could downgrade the Drush version but this will delay the problem.

Someone has an idea?

Thank you.


texts:
Whenever I run drush sql-dump it will prompt me for the database password. Is there a way that this can be done automatically? I don't quite understand why its not just reading this from settings.php

When I do a drush status --show-passwords it is shown there.

I ask because I want to script db backups to happen via drush. Any advice? Thanks!


texts:
I have installed Drupal Commerce 2 through composer as mentioned in

https://docs.drupalcommerce.org/commerce2/developer-guide/install-update/installation

after that, I have installed a few modules and a Barrio (Theme) directly through drupal admin interface.

Can I still update them through composer?

I have tried to update with ~/composer.phar update drupal/block_class --with-dependencies, but I am getting the following output.

  DrupalProject\composer\ScriptHandler::checkComposerVersion
  Package "drupal/block_class" listed for update is not installed. Ignoring.
  Loading composer repositor
  Updating dependencies (including require-dev)
  Nothing to install or update
  Generating autoload files
  DrupalProject\composer\ScriptHandler::createRequiredFiles


texts: Drupal 7 Views - Add a wrapper around rows for unformatted list from admin panel

texts:
I have a views which rendered html like this

Some Text here

Some Text here

Some Text here

Now I want to wrap the rows using a wrapper div like so.

Some Text here

Some Text here

Some Text here


texts: When moving from page to page on site, URL increases in length with repeating additional strings separated by & - how to control?

texts:
I've notices in several situations on my site that the URL length increases with additional strings (arguments, parameters)

This happens including when Views are being used, for example, this URL fragment when browsing pages with maps:
field_geofield_distance%5Bdistance%5D=100&field_geofield_distance%5Bunit%5D=3959&field_geofield_distance%5Borigin%5D=so14+7dw#field_geofield_distance%5Bdistance%5D=100&field_geofield_distance%5Bunit%5D=3959&field_geofield_distance%5Borigin%5D=se20%208az&zoom=10&lat=51.01656&lon=-1.6389&layers=BTT

Not just on maps Views but other kinds of Views. The strings repeat in the URL which means they are superfluous - only once occurrence is necessary.

How can I control this - i.e. stop the repeating, and also minimise the need to use % in the URL? (Another way to answer this might be: what is the root cause of these extraneous strings in the URL?)


texts: Entitybrower access denied for non-admin user

texts:
I have created an entity browser for taxonomy terms that is used as an entity reference select form element on a node. This allows users to browse terms grouped by vocabulary, see synonyms etc. The view that it is using has the permission "View published content" and all users including anonymous have this permission. I do not see any permission settings in the entity browser setup itself or in the general permissions for the entity browser module.
The browser works well for the admin user but gives an access denied to editor users.
What can I check to investigate this?


texts:
I'm trying to link to a Drupal path like "Contact Us" in my Twig template.
I've tried this code in my Twig template but I can't get any result.

{{ 'Contact'|t }}

As well as this:

{{ 'Contact'|t }}
{{ 'Contact'|t }}

What is the correct way to link to an internal Drupal path in Twig?


texts: Bad detection of language when anonymous user cache is switched on

texts:
I have a website with Domain Access, Domain Locale and the default language is Spanish, second language is English. The detection is done by suffix ( www.example.com/es , www.example.com/en ) and the browser detection is second one.
It works perfectly, in internet browsers with spanish as default language, when typping www.example.com , I will access the Spanish version. When the primary language of the browser is English, I will access the english version.

The problem arises when activating cache for anonymous users in Performance section of Admin.

I clear browser cache, and when typping www.example.com, I will be redirected to english version, with the suffix /en added to the url.

When switching off the cache, it works as expected.

I tried to replicate with a fresh Drupal installation, and cannot achieve it, so the problem is persistent only to my installation.


texts: Unit price showing in purchased entity (Item) field

texts:
Commerce2.x admin/structure/views/view/commerce_cart_form

Field:
(order_items: Order Item) Order item: Unit price (price)
admin/structure/views/nojs/handler/commerce_cart_form/default/field/unit_price__number

Showing in

Field: (order_items: Order Item) Order item: Purchased entity (item)
admin/structure/views/nojs/handler/commerce_cart_form/default/field/purchased_entity

Is this a bug or configuration problem?

d8.4 Commerce2 updated


texts: How do I get the correct URL of an image field?

texts:
I'm trying to print out the URL of an image field using the following code.

<img src="<?php echo $field_company_logo['und'][0]['uri']; ?>" alt="<?php echo $company[0]['#markup']; ?>" />

The code gives me a URI like public://company-logos/image.png when I would need sites/default/files/company-logos/image.png.

What code should I use to print the image path (i.e. sites/default/files/company-logos/image.png)?


texts:
I am looking to create aliases.

My url is user/uid/edit and I want panel/your-edit or panel/uid/your-edit
How can i do that? How create alias?

When i try create alias in admin panel I have an error:
Path user/[user:uid]/edit is incorrect or user do not have access.


texts: How to create a link to a file in a module?

texts:
In Drupal 7 I have a custom module that create a file in public://company/my.csv but in my module admin interface I want to create link to this file in a status message :

drupal_set_message('download your ' . l('file', $url));

To link the file I tried

$url = file_create_url('public://company/my.csv');
$url = drupal_get_path('file', 'my.csv');

I tried also to make myself the link to sites/default/files etc but it doesn't run. Sometimes I get 404 not found and sometimes "You cannot access to this directory".

(I have already checked that the file is well created in the good folder)

Any help is appreciated.


texts: How to display specific forms in drupal 7?

texts: I need to display the system login form and the system registration form on the same page but different panels (not tabbed like the default). I don't want to build a form from scratch using the forms api. I want to pull the accrual forms from the system and use them. The result should be much like the home page of facebook before you login, on the same page you can either login or sign up. I want to do all this from code, not from a module but from the page.tpl.php file. I have a special function that will display a completely different page for the home page.


texts:
In page--front.html.twig I load a nested twig file {% include
"header.twig" {} %}
In header.twig I want to render my menu block

I tried the following but no result:

In my_theme.theme I added:

function crm_theme_preprocess_page(&$variables) {
  $block = \Drupal\block\Entity\Block::load('crmnavigation');
  $variables['block_output'] = \Drupal::entityTypeManager()
    ->getViewBuilder('block')
    ->view($block);
}

In header.twig I added {{ my_navigation }} but it doesn't show the menu block?


texts: How to hook into file upload and remove button

texts:
I am implementing a module (in Drupal 7) that allows the user to upload or remove a file using the managed_file form type. I have looked at the form APIs and it states that info about the file should appear in ['values]['form_name'] but that is not what I see. To find any info about the uploaded file I need to look in ['input']['form_name'][0]. And when I do, the only values available are ['fid'] (which is always set to the file id) and ['UPLOAD'] (which is always NULL). The problem is that I don't know if the user wanted to add or remove the file. How do I determine this? What have I screwed up?

Here is my form:

$form_array = array(
  '#type' => 'managed_file',
  '#title' => t('File'),
  '#description' => 'The file associated with this submission',
  '#name' => 'obj_file',
  '#upload_location' => 'private://temp',
  '#default_value' => $submission->file,
);

Here is the submit portion:

if ($file_id == 0 && $submission->file) {
  $file = file_load($submission->file);
  file_delete($file);
} else {
  $file = file_load($file_id);
  $file->status = FILE_STATUS_PERMANENT;
  file_save($file);
  file_usage_add($file, 'my_module', 'submission', $submission->id);
}

According to the API file id should be 0 if removed but it never is in my case. Is it possible to hook into file_managed_file_submit()? That would at least provide an avenue to see which button is being pressed.

Any help or insights would be appreciated!


texts: Migrate users from a table with non-unique email column

texts:
I'm using the Migrate module to migrate users from a non-Drupal PHP/MySQL site to Drupal 7.  The users are spread across two tables, the second of which has a non-unique email column, many values of which are present in the first table.

Generally, how do I import the second table, inserting users with new email addresses, and updating a couple fields whenever the email address is already present among the users created from the first table and avoiding duplication errors from the second?

The users from the first table are administrators.  The users in the second table are clients.  There are other tables that references administrators and clients by ID.  The ID columns for the two types of users are unique only within its respective table.

I made all the client uid's globally unique by adding 10,000 to all their uid's and updating their references in the other tables accordingly.


texts:
Is it possible to make path alias that is not storing in database, like using system hook menu path I want to make url for en/weather and rs/vreme.

e.g

<?php
function weather_menu() {
    $items = array();
    $items['weather'] = array(
      'title' => 'title',
      'description' => t('description hook menu'),
      'page callback' => 'weather_page',
      'access callback' => TRUE,
      'type' => MENU_CALLBACK
    );
     return $items;
}
?>


texts: Use drush to sync core &/or modules directory only

texts:
I've just discovered the wonderful world of drush aliases, and I'd like to use drush to keep a dev site in sync with the live site (and visa versa). So far I've figured out that the following command does it pretty well for a site in the sites/ folder:

drush rsync @mysite.com.live @mysite.com.dev

I'd like to be able to sync modules and core the same way. Is there a way to do that with drush?


texts: Change existing configuration at theme installation

texts:
I am creating a custom Drupal 8 theme, and I want to change the image style of the indexed article content of the frontpage - only the article content type.

To do that properly - avoiding using CSS hack - I have to *change the image style the image field of the display mode Teaser of the article content type**, the display mode "teaser" is used by the native view "frontpage" to index content. And I have to do that modification at the theme installation and thus configure the theme properly to do that modification at installation. It's not working with conf file because the configuration already exist.  i am asking here advice on how to do that.

In details: I need to change the image style of the field "field_image"  of the mode display "teaser" of the content type "article".

By default it use the image style "large" and I want it to use a new image style "hp_wide" that the theme import -  successfully - at theme installation.

From my research, I've found that I've to create a PHP function in MyThEme.theme with \Drupal::configFactory()->getEditable($name), it is the correct way? If yes how can I target that specific field settings, how can I know the "path" of that settings?


texts: How to get RSS feeds from other sites and display their links in a block?

texts:
I am using the aggregator core module, I also have feeds module installed but I can't figure how to make it read a remote rss and display the remote links in a block.

Thanks


texts: user/login page displays but gives a 404 error on firebug

texts:
My Drupal site gives a 404 error in firebug, even though the login form is showing. Also nothing happens when you click Log in-- the page just refreshes and login DOES NOT happen. This only happens in https. There is no error in HTTP and the login is working.

I have installed the secure_login module hoping it might help, but no change. Basically, it just forced the login page to redirect to https.

I thought maybe the https is not configured correctly, but HTTPS is working fine in all the other pages. My site works in both http and https. The only problem is the login form.


texts: PDOException Error While saving the view

texts:
I get this Error when i save a view of format JCarousel.

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry 'slidersidebar' for key 2: INSERT INTO {views_view}
  (name, description, tag, base_table, human_name, core) VALUES
  (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5); Array (
  [:db_insert_placeholder_0] => slidersidebar [:db_insert_placeholder_1]
  => [:db_insert_placeholder_2] => default [:db_insert_placeholder_3] => node [:db_insert_placeholder_4] => Slider Sidebar
  [:db_insert_placeholder_5] => 7 ) in views_db_object->save_row() (line
  2092 of
  /home/kumarang/public_html/sites/all/modules/views/includes/view.inc).


texts: What is the purpose of the PHP class FileTransfer? In which cases, should a module deal with that class or one of its child classes?


texts: How to change the title of submit button when someone register in mailchimp?

texts:
I want to be able to change the title of the submit button of the Mailchimp block when someone subscribes or unsubscribes to mail chimp list. I'm using mailchimp block on D7.
How shall I do it?


texts: How to create websites in shared folder using quickstart?

texts:
I am using quickstart and I am able to create websites, run all drush commands, etc.

I am running Virtual Box on a Windows7 machine. i have setup a folder to be shared.

My problem: I am not able to create drupal sites (using drush qc --domain=mysite.dev") in that shared folder.

I want to create in that shared folder since I need access to the files from my windows environment also - for backup purposes, etc.

My terminal Output:

12:51:05 ~$ cd Desktop/
12:51:12 ~/Desktop$ cd shared
12:51:14 ~/Desktop/shared$ ls
DrupalPro_test.ova
12:51:15 ~/Desktop/shared$ drush qc --domain=neil.dev
                                                                     [ok]
Creating dns config (add neil.dev to /etc/hosts) ...                 [ok]
Command failed: neil.dev already exists...doing nothing              [error]
12:51:30 ~/Desktop/shared$ ls
DrupalPro_test.ova
12:51:36 ~/Desktop/shared$ ls
DrupalPro_test.ova
12:51:37 ~/Desktop/shared$


texts: How can the Panels IPE "add content" modal be customized?

texts:
I have a content type rendered via Panels IPE (In Place Editor) which allows authenticated users to customize the layout of their node. When users click to "add content" I would like to be able to control what appears in the modal dialogue. By default it is not very user friendly:

Ideally I would like to be able to choose what can be added, for example only "nodes", or only "views" and "widgets". I'm not sure where this can be changed or if a module exists that does this already. The only module I have found that attempts to do this is Panopoly Magic which requires an entire suite of modules called Panopoly to be installed. I don't need the majority of the functionality that Panopoly adds and hence I don't think it is a very light solution. Here is the result that can be achieved:

Is there a way the IPE add content modal can be customized?


texts: How do I conditionally add a class to my page title within page-title.html.twig?

texts:
I have a boolean field within my Page content type called Hide Title.

I need to conditionally add a class to h1's to visually hide them if this field is checked.

I have the following within page-title.html.twig

{% set hide_title = content.field_hide_title.0 %}

{% if 'On' in hide_title %}

{{ title }}

{% else %}

{{ title }}

{% endif %}

This is is not adding the class while the boolean is set on or off.


texts: How to create new node programmatically, when a new user is created, in Drupal 7?

texts:
At the time when a new user is created, I want programmatically to create a new node (of some defined type) and make him the owner of that node.

How can I do this in Drupal 7 ?


texts: How do I differentiate between different node dates?

texts:
A site owner wants to differentiate between semantically different dates of articles published on their Drupal site as follows:

Editorial changes on an article will NOT create a new revision.
Content changes (e.g. updates, new paragraphs, etc.) WILL create a new revision.
Order of display (e.g. on overview pages) should be done by revision date or publication date, whichever is more recent
Articles should always display the most recent version (i.e. to reflect editorial changes)

I don't understand the logic behind the various dates provided by core Drupal 8, and how I could use them to implement what the customer wants.

For better understanding, here is an example:

On 1 May 2019, Article 1 was written and published in one go, and has never been changed since.
On 12 May, Article 2 was published after it was started on 10 May.
On 15 May, Article 3 was written and published.
On 19 May, Article 3 received editorial changes without a new revision.
On 21 May, Article 2 was updated with more content, thus creating a new revision.

The (descending) order in which these articles shall be displayed is:

Article 2 - 12 May 2019 (Updated on 21 May 2019)
Article 3 - 15 May 2019
Article 1 - 1 May 2019

How can I achieve that with the least amount of custom code or modules to be used? Ideally the solution would entail only core Drupal views (however complex).


texts: Can I search boolean field through Search Terms in a view

texts:
I am using Search Terms to search within a view.

It is working for all the fields I included in the view except a "Boolean Field". Is there any way I can search the results through Boolean field as well?

Thanks a lot.


texts: How to keep showing Administration menu when changing user?

texts:
I'm using the Administration menu, like thousands of others. I recently discovered that one can change from user by hoovering over the red "hello user" button at the right. It's a nice feature, but I was wondering if it's possible to keep showing the toolbar when one changes from user (even when that user doesn't have permission to use it) in order to be able to switch back to administrator quickly. When I, as an administrator, would like to see how the page looks like for another user, I now always have to log in again as administrator - quite time consuming.

Any suggestions?


texts:
In a function that is a response to a drupal_get_form() I am constructing a form that includes a date field

$form['dob'] = array(
    '#type' => 'date',
    '#date_format' => 'm-d-Y',
    '#title' => 'Date of Birth',
    '#required' => TRUE,
);

This however displays the the input with year first then month and date. How can I change this to render the month first then day and then year?


texts: Is it possible to develop without a local development environment?

texts:
I am used to having Virtualbox and linux running on my local to do development work. My new client has a migration project for me to do but they do not allow any local development tools like xamp, dev desktop, Vagrant, Virtualbox. They are a government client and they want us to use their laptops and work on their network in their office. They are not very tech savvy They also do not want to use Git. The client asked that I do all the work on their staging redhat server then clone it to the production server. Their project is to turn 2 static html websites into Drupal CMS. The sites consist of a 80 pages and about 200  PDF files that users search for and download. Does anyone have any ideas of how to approach this project? We cannot place their website content on our personal laptops. But I should be able to build the theme and content types on my personal laptop.
My plan was to let them install Drupal 8 on the stage server. Then I will download the site and sql file. Copy the site over to my personal laptop which has Virtualbox. ( I will need to get permission to do this) Then build the subtheme, content types and add the needed fields to all content types. Basically get it ready to import CSV spreadsheet. Export the config then import changes to the stage server and upload the new theme. Then create the CSV spreadsheets based on the clients website pages and pdf files. Create the migration scripts and import content directly on the staging server. That is what I thought I could do. If you have ideas please let me know. Thank you


texts: Problem with i18n_string + features + sites with different default language

texts:
(I will talk about i18nviews in this question, but I think the problem applies equally to other cases of i18n_string)

Background

With regular Drupal t(), Drupal will always assume that the original string is in English.

With i18n_string, it is assumed that the original string is in the site default language.

Use case / problem

I have multisite with two sites, one with default language German, another with default language English.

I created a page view on the German site, with a page title "Produkte finden".

I exported this view as a feature, and want to enable this feature on the English site. On the English site, the page title should be "Find products".

I thought I can use i18nviews (which uses i18n_string) to translate the page title configured in the view.

However:

In the German site, Drupal thinks that the exported page title is in German.
In the English site, Drupal thinks that the exported page title is in English.

This means that Drupal will never attempt to translate the views page title. So I would get the same, non-localized page title on each site.

Question

I want to find a way to export a view into a feature that can be installed on sites with different default language, and have localized labels on each site.

If this can be done with i18n_string, great. If not, I am open for other suggestions.

Thoughts

I think to make this work, the exported feature would have to contain information about the language with which it was exported, which could then be picked up by i18n_string (which I assume it is not really capable of atm).

Or all sites would need to have default language = English.


texts: Display exposed date (year) filter as checkbox

texts:
This has been bugging me all day and i'm still none the wiser and would really appreciate help.

I want to expose date (node) field on my view so that users can select a year and see blog articles.

I've managed to expose the filter in a dropdown box but need to create them as checkboxes.

So i've used hook_form_alter and tried to change the $form['date_filter'] to a checkbox array like so:

$form['date_filter'] = array(
'#type' => 'checkboxes',
'#options' => array(
'2013' => '2013',
'2014' => '2014',
'2015' => '2015',
'2016' => '2016',
),
'#title' => t('Year filter'),
);

While this does change the dropdown into a list of checkboxes the checkboxes no longer work when I select one and click apply.

So I inspected the select tag and the name attribute was date_filter[value][year] where as my checkboxes name attributes are: date_filter[2013], date_filter[2014], and so on.

I would like to know if this is what is causing the form to no longer filter my articles and if it is how to fix it? IF not what else can I do?

P.S. I've installed Better exposed filters and this doesn't allow me to change date to checkboxes, only datepicker.


texts:
I can't seem to get the hang of images in D7.

In D6, I used image and image_filter, which worked very nicely.

The D6 to D7 upgrade converted my image nodes to Node_image, which is useable as far as it goes.

In D7, I'm currently using image (from Drupal core), file entity and insert, (with sources set to existing fields, which requires filefield_sources).

I have tried to add some to book nodes. There are two problems:

Linking back to the image node. In structure -> manage -> book -> manage display, the options are "link to content" (which links back to the current book page), "nothing", and "link to file" (which links to the image itself).
Displaying the images sanely. The same "manage display" will let me move the images before or after the body of the content. If I have more than one image, they are displayed above each other, not side by side.    I can't see a way to move the image(s) to a different spot per book page. If I've understood things correctly, DS will let me put the images eg. in the top right or left corner of the content, nicely wrapped. While that's a step in the right direction, it's not optimal.

I'm sure others have had these same problems. How have you solved them?

(If nothing else, I'll insert the lot by hand, with "img src=" and "a href=", but that's defeating the whole idea of a CMS.)

Referenced modules: http://drupal.org/project/image * http://drupal.org/project/image_filter * http://drupal.org/project/file_entity * http://drupal.org/project/insert * http://drupal.org/project/filefield_sources * http://drupal.org/project/ds


texts: Conditional Fields Changed Answer Problem

texts:
I have three fields on an entityform the third is hidden unless the second one is answered with yes.

The problem I have is that if a user makes three visible by answering "yes" and then answers three but then decided to change question 2 to  "no" field 3 is hidden but the answer is still recorded.


texts: Notice: Undefined offset: 1 in drupal_http_request().... common.in

texts:
I have installed Drupal and I am getting the following Notice messages:

Notice: Undefined offset: 1 in drupal_http_request() (line 989 of /home/sites/nucreativetesting.co.uk/public_html/my-site/includes/common.inc).
Notice: Undefined offset: 2 in drupal_http_request() (line 993 of /home/sites/nucreativetesting.co.uk/public_html/my-site/includes/common.inc).
Notice: Undefined offset: 1 in drupal_http_request() (line 993 of /home/sites/nucreativetesting.co.uk/public_html/my-site/includes/common.inc).

This is the second time that I have run into these messages. This time i have installed from a purchased Drupal theme, and the first time I used a vanilla install of Drupal core. They seem harmless as the old site worked fine. I would love to know what they are about and if I can get rid of them.

Please let me know if there is anything I can do to provide more helpful information.


texts:
As far as I know, the way to create a taxonomy term is having to go into the taxonomy module and creating on there, and THEN assigning the term to the node.
Is there a way to create taxonomy terms on the fly? When the node is created, if the taxonomy term doesn't exist, it should be created too.


texts: How to do Test Driven Development (TDD) in Drupal?

texts:
What are the tools used TDD in Drupal (PHP modules, Drupal modules, etc)?
What does your commit/test/deploy workflow look like? Do you use Phing, PHPUnderControl, Hudson for managing this workflow?
In which way does unit testing make your code more reliable?
Do you need a separate, expensive, stand-alone unit test server, or can you do it from a laptop?

I know that Robert wrote an excellent technical post here about unit testing in Drupal with SimpleTest; I am more interested in covering the workflow and configuration part. Currently I have a development machine, staging and production server. Both production and stage sites run on a 300MB RAM/300MHz CPU Dreamhost VPS.


texts: How do I 'disable' my contextual filter (return all results) for uid=1?

texts:
I have a View (content) created with a contextual filter.
The contextual (Content:Country) filter uses PHP code to check custom fields:

global $user;
$user_uid = user_load($user->uid);
$mycountry = $user_uid->field_user_country['und']['0']['tid'];
return $mycountry;

The filter is [field_address_country] == [field_user_country]
The contextual filter works fine.

However, I would like to 'disable' the filer for admin (uid=1) so that I can view all nodes regardless of the field_address_country value.

I have tried adding a condition to check for uid=1 but it doesn't work

global $user;
$user_uid = user_load($user->uid);
$mycountry = $user_uid->field_user_country['und']['0']['tid'];
if ($user_uid == '1') {return 'all';}
else {return $mycountry;};

Is there a method for returning all results (or disabling the filter) for admin user?


texts: How to add custom node field into page title?

texts:
I have a custom node field I want to add into the page title. How can I do this?

Content type is a property listing and I want to have area size and location printed next to the title.

e.g. Large Mansion 900 sq ft (Chicago)

Location is also a taxonomy term in a dropdown list.

Do I need a preprocess_page function to extract the field and then use page.tpl.php?


texts: How to speed up event confirmation email?

texts:
I recently setup a Drupal 8 instance to set up a special event website. I am allowing users to build inline contacts to register for an RNG event. Everything seems to be working: The users offer their email and username, and the contact is created; then, they register for the event and the registration is created. Twelve hours later, they get an email message setup using the Courier and Rules integration with RNG.

Is there a way to speed up the confirmation email?  If I send an email from a user contact form on the same website, it sends it immediately. I imagine it is a Courier/Rules issue with how often the email queue is being processed, but I cannot figure out where that is configured.


texts: How do I print the term names associated with a node?

texts:
I want to show the term names used in a node. My term field machine name is field_category.

$query = \Drupal::entityQuery('node');
$query->condition('status', 1);
$query->condition('type', 'content_type');
$entity_ids = $query->execute();
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($entity_ids);
foreach ($nodes as $node) {
   dpm($node);
}

dpm() prints the following.

stdClass Object(
[__CLASS__] => Drupal\node\Entity\Node
[in_preview] =>
[values] => Array
 [field_category] => Array
            (
                [x-default] => Array
                    (
                        [0] => Array
                            (
                                [target_id] => 4
                            )

                        [1] => Array
                            (
                                [target_id] => 2
                            )

                    )

            )

How can I print the term names as term-1,term-2?


texts: How to load to panels a referenced node?

texts:
I have the user profile panel and I want to load in the panel a node that is referencing this user.
There is a trick to load a view in the panel,but I don't know exactly how to do this...
Can somebody help me on this?thanks


texts: Is there a way to have a language neutral link that automatically redirects to the user's active language?

texts:
We have a multilingual Drupal 7 site, and after turning on the first translation, we realized that one of the third party modules we're using, a slider module (comes with Eventus theme, it's a module the vendor built (or perhaps bought and extended/branded)). The slider module is not multilingual aware and it is routing all users to the same URL (which sends them back to the default language), regardless of the active language.

We're evaluating our options to address this, and one idea (that I am unsure if it is possible) is to make the slider links go to a "language neutral" URL, which will then forward them on to the user's currently active language for any given URL. However, so far I haven't been able to figure out A) if this is possible and B) if it is possible, how to construct the URL. So, is it possible, and if so, how would I set this up? Open to suggestions.

The slider module's content is currently identical for all language versions of the site.

To try and clarify, I'm going to use example the following example URLs:

/about -- this is the default, primary language (english) version of the "about" page
/pt-br/sobre -- this is the translated, Português version of the "about"

The first "slide" in the slider says "Learn more about us!" and links to the /about.

Our goal is to make Drupal aware of the user's current language setting, and if they click on a link that sends them to /about, but their language is currently set to Português, it will automatically redirect them (or at least provide them) with the Português version of the "about" page.

Is this possible, and/or is there a better way to accomplish this?


texts: When creating an autocomplete form in a custom module how do tell Drupal what modules I need?

texts:
I want to create an auto-complete form in my custom module that will be loaded in a block. Drupal doesn't seem to be loading the necessary Javascript libraries to work properly. How do I know what needs to be loaded and how/where do I tell Drupal to load these libraries?

hook_block_view:

function my_module_block_view($delta = '') {
    //The $delta parameter tells us which block is being reqested.
    switch ($delta) {
        case 'my_module_my_block':
            $block['subject'] = t('Block Subject');
            $block['content'] = drupal_get_form('my_module_my_form');
            break;
    }

    return $block;
}

Form code:

function my_module_my_form($form, &$form_state) {
    $form = array();

    $form['term'] = array(
        '#type' => 'textfield',
        '#autocomplete_path' => 'my-module-autocomplete'
    );

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

    return $form;
}

The form loads, the field is there, but auto-complete isn't working :(

If I call the my-module-autocomplete path I do get a valid response back when compared with a Content Type edit form. The ajax spinner in the input field never appears so the ajax isn't being called.


texts: Remove an item from $form_state in an ajax callback

texts:
I'm using this form api example: AjaxAddMore. I want to add a "remove button" for each indiviaul element, in order to remove an item but not the latest. Thouse are my changes:

...
  $form['names_fieldset'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('People coming to picnic'),
      '#prefix' => '
',
      '#suffix' => '
',
      '#attributes' => array('class'=>array('container-inline')),
    ];

    for ($i = 0; $i < $num_names; $i++) {

      $form['names_fieldset']['fields'][$i] = [
        '#type' => 'fieldset',
        '#name' => 'id_'.$i
      ];

      $form['names_fieldset']['fields'][$i]['ids'] = [
        '#type' => 'textfield',
        '#title' => $this->t('ID'),
        '#default_value' => $i,
        '#name' => 'id_'.$i
      ];

      $form['names_fieldset']['fields'][$i]['name'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Name')
      ];

      $form['names_fieldset']['fields'][$i]['remove'] = [
        '#type' => 'submit',
        '#name' => 'remove_'.$i,
        '#value' => $this->t('Remove this'),
        '#submit' => ['::removethisCallback'],
        '#ajax' => [
          'callback' => '::addmoreCallback',
          'wrapper' => 'names-fieldset-wrapper',
        ],
      ];
    }
....

It works good and I can add several records. But I can't remove an item other than the latest one. This is my callback function where I've tried to unset the item I want to remove:

public function removethisCallback(array &$form, FormStateInterface $form_state) {
    $button_clicked = $form_state->getTriggeringElement()['#name'];
    $id = substr($button_clicked,7);
    $values = $form_state->getValue(['names_fieldset']);
    unset($values[$id]);
    $form_state->setValues(['names_fieldset'], array_values($values));

    $name_field = $form_state->get('num_names');
    if ($name_field > 1) {
        $remove_button = $name_field - 1;
        $form_state->set('num_names', $remove_button);
    }
    $form_state->setRebuild();
}

But It doesn't work. How could I remove or update an item from $form_state?


texts: What would be a comprehensive but safe set of html tags to use with the HTML Filter but compatible Markdown?

texts:
I want to use the Markdown filter on my pages, but using the HTML filter messes it up. However I still want to use it. Does anyone have an idea what other tags should be allowed beside these and what the safety issues are?

This the list I currently use - what else should be added?

 <src>


texts:
I have inherited a complex website which has the Features and Views module installed.
I can configure a Feature to include a View as you would expect.

However, I'm putting together a private website which also has Views and Features installed.
My problem is Views does not appear as an option to select data from when configuring the Feature.

Is there a setting or module which is responsibly for exposing Views in Feature create/edit mode ????

The image on the Feature project page seems to suggest Views should be there by default.

Any help, please !


texts: Adding readonly wysiwyg field to entity form

texts:
I'm using entity forms and I want to add a wysiwyg text block in between two form fields, that is just an explanation text. This text does not need to be submitted and should not be editable for the user. It is just an explanation text block that needs to be in the form and that has to be entered via an wysiwyg editor in the backend as it contains some formatted stuff like an headline etc.

Any ideas? Thanks!


texts: Add new user via Commerce or Add User account

texts:
I am working with a community site where new members should be able become members by purchasing an annual membership using commerce_license. I see 2 ways forward:

Members add an account application via the page .../?q=user/register and the user fills in all required fields. Via rules the appropriate membership is added, the user is redirected to the checkout, and when payment is complete the role is applied.
User buys the appropriate membership product, and when paid in full receives the correct role.

I have tested both these but cannot seem to get the second option working since I don't have a way to expose the custom fields added to the users, and let the user fill in those when applying for membership.

The first option seems more promising but there the user is not permitted access to the checkout page when redirected ( although I can see that the basket is created with the matching product in it).

Any pointers on how to move forward is much appreciated. I will not require an approval step, except that the membership fee must be paid in full to get access.

BR
/bo


texts: User rights: Only create, edit and publish articles

texts:
There is a user role where users can edit, save and publish articles. But they don't see the admin menu.

Does exist a module to realize a "create content" button only or to modify the admin menu?


texts: How to hook "/system/ajax" with javascript in Drupal 7

texts:
When a field accepts multiple values, the admin form adds a button "Add another item". Mousedown submits a POST to /system/ajax to get another field (i'm using multifield here).

I'd like to hook into the javascript completed event to do some custom handling on those additional fields.

How can I most easily hook these ajax calls for javascript callback and reference to the block being added? Is it possible without PHP?


texts: How to implement module dependencies in a theme and package modules with a theme?

texts:
If you're making a theme and associated custom modules designed for that theme and no other theme. Is there a way to package the modules with the theme so that when the theme is activated the modules will show up in the module list ready to be activated? The custom modules are build for the theme and so if they can be packaged with the theme that would make it simple to distribute.

I would like to avoid the problems of the user not being able to fully use the theme due to a missing library or module.

If a theme and collection of modules that are packaged in a single zip file, when passed to the drupal installer, permit Drupal the ability to extract the theme and modules to the correct locations? Can it determine the themes dependencies and then install the modules from a url?

Some examples that I can think of is having color pickers for a theme so you can select different colors for the theme in the settings area. I could make custom modules for this and have the modules show up if the theme is active. Maybe also have it alert the user to activate the modules one theme activation. If the theme has a custom slideshow should this be built into the theme or maybe as a packaged module inside the theme that shows up as a module in the modules list to be activated.

Maybe inside the theme package it could have a modules folder that Drupal could then extract the modules and install them into the module directory. On uninstall could prompt the user if they would like to also uninstall the associated modules. If this is possible (or soon to be) this would make managing complex themes clean and simple. It would also keep the module list clean as well. maybe some dependency in the theme info file?

Other thoughts would be if a theme was active maybe it could find said modules and inject rendering options into the modules configurations options.

As of right now this is just a curiosity of mine and I wonder if it could be done. This idea came about after setting up many Drupal sites and making custom modules and themes. Then it hit me what if I could do more with my custom themes by knowing it can only run if all the needed modules where there. Then I wouldn't have to worry about a bad user experience.


texts: Module to create tokens that insert node field data based on node title

texts:
I have a Date entity bundle based on node that has a date field (starting and ending).  I would like to be able to give my content admin's the ability to insert a date with a non-techie friendly token.

For example, I have a node titled "Attendee Registration Opens" with a date value of December. Ideally a writer, creating a page or article or any other node, could simply do [attendee_registration_opens:start_date], which they would pick from a fieldset.

I am currently playing with token_filter and token_insert but, as far as I can tell, these do not allow me to use a token that, again, shows one field from a different node.


texts: How to find which templates are affecting a display?

texts:
spending hours dealing with form_alter , finally realized that a tpl.php file is overriding the output !!!

now the question is

  what are the ways to understand which template files(or functions) are affecting a display so they can be customized ?


texts: How do I dump variables to the screen when running PHPUnit tests?

texts:
I'm trying to put together some PHPUnit tests in Drupal 8. I'm running the tests from the command line, using /vendor/bin/phpunit, but I'm having troubles figuring out how to dump a variable to the screen for debugging purposes.

For that matter, I'm using this:

$this->assertEquals(2, $this->currentUser->id(), 'ID is correct');

And when it passes, the message 'ID is correct' is not shown in the console. Does anyone know how to make the error messages properly show?


texts: How to print the raw value of a custom user field in comments

texts:
I want to print a custom user field of the commenters. It is an Link field (https://www.drupal.org/project/link). Some users have that field completed and other not.

I've read a lot of posts  related to this and tried several solutions. The only code that seems to nearly work OK is the following (found in https://drupal.stackexchange.com/a/129222):

<?php print render(field_view_field('user',user_load($comment->uid), 'YOUR-CUSTOM-USER-FIELD'));?>

The field shows, but there are 2 problems:

1) It causes 2 errors of "Strict warning: Only variables should be passed by reference en include() (line 73 of .../templates/comment.tpl.php)."

2) It shows the entire field, including its label and the complete link with the settings of the field. I only want the "raw" value of the field, the text that users introduce in the field.

Thanks for your help!


texts: How to apply a Views filter to show fields if a radio button is not FALSE?

texts:
I have a custom field that is a radio button (from CiviCRM), and I made it available as a filter by implementing hook_views_data().

I'd like to apply a filter to show fields if the radio button is set to true; in other words, if not == false.

I feel like this should be possible without using the Views PHP module, but I have hit a wall.


texts: How do I make the file description field required?

texts:
In Drupal 7, I need users to enter a file description, how do I make this field required?
Also on another note, I would love to make this field a select list, there's no clear way to do this aside writing a custom module. Any ideas?


texts: Text comparison rules on node:body:value with input filters

texts:
My text comparison rule works like a charm if the user selects 'Plain text'.  If they use 'Filtered HTML' it doesn't find a match even though the pattern does exist in the raw and filtered versions of the text.

The short question is how can a text comparison rule be run against filtered input?

The long version is what's the process by which rules and input filters interact and why is this an issue?


texts: Why is Rules Action "Create Linked Drupal User Account" not working?

texts:
I’m using Drupal 7.56 and CiviCRM 4.6.31.

I’ve been using Rules in Drupal to create a Drupal User Account linked to the CiviCRM contact created.
But it's failing. I'm getting the following error:

  Cannot create user, email: invalid!!

This is the export of the Rule:

{ "rules_create_a_drupaluser_for_an_civicrmcontact" :
    {
        "LABEL" : "Create a Drupal user for an CiviCRM contact",
        "PLUGIN" : "reaction rule",
        "OWNER" : "rules",
        "REQUIRES" : [ "civicrm" ],
        "ON" : { "civicrm_contact_create" : [] },
        "IF" : [
          { "NOT civicrm_entity_user_exists" : { "civicrm_contact" : [ "civicrm_contact" ] } }
        ],
        "DO" : [
          {
            "civicrm_entity_action_create_user" : {
              "USING" : {
                "civicrm_contact" : [ "civicrm_contact" ],
                "is_active" : "1",
                "notify" : "0",
                "signin" : "0",
                "username_format" : "email"
              },
              "PROVIDE" : { "civicrm_user" : { "civicrm_user" : "Created Drupal User" } }
            }
          }
        ]
    }
}

It was working some time ago.

The link where I downloaded the civicrm_entity (release 7.x-2.0) is:
https://www.drupal.org/project/civicrm_entity/releases

For your convenience I've added the source code for the Rules Action civicrm_entity_action_create_user:

function civicrm_entity_action_create_user ($contact, $is_active, $notify = FALSE, $signin = FALSE, $username_format = 'first last') {

  if (!is_array($contact)) {

    // Perhaps we should be accepting object rather than array here?
    $contact = (array) $contact;
  }

  // We'll use the civicrm sync mechanism to see if Civi can match the
  // contact to an existing user.

  // Don't think this is a great approach but will use for now - could
  // just create the user but no great support for that yet.

  if (empty($contact['display_name']) || empty($contact['email']) || empty($contact['first_name']) || empty($contact['last_name'])) {

    $contact = civicrm_api('contact', 'getsingle', array(
      'version' => 3,
      'id' => $contact['id'],
      'sequential' => 1,
      'return' => 'email,display_name,first_name,last_name',
    ));
  }

  if (!is_string($contact['email']) && isset($contact['email'][0]->email)) {

    $contact['email'] = $contact['email'][0]->email;
  }

  // @TODO What happens if they don't have an email at this point?

  // An email is a pre-requisite for a Drupal account, so the action
  // fails if they don't have an email.

  if (filter_var($contact['email'], FILTER_VALIDATE_EMAIL) === FALSE) {

    drupal_set_message(filter_xss("Cannot create user, email: " . $contact['email'] . " invalid!!") , 'error');

    watchdog('civicrm_entity', 'Cannot create user, email %mail invalid.', array('%mail' => $contact['email']), WATCHDOG_ERROR);
    return FALSE;
  }

And here is where the error raises.

These is the Rules evaluation log:

Reacting on event CiviCRM Contact has been created.

 Evaluating conditions of rule Create a Drupal user for an CiviCRM contact.

 The condition civicrm_entity_user_exists evaluated to FALSE

 AND evaluated to TRUE.

Rule Create a Drupal user for an CiviCRM contact fires.

   Rule Create a Drupal user for an CiviCRM contact fires.

   Evaluating the action civicrm_entity_action_create_user.

   Evaluating the action devel_debug.

   Rule Create a Drupal user for an CiviCRM contact has fired.

Finished reacting on event CiviCRM Contact has been created.

And the Log Message gets this Error:

MESSAGE "**Cannot create user, email invalid.**"

Does anyone have any clue about what might be happening?


texts: How to get rid of an extra space in a twig date field template?

texts:
I have a twig date field template that has a mysterious extra blank space that I want to remove.

In my twig template, field--comerce-product--field-ppromotion-enddate.html.twig, I have the following line:

{{ item.content }}{{ 'TEXT'|trans }}

Unfortunately, the printed output looks like this:

2017-12-25 TEXT

I don't know where the space is coming from.

I am using a similar template for an integer field that has this line:

{{ item.content }}{{ 'OFF!'|trans }}

This prints the discount percentage (integer field) and then the word "off" (example: 20%off)-- there is no space between the percentage and off, which is what I want.

(Why no space? My site actually uses an Asian language that doesn't use spaces.)

So where is this space coming from on the date field?  When the date field content is printed, it uses the template time.html.twig, but the content of that template is this single line (skipping the comments):

<time{{ attributes }}>{{ text }}</time>

EDIT: Based on the suggested answers, I have tried {{- foo -}} to remove the whitespace around the date and text, as well as {%spaceless%} to remove other whitespace, but the extra space is still there between the date and the text):

  {% spaceless %}

{{- item.content -}}{{- 'TEXT'|trans -}}

  {% endspaceless %}

Actual output of this code: 2017年12月25日 TEXT

Output should be: 2017年12月25日TEXT


texts: Some CSS and JS is not loading for anonymous users

texts:
I recently started working on an existing D7 site, which has its own custom theme. With this theme only, some CSS and JS files are not loaded at all for anonymous users. Logged in users dont have that problem. When I switch the theme to Garland for example, the CSS and JS files are loaded correctly for anonymous users.

The CSS or JS files are either coming from core, or from some contrib modules.

Where should I start looking?


texts:
For example I have the code:

function contact_block_view($delta = '') {
$block = array();
switch ($delta) {
  case 'contact_block':
  $block['content'] = drupal_get_form('contact_form');
break;
}
return $block;
}

How to set inside this block the id or class attributes?


texts: Filtering Taxonomy term descriptions in Views

texts:
I've created a Taxonomy Vocabulary with the name "Remarque prix". I imported it as a Term reference field to Commerce Product with the aim to be able to give a unique Vocabulary term to each product (SKU).

I want to present the Vocabulary term description in the the node by using Views so I created a View showing the Term description and took it into the node as a dynamic field, but I can't figure out how to set Contextual filters and maybe Relationships within views so each SKU/Product will have the correct Vocabulary term.

I have spent over a full day on this but can't figure out how to do. Could maybe anyone help me, please?

All the Best

Hans


texts: How to alter the default font displayed INSIDE CKeditor

texts:
I would like to be able to alter the font in the CKeditor (version 7.x-1.15) module so that it does not show Times New Roman, but rather the font that the rest of the site uses, Helvetica. I'm using Drupal 7.30.

When CKeditor loads when content is edited it always shows Times New Roman!

I have altered 'Custom Javascript configuration' in:

admin/config/content/ckeditor > Advanced options to read:

config.extraCss += "body{font-family:Helvetica, serif;}";

Cleared all Drupal caches AND browser caches - nothing.

I've also altered:

ckeditor.config.js - line 36:

config.extraCss = 'font-family:Helvetica;color:#726F6F;';

Again, cleared all caches - nothing!

Please could someone explain what I'm doing wrong!


texts: Drupal 7 : problem with newly added field language property

texts:
I have to add some new field to a content type on a Drupal 7 site.

The new fields works perfectly, but when I'm saving my node, those fields language property is set to "und", while all the olders fields language is set to "en".

Why is there a difference with the newly added field ?

How can I manage to set the language of my new field to "en" ?

This cause me some trouble with existing module which use the language property.

Thank you in advance.


texts: How to add 2 different contextual filters to a view

texts:
I have a page view that displays a list of jobs. I want to be able to filter on SECTOR and REGION. When I add a contextual filter to my jobpage view for sector it works perfectly, however when I add the second one, region, it doesn't display anything.

Clicking on "Diensten" goes to my page view and displays all jobs tagged with "Diensten". However when I click a region, it doesn't display any jobs, only when I make sure the region contextual filter is above the sector one. How can I get this to work?

I use Taxonomy name to ID in my contextual filtering


texts: Getting The d7_nodesubqueue plugin must define the source_module property

texts:
I am trying to use Migrate Drupal UI to upgrade from Drupal 7 to Drupal 8 (8.9.7).  When I put in the credentials and run it I get the error message:

The d7_nodesubqueue plugin must define the source_module property.

Looking online I came across the Issue for the Module Missing "source_module property" annotation (https://www.drupal.org/project/nodequeue_migrate/issues/2971399).
The patch is to add to the annotation the source_module to the NodeQueue.php and NodeSubqueue.php files (found in /nodequeue_migrate/source/d7/)
*   source_module = "node",

The updated NodeSubqueue.php
/**
 * Drupal 7 nodesubqueue source from database.
 *
 * @MigrateSource(
 *   id = "d7_nodesubqueue",
 *   source_module = "node",
 * )
 */

And the updated NodeQueue.php
/**
 * Drupal 7 nodequeue source from database.
 *
 * @MigrateSource(
 *   id = "d7_nodequeue",
 *   source_module = "node",
 * )
 */

Unfortunately I am still getting this error.
If I disable the migrate_nodequeue the migration goes through, but the data does not get migrated.  This kind-of defeats the purpose.
I have just noticed a dev version of nodequeue_migrate so I may give that a try.  Still want to see here if there is another solution.
Thanks


texts: Entity metadata wrapper, get field collection in field collection

texts:
I want to get (and to set after) the value of a field collection in a field collection (multidimensional field content).

This is my code :

// The node is a custom content.

// I get the list of first collections fields.
$temp = field_collection_get($node,'field_top');
// Shows the structure you can see below in the screenshot.
dpm($temp->value()[0]);

// Now, I want to get the value of field_website_informations.
// I've tried several ways but I couldn't find the right way.
// The following line returns an error.
$testage = entity_metadata_wrapper($temp->value()[0], 'field_website_informations');

Is it possible to do with the Entity API?

The screenshot :


texts:
I am trying to setup behat tests with Selenium and Chromedriver for my D8 project.

All @api tests work perfectly, but as soon as I add @javascript, it stops working with

Behat\Testwork\Call\Exception\FatalThrowableError: Fatal error: Call to a member function elements() on null in vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php:488

My Behat.yml

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
 extensions:
   Behat\MinkExtension:
     goutte: ~
     javascript_session: 'selenium2'
     browser_name: 'chrome'
     selenium2:
       wd_host: 'http://192.168.56.1:5555/wd/hub'
     base_url: http://mydev.dev
   Drupal\DrupalExtension:
     api_driver: "drupal"
     blackbox: ~
     drush:
       root: "/usr/share/drush"
     drupal:
       drupal_root: "/var/www/mydev"

It is important to note that i am running inside a vagrant box and that I am also running my behat tests from within the vagrant box using:

bin/behat -v -c behat.yml features/my_feature/

My current feature just contains:

@api @javascript
Feature: Create a Quiz
In order to have a quiz on my site, as a Content Editor, I need to be
able to create one

Scenario: Create a quiz
  Given I am logged in as a user with the "administrator" role
  And I go to "node/add/quiz"
  #Then show last response

I have registered a node on my local machine (host) to the selenium hub within the vagrant. I have also validated that http://192.168.56.1:5555/wd/hub/ is working just fine.

Thanks in advance


texts:
I try to save some data I get into a form in the database but I don't know how to do it.

Currently, here is what I have in the database (I try to add articles). As you can see I already have 2 of them but I set them using directly the CMS.
Now I would like to be able to modify these data (for exemple the title of an article) and even add new full articles if possible.

To get the articles this is what I am doing (it works).

    $query = \Drupal::entityQuery('node');
    $query->condition('type', 'Article');
    $items_ids = $query->execute();
    $items = Node::loadMultiple($items_ids);

How do I set the title for the article 2 to title 2 changed?


texts: How can I have device-specific block layouts?

texts:
I'm fairly new to Drupal. In my current project, I'm using Drupal 8. The site is supposed to have a fairly different look depending on the device, in a way such that being responsive is not enough here.

So, within a single custom theme, I would like my site to have two different block layouts depending on the type of device (mobile / desktop) on which it is displayed. This can be achieved by showing / hiding blocks depending on the device. For performance reasons it is important for the hidden blocks to not be rendered at all in the HTML code (i.e. merely hiding with CSS won't do).

For this it seems that a combination of the Context module and its little brother Context Mobile Detect would do the trick. However, Context Mobile Detect is not yet available in Drupal 8, preventing me of using the Context module with the relevant condition.

Is this the right approach? Any other solutions for achieving what I'm trying to do here? This seems like a common enough problem to me and I'm expecting other developers to have found a way.
If it is: I'm tempted to write my own custom condition (wrapping the project Mobile Detect) so I can use it with the Context module. It seems Context uses the Drupal 8 Condition API, but I can't find any useful resource on how to write my own custom conditions in version 8 of Drupal. The official doc is sparse at best and I would rather avoid trying to reverse-engineer the thing. Any of you have a useful link/video/advice for this?


texts: How to make certain nodes available to anonymous users?

texts:
I am having a site that hosts a number of content items (nodes) that are available to registered users. We would like to make some of those data available to anonymous users, too, via a view. I have encountered so far two issues:

The nodes have attachments and currently the attachments are saved
in Drupal's private storage. When an anonymous user will try to
access the attachment directly, they will see an error.
Currently, I deny to anonymous users the permission to View published content. Thus, when a user clicks a link to a node, he will see an Access Denied error. This can be perhaps solved by using Content Access.

The solution I can think of is to clone the nodes I want to make public and make public their cloned counterparts but I dislike data copying as a practise. Any other ideas?


texts: How do I create customer/order relationship with entities?

texts:
I am fairly new to Drupal 7 and especially new to the entity concept.
I need to create a site which records customer data (name, address etc) as well as other objects/entities such as orders, which are related to the customer with a parent/child relationship. I don't know how to do this in Drupal 6 and definitely not in Drupal 7. I know you can create a node reference as a field, but that is not what I want.

I'm pretty sure this has to do with entities, as entities are paralleled to objects, and what I really need is an object to own another object. I am presently listening through tutorials about Entities, but can someone point me in the correct direction to see what exactly I should be looking for (and to perhaps clarify the Entity concept to me).


texts: I've run into a problem where i set the maximum length of a field to short. There are 500+ nodes using this field so delete and re-write everything would be very time consuming. Is there an easy way to copy the values to another/new field with longer maximum lenght?


texts: how do i get fields value of webform before entering into database?

texts: I want value of a hidden field of webform in custom module so that i could match it with other value from database to validate it


texts:
Possible Duplicate:
  Is it possible to assign permission to fields?

I have a contact type called contact form, and I want to alter the fields that are visible when adding that contact type, based on the user role. I want admin to be able to change the value of fields such as 'status', 'date completed' etc but I don't want these to be visible to the anonymous role.


texts: How do we make the date field default to today's date?

texts:
We want the date field to default to today's date when creating a new article.
In the node edit form it defaults to the date set in the content type field settings.
In the field settings form, it says "leave blank to use the time of form submission". If we leave it blank, it saves the form submission time which is then the new default for the node edit form.

How do we make the date field in the node edit form always show today's date for new content?


texts: Use custom datetime format in view (both created in code)

texts:
I have a view displaying a date field (from the Date module). I only want it to show hh:mm though, so I created a new datetime format.
This worked fine until I moved it into my module, i.e. I create it via hook_data_format_types and hook_date_formats. The view is also created by the module (via Features).

Now my problem is that after enabling the module, the view uses the default datetime format.
After saving the date/time formats (without performing any modifications) it works fine though so it smells like some caching issue.

I wonder how to make it work without this step as having to do anything but enabling the module, especially when unrelated to what the module does, is not very user-friendly.


texts: How do I assert for a link's href AND link text in a functional test?

texts:
In a functional test, I can use WebAssert::linkByHrefExists() to check that a link with a specific href exists on the page. And I can use WebAssert::linkExists() to check that a link with a specific link text exists on the page.

But there's no guarantee that these two will find the same link! How do I check that a link on the page has the expected href AND text?


texts: How do I add a Product to the Cart programmatically in Ubercart?

texts:
I'm creating a section of my site where users must purchase individual nodes of a certain content type. In an effort to enhance usability, I allow the user to create the node without paying, but then save it as "Unpublished" so it's not yet visible on the site. Then, once the user pays, we'll publish their node. So whenever a user creates a node of a particular type, it should add a Product (which represents the right to post that particular node) to the user's Cart.

I know I can implement hook_nodeapi() to hook into the node creation event, but how do I add the product to their cart?


texts:
Normally, I can use kint() in the place of dump() to debug my twig templates.  The theming manual agrees.

However, this doesn't work for me in Commerce 2.

In commerce-product.html.twig, I added

{{ kint(product) }}

And rebuilt the cache.

This caused me to be redirected to the "install" url, with the message "Drupal is already installed".

If I use {{ dump(product) }}, I get the expected output, but this array is enormous and hard to read so I want to use kint.  Is there something different about variables in Commerce?

If I use {{ kint(links) }} and the like in a template copied from core I see the kint output correctly.


texts:
I'm developing a website that mostly sells electrical wire. Prices are per kilometer and imported into commerce with 2 decimal places. Order amounts are per meter though, so in a rule I divide the price by 1000 when calculating the unit price. I use the following module for formatting the price with 5 decimals after the decimal point: https://drupal.org/project/commerce_price_decimals_formatter . In the display node this renders the price per meter correctly.

In the shopping cart view, I can also choose to format the price with 5 decimals, but the extra decimals are not shown, and simply show zeros.

So if I have a cable that's priced at

€ 124.44 / km, it shows
€ 0.12444 / m in the product display node, but
€ 0.12000 / m in the shopping cart

The totals in the shopping cart are correct. I'm guessing views is only getting the unit price up to 2 decimals out of commerce. What can be done to fix this?


texts: I was trying to make a row of the table I created using Views into something that was clickable. I'm really not finding anything online and everything I try doesn't give me the effect I'm looking for. I'm hoping someone here could share some insights. Thanks.


texts: How to import Image alt, titles or File description?

texts:
Hello Drupal Community,

In a Product display i have image and file fields, I was wondering if there is a bulk way to import image alt text and image title or File description?

I used feeds to import images and multiple Files into product display but i cant find a mapping options to link alt, title or file description.
Also i was considering it is possible with VBO by executing arbitrary PHP script.

Any assistance would be appreciated.
Thank you
Darius


texts: Passing field value to #autocomplete_route_name in custom form

texts:
I am creating a custom form where I have 2 fields.

Taxonomy : select field having list of vocabularies.
Terms : Autocomplete field having terms list.

When I start typing in terms field, the value of the term field is passed to the routing function. However I also need the value of the taxonomy field in routing function so that I can restrict the terms list.

Is there anyway that I can get the other field values in the routing function?

Here is my buildform function :

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['taxonomy'] = [
    '#type' => 'select',
    '#title' => $this->t('Select Taxonomy'),
    '#options' => $taxonomies,
  ];

  $form['taxonomy_terms'] = [
    '#type' => 'textfield',
    '#autocomplete_route_name' => 'unido_drupal_admin.get_taxonomies'
  ];

  return $form;
}

Here is my routing function :

public function get_taxonomies(Request $request) {
  // Here I need to get taxonomy field value to restrict the result.
  $params = $request->query->all();
  $result = \Drupal\taxonomy\Entity\Vocabulary::loadMultiple();
}

Thanks.


texts: How can I create a table in which columns and rows get added dynamically?

texts:
I want to create table with Tasks as columns and Users as rows.

Here is a sample of how such a table should look like:

------------------------------------
|       | Task 1 | Task 2 | Task 3 |
------------------------------------
| User1 | 30%    | 0      |        |
| User2 | Done   | 100%   |        |
| User3 |        | 100%   | 10%    |
------------------------------------

I want to do it in the following way.
When I create a new node with Node Type "Task" that has
title "Task XX..." and some description, then the new
column with "Task XX" label appears.

Users (User1,User2...) are just a group of drupal users.
So probably I need a new Node Type like "User tasks track".

And when a new "Task XX" appears, probably Node Type
"User tasks track" should be extended with a new field "Task XX".

I've checked a lot of modules (EditableViews, ViewsMatrix, QuickEdit,
Datatables, AjaxTable, Footable, FiledCollections, SlickGrids),
but I still can't see the whole solution.
If these modules can provide the described behaviour.
I can write custom module which plays with database, but I really don't
want to invent the wheel, if there is the solution somewhere out there.

Please help me with you opinion, any references, architectural tricks/advice.
Anything that can at least show me the directions to the solution.


texts: Why do I have two menu bars in my drupal instance?

texts:
I noticed while I was building my theme, that I have 2 menu bars at the top of my screen, like so:

I don't see anywhere that would indicate there would be two.

How would I go about fixing that?


texts: How do I force config overrides to refresh?

texts:
I've setup a system of dynamic config overrides using a service tagged with config.factory.override. This override overrides the system.site name configuration.

I have a form that upon submission invalidates the necessity for that override. An email is sent as part of this submission handler, that includes a token for [site:name] and [site:url]. The token swap happens as part of another module that I'm not coding, so I cannot set this up to retrieve the original non-overridden values.

I have found that if I call drupal_flush_all_caches() in my submission handler, the emails show up with the correct values for the original non-overridden values.

I don't want to take this sledgehammer approach however. But I cannot figure out what to invalidate to force the config values to regenerate rather than use the originally overridden values.

I've tried invalidating the static cache. I've tried invalidating cache tags for system.site and system.site.name. And a lot of other various cache invalidations. However, the only thing I can find that actually works is drupal_flush_all_caches().

Does anyone know how I can force the config system (or maybe the Token system?) to rebuild config (or token) values?


texts: Change Password/Confirm_Password Password Tips

texts:
How does one go about changing the Password Tips for the password_confirm form element?

This one specifically:

Recommendations to make your password stronger:
•Make it at least 12 characters
•Add lowercase letters
•Add uppercase letters
•Add numbers
•Add punctuation

Into something like:

Password should have:
• Minimum of 12 characters
• At least one lowercase letter
• At least one uppercase letter
• At least one number
• At least one special character
• No three consecutive same characters

I'm tried using the hook_element_info_alter() hook that calls a method my_module_form_process_password_confirm() and followed this template(https://api.drupal.org/api/drupal/core%21modules%21user%21user.module/function/user_form_process_password_confirm/8.5.x).

But it doesn't seem to be working.

/**
 * Implements hook_element_info_alter().
 */
function client_element_info_alter(array &$types) {
  if (isset($types['password_confirm'])) {
    $types['password_confirm']['#process'][] = 'client_form_process_password_confirm';
  }
}

function client_form_process_password_confirm($element){
  if (($key = array_search('user_form_process_password_confirm', $element['#process'])) !== false) {
    unset($element['#process'][$key]);
  }
  $element['#process'] = array_values($element['#process']);

  $password_settings = [
    'confirmTitle' => t('Passwords match DOES IT:'),
    'confirmSuccess' => t('yes'),
    'confirmFailure' => t('no'),
    'showStrengthIndicator' => FALSE,
  ];

  $password_settings['showStrengthIndicator'] = TRUE;
  $password_settings += [
    'strengthTitle' => t('Password strength:'),
    'hasWeaknesses' => t('Password should have:'),
    'tooShort' => t('Minimum of 12 characters'),
    'addLowerCase' => t('At least one lowercase letter'),
    'addUpperCase' => t('At least one uppercase letter'),
    'addNumbers' => t('At least one number'),
    'addPunctuation' => t('At least one special character'),
    'sameAsUsername' => t('Make it different from your username'),
    'weak' => t('Weak'),
    'fair' => t('Fair'),
    'good' => t('Good'),
    'strong' => t('Strong'),
    'username' => \Drupal::currentUser()->getUsername(),
  ];

  $element['#attached']['library'][] = 'user/drupal.user';
  $element['#attached']['drupalSettings']['password'] = $password_settings;

  return $element;
}


texts: How to create non-entity(custom) Index in Search API

texts:
I'm working on a website that calls another external web service. I want to collect those data somewhere on the D8 website. then based on them I'll provide some REST endpoints for the FE layer.

one solution can create a custom entity or custom content type and on cron run  get data from the external web service and store them into the custom entity and custom content type then they will be indexed and will be available on the search_api to write a REST endpoint on them but the problem is that structure of the data is complicated and I don't want to engage drupal entity in the project.

my question is how can I create a custom search API index programmatically without having content type or custom entity?


texts: Fixing Notice: Undefined variable: content_share in include() (line 39....node.tpl.php)?

texts:
I followed online tutorials and defined a new region in litejazz Drupal 7 theme info file as :

regions[content_share] = Content Bottom

and exposed the new block using the code below in node.tpl.php as :

  <?php if (!empty($content['links']['node']['#links']) || !empty($content['links']['comment']['#links']) || !empty($content['links']['blog']['#links'])): ?>

&raquo; <?php print render($content['links']); ?>

  <?php endif; ?>
      <?php if ($content_share): ?> //<<<<<<<<<<<- THIS LINE CAUSES WARNING

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

<?php endif; ?>
  <?php if ($content['comments'] && ($page)) { ?>
    <?php print render($content['comments']); ?>
  <?php }; ?>

Now my logs are getting filled with following warning :

  Notice: Undefined variable: content_share in include() (line 39 of
  /srv/bindings/ertr88c9reretrea25f7b405eeee/code/sites/all/themes/litejazz/templates/node.tpl.php).

I had tried clearing cache as suggested in other solutions but none worked.


texts: How can I use REST API to create a node with status/tags/data

texts:
Follow the Services module document, I can only create nodes using REST API with type, title and body. But I am not able to create nodes with more parameters such as tags, status and date.

Need help.


texts: Hook path in main menu not hold active trail

texts:
In custom module names supply_area I've created custom path.

function supply_area_menu() {
    $items['supply-area'] = array(
        'title' => 'Supply area',
        'page callback' => 'supply_area_page',
        'type' => MENU_NORMAL_ITEM,
        'access callback' => true,
        'menu_name' => 'main-menu',
    );
    return $items;
}

Everything works perfectly except that even if I assign this path into main menu structure it does not hold menu structure so breadcrumbs looks like:
Home > Supply area and not Home > About > Supply area.
Is there something wrong with my hook_menu?


texts: Trying to create a custom menu link in a menu

texts:
So I want to have different menu links depending on if a user has received a message or not.

I make a hook_menu() instance, like this:

/**
 * Implements hook_menu().
 */
function MYMODULE_menu() {
  global $user;
  $items = array();
  $items['user/' . $user->uid . '/messages'] = array(
    'access callback' => 'user_is_logged_in',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'main-menu',
    'title' => t('Messages'),
  );
  return $items;
}

However it only takes me to my user page, and not the messages (which should be a view at the path specified).

Is there a way to make it so that I can directly go from this item link in the menu to the view?


texts: Why there are two payment for one order with same remote ID

texts:
Right now, I am using Commerce Paypal to capture payment. But I found there is a order which shows me two logs for capturing payment. However, I just find one in my paypal account and also I found the Remote ID in both two logs are same.
The customer bought one item which costs $17, but the total shows on drupal is $34. What is the exact total price for this order? Does anyone know why this happened? Is there something wrong during my config?

Here is a screenshot for this strange order:


texts: Rules send email on entityform submission with current node field content

texts:
I have a rule which sends an email on saving an entityform. The entityform appears on several nodes.

I would like to 'grab' field content specific to these nodes and include this data in the email message body.

I think I might need a rule component but I'm unsure how to build a relationship between the node content and the entityform.

Can anyone help?


texts: How can I access XMLSitemap links from external PHP script?

texts:
I have an external PHP script that does a lot of back end processing for a website.  I need for this PHP script to query, insert, and delete various links from the XML Sitemap.

I want to use XMLSitemap's API instead of raw SQL so any additional functionality that needs to happen on inserts and deletes are called, like any alter hooks, etc.

I don't want to bog down the website for this processing, hence why I need to do this from a back-end script.


texts: How to set Permission based on roles for Views Data Export

texts:
Using views data export module, I set the permission for different roles in the Data Export in Views like:

But I can still see the Export button for all users in front page. However if the role doesn't have permission to export then after clicking it they are redirected to Access Denied Page

Is there any way I can hide the export button from all the user roles except the ones that have permission to export?

If it was a link defined in *.tpl.php then I could have done something like

<?php if (in_array('myRole', $user->roles)): ?>
// The export button
<?php endif; ?>

But I couldn't figure out how to do it with Views Data Export (without hacking the module)


texts:
I am doing some updates on existing drupal multi site set up and am unable to set up cron for subsites. Subsites are accessed in a different way (example.com/site1 example.com/site2 )
From browser accessing example.com/site1/cron.php runs the cron but its not running from crontab.

45 11 * * * /usr/bin/lynx -source http://example.com/site1/cron.php
45 11 * * * /usr/bin/wget -O - -q -t 1 http://example.com/site1/cron.php
45 11 * * * curl --silent --compressed http://example.com/site1/cron.php

Tried all these but its not triggering cron functions.


texts: How can I change the Available Menus to all, programmatically, for a specific content type?

texts:
Hello I'm trying to alter a content-type's menu options by code, since there will be new menus that keep being created on the site and I can't keep going back to the content type to keep adding every single menu to the Available Menus. I should be able to set the default available menus to all, or all custom... but I can't figure this out. I'm looking at the function menu_form_node_type_form_alter and created a module to override, however nothing changes, and the Main Menu is always the default available menu. I'm actually trying to prepopulate the parent menu through the URL, which only works if the parent menu is checked as available, but it's not working for all the new menus because the parent menu is not set as available ... How do I override the default menu option for a certain content type so that the available menu checkboxes gets set automatically to all of the custom menus that were created?

Thanks in advance!

update:
still not figured out yet, but,
I went straight into the core menu module and modified this piece of the function above:

  $form['menu']['menu_options'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Available menus'),
    '#default_value' => variable_get('menu_options_' . $type->type, array('main-menu')),
    '#options' => $menu_options,
    '#description' => t('The menus available to place links in for this content type.'),

changing the 'main-menu' to a different name actually works straight from core but doesn't work when trying to override with my own module.