texts: "CSRF validation failed" using "Session Token authentication only"

texts:
Having problem in CSRF validation when using Session Token authentication only using services_session_token_auth 7.x-1.x-dev module.

already set the token but it keeps throwing CSRF validation failed.

I am getting token using
services/session/token I follow all the steps in README but no luck to make it work.

anyone can help me to point out what I am doing wrong?

Note: this works in default session authentication.


texts: Proper way to display custom line item fields on checkout form

texts:
Is there any proper way to display custom line item fields on checkout form?

I know that I can add each custom field one by one into views but it's complicated when I have few line items with dozen conditional fields and you need always to remember about it.

I found out that I can add to checkout view "Rendered Commerce Line item", formatter: "render complete entity" and choose necessary fields by adding custom view mode by hook_entity_info_alter. That's great with one little problem. It's always rendering number before my fields (it's line item id?).

Is there any way to get rid of that number (maybe altering some hook?) or other way to list out all line item fields?


texts: How to use the Rules module to implement a custom redirect for an outdated URL?

texts:
I used to show content from a catalog via the Views module, accessing an external database, so that all of the URLs would be something like /content?name=[name].

For various reasons, I've opted to import the content directly into Drupal as a unique content type. So now my URLs are /content/[name].

I need to implement a 301 redirect so that people going to the first URL (due to old bookmarks, links, etc.) are taken to the new URL.

Is it possible to set up a rule for the content type to accomplish this? The [name] field is the same so I feel like it should be a fairly straightforward thing to set up.

I did some searching around, and came up with RewriteRule ^/?content/([^/d]+)/?$ content?name=$1 [L,QSA]. I tried putting that in the .htaccess file after RewriteEngine on, and that didn't work. Am I following the proper .htaccess convention? I tried RewriteRule ^(.*)/content?name=(.*)$ $1/content/$2 [R,L] too, but it didn't work.


texts: The "Add another item" button doesn't work with field groups

texts:
I am working on a site that uses a lot of horizontal field groups. I am having a problem where any fields that sit in a field group and have "unlimited" set for the number of entries is unable to use the "Add another item" button. The AJAX call is returning some JS settings but no HTML.

The fields themselves range from simple text fields to node references. If a field is not residing in a field group then it works fine.

I will point out that I am using Drupal 7 and field_group version 7.x-1.1.

It seems that the Drupal core is unable to properly identify which button was clicked and so has not idea how to respond.


texts: Can't access default Drupal twig functions

texts: I am unable to get a result back from app.request.attributes.get('_route'). What could cause this. I have tried similar variable and still get no response.


texts: How to send form submitted data to paypal in Drupal?

texts:
I have setup a form where user fill some fields and choose a user type & on submission I have to send him to paypal with the values which he filled up, so that on IPN callback I receive the data from them and do something(this is the procedure I have come to know from reading paypal integration with php), I am stuck at form point because at submission I have another function where I can get the selected value by form_state..

Here is the code --

<?php

//Hook_Menu for paypal callback function.
function user_type_registration_menu(){
  $items = array();
          $items['paypal/payment/ipn'] = array(
          'title' => t('Paypal Payment IPN'),
          'description' => t('Paypal Payment IPN'),
          'type' => MENU_CALLBACK,
        'file'  => 'paypal_payment.inc',
          'page callback' => 'paypal_payment_paypal_ipn_callback',
          'access callback' => TRUE,
        );
      return $items;
}

//Form alter for registration form.
function user_type_register_form_alter(&$form, &$form_state, $form_id){
  switch($form_id) {
      case 'user_register_form': // the value we stole from the rendered form
        $form['account']['user_type'] = array(
          '#type' => 'select',
          '#title' => t('Membership Type:'),
          '#options' => array(
            0 => t('General $50.00/Yr'),
            1 => t('Student $40.00/Yr'),
            2 => t('Government $60.00/Yr'),
            ),
           '#weight' => -11,
           '#description' => t('Select the membership type, which you want to have.'),
          );
        $form['account']['user_type_submit'] = array(
          '#type' => 'submit',
          '#value' => t('Submit'),
          '#submit' => array('user_type_register_form_submit'),
          '#validate' => array('user_type_register_form_alter_validate'),
        );
        $form['account']['name']['#description'] = t('');
        $form['account']['mail']['#description'] = t('');
        unset ($form['actions']);// unset the default submit Button
        return $form;
      break;
    }
}

function user_type_register_form_submit($form, &$form_state){
  $username = $form_state['values']['name'];
  $user_email = $form_state['values']['mail'];
  $user_type = $form_state['values']['user_type'];
  $password = user_password(8);
  switch($user_type){

    case '0':
      dpm("General");
      $membership_price = 50;
      $fields = array(
        'name' => $username,
        'mail' => $user_email,
        'pass' => $password,
        'status' => 1,
        'init' => $user_email,
        'roles' => array(
          DRUPAL_AUTHENTICATED_RID => 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account->password = $fields['password'];
      //--Here I have to send if to PAYPAL

      dpm("user registered");
      break;

    case '1':
      dpm("Student");
      $membership_price = 40;
      $fields = array(
        'name' => $username,
        'mail' => $user_email,
        'pass' => $password,
        'status' => 1,
        'init' => $user_email,
        'roles' => array(
          DRUPAL_AUTHENTICATED_RID => 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account->password = $fields['password'];
      //--Here I have to send if to PAYPAL
      break;

    case '2':
      dpm("Government");
      $membership_price = 60;
      $fields = array(
        'name' => $username,
        'mail' => $user_email,
        'pass' => $password,
        'status' => 1,
        'init' => $user_email,
        'roles' => array(
          DRUPAL_AUTHENTICATED_RID => 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account->password = $fields['password'];
      //--Here I have to send if to PAYPAL
      break;
  }
}

function user_type_register_form_alter_validate(){

}

I hope somebody can help...


texts: Unique Identifier of Every Drupal User Instance

texts:
I've been developing a custom module in my drupal system. One user account can be simultaneously access in different computer/browser. For example:

Username: ghlatorre
Computers accessing my system/module using the username ghlatorre: Computers 1, 2, 3, 4, 5

Is there a unique identifier I could use to differentiate these different system user instances?


texts: How can I set node/entity references automatically using rules?

texts:
Use case: On my site, when a user registers, four nodes of four different content types are automatically created using rules.  I would like references to these nodes to be stored using node/entity reference* fields in the user profile.  I want to use rules to assign each node to the respective field in the user profile automatically.  Is there a way to configure a rule to do this?

I tried using the rules "Set a data value" to set the user profile field to the created node but that didn't work-- it doesn't give an error, but after the rule is triggered the reference is still unset.

I wrote "entity/node" reference because I am happy to use either the entity reference or the references module, so long as I can get a solution.


texts: Redirect user to previous page after registration

texts:
I'd like users registering on my website are redirected to the page where they clicked the "create account" button which is in a modal.

First, I tried to redirect to an absolute url
I tried

$form_state->setRedirect($myUrl);

I tried

$_REQUEST['destination'] = '<front>';

I tried this too :

$response = new \Drupal\Core\Routing\TrustedRedirectResponse('http://www.google.be');
$form_state->setResponse($response);

I'm always redirected to /user/[uid]/edit


texts: Returning Values from Tableselect Form with AJAX

texts:
Objective:

To combine AJAX Autocomplete with my Tableselect Form to create a key for users to select imported products that don't match existing products within your Drupal site. This new billing module would make it possible to use a specific 3rd party billing service.

Issue:

I am unable to get the following code to return the values inserted via the AJAX row. The array continues to send back the array keys of the row as both keys and values.
Here is what the original selection is:

And here is the returned values:

As you can see the rows selected have their array key listed as the value on return, where as the non selected row has the value 0.

Question: How do you change the return value so that it is the value that was selected on my AJAX form field?

function Test_product_form($form, &$form_state)
{
  $form_state['page_num'] = 2;

  $form['Markup'] = array(
    '#markup' => t('Please select and synchronize Test Subscription Offers with your Drupal Commerce Product SKUS below:') . '
' . '
'
  );

  foreach ($form_state['sub_offers'] as $key => $offer) {
    if ($offer['Status'] == 'Active') {
      $product = commerce_product_load_by_sku($offer['OfferCode']) ? commerce_product_load_by_sku($offer['OfferCode']) : FALSE;

      if ($product === FALSE) {
        $rows[] = array(
          'Test Subscription Offers' => array(
            'data' => $offer['OfferCode'],
            'id' => 'row' . $key . '-aso',
            'class' => 'col-aso'
          ),
          'Drupal Product SKUS' => array(
            'data' => array(
              // drupal_get_form('commerce_product_line_item_add_form'),
              '#type' => 'textfield',
              '#title' => t('Product SKU'),
              '#description' => t('Enter the SKU of the product to add to the order.'),
              '#autocomplete_path' => 'commerce_product/autocomplete/commerce_product/line_item_product_selector/product',
              '#size' => 60,
              '#maxlength' => 255,
              //In order for AJAX within the Rows of tableselect form you must declare the
              '#id' => $key . 'product_textfield'
            ),
            'id' => 'row' . $key . '-dps',
            'class' => 'col-dps'
          )
        );

      } else {
        $rows[] = array(
          'Test Subscription Offers' => array(
            'data' => $offer['OfferCode'],
            'id' => 'row' . $key . '-aso',
            'class' => 'col-aso'
          ),
          'Drupal Product SKUS' => array(
            'data' => array(
              '#type' => 'link',
              '#title' => $product->sku,
              '#href' => 'admin/commerce/products/' . $product->product_id
              // '#options' => $l_options,
              // '#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
            ),
            'id' => 'row' . $key . '-dps',
            'class' => 'col-dps'
          )
        );
      }
    }
  }
  $hinput = array(
    'Test Subscription Offers' => 'aso',
    'Drupal Product SKUS' => 'dps'
  );

  foreach ($hinput as $hkey => $hvalue) {
    $header[$hkey] = array(
      'data' => $hkey,
      'id' => 'head-' . $hvalue,
      'class' => 'col-' . $hvalue
    );
  }

  $options = array();

  foreach ($rows as $key => $row) {
    $options[$key] = array(
      'Test Subscription Offers' => $row['Test Subscription Offers'],
      'Drupal Product SKUS' => $row['Drupal Product SKUS']
    );

  }

  $form['table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    //'#js_select' => TRUE,
    '#multiple' => TRUE
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
    '#submit' => array(
      'Test_payment_submit_step_two'
    ),
    '#validate' => array(
      'Test_payment_validate_step_two'
    )
  );
  ddl_once($form);
  return ($form);

}


texts: Views 8.x fields collection relationship

texts:
In D7 views it was very easy to get to a particular field from field collection - by relationship.

How about now? I can not see any relationship connected with this collection. I am able to display FC content only (all at once, by one field).

Any ideas?


texts: How do I create templates in my custom module?

texts:
I've created a custom module that has a bunch of PHP functions whose main purpose is basically to output HTML. For example:

function showRecentActivity($tid, $recordStart, $count){
    //do some db_select stuff to get an array of node IDs...

    foreach($nids as $nid){
        $node = node_load($nid);

        //now that we've loaded the node, 100 lines of if, echo, etc. will follow in order to output the HTML to the page
}

Perhaps you can already see the problem. While echoing HTML is fine for small pieces of markup, constructing full pages with echo statements is horrible to code, maintain, and very bug-prone.

Obviously what is needed is a pre-defined template file, written in HTML with just small places for echoing the necessary PHP variables. Just like my theme's template files.

But I have no idea how to do this with my custom module.


texts: HTML E-Mails are being sent out as plaintext

texts:
I am  using the Swift mailer module to send HTML emails. My actual body in hook_mail_alter() is the following.

New Enquiry Appear

            お名前
            @name

            &nbsp;メールアドレス
            @email

            &nbsp;電話番号
            @mobile

            題名
            @title

            メッセージ本文
            @message

&nbsp;

The actual output is something like the following.

    /*New Enquiry Appear */

お名前
                        amol

                         メールアドレス
                        testl@gmail.com

                         電話番号
                        99888776655

                        題名
                        challawar
               Html tag are not converted in Bold and Italic.

                        メッセージ本文
                        sssssssssssssssss

I want my output to be well formatted as per my HTML markup. (Few HTML tags like
, , and
 are not working in the above example.)


texts: How to build a module which calls a JS file on one certain node?

texts:
There’s one site (A) which via an API of one other Drupal site (B) gets an already rendered views block displayed on one node - finally with hook_menu() and hook_block_view(). So now I have that node (/stuff) here with it’s views rows and views fields containers.

Since these things really have nothing to do with (B) (where I also don’t have access to) I want to build a module (button) on (A) which calls a JS to manipulate the DOM only on /stuff. Which hooks and syntax will I need?


texts: what when displaying a variable with kint crashes?

texts:
I am trying to find the variable name for the content link in a view.

{{ kint(content) }} makes the page crash, probably because the variable is too big.

The same is true for the following code.

function my_theme_preprocess_field(&$variables, $hook) {
    var_dump($variables);
}

How can I find out what I am looking for?


texts: How to import beans using the migrate module?

texts:
The migrate module allows you to migrate many different kinds of content with what it calls Destination Classes. However i don't see support for beans in there.

I've searched in https://drupal.org/project/migrate_extras and https://drupal.org/project/issues/migrate_extras?categories=All to no avail. So my question is how would i go about importing beans into my DB?

For the moment i've been using bean_create, however I believe an implementation that hooks into migrate would be better.

The default Destination Classes are https://drupal.org/node/1006988


texts: How allowing img tag in formats can be dangerous?

texts:
I get this recommendation form Security review module:

  It is recommended you remove the following tags from roles accessible
  by untrusted users: img

I am wondering what real world threats can img pose?


texts:
My Drupal 7 installation has a handful of tables that have been corrupted. Attempts to repair them have not been successful so my best chance of being able to move forward is to recreate them.

I have not been able to find the DDLs for the tables that are corrupt so my question is, where might I find the DDLs for the core Drupal tables so I may recreate them?

The 2 tables that seem to be giving me the most grief because they are not available are field_data_field_files and field_revision_field_files.


texts:
I'm a bit confused about best practices for testing in Drupal 7.

When I'm going to deploy, should I run the entire test suite—including all Drupal core tests—every time? This seems like a bit of overkill, especially given how long each test takes to run.

At the same time, it seems logical that I should run all tests every time, since code changes I make in my custom modules could break something in core (via hooks, etc.). The problem is, each test runs in a sandbox with only its dependencies enabled, so core tests won't even be aware of my custom modules and thus won't fail even if they should.

I'm accustomed to testing in Rails, in which tests are run against the entire application as a cohesive unit, with all "modules" (gems) being enabled at test runtime. It seems that in Drupal, only certain pieces are tested at a time, which prevents an accurate assessment of whether the site will work in production.

So I guess my question is twofold: A) Should I run the entire Drupal test suite (including core tests) every time I deploy? B) How do I check whether my custom code causes core tests to fail, given that core tests don't take custom modules into account?


texts: Create any number of paragraph fields in a multiple value field on node create form

texts:
I have a paragraphs field that takes a term reference.

I need to count how many terms there are for a specific vocabulary and then create that many instance of the paragraphs multiple value field for when creating a node of a certain type. Can this be done with Hook_form_alter ?

It is important that these fields are loaded when the node creation form is loaded rather than the user having to click add more

Any help would be greatly appreciated

I have tried this but when saving the node it doesn't save the new fields

function hook_form_alter(&$form, $form_state, $form_id) {

  if ($form_id == 'my_form') {

  $item = $form['field_features']['widget']['0'];

  // get taxonomy terms
  $query = \Drupal::entityQuery('taxonomy_term');
  $query->condition('vid', "my_voc");
  $tids = $query->execute();
  $terms = \Drupal\taxonomy\Entity\Term::loadMultiple($tids);

  $count = count($terms);

  $i = '1';
  foreach($terms as $term){
    $form['field_features_para']['widget'][$i] = $item;
    $form['field_features_para']['widget'][$i]['#delta'] = $i;
    $form['field_features_para']['widget'][$i]['#weight'] = $i;
    $i ++;
  }
 }
}


texts: How to make a custom block visible if and only if there are no other blocks active in given region

texts: The site's header banner is displayed using a custom block containing an image.  Is it possible to create a default block which will return visibility = TRUE only in the case that there are no other blocks which are visible in the header region for the page currently being rendered?  In other words, can a PHP-code visibility test access the list of blocks which will be rendered in the block's region? If not, how can this functionality be implemented?


texts:
I have installed apachesolr module and built the index for it. now i can search normally but when i filter the result using any enabled filter, the result DOES'T change and i get the same result of searching for the key. for example i searched for business and then filtered the result using taxonomy tid:36 and i got the same result before filtering!!
I have var_dump the $query that has been generated at line 215 in apachesolr_search.module and part of the result is shown below

object(Solr_Base_Query)#17 (13) {
  ["id"]=>
  int(1)
  ["fields":protected]=>
  array(0) {
  }
  ["fields_added":protected]=>
  array(0) {
  }
  ["fields_removed":protected]=>
  array(0) {
  }
  ["filterstring":protected]=>
  string(6) "tid:36"
  ["field_map":protected]=>
  array(0) {
  }
  ["subqueries":protected]=>
  array(0) {
  }
  ["keys":protected]=>
  string(8) "business"
  ["base_path":protected]=>
  string(24) "search/apachesolr_search"
  ["solr":protected]=>
  object(Drupal_Apache_Solr_Service)#16 (20) {....

also the filter doesn't appear in CURRENT SEARCH block. the block still showing

CURRENT SEARCH
Search found 38 items

(-) business

Also I have made a var_dump for params array that has been generated in function apachesolr_search_execute in apachesolr_search.module at line 212 and the result was:

array(13) {
  ["fl"]=>
  string(71) "id,nid,title,comment_count,type,created,changed,score,path,url,uid,name"
  ["rows"]=>
  int(10)
  ["facet"]=>
  string(4) "true"
  ["facet.mincount"]=>
  int(1)
  ["facet.sort"]=>
  string(4) "true"
  ["hl"]=>
  NULL
  ["hl.fragsize"]=>
  NULL
  ["hl.simple.pre"]=>
  NULL
  ["hl.simple.post"]=>
  NULL
  ["hl.snippets"]=>
  NULL
  ["hl.fl"]=>
  NULL
  ["spellcheck.q"]=>
  string(8) "business"
  ["spellcheck"]=>
  string(4) "true"
}

nothing for fq=tid:36
any idea of what i might be missing? or how to fix it?
Thanks for your help


texts: caching views based on arguments as taxonomy term id

texts:
Hi need to enable caching based on taxonomy term id from the url which the views takes as an argument

1)simple cache returns empty results

2)views_arg_cache module also empty

3)views_content_cache module aslo empty

please help if any body has tried such scenario and found the solution


texts: I just noticed that Devel tabs are showing on my Basic Pages, even when the user is not logged in. Anonymous users should not see "View" and "Devel" tabs! I can't find a setting for this in the Devel configuration page. Any ideas how to prevent the tabs from displaying? Thanks!


texts:
OK, so I have 3 different Taxonomy Vocabularies filled like this: One for Carriers [AT&T, T-Mobile] One for Manufacturers [Samsung, iPhone, etc] And one for the Models [Galaxy S3, S4, etc]

All of these are set as an Exposed Filter for a custom view, But what I want is for the last Exposed Filter, "Models" to be Filtered by whatever Selection is made in "Manufacturers"

So if I Select iPhone, I only see Models for iPhones.

I've searched everywhere without the solution I need. And if it is what I needed, I wasn't able to set it up, or directions weren't clear enough.

I have Term References Linked from the Models to the Manufacturers, but idk how to Filter the Exposed Filter to only show Model choices for the selected manufacturer.

How do I filter exposed taxonomy terms with other exposed taxonomy terms?
Any help is appreciated!

I'm Working with Drupal 7.


texts: Is there any danger in caching forms, such as node edit, add, etc?

texts:
I am playing with authenticated caching modules to speed up performance while logged in.  Currently I am using authcache.  However, authcache and other caching modules often have node add, node edit, and other (CRUD) forms excluded from the pages the module will cache.

Why? What is it about a form that it should not be cached? Is there any potential danger in allowing these modules to cache forms found in the authenticated areas?


texts: Output both form and generated image (imagejpeg) onto same page

texts:
This is my first newbie module (drupal 7). It's 'simple' but needs help x2.

Intention: To create an online image-name generator i.e, user types their name into a formfield and the browser outputs the text as a jpg image so they can right-click and save.

What I've done: 1. created one hook menu with two callback functions, one for the form and one for the image output.
2. A working form where user types in their name. 3. Able to output Image by setting name input manually through code, not by submitting the form!

What doesn't work: I created a $name variable within the form function, but using that same $name variable within the image-output function won't work. So I can't output  a text-image when users submit the form.  Also I don't know how to render both form and image output onto the same page.

I need help with: 1. How to render both form and image onto the same page?.
2: How to associate $name variable so inputted text will render upon submit button.

Frameyourname.module:

<?php

//Create simple image-generator.

//Implements hook_menu().

function frameyourname_menu() {
$items['frameyourname'] = array(
'title' => 'Frame Your Name form',
'page callback' => 'drupal_get_form',
'page arguments' => array('frameyourname_nameform'),
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM ,
);

//not entirely sure what to put here.

$items['image'] = array(
'title' => 'image',
'page callback' => 'drupal_get_form',
'page arguments' => array('create_textimage'),
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM ,
  );

return $items;

}

// Define a form.

function frameyourname_nameform() {
$form['user_name'] = array(
'#title' => t('Your Name'),
'#type' => 'textfield',
'#description' => t('Please enter your name.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit')
);
return $form;
}

// Validate the form.
function frameyourname_nameform_validate($form, &$form_state) {
}

// Handle post-validation form submission.
function frameyourname_nameform_submit($form, &$form_state) {

//set name variable associated with user input and test if works.
$name = $form_state['values']['user_name'];
drupal_set_message(t('Thanks for adding your name,'.  $name));
}

// create image
function create_textimage() {

// Create a blank image and add text as per form input
$im = imagecreatetruecolor(400, 400);
$text_color = imagecolorallocate($im, 233, 14, 91);

//trying to reference $name variable not sure how.
imagestring($im, 1, 5, 5,  $name, $text_color);

// Set the content type header
drupal_add_http_header('Content-Type', 'image;jpeg');

// Output the image
imagejpeg($im);

// free from memory
imagejpeg($im);

}


texts: Allow the user to send emails to all or selected rows in a particular views display

texts:
Salut!

I have been working on a 100% non-profit project for 1 month and now I am facing a problem with the main feature that this project offer for free.

The project is a website about people willing to help other for free so there are two roles on the website: Job helper and Job Seeker

When someone register under the role of Job helper, he will be asked to verify his phone number and email address because at any time he might receive email/sms asking him for help.

When someone register under the role of Job seeker, he will be able to see a list of all available Job helper using a view display and then choose one from two options:

A button or link to Send emails to all the available listed Job helper profiles, or
A button or link to send email to only selected Job helper profiles.

Problem:

How to create such functionality, note that the view is already created and displaying all available users which are registered under the Job helper role but I cannot find a way to place a button or link within the view as well as check box near to every user so a Job Seeker can select all or select few profiles and send a customized email.

Solutions:

1) Using VBO, is possible to do the above, however after selecting users to send emails for them, I want the Job Seeker to be able to customize only the message body being sent, but VBO will display all the field shown in the picture below which will confuse the user of the website.

I want to display only the message text body so the Job Seeker can customize his own message like:

"We need help in cleaning the beach of Florida from any garbage at 14:00 tomorrow 15/Jun/2017, please be there for the beach"

Note the Job Seeker will have to write no recipient and no subject just a message text about the job.

2) I have an idea about using flag module with views, and so the Job Seeker will have to flag every single Job Helper and then write a customized message body to be send via email... But I really have no ideas from where I should start ?

Please note that I need to integrate rules with the solution because if every Job Seeker has the right to send 1000 emails per weeks and so I want to use rules to "-1" for every email being sent by a specific Job Seeker user.

Any suggestion and help will be much appreciated !
Thank you,


texts:
I am using views for front page. I was able to customize some things.

But I have some

 in the body of an article and for the frontpage I want to change that automatically into

. Is that possible with views and if yes, how?


texts: PDF with print module and wkhtmltopdf - how to install?

texts:
I try to generate pdf with the print module and have tried it with the PDF generators MPDF and DOMPDF. Unfortunately, the results are of no use, which is why I want to try wkhtmltopdf. I read good things about it.

Unfortunately, the installation guide is outdated. For instance, I read that you don't need a x server anymore since 3 years.

What I've done so far:

I have downloaded the latest version for Windows.
As described in the instructions I put the executable in the directory sites / all / libraries.
After I renamed the cryptic file names wkhtmltox-0.12.1.2_msvc2013-win32.exe in wkhtmltopdf, it was recognized in the print module settings.
When I try to generate a PDF on my local installation, a confirmation dialog appears where I have to give permission and then I have to install the executable. After installation a error message occurs (the problem is known, so I will not thematize it further).

My first problem is that I do not know how the .exe needs to be used properly. Whenever I want to generate a PDF, I have to install the program (via "Allow" - "Terms of Conditions" agree and then "Install below C: // Program Files / Files") to continue. There is something wrong. Does anyone of you see the mistake in my procedure?

Or can someone give me an advise how to make wkhtmltopdf work with the print module on a localhost (WIN7 and XAMPP), please?


texts: Migrating Translated User Entities slowing migration down significantly

texts:
I have a very large site I'm attempting to migrate from D7 to D8 but am experiencing significant performance issues. We have around 35,000 users, so I don't expect this to be fast, but if I don't make any changes the migration will take several weeks to complete which is obviously not an option considering we can't shut down our site for multiple weeks... Here's my experience so far
I ran a test migration of the site via the UI which ended up stalling out when processing the d7_entity_reference_translation:user__user migration. I ended up having to use drush to finish out the migration via drush migrate-import.
After cleaning everything up post-migration (took about a week), we decided that it would be better to just keep this instance up and running and only re-migrate users and their data before going live considering that's the only data that will have changed since the initial migration. Specifically, we plan on running these user-data related migrations using drush: d7_user, d7_entity_reference_translation:user__user, d7_google_analytics_user_settings, and d7_legal_accepted.

The d7_user migration took about 14 hours, not great, but it was consistent and worked.
The d7_entity_reference_translation:user__user translation is where we ran into performance issues. During the first hour, it processed about 3000 users (on par with the rate d7_user migrated. However, it's slowly become slower and slower. Currently, I am sitting at the 24 hour mark and it's only processed 25K users and in the last 3.5 hours it only processed 2000 users. Therefore, it started at a rate of about 3000/hr, and after 24 hours it's down to only about 500/hr.

I've attempted the following and seen some improvements, but nothing significant:

Increased the max_execution_time in php.ini settings to around 600 seconds instead of 60 (little difference)
Increased the memory_limit up from 128M to a few GBs (note, this instance is isolated to just this task at the time, so it's okay for us to use more memory). This seemed to work a little, but obviously not enough.

What other adjustments can be made or tips anyone might have to mitigate this performance issue?


texts: Domain access - prevent redirecting to default domain on account creation

texts:
Drupal 7.36 & Domain access 7.x-3.x

I have 2x domains running curtesy of domain access. Each domain has been set up for 2 specific groups of users. The idea is that each group can create accounts, log-in and access content on their respective domain. Setting up the default domain worked fine. But, when users attempt to register on the second domain, they are redirected to the default domain instead, causing confusion.

I have Domain Strict enabled – plus I have tried Domain bonus, but the solution does not seem to be straight forward.

How you I prevent this from happening?


texts: Drupal Migrate - Link fields from an XML Source

texts:
I am using the Migrate (v7.x-2.2) module to migrate records from an XML source into Drupal 7.9.

I've also installed the popular link field module (v7.x-dev).

So far, in my migration class, all built-in fields work well during the migration, but I have not figured out how to migrate link fields from my XML source with their title.

I have two XML source fields (xpaths):

/record/organization/name  <-- I want to migrate this into the link title
/record/organization/url   <-- I want to migrate this into the link url

I am able to get the URL to import using this line in my Migration file (had to use link v7.x-dev module, not 7.x-1.0):

   $this->addFieldMapping('field_organization', 'organization_url')->xpath('/record/organization/url');

...but I have no idea how to inject the /record/organization/name into the title argument:

   $this->addFieldMapping('field_organization', 'organization_url')->xpath('/record/organization/url')->arguments(array('title' => [WHAT GOES HERE?]);


texts: How to allow the translation of menu links provided by my_module.links.menu.yml

texts:
I have the Configuration Translation module installed in a multilingual site and I am able to translate any menu created with the UI.... This is fine!!
I have a module which is creating some menus with the help of a yml static file: my_module.links.menu.yml
Unfortunately,
1-I couldn't translate any title/description (created in the yml) through in the UI as the translation tab is "locked" with this message : This link is provided by the xxx module. The title and path cannot be edited.
2-the User interface translation page (/admin/config/regional/translate) couldn't find the titles/descriptions (created in the yml) that I would like to translate
More to add: I have checked Custom menu link in the Content language an translation page (/admin/config/regional/translate) but this doesn't change anything... What is the purpose of this option?
...If someone can help me on this, I assume I will be able to use the provided solution to translate items created in other yml static files like my_module.links.action.yml


texts: db_query() and db_select() don't return any value

texts:
I'm trying to run the following query.
SELECT floormap_counter_expected.counter_name, tls_connect_agent_counters.counter_stage,tls_connect_agent_counters.applicant_gwf, tls_connect_agent_counters.counter_ip, floormap_counter_expected.expected FROM tls_connect_agent_counters INNER JOIN floormap_counter_expected ON floormap_counter_expected.counter_name = tls_connect_agent_counters.counter_name;

When executed via the command line, MYSQL returns the information I need.
When I try the following code, I get an error saying that $center_counters is not set.
$get_counter_info = db_select('tls_connect_agent_counters', 't');
$get_counter_info->fields('t', array('counter_stage', 'applicant_gwf', 'counter_ip'));
$get_counter_info->fields('n', array('expected'));
$get_counter_info->join('floormap_counter_expected', 'n', 't.counter_name = n.counter_name');
$get_counter_info->execute()->fetchAll();
if (isset($get_counter_info)) {
  foreach ($get_counter_info as $results) {
    echo "Rest";
    $center_counters[$results->counter_name]['stage'] = $results->counter_stage;
    $center_counters[$results->counter_name]['counter_ip'] = $results->counter_ip;
    $i++;
  }
}
return $center_counters;

The same happens with the following code.
$counters_query = "SELECT floormap_counter_expected.counter_name, tls_connect_agent_counters.counter_stage,";
$counters_query .= "tls_connect_agent_counters.applicant_gwf, tls_connect_agent_counters.counter_ip, ";
$counters_query .= "floormap_counter_expected.expected FROM tls_connect_agent_counters INNER JOIN ";
$counters_query .= "floormap_counter_expected ON floormap_counter_expected.counter_name = tls_connect_agent_counters.counter_name";
$get_counter_info = db_query($counters_query);
$get_counter_info->fetchAll();
if (isset($get_counter_info)) {
  foreach ($get_counter_info as $results) {
    echo "Rest";
    $center_counters[$results->counter_name]['stage'] = $results->counter_stage;
    $center_counters[$results->counter_name]['counter_ip'] = $results->counter_ip;
    $i++;
  }
}
return $center_counters;

I tried wrapping the code with try{} catch(Exception $e) {echo $e-getMessage()}, but nothing is printed.
I assume the query is running without error because nothing is "caught".
I was thinking that maybe I'm just calling the information wrong in my foreach loop. Maybe I should identify the table name as well when I call the field name. I don't think that is the case as nothing is printed when I try to echo strings out of foreach.


texts: SharePoint online search query in logged-in user context, which is connected through SIMPLESAML SSO (Azure AD IDP) with Drupal application

texts:
Below is problem description - I have sharepoint online and its URL is like - https://abc.sharepoint.com
Above sharepoint is connected through SSO (Office 365 Azure AD IDP and SAML)
I have another Drupal 8 application like - https://drupalapp.something.com
It is also connected through same SSO (Office Azure AD and SAML) so that if user login through either of application through SSO then he is allowed to login in another application as well. It means application is Single sign on enabled. and its working fine.
Now as a user, i am able to login through drupalapp.something.com using SSO (office 365 azure AD and SAML ). Now after user login being developer, i need to show recent modified SharePoint document from SharePoint online using SharePoint REST query but condition is that, it should fetch only documents on which logged in user has permission to show.
Brief requirement -
The requirements is to be able to make REST queries to SharePoint online but when the REST query is made, the person the query is for must only see the results based on their security context.
So if user1 has access to a SharePoint folder but user2 has not, then when the REST call is made they will each see a different set of results.
Example: user1 has access to abc.sharepoint.com/abcfolder/afile.pdf. User2 does not have access to the folder abc.sharepoint.com/abcfolder/ and so he will not have access to abc.sharepoint.com/abcfolde/afile.pdf.
If some updates this document it becomes a “Latest Update”. User1 will see it in the Latest documents but User2 will not.
I tried using PHPSPO library (https://github.com/vgrem/phpSPO) and it giving me result but this library is giving me result based on admin credential which I pass to connect SharePoint. So this is giving me all the documents regardless of logged in user permission.
How can we achieve this in logged in user context. Considering user is already login through SSO in Drupal application through SSO.
I also tried to make AJAX request with credential query from Drupal app but it always giving me CORS and CORB error. I don't know if this is right way of solution. Below is code -
var urlval = "https://abc.sharepoint.com/_api/search/query?querytext='isdocument:1'&selectproperties='Title,Size,Name,Path,FileExtension'&rowlimit=5&sortlist='created:descending'&refiners='fileextension'";
    $.ajaxSetup({
      xhrFields: {
        withCredentials: true
      }
    });

    $.ajax({
      type: 'GET',
      crossDomain: true,
      dataType: 'jsonp',
      url: urlval,
      cache: false,
      headers: {
        "accept": "application/json",
        "Access-Control-Allow-Origin": "https://abc.sharepoint.com",
      },

      success: function( response ) {
        console.log( response ); // server response
      }
    });

Please help me to solve this problem.


texts: How to show number of a views return results without submitting the view?

texts:
I have a view with some exposed filters.When selecting first exposed filter,I want to appear the Number of the view results without having submitting the view.Same thing for second exposed filter etc.
I have seen this to other sites and I am not sure how to do this with drupal.
thanks


texts:
I'm trying to understand Workbench for Drupal 7. We have a role called Content Edtior that is able to create drafts of new content and new drafts of existing content.

Our trouble happens when someone in an admin role approves their own content or creates a new draft. The entire page becomes unpublished. More over, the WB UI says the page is published, but other parts of Drupal say otherwise.

We've tried to mark these troubled items as "Needs Review" and back to "Publish". This does not work. There seems to be a disconnect operating specifically on the administrator role.

Although the workbench is showing that a test node here is published.

However when viewing the page, it's shown as access denied and now is unpublished.

More information:

Using WB 7.x-1.2 and WB Mod 7.x-1.4
Drupal v 7.44


texts: How do I upload a PDF for users to download?

texts: I am very new to Drupal. I simply want to provide a link in an article for users to download a pdf document. How do I upload the document on the admin side and then link to it in an article?


texts: How to render a field collection without default divs?

texts:
I want to output a field collection using dl, dt and dd tags. The collection has two fields - field_heading and field_text. I want each field_heading to be a dt, each field_text to be a dd and to wrap the whole set in a dl.

I have achieved this by overriding field--my-collection--my-content-type.tpl.php and the field--my-field.tpl.php for the heading and text fields.

The problem is, a div is being generated on each item in the field collection (by the field collection module I believe). (div class="field-collection-view clearfix view-mode-full") This div wraps the heading and text elements together. The div is therefore inserted inside the dl but before the dt. This is a problem because the dt needs to be a direct child of the dl.

Is there a way to render the field collection without this div?

field--my-collection--my-content-type.tpl.php

<?php foreach ($items as $delta => $item){ ?>
    <?php print render($item); ?>
<?php } ?>

field--field-heading.tpl.php

<?php foreach ($items as $delta => $item){
    print render($item);
} ?>

field--field-text.tpl.php

<?php foreach ($items as $delta => $item){
    print render($item);
} ?>


texts: Custom text in a View that Links to a PRODUCT (not a node)

texts:
I'm using Drupal Commerce and a View that displays all my products of a certain type.

The first item displayed in the view (for each product) is the Title and it is helpfully linked to the product page.

I also want to add another link to the product page that says 'Register Now' but I can't figure out how to create custom text that also links to the product page!

I've tried adding the product UUID, ID, and 'Link to Product' fields in my View...and putting them above my 'Custom Text' field...but none seem to work.

When I use {{ id }} for example (as the link in the custom text field), it just makes the link '/id' ...but that's not the actual link to the product, so naturally I get an error. The same problem persists for the other referenced fields.

So...anyone know how to create custom text that links to the actual product?


texts: Display book hierarchy of one organic group with Panels

texts:
I am using organic groups for a tutorial website.

I have one group for each tutorial. For example,

Java Group
C++ Group
Python Group
etc.

For each Group, I have a tutorial using the book module of drupals (several chapters, etc).
I also have several others contents for each group (for example posts, etc).

I am using views and panels to display the content of each group.
For example, I am using the OG members view to display all the members of the current group.

There is an OG content view but it displays ALL the content of the group.
I just want to display the book associated to the group with the book hierarchy (as with the block navigation).
Any idea of how to do that ?
Thank you.


texts:
I am using D7 with Panels and Panels Everywhere enabled and using the Versatile Theme.  I have changed the default versatile.css file to have the page-content div be 960px instead of 1020px.  All of the regions are % that are created using the Builder Flexible layout since the site is still under development.

Every time I clear the cache the css at -- /sites/default/files/ctools/css/ad57ff1546b4e3e493a0d16eb09e3ad9.css
reverts back to 1020px.

Seeing if anyone knows how to keep this from happening?

/* found out what I was doing wrong.  1020 was the default width that was still being used at the General page of Variant even though I changed the default setting in the Panels Mod.*/


texts: Currently the search field has a maxlength of 128, I am wondering if there is any way to increase it too maybe 255?


texts:
I would like to set a role permission for displaying a field depending on the value of an other field. But I can't find how to do it.

For example, I have a content type Person. If I add a content Person that is a "policeman" (field Job = "Policeman") then his phone number (field Phone) is display only to user that have the role "Officer". But if the person is a "Secretary" then his phone number is display only to user that have the role "Direction".

Does anyone know how to do it ? Is there a module for that ?

Thanks !


texts: Define image cropping in new image style

texts: When creating a new image style, is there a module which can let you define where to start the cropping? I think Drupal only crops from the very center. What if for this specific image I want the cropping to being from the top left? Or better yet, provide some gui which can let me crop the area manually like in fb.


texts: Programatically is it possible to list up all the path aliases that my site has?

texts:
A site has many path aliases generated using the Pathauto module, or from the user interface.

I want to get all the aliases the site has. how can I achieve this?


texts: URL contains a number after node/nid: why?

texts:
I have just inherited a site to maintain.

The site has many pages ending with /node/$nid. I notice that appending /x to the end of this URL seems to change nothing. That is, if I browse to http://example.com/node/123/1, I get the same result as if I browse to http://example.com/node/123/2.

What are those numbers typically used for? I notice that in my sidebar, it seems to be sending people to the /2 version.


texts: How can I get custom code running at a specific path?

texts:
I am trying to add custom javascript to my Drupal 7 site which I need to run on the path /node/add/h5p-content. I have created a custom module (called mods) with the function:
function mods_h5p_scripts_alter(&$scripts, $libraries, $mode) {
    $scripts[] = (object) array(
      // Path relative to drupal root
      'path' => drupal_get_path('module', 'mods') . '/JSOverrides.js',
      // Cache buster
      'version' => '?ver=1',
    );
}

The JavaScript code runs successfully on the front page, but not for /node/add/h5p-content. At this stage, the code is just a call to console.log(). I investigated other paths on my site and the code runs for some pages (for example /node/62) but not others (for example /node/25).
How can I fix this issue?


texts: How to use my own video and be able to play from a specific time?

texts:
I have Drupal 7 with the video module installed using ffmpeg. The video is playing fine. However, I noticed that users can only play from the beginning of the video. I would like to have users play from any specific time.

The embed video field module is only for embedding other videos so does not suit my needs.


texts:
In code I am trying to mark an order as completed. I am doing this in hook_commerce_payment_order_paid_in_full

function my_module_commerce_payment_order_paid_in_full($transaction) {
  $orderid = $transaction->order_number;
  $order = commerce_order_load($orderid);
  commerce_order_status_update($order, 'completed');
}

However this does not seem to work. The state the call is at when going into this is processing

I also have the following 2 rules

{ "commerce_checkout_order_status_update" : {
    "LABEL" : "Update the order status on checkout completion",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "Commerce Checkout" ],
    "REQUIRES" : [ "commerce_order", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "DO" : [
      { "commerce_order_update_state" : { "commerce_order" : [ "commerce-order" ], "order_state" : "pending" } }
    ]
  }
}

And

{ "rules_update_the_order_status_on_checkout_completion_if_payment_" : {
    "LABEL" : "Update the order status on checkout completion (if payment complete)",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "1",
    "TAGS" : [ "Commerce Checkout" ],
    "REQUIRES" : [ "commerce_payment", "commerce_order", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "IF" : [
      { "commerce_payment_order_balance_comparison" : { "commerce_order" : [ "commerce_order" ], "value" : "0" } }
    ],
    "DO" : [
      { "commerce_order_update_status" : { "commerce_order" : [ "commerce_order" ], "order_status" : "completed" } }
    ]
  }
}

In short as soon as the balance is 0 I want the order to be complete.


texts: Views Block Caching issue for not logged in User

texts:
We are using Drupal inbuilt caching with Memcache. Our website home page has more than 5 blocks created using Views for which we have enabled Time based caching. But the contents are not getting listing in these views even after the query caching time. Following is the views cache settings:

Query Caching : 15 mins and Render Caching 6 days
Block Caching : Do not Cache

Following is the Drupal cache settings:

Also, like to add one more point that the contents are published using Scheduler module.


texts:
I've just started to use Drupal 8's Entity Validation API and I'm applying constraints to entities in the following way using hook_entity_bundle_field_info_alter:

MYMODULE_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {

  switch ($bundle) {
    case 'example_content_type':
      $overlay_text = $fields['field_example_text'];
      $overlay_text->addConstraint('NotNull');
        break;
  }
}

This successfully prevents the an instance of this content type being created if no value is entered in the field_example_text.

However, in this content type, I'm using conditional fields. In this scenario, I would only want to apply the NotNull constraint to field_example_text if another field, field_colors, a text list checkbox field where the user can check any number of options, has a certain value (e.g. 'Green') checked.

Conditional fields is hiding and showing dependent fields nicely based on which values in field_colors are checked, but I need to set these fields as not null via the constraints only when field_colors has a particular value. Is this possible?


texts: Not able to assign value to hidden form field using form_alter hook

texts:
I have a form in which field my_consultant_id is "Hidden integer" type field and having widget type as "Hidden field".

I am assigning the value to this field by using hook_form_alter

function threebl_summary_report_form_alter(&$form, &$form_state, $form_id) {
    if($form_id == 'eck__entity__form_add_summary_report_comparative_client_group') {
        global $user;
        $form['field_created_by']['und'][0]['#default_value'] = (int) $user->uid;
    }
}

But not able to set the value for that field.

If I inspect the form it shows html code for field like:

<div class="field-type-field-hidden-integer field-name-field-my-consultant-id field-widget-field-hidden form-wrapper" id="edit-field-my-consultant-id">

Thanks in advance.


texts:
I have two group content types (I use OG groups) which are still under development. I created dummy content types so that these links will appear in the group content creation links.

But they are not ready yet. Instead i would like to redirect the user when he clicks on the link to an article which basically describes what the functionality is and is under development.

I googled and searched drupal answers for this but could not find anything that fits my problem. Please let me know if someone knows how to redirect node creation links in a group context to a static article page. Thanks.


texts:
I created 2 different content type

polls
questions

Authenticate user can add them.
When user add any of the content.
we get urls like

node/3

node/4

I want to use view to have different designs on these pages.
But when I create a view with the page node/%

it is implementing same design on both of the content type.

Is there a way I can achieving this?

Please suggest.


texts: How to create an iCal feed of non-Nodes?

texts:
It looks like the Calendar/Dates modules don't add Views Display types directly. Instead you're apparently supposed to copy one of the default views that come with Calendar to access the additional displays. However, the default views are Node views and I want to create a view of non-nodes. For example, say I want to create an iCal feed display type listing the dates users created their accounts on the site. Is there a way to do that using the Calendar/Date modules?

I made several attempts to use the iCal functionality included with the Calendar module, but in the end I gave up on that idea. Instead, found an issue associated with the Views Bonus Pack, with code for adding iCal support to that module.

I made some modifications to allow me to use arbitrary Views fields in an iCal feed. I'm interested in hearing feedback on the idea, if anyone here gets a chance to try it out.


texts:
I've been asked to import users from a drupal 7 site into an already-built drupal 8 site. I also need their order history from drupal commerce.

I tried using drush migrate-upgrade --config-only to do this, but as of drush 9, the migrate-upgrade etc commands don't work. There is a bug report about this and several patches, but my understanding of drush isn't advanced enough to properly patch & test.

Is there a way this can be done without needing to use drush?


texts:
I have an embedded youtube video on the home page (content in "#main"). I have a superfish menu (content in "#menu") which works perfectly in Chrome, FF and Opera and not in Safari and IE (not surprised by IE).

Here is my minified page.tpl.php structure:

     menu here

     video here

     footer

I have tried the following:

#menu {
   position:relative;
   z-index:999;
}

#main {
   position:relative;
   z-index:0;
}

Is there any thing else I can try?

Thanks in advance.

[EDIT]

The menu goes behind the youtube clip on Safari and IE


texts: How to display selectable variations without attributes?

texts:
With Drupal Commerce 2, each of my products have multiple variations which are unique and can be adequately described by their variation title.

I can not figure out how to display a dropdown for the add to cart form based the variation title alone. All that is shown is the title of first variation, the price and the add to cart button. No dropdown with the other variations.

The only way I can get it to work is by first creating a series of matching attributes which is both a repetitive exercise and seems like it should not be necessary.

What am I missing?

Similar question: What's the best the approach to add an extra attribute field in Drupal Commerce?


texts: How to hide a block for specific users using Views?

texts:
I have a bunch of blocks that I would like to have hidden by default and only shown to specific users that will be determined by a view.

Is this possible? If so, how?


texts: the difference between the drupal login "block" and mysite/user/login

texts:
I trying to understand the difference between the default Drupal 7 login block and the login provided at mysite/user/login.

From my own understanding, it would appear that the default login block provided by Drupal 7 only logs you into the web interface and the login provided at mysite/user/login is a page provided for you to login through your website.

I have come to this conclusion because if I log out of the web interface and try to login at user/login, nothing happens (I enter my credentials, but nothing happens).

This is my understanding.

If my understanding is wrong, I would appreciate it if someone could please correct me. If I am correct, could someone please provide a good tutorial that teaches one how to use the login page to validate a user and "transfer" the user to a validated state?

Thank you.


texts: What is the risk of using number in image style preset name (imagecache in D6)

texts:
There is a message below the preset name to be written. It not suggest us to write number:

The name is used in URLs for generated images. Use only lowercase alphanumeric characters, underscores (_), and hyphens (-).

Sometime I need the name with number such as thumb90, profile100x150, etc.

I can see some developer also write number in the name field.

Even no problem so far, I need to know what actually the risk of using number together in the name.


texts: How can I assign a block to a panel or mini-panel?

texts:
I was reading the project description for Panels, and I noticed it was a way—using mini-panels—for me to rearrange the contents of my site.

So I just created a mini-panel with a two column layout. I want to add one block to the left and one block to the right. How can I do this?


texts: php in views contextual filter for different user roles

texts:
I am attempting to filter a view based on a php contextual filter, however the filter needs to come from different sources depending on the users role:

administrators - from a query string
all other roles - from an entity reference field on the user

I am using draggable views which prevents me from using two separate views.

So far I have:

global $user;

    if (in_array('administrator', array_values($user->roles))) {
        $query= $_GET['query'];
        return $query;
      }
    else{
        $user_uid = user_load($user->uid);
        $myfilter = $user_uid->field_custom['und']['0']['target_id'];
        return $myfilter;
    }

The else filter works great but it is failing to filter for the administrator role.


texts: Writing a migration from non a non Drupal site

texts:
How can I translate this in a migrate query?

SELECT t.name FROM tags t
    join tag_types tt on (tt.id = 3)
    join story_tags stg on (stg.tag_id = t.id) WHERE story_id = $row_id'

I tried this, but it doesn't work.

->select('story_tags', 'tags')
->fields('tags', array('tag_id'))
->leftJoin('tag_types', 'tt', '(tt.id = tag.tag_type_id)')
->condition('tag_type_id', '3', '=' )
->condition('story_id', $row->id, '=')
->execute()
->fetchCol();

What am I missing?


texts: How to render inside a paragraph template a specific view mode for that paragragh

texts:
You may say that I should just change the display settings but in my use case I need to include 2 view modes inside one template as the mobile and desktop version of the output require very different HTML.

Is there a way to do this or do I require some preprocess function to do this?

Thanks


texts: Updating content to remove it from the front page shows it as being 'New'

texts:
I am removing content from the front page as it is out dated, but I don't want to un-publish it as it remains valid information.

Unfortunately Drupal then labels the old article as 'New' and put it to the top of the content list, exactly the opposite effect of the one intended.

How can I stop this?


texts: Feeds XPath parser - setting the created date of a node

texts:
I'm importing a date field in the format:

dd/mm/yyyy

I want to set this as the created date for the node I'm creating/updating.

I've tried the Feeds tamper module but the date function seem to convert between a string and a Unix timestamp, which doesn't seem to work anyway.

What's the best way to do this?


texts:
I am building a system in Drupal and here is one question that is blowing my mind for more than a month and I hope you guys can help me.

My user access control inside the system must work like this:

1) I have a role called partners and I have lots of permissions assigned to this role partners.

2) I have a role called clients and again, I have a bunch of permissions assigned to this role.

3) The users with a partner role can create users with role partner AND client. The users with role client can create users with role client.

So far it is simple!

4) A user with role partner can create users with role partner and client BUT they can also say that the new partner or client created MUST NOT access some specific areas. So for example: A partner is allowed to see users, create users and create clients. When the ¨partner master¨ is creating a new partner user, he can say that this new user can only see users and create users but not create partners.

Do you know any module to solve this problem? I have already tried user_permission and subrole, none of them fit :(

Hope you can help, thanks!

BTW, I am using Drupal 7


texts:
I'm new to Drupal 8.

I tried to do some batch process (for example installing modules or importing language files).

I got access denied for example on this address :
http://localhost/en/batch?id=17&op=start

I tried to investigate and debugging and find out in the file batch.inc

$request->get('id')

is Null

That means id=17 is not working.

What am i missing? Is it related to my Nginx server block config?


texts: How do you create a link to a modal dialog?

texts:
The following code does not work:

All Topics

Drupal 8.6.5. Bootstrap subtheme. Chrome console log shows no errors. Rather than a modal, the referenced page opens.

So, how do you create a link to a modal dialog in Drupal 8?


texts: Import content using the "Default Content for D8" module

texts:
I am using Default Content for D8 to import content on my site.

After Profile installation completed, I enabled my custom default content module with contents sample json for node entity [my_module/content/[entity_type]/anything.json].

I get the following error:

  Symfony\Component\Serializer\Exception\UnexpectedValueException: Type
  /drupal-pro-8/rest/type/node/article does not
  correspond to an entity on this site. in
  Drupal\hal\Normalizer\ContentEntityNormalizer->getTypedDataIds() (line
  239 of
  \drupal-pro-8\core\modules\hal\src\Normalizer\ContentEntityNormalizer.php).

And the node isn't imported...

What have I done to try to fix it:

. Ensure I have the article content type;

. Flushed all cache;

. Tested in different browsers;

. In the module page it says all tests were passed with the following conditions: PHP 5.5 & MySQL 5.5, D8.5 6. I started to use the same version of PHP, MySQL and D8.

After all this, the same problem keeps on appearing and I can't understand why this happens. May I missed something. Any help.

Thanks in advance.


texts: Products discount pinned at the top of the lists

texts:
I would like that when a product at a discount, it is "Pinned to the top of the lists" automatically.

And when a product does not have a discount, it is no longer "Pinned to the top of the lists".

How to do this with a rule?


texts:
Is there any way of having a shared bibtex bibliography in a book ?

For example, I want to have one book page "References" where I put all my references and then in all my book pages, I can reference each entry of the bibliography.


texts: "Term reference" for two language versions

texts:
I'm currently working on a Drupal's website for my client. We have a small issue related to new fields in "content types".

I've created a new field with field type "Term reference". We're using terms for isotpe grid, and it should work in both language versions - NL and EN.

That field only displays a single language version (default one), even when we change thhe language.

Here is an example - "field_thema[nl][8]", it supposed to be:

"field_thema[nl][8]"

and

"field_thema[en][8]"

Is there any way we could fix this?


texts: When anonymous user adds product to cart, redirect to checkout and skip the cart, using rules

texts:
I thought it was easy using Rules to skip the cart and redirect to the checkout page, but for anonymous users the URL is something like /checkout/64244
So I have no clue what destination I should use for the redirect.
Any other approaches to skip the cart are welcome..


texts: List all users who voted on a node with their ratings

texts:
I am using fivestar module for voting on nodes. For each node I would like to create a list of users who have voted on this node and the rating they have given. I am trying to do this using Views 3 but I don't see any relationship which can give me this.

I tried doing this using both the node base table and user base table in Views.

Any ideas how I can go about this?


texts: I have created a block view for filter options and tried to display the filter options as check boxes using Better Exposed Filters(BEF) but in the BEF settings i don't get check box option in select option list of  "display tid as" drop down. now how to solve dis problem?


texts: Unsafe to use NFS to share sites/default/files between many Drupal instances?

texts:
If you have a high-traffic website backed by multiple Drupal instances, you may want to have a dedicated file server that hosts sites/default/files, and somehow share that between all those Drupal instances. One approach that's commonly mentioned is to simply use NFS among all those Drupal instances to have their local sites/default/files point to that dedicated file server.

You could then set that file server to be accessible at files.yoursite.com and have Varnish cache the media getting served from it so the file server isn't getting too much load from reads (only writes, coming from the Drupal instances).

Conceptually this is very simple, and very simple to set up in practice. But is this unsafe to do when all those Drupal instances are making writes to the files directory at the same time, or does Drupal somehow mitigate this? There's a detailed description of how NFS is considered harmful at http://www.time-travellers.org/shane/papers/NFS_considered_harmful.html. It describes problems related to locking and more.

For a high-traffic media site with many Drupal instances all modifying the files directory all the time, could this lead to inconsistencies, corruption, or other problems that could eventually arise? Does it become more problematic as the number of Drupal instances increases (e.g. 5, 10, 20 or more NFS clients)?

With image styles, wouldn't the problem become even more likely to appear? For example, let's suppose 2 different requests go to 2 Drupal instances, both requesting the 'mobile' image style of a particular image at the exact same time, and that image style hasn't been created yet. Both of these would then want to write out that styled image at the exact same time, how would NFS handle this?

How are sites with multiple Drupal servers serving files? I know there's options like Amazon S3 and there's good Drupal support for that, but if you'd rather host the files yourself what options are there?

I see there's no way to upload files from Drupal instances directly to a central server using SFTP or SCP or anything like that. There is the CDN module https://drupal.org/project/cdn but that requires installing FileConveyor which is some custom application on all the Drupal instances and then there's some minor delay in syncing to the central server. This is an undesirable solution, when what you'd really want is a way for file uploads to go directly to the central file server (NFS, SFTP, etc).


texts:
How I determine which template or form is responsible for processing node of page with this URL: mysite.com/node/node-number/edit ?

I think, that Drupal find the template of edit in this files:

page-node-edit.tpl.php
page-node- node-number.tpl.php
page-node.tpl.php
page.tpl.php

However, in my theme folder I have only page.tpl.php without the code of edit template, but edit template is worked.

And in template.php i heve this preprodsse_node:

function my_theme_preprocess_node(&$vars) {
    $node = $vars['node'];
    switch ($node->type) {
        case 'page':
            break;
    }
}

Now I think that the CCK module to generate this form. I can change one field or a behavior of the form?

P.S.

I need to change some input in edit form. And I can't use a different version of Drupal :(


texts: Check if a node field has changed upon save

texts:
I am parsing pdf's in a field for a custom content type in a cron job. I have a boolean on each node that determines whether their pdf has already been parsed. I grab the ones I need like so:

$query = \Drupal::entityQuery('node')
    ->condition('status',1)
    ->condition('type', 'issue')
    ->exists('field_pdf')
    ->condition('field_indexed',false)
    ->sort('created','ASC');
if($range > 0){
    $query->range(0,$range);
}

$issue_nids = $query->execute();
$issue_nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($issue_nids);

foreach ($issue_nodes as $issue_node){
    //do my pdf parsing magic on field_pdf
    $node->field_indexed->value = true;
    $node->save();
}

This works fine but if the user replaces field_pdf and uploads a new one I want to make field_indexed false again so I know to reindex it. The problem is I don't really have a way of knowing whether the field changed.

I considered using a presave hook but I didn't see a way to compare the form state to what was currently on the node.

Is there a way I can detect when a field has changed when a node has saved?


texts: Using raphael, why won't the href attribute work while everything else does?

texts:
I am having trouble getting Raphael to work in Drupal. Very bizarre problem however. I have a page that requires an SVG map with active links. I have created a custom tpl.php file for the page that will have the SVG. In it I put the link to raphael and the javascript for drawing the SVG. Everything is working well in my SVG except one thing. I have many shapes that each need a hyperlink. So I am using the 'href' attr which is part of the Raphael API. However, while my shapes are rendering perfectly, and all my other attributes (title, target, opacity, fill, etc.) are working, href comes up with something strange. It does put the svg shape inside "a" tags but the URL ends up in a second title tag within the shape. My code looks like this:

// after <?php print $page; ?>

the output looks like this

    <circle cx="973" cy="732" r="8" fill="#000000" stroke="#000" opacity=".3" stroke-width="0" stroke-opacity="1" style="cursor: pointer; opacity: 0.3; stroke-opacity: 1;">
       <title style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Click Me!</title>
       <title style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">http://www.w3.org/2000/svg</title>
    </circle>

I have also tried putting the javascript to draw the SVG in the node but with the same results. Also, my code works fine when it is not in Drupal.
Mind == Blown.
Does anyone have any idea what could be causing this?


texts:
I want to render drupal 6 form through tpl file.
for that
1. I have written mytheme_theme in template.php file and there I have define my template forms arguments and path for tpl file.

I have written tpl file
in form function at the end I have called theme by '#theme' => 'my_template'

doing all these thing my from is rendering through tpl but now its not going into submit_hander() and validation.

can any one help me these? I am not getting what's wrong in these.

see in my template.php contain:

function cs_theme(&$existing, $type, $theme, $path) {
  $hooks = zen_theme($existing, $type, $theme, $path);
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */

  // @TODO: Needs detailed comments. Patches welcome!

  $hooks['my_theme_example'] = array(
                  'arguments' => array(
                  'order' => null,
                  ),
                  'render element' => 'form',
                 'template' => 'mymodule_template',
                 'path' => drupal_get_path('theme', 'theme_name') . '/templates',
              );

  return $hooks;
}

In these way I have printed all the form fields
in my .tpl file is:

   <?php print drupal_render($variables['order']['logo']);?>


texts: How to add element not appearing on the page via node_view_alter?

texts:
Given the following code:

function mymodule_node_view_alter(&$build) {
  $node = $build['#node'];
  if ($node->type != 'podcasts') {
    return;
  }

  $build['new_section'] = array(
    '#weight' => 15,
    '#markup' => 'test injected data'
  );

  dpm($build);
}

In the dpm() output, I can see that my test data is in the array; however, nothing shows up on-screen.

Do I need to pre-define this new section or set it to allow any new sections?


texts: The module does not dissapear after disable, uninstall, clear cache and cron job

texts:
I want to completely remove the File entitymodule from my Drupal site.

I've disabled the module via Modules in admin panal. Then I also uninstalled it though the panel. After that, I've deleted the files from ftp located under /sites/all/modules/file_entity.

I've cleared the cache. I've run the cron. I even tried /update.php but it says there's nothing to update Review updates step.

When I log into administration panel, I still see that ghost:

I don't have any module that is dependent on File entity.

How to remove that module? I want to do so I can install the new fresh version of it which I need.


texts: What is the easiest way to update thousands of users' "created date"?

texts:
I want to change all user created date. Is it possible use VBO for that? However, I don't see any option to change the user's created date there.

Originally the site is migrated from Joomla; I have thousands of users with a blank created date, and I want to set them to a week ago.
Can this be done with VBO?


texts:
I have a Node Content Type that has an "unlimited" number of Long text boxes allowed.  I have created one-too-many text ![enter image description here][1]boxes and cant seem to find a way to delete them.

Here is a link to what I am talking about

http://my.jetscreenshot.com/demo/20120730-gpz3-42kb.jpg


texts: Use a form instead of content type in maestro drupal module

texts:
I am working on maestro module of Drupal 7, the module uses content type to add the form fields ,but instead of content type i want to use simple form which i have created using php , can anyone please help me , it is very urgent.
Thanks a lot in advance


texts: add ajax to select filed of node add,but no values of the filed in form['status']['values']

texts:
I have a node type with field:Budget Items  field_budget_items  Entity Reference    Select list.

and I want add ajax when value change.
so the code is :

function camplus_pr_field_widget_form_alter(&$element, &$form_state, $context) {
  if(isset($element['#field_name']) && $element['#field_name'] == 'field_budget_items') {
    $element['#ajax'] = array(
      'callback' => 'ajax_get_bi_mixable_amount_callback',
      'wrapper' => 'bi_warning',
      'method' => 'replace',
      'effect' => 'fade',
    );
  }
}

/**
 * Implements hook_form_alter().
 */
function camplus_pr_form_alter(&$form, &$form_state, $form_id) {
  $forms = array('camplus_pr_range_settings_form','camplus_pr_roles_involved_settings_form');

    if(in_array($form_id, $forms)){
    drupal_add_css(drupal_get_path('module', 'camplus_pr').'/camplus_pr.css');
  }

  if($form_id =='purchase_request_node_form'){
    drupal_add_js(drupal_get_path('module', 'camplus_pr').'/camplus_pr.js');
    $form['bi_warning'] = array(
      '#markup' => '1.您不能跨部门预算
2.该部门的为负值，不可选择
3.不能超额',
      '#weight' => -100,
      '#prefix' => '
',
      '#suffix' => '
',
    );
    $form['#validate'][] = 'purchase_request_node_form_validate';
  }

}

and the callback function:

function ajax_get_bi_mixable_amount_callback($form, &$form_state) {
    // $form_state['rebuild'] = TRUE;
    dpm($form_state['values']['field_budget_items'],**'why I can not get the choosed value** of BI?');
    $commands[] = ajax_command_replace('#bi_warning', $html='
budget_nid-->This BI ---
');
    return array('#type' => 'ajax', '#commands' => $commands);
}

why I can not get the choosed value?? thx


texts:
I have a situation where after doing the basic registration the user is redirected to a page where he needs to fill a small form.

I aim at implementing the hook_user_insert() and hook_menu() to do something like this

function registration_user_insert(&$edit, $account, $category){
  drupal_goto('splan/'.$edit['uid']);
}

function registration_menu() {
  $items['splan/%'] = array(
    'title' => 'Select a Plan',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('selectplan_form'),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK
  );

  return $items;
}

In selectplan_form() I will define my new form and then, using the user ID, I would save data into user table.

The basic user registration form is being submitted, the user is redirected to splan/uid, but I also get the following error.

  You are not authorized to access this page.

I have changed permissions to allow anonymous users to create and edit webform, but the problem still persists.


texts: How to uninstall a module that has added a basefield that has data

texts:
My module adds a basefield 'myfield' to the core 'file' content entity.

I now need to uninstall my module for development purposes, but I can't because drush refuses to uninstall the module, saying "There is data for the field myfield on entity type File".

My understanding is that this is a known issue:

Because my module adds this field to an entity it does not own, this uninstallation will not be taken care of automatically by the core uninnstall procedure,
Therefore my module needs to have a hook_uninstall that triggers field uninstallation using  \Drupal::entityDefinitionUpdateManager()->uninstallFieldStorageDefinition
However, a field can't be uninstalled if it still has data in it, so I first need to remove the data.
But the system to purge field data currently only works for bundle fields not base fields.
There may be other ways to delete field data, but they won't scale to large quantities of data.
Therefore there is no robust way to uninstall my module and Drupal core is correct to refuse to uninstall it.

Given all that, how best can I uninstall it when I need to do so for development purposes (short of reinstalling Drupal)?

Here is how I am creating it:

In mymodule.module:

function mymodule_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  if ($entity_type->id() == 'file') {
    $fields = array();
    $fields['myfield'] = BaseFieldDefinition::create('boolean')
      ->setLabel(t('My field'))
    return $fields;
  }
}

In mymodule.install:

  $entity_manager = \Drupal::entityManager();
  $definition = $entity_manager->getFieldStorageDefinitions('file')['myfield'];
  $entity_manager->onFieldStorageDefinitionCreate($definition);


texts: How to redirect user after form submit in overlay mode?

texts:
The following code redirects user to node/add/article but doesn't use overlay.

$form_state['redirect'] = 'node/add/article'

How do I open node/add/article in overlay mode?


texts: How to show the content type diffrent types in a block?

texts:
I have a news website, I have one content-type what named news, news has some fields like:

  news_title

  news_date

  images

  body

  news_type

I want each news type shows in a block dynamically, my news_types are Sport, Economy, Political, Health and some others. and I want each of this shows in one block, is there any way is view or even in content-type settings to do this?


texts: How can I remove items from the allowed values list of a select field that has data for the values?

texts:
I've created a content type that has a list / select option field, and I've entered the key|value pairs as necessary for the select list to function.

Data has been entred, and it's been decided that certain terms no longer apply and that they should be deleted.

However, when trying to remove said terms, I get the following error:

Allowed values list: some values are being removed while currently in use.

Obviously, in the life of a project, values are going to change. What's a practical way to remove items once nodes are associated with the listed terms?

This is about the closest thing that I could find:

https://drupal.org/node/1653012

It references a d6 plugin and some patch trickery I'd prefer not to have to resort to.  If I did have to ultimately resort to using the patch to remove the validation check on that field, is there any harm in leaving those items orphaned on the nodes they were associated with?

Update, I have come accross this issue again with a government client who, for the last 7 years of having a Drupal site has had 50 states and territories in a select list. Now, policy has changed and the territories no longer needed to be included. Being able to remove items from the select lists is important, and thus I'm offering a bounty.

I'm looking for a safe solution to be able to remove items from a select list. What I don't know is if that solution should update any of the nodes as I'm not sure how the field values are stored in relation to a node's total content.

I'm happy with a pure SQL solution to run in MySQL; or, I'm looking for a module.


texts: How do I use variables in links.task.yml?

texts:
I have a local links.task.yml file to display the tab for the node data , But it seems to have a problem passing argument to the path . As you can see i am extending the node's basic fetaures like edit,delete.revision with an additional function using tab .  I have module_name.links.task.yml

entity.node.check_backend:
  route_name: module_name.my_route
  base_route: entity.node.canonical
  title: My title

And i have the route in module_name.routing.yml  as follows

module_name.my_route:
  path: '/node/{arg1}/function_name'
  defaults:
    _controller: '\Drupal\module_name\Controller\ControllerName::function_name'
    _title: 'My title'
  requirements:
    _permission: 'access admin tab'

But it throws me error like :

  Symfony\Component\Routing\Exception\MissingMandatoryParametersException:
  Some mandatory parameters are missing ("arg1") to generate a URL for
  route "module_name.my_route".

How can i pass variables in links.task.yml file ?


texts:
Please forgive me if this is a total noob question, but here it is anyway.

I have a content type 'person'. One of the fields I want to add to the 'person' is a relatives field and I want it to either be an autocomplete or a drop down list. I'm pretty sure I can figure that part out. The question is, how can I populate the drop down list (or the autocomplete) with the names of all 'person' content that is already created?

Also, I am using the persons full name for my title field.

I'm also running drupal 7 and I've installed the CTools and Views modules.

EDIT:

After some more thought on this, what I'm really trying to do is have a field that links to a related content node. That way if a person is ever deleted they would also be removed from those who claim to be related to them.

Does drupal have a way to do this? I have so many ideas on how to use drupal, but most of them involve relating nodes to one another in a heirarchal format.


texts: Drupal 7 install on Centos 7 - Forbidden You don't have permission to access ... on this server

texts:
I installed Centos 7 (minimal) with LAMP stack on a dedicated development server on my home LAN as a development platform to migrate my Drupal 6 website to Drupal 7.  Drush was used to install a new standard Drupal 7.x-dev platform, but could not initially get past the Apache welcome page to finish the Drupal 7 install. After tweaking .htaccess, settings.php, and /etc/httpd/conf/httpd.conf I now cannot browse anything on the server without getting the "Forbidden" error.  The Apache log error is:

[Wed Dec 21 20:33:15.366352 2016] [core:crit] [pid 2891] (13)Permission denied: [client 10.0.0.154:58621] AH00529: /var/www/html/drupal7/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/html/drupal7/' is executable

I assume this may be a permissions or ownership issue.  Document root is /var/www/html/drupal7 with ownership and permissions for the directories and config files are: /var (root) 755; /www (root) 755; /html (apache) 755; /drupal7 (apache) 775; .htaccess (root) 644; index.php (apache) 755; install.php (apache) 644; and /etc/httpd/conf/httpd.conf (root) 644.

Have I got these permissions right?  The $base_url is currently set to "http://localhost" but I'm not sure this is right either.  -Any suggestions?


texts: How do I open a custom module ajax form in colorbox popup?

texts: How do I open a custom module AJAX form in colorbox popup using button click?


texts:
I added two term filters with operator is one of. I'm using better exposed filters to get them working with nested checkboxes and AJAX result updating. This works very well except one case:

I can't uncheck all checkboxes. The filters are optional and have no preselection at all. But after I selected one of the checkboxes I can't uncheck all of them again. If I uncheck the last checked chechbox it gets checked again after AJAX reload.

Is this s bug or did I miss something like to set/unset an option in view's configuration?

UPDATE

Okay to me it seems like a bug. If I untick the Remember the last selection option in the filter settings I can uncheck all options again.


texts: How I can change the value of a commerce product field after Completion process?

texts:
I want to change the value of one of my product custom fields when "Checkout completion". I created that custom field myself, with machine name field_prodstat.

How I can do that with the Rules module?


texts:
I want upload an image for my theme, like the logo or favicon with bartik (or other theme).
Where's the code for doing that with bartik ? (it's not in bartik/theme-settings)

In fact, i want this features : The user choose his background like the logo

Thanks.


texts: Rendering field groups (not individual fields)

texts:
I am using Field Group to group my fields. Purpose of this is to have better control when rendering them inside the node.tpl.php file. Specifically, I want to designate in the node.tpl.php where in the html document I want specific groups of fields rendered, while sorting fields and designating what fields belong to what group inside the UI.

Do you think Field Group is a good way of achieving this? If grouping fields using Field Group, how do you then render that group in the template file?

Edit: I am steering towards template solutions, avoiding the likes of Panels and DS.


texts: How can I add form elements in custom form on click of link?

texts:
I want to add form elements inside my custom form when some body clicks on the link outside the form. Links are like :

Add textfield
Add selectlist

When user click on any link it via ajax add an element to the form. I just want and idea whether it is possible or not in drupal. If it is possible then just give me some idea about this.

Thanks


texts:
I am trying to use _locale_import_po($file, $langcode, $mode, $group = NULL).  I want to point it to a local file in my Drupal site (e.g. drupal-7.23.fr.po').

However, when I try to do this I get the following error:

  fopen(): Filename cannot be empty locale.inc:693

I am using the following code to initialize the $file variable passed to the function.

  $file = new stdClass();
  $file->filename = 'drupal-7.23.fr.po';
  $file->filepath = drupal_get_path('module', 'mymodule') .'/'. $file->filename;

I have the file in sites/all/modules/mymodule/drupal-7.23.fr.po.


texts:
I tried drush disable theme-name and afterwards drush enable theme-name, but it didn't work.

How do you change theme with Drush?


texts: What's wrong with my custom node template?

texts:
I'm attempting to make my first custom node template that is supposed to be used for a certain content type with the machine name of "content_block." I copied the "/modules/node/node.tpl.php" file to my theme's directory at "/sites/all/themes/mytheme." Then I renamed the file to "node--content_block.tpl.php."

Then I cleared the site's cache via "Administration » Configuration » Development » Performance."

It seems to only be partially working. Some of my content type's field variables render, but not with the values I expect. Others don't render anything but the word "Array".

My template code looks like this:

<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
  <?php if ($field_headline == TRUE && $field_headline != " "): ?>
    <?php print render($title_prefix); ?>
    <?php print $field_headline_level; ?><?php print $title_attributes; ?>><?php print $field_headline; ?></<?php print $field_headline_level; ?>>
    <?php print render($title_suffix); ?>
  <?php endif; ?>
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $field_content; ?>

One thing I definetly don't understand is when to use print render($variable) and when to use print $variable.


texts: Rules Redirect User at Login by Role to URL not working

texts:
I am trying to redirect any user with a particular Role at login to a URL.
I am using Backdrop (Drupal 7).
I have looked at most of the posts relating to this problem, and tried many of the examples but the redirect fails. There are no messages in the Logs, I have debugging on in Rules.
I have tried this which is from a post I found, and modified for my page redirection which works:

    { "rules_after_login_redirect_to_host_registration" : {
    "LABEL" : "After login redirect to Host Registration.",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_login" : [] },
    "IF" : [
      { "NOT text_matches" : {
          "text" : [ "site:current-page:path" ],
          "match" : "^user\/reset\/",
          "operation" : "regex"
        }
      }
    ],
    "DO" : [
      { "redirect" : { "url" : "webform\/host-registration" } },
      { "backdrop_message" : { "message" : "Redirecting to Host Registration" } }  ]
  }
}

However my Rule to Redirect a user at login with a Role of Host does not work:

{ "rules_redirect_role_host_to_selected_page" : {
    "LABEL" : "Redirect role Host to selected page",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_login" : [] },
    "IF" : [
      { "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "host" : "host" } } } }
    ],
    "DO" : [ { "redirect" : { "url" : "webform\/host-registration" } } ]
  }
}

I am baffled. Why is the Role Condition not picked up?


texts: Views date filter in calendar (filter in range)

texts:
I add a node to the calendar start date 03/10/2015 and end date 15/03/2015.
In the view, I would like to do a filter that returns this node by entering the date 03/12/2015. Is it possible? I can't do that :/


texts: How to translate all the country names provided by the Countries module in one shot?

texts:
I'm using Commerce Kickstart distribution. My site is not multilingual, it just uses French as the default language. I want to translate the countries names list provided by the countries module from English to French.

After I enable the Countries translation sub-module of this module, I would like to find a way to translate the names of all countries at once (in one shot), so that I do not have to translate them one by one (which seems to work fine).


texts: How to displaying translate tab in the node

texts:
I have Multilingual and internalization Module installed on a Drupal installation. I need to have the translate link option on every node as the following screenshot:

Also I need if the content (node) in some language has no translated version in other language, when clicking to the language choose bar, it go to the default home page in the other language or Page Not found.


texts: Using views to display KML of each node in respective maps for each node

texts:
I have been using OpenLayers and Geofield to try display the custom data layer (KML polygon) on the. First of all I havent been successful at it despite trying out many mays. Also I realized that the views approach discussed almost everywhere would show the custom maps on a 'new' Page or a 'new' block. But what I want is to show the map with the KML data layer right at each node.

Is this ever possible using Views (Data layer) + Openlayer + geofield in first case?

If so, how do I configure the geofield's map which is displayed in each node?


texts: How to add translation to Inline Entity Form + Entity Browser

texts:
Situation

I've got a special "Dashboard" node that consists of entity references to other node types. In dashboard form mode all widgets are configured to use Entity Browser to display an (Inline Entity-) form in a modal popup. (So all child entities are editing in a popup window, opened with a click inside the dashboard node). This works fine for my main language.

Problem

I need to enable translation capabilities for the referenced entities from within my Dashboard node. I've enabled translation for all referenced entities. But my editors do not have access to content overview, they need to do the translation from somewhere within the dashboard node UI. But neither EB nore IEF have any options to display a translation button or translation tab. There are options for edit/replace/remove, but no "embedded" translation.

(To emphasize: The dashboard node is just some sort of container node with untranslatable ER fields. I need translation for the referenced entities, but accessible/clickable starting from somewhere inside the dashboard node edit form).

Question

What is the best starting point to add a translation link/button for the child entities? I can think of two options: Modify the EB field widget and add a translate button in the parent form, or add a local task in the popup modal edit form of the child entity.

I've done some simple form hooking and simple fields (-widgets), but TBH I've no clue at all with complex stuff like EB and IEF, and would be grateful for any hints directing me to a good starting point.


texts: How to edit Drupal core rdf.module functionality

texts:
Using drupal's core RDF module there is a function (shown below) that add "xml:lang" attibute to tags. What I want to do is to change this functionality so that $variables['attributes_array']['xml:lang'] = 'en'; instead of leaving it blank like in the core module. What would be the best way to achieve this?

/*
 * Implements MODULE_preprocess_HOOK().
 */
function rdf_preprocess_username(&$variables) {
  // Because xml:lang is set on the HTML element that wraps the page, the
  // username inherits this language attribute. However, since the username
  // might not be transliterated to the same language that the content is in,
  // we do not want it to inherit the language attribute, so we set the
  // attribute to an empty string.
  if (empty($variables['attributes_array']['xml:lang'])) {
    $variables['attributes_array']['xml:lang'] = '';
  }
}


texts: How to handle simultaneous editing and deletion of nodes?

texts:
This is a slightly different version of the question about what happens when two people are editing and saving the same node.  My version involves node deletion instead of editing:

Alice starts to edit the node (/node/123/edit).
Bob starts to edit the same node (/node/123/edit)
Alice deletes node 123 via the Delete button on the form and the followup "are you sure" page.
Bob, not knowing the node has been deleted, hits the Save button on the form.

Currently, Bob gets a 404 error back from the server -- "The requested page '/node/123/edit' could not be found."  This makes good sense, since the node has in fact gone away, but in a perfect world I would trap the doomed request and send back something a little more helpful, perhaps redirecting the user to a more reasonable page.  Is there any way to do this, short of major surgery on the forms API?  I can't think of one, to be honest -- it's the web server here that's unhappy, not Drupal -- but I thought I'd ask...  Maybe there's a hook out there that I don't know about?


texts: How do I show/hide elements on a page using jquery?

texts:
I am trying to hide check-box selectors in the custom search module when the page initially loads and then have a clickable link to show them. I have the clickable link working but the check-boxes are initially in a visible state. How can I hide the check boxes when the page/module loads? I tried placing the following code in my THEME_form_alter(&$form, &$form_state, $form_id) function

drupal_add_js('jQuery(document).ready(function () { $("#edit-custom-search-types")[0].hide(); });', 'inline');

and

drupal_add_js('jQuery(document).ready(function () { $("#edit-custom-search-types").hide(); });', 'inline');

But neither worked. Any help would be appreciated. thanks