texts: Order total field, transactions and balance

texts:
In drupal commerce, using the commerce payment payment module,
I would like to display the amount paid and order balance in paid order like on the example below.

Subtotal ------------- 20
TAX --------------------- 3
Total ------------------ 23
Amount paid ----- 23
Order balance ---- 0

How could I achieve this ?
I'm close to get what I want. I created a module
I still have an issue : I don't know how to get the order_ID ?
<?php

/**
* @file
* Commerce Order Total and Balance Module.
*/

// implement hook_commerce_price_formatted_components_alter()
function commerce_order_total_and_balance_commerce_price_formatted_components_alter(&$component_types) {

// TO DO : retreive the order ID (or the order object)
$order_id = 142;

// load the order
$order = commerce_order_load($order_id);

// get the balance
$balance = commerce_payment_order_balance($order);

// rename and reorder component_type
$component_types['base_price']['title'] = 'Total HT';
$component_types['base_price']['weight'] = -90;

// rename and reorder component_type
$component_types['tax|20_vat']['weight'] = -80;

// rename and reorder component_type
$component_types['commerce_price_formatted_amount']['title'] = 'Total TTC';
$component_types['commerce_price_formatted_amount']['weight'] = -50;

if ($balance['amount'] <= 0) { // we display total payments and order balance only if order balance is zero or less
  // add component_type "total_paid"
  $component_types['total_paid']['title'] = 'Montant pay&#233;';
  $component_types['total_paid']['weight'] = -40;
  $component_types['total_paid']['price']['currency_code'] =      $component_types['commerce_price_formatted_amount']['price']['currency_code'];
  $component_types['total_paid']['price']['amount'] = $component_types['commerce_price_formatted_amount']['price']['amount']-$balance['amount'];

  // add component_type "order_balance"
  $component_types['order_balance']['title'] = 'Solde';
  $component_types['order_balance']['weight'] = -30;
  $component_types['order_balance']['price'] = $balance;
 }
}


texts: get error field is required when #access is false with field permission  in image field

texts:
With fieldpermission module I set some permission on some fields(fields are in profile type (I used profile2 module)) ,some of them are required , showing of field is ok ,(they are not showend and #access property of them is false ). but when I save node  get field is required error to me.
any idea?

update: after some debugging find out this problem not issued from profile2 module, problem is a bug(maybe) with image cck field and field permission. when you have image cck field and restrict it with field permission even it not showed(by #access=false ) but in submit (if it reqired) , return  the image field name is required.
any idea?


texts: What are the steps to create a custom widget based on taxonomy_select?

texts:
I need to create a widget for fields of type "taxonomy_term_reference". The widget "taxonomy_select" is very nearly what I need to build, but needs some modification. I have seen examples that start with a given widget to build a custom version. The function below fails because there is no "taxonomy_select_field_widget_form" defined. Where is the "taxonomy_select" form creation code?

/**
 * Implements hook_field_widget_form().
 */
function taxonomy_multiselect_add_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {

  $element += taxonomy_select_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);

  return $element;
}


texts:
I'm making a module that changes the output from the tabs (View, Edit, ...) into contextual links. The name of my module is "testmodule" and the name of the theme I'm using is "Bartik".

When I place this into my test module, it works, but only when I use the Bartik theme:

function bartik_menu_local_tasks($variables) {...}

This doesn't work

function testmodule_menu_local_tasks($variables) {...}

Any idea's?

I was also wondering if I could easily change the html made by template.php, for achieving the change of tabs to contextual links I have to change this line in template.php:

change into :

I want to do this within my module...


texts: Using the "Previous/Next API" module with Display Suite and Colorbox Node

texts:
Using Drupal 7. I have a "people" content node for employee biographies. I have a views page that aggregates the display of people content types into a 5 across by 2 deep grid. Each cell is a portrait over the person's name. I've hyperlinked the image/name with a classed anchor to invoke the colorbox node function to display the particular "people" node content within a colorbox display. It's all working nicely, but I need to add one more navigational element.

I'd like to add "prev/next" links to the node, using the "Previous/Next API" module. I've added this code to my template.php file as per the page. Next I'd like to add the template code for the "Colorbox" Display Suite for the "People" content type:

<?php
  $nextPost = pn_node($node, 'n');
  $prevPost = pn_node($node, 'p');
  if ($nextPost != NULL) {
    print '
Newer:'. $nextPost .'
';
  };
  if ($prevPost != NULL) {
    print '
Older:'. $prevPost .'
';
  };
?>

I've created a display suite "custom field" and have input the above using the "Display Suite Code" input formatter.

I've added a "colorbox" view mode display for "people" and it's working as it should, namely, my changes to that view mode reflect in the colorbox output. The prev/next module is working on all 9 people are indexed as reported by drush cron after configuring the module to index the people content type. I've run drush cc all to clear caches.

However, I am not seeing the rendered links as per the above custom code. Nothing prints in the region where I have set the custom field to output.


texts: Add a module dependency to a sandboxed project

texts:
I am developing  custom module which requires the use of the Entity Construction Kit (ECK) and the ECK Extend module. The problem is that the ECK Extend module is a sandboxed module.

I want to add the ECK Extend module as a dependency for my custom module.

How would one do this in the Drupal ecosystem? If I add the sandboxed module as a dependency, will drush recognise it and download it for me when I enable my custom module like drush would normally do with module dependencies?


texts: No block to display at block settings in any contributed theme

texts:
I am trying to use Simplenews module for newsletter, but there is no block to display at block setting in any contributed theme after enabling the module.

However it's show when I activate the core theme (Bartik).

My problem is if I use contributed theme, there is no block of Simplenews module for enable the block on the front-end (on the block setting page).

What should I do in order the block is displayed?


texts: I would like to add a class to a views table row if a date field in the row is less than the current date. What would be the best way to do so?


texts: jquery integration issue when attempted to execute on load

texts:
It may just my limited js experience but until recently I had some js attached to the drupal context on one of my sites to produce some small animation/style effects that took the form:

$(window).on("load",function() {
    //do something
})

This worked great until recently then suddenly stopped working with no errors or messages. Eventually I got it working by changing the above to:

$(document).ready(function() {
    //do something
})

Did something change in core or jquery that caused this? Why would there be no errors? I use the first $(window).on() successfully on at least two other sites but have not been able to figure out why it stopped working on this one.

Some of the js I wish to run relies on the entire page being fully loaded so I really would rather use $(window).on()- which I believe triggers later.

I am using the latest release version of drupal 8


texts: What's the correct way to create a custom formatter for a comment?

texts:
I'd like to create a custom formatter for the field Comments. My goal is to display a custom comments section beside CKEditor (URL /node/xx/edit). Following this article, I created my custom module:

custom_comments/custom_comments.module

function custom_comments_theme() {
  return [
    'custom_comment_formatter' => [
      'variables' => ['name' => NULL],
      'template'  => 'custom-comment-formatter',
    ],
  ];
}

custom_comments/src/Plugin/Field/FieldFormatter/CustomCommentFormatter.php

namespace Drupal\custom_comments\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FormatterBase;

/**
 * @FieldFormatter(
 *   id = "custom_comment",
 *   label = @Translation("Custom Comment Formatter"),
 *   field_types = {
 *     "comment"
 *   }
 * )
 */
class CustomCommentFormatter extends FormatterBase {

  public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];

    foreach ($items as $delta => $item) {
      $name = $item->getName();
      $elements[$delta] = [
        '#theme' => 'custom_comment_formatter',
        '#name'   => $name,
      ];
    }

    return $elements;
  }

}

custom_comments/templates/custom-comment-formatter.html.twig

{{ name }}

I installed this module and then, just to test the display, I created a new content type "Special article" with a Comments field. In "Manage display", I changed format from Comment list to Custom Comment Formatter. However no comment names are displayed on the node page.

I noticed there is two different things: the list of comments and the comments themselves. Should I use two custom templates (one for the list, another for each comment)?

What's the correct way to display a custom list of comments?


texts: Theming login form just for specific user registration / Auto Assign Role Page

texts:
On this page users gets automatically a role assigned by the Auto Assign Role module.

For a better user experience i added the login form also to this page. This works great:

In user--register.tpl.php I added the following code to print the login-form <?php print(drupal_render(drupal_get_form('user_login_block'))); ?>

But how do i THEME this login form on this specific page? So it doesn't affect the original form on /user/login?


texts: Online streaming and on air/broadcast function for a Drupal website

texts:
I'm trying to figure out how to build a website for a tv using Drupal.

Going around the web I found different modules and Videola distribution.

About the Videola distribution, I have not find any tutorial or something close to it.

I've found Kaltura , Live Streaming and VideoWhisper

has anyone here got experience with these modules?

Thanks in advance.


texts:
I don't see an example when looking at the api.  I'm setting up a query and would like to use NOT LIKE as opposed to STARTS since START does not seem to be supported.

Is this possible?


texts: Is it a good idea to mix node api and entity api?

texts:
I have a custom module that depends on several contrib modules. One of the contrib modules has a new version out and has switched to using entities. The code in the custom module is using node api hooks. I update it just for the change in the contrib module, there will be one hook that is using entity api e.g. hook_entity_presave().

Should I update everything to use entity api or will mixing the two be okay?


texts: Assign different weights for different displays

texts:
I am already guessing the answer is that it can't be done but any input on this would be much appreciated.

So I have my Content Type, say... Cakes! Now, I have a view named ALL Cakes! and they are sorted alphabetically on that.

I also have a view called Popular Cakes. Those can be sorted by weight and the awesome weight changer view integration.

Now, for some bizarre reason I also need a Recent Cakes view which is sorted in it's own way as the name reveals.

Now my question is, is there any way to add another weight for that view's use?

I know I can sort by date created but that would require going to every single node and manually changing the date; in short I am losing the drag and drop functionality Weight offers.


texts: How do I add a class to a row in a hook?

texts:
I am building a view on my website that lists all currently pending user registrations. (They need to be approved by administrators). I also have a taxonomy that lists 'banned' names. The view lists the users username, email, discord name and twitch handle. I am trying to build a feature that takes any of those fields, and compares them to the 'banned' names list, and if a match is found on any or all of the fields, it adds a special class to the views row.
I can't find the appropriate hook to tie into that allows me to check these values, but also set a new style/class on the row if a match is found. I already have a function that takes the appropriate value and compares it to the taxonomy and returns a result, but I am not sure what hook to place this function in so that I can do if, for example:
MatchFound() goes through each provided value in the array, and if a match is found returns TRUE, or FALSE if not found at all.
$search = ['name','email','discord','twitch'];

if (MatchFound($search)) {
  'return flagged style for row'
}

Is there anybody that could help me?


texts: Make a specific content-type inaccessible

texts: I have a content-types that only is linked from nodes of other content types and therefore should not be directly accessible. In other words, I don't want a visitor to be able to access these kind of nodes by going to node/<nid>. Is this possible?


texts: How to print $item separately, with different content, in views-view-grid?

texts:
I am trying to create an image gallery, using Views 3 for Drupal 7. A brief overview of what I did:
- Create custom content type for photo gallery (title and image fields
- Create View for the gallery page
    - Set format to "Grid", and show to "Fields"
    - Added field: "Content: Photo" (preview image style)
    - Added field: "Content: Photo" (thumbnail image style)

As you can see, I have two fields with the same field so that I can have two differently sizes of each image. What I need to do, is print these images in two different places in my template.

This is my views-view-grid--gallery.tpl.php:

  <?php foreach ($rows as $row_number => $columns): ?>

      <?php foreach ($columns as $column_number => $item): ?>

          <?php print $item; ?>

      <?php endforeach; ?>

  <?php endforeach; ?>

I want to be able to do something like this:

    <?php // foreach ?>

        <?php // print preview image ?>

  <?php // foreach ?>
    <?php // print thumbnail image ?>

I have tried a multitude of things, but I can only make $item print either one of the images, or both of the images. Since only the final, HTML-formatted image is returned, I can't figure out how it is possible to split it up.

Thanks much in advance!


texts: Are Drush vbo-execute actions supported?

texts:
I've been trying to find an efficient back-end way to delete large numbers of nodes based on some filter criteria to implement data retention policies. I have read that it's possible to perform actions provided by views bulk operations on results from a view via drush - such as in the answer in the screenshot below (in response to this question).

This seems like a very powerful concept because you can use the selection power of views and do operations on large amounts of data from the server side. I tried to do this on my Drupal 9 site. One discrepancy I noticed is that when I go to add the VBO field, I do not have an option for "Bulk Operations: Content" like is suggested in the above screenshot, rather only the one from the "Global" Category:

I tried using that field anyway, and selected the "Delete selected entities/translations" option and saved the view.
When I try to execute the action from the view using the drush command
drush vbo-execute my_view_id action::views_bulk_operations_delete_item
I get the following error:
In ViewsBulkOperationsActionManager.php line 169:

  The "action::delete_action" plugin does not exist.

I cannot seem to find this error in any other forum posts, or any documentation from VBO as to how to identify what actions are available. Is this capability for VBO not available for Drupal 9, or is there some knowledge base I have missed that details how to specify the action?


texts:
I've the following code (sample) that runs on Cron and sends SMS to users.
$token = \Drupal::token();
$message = Hey, [current-user:account-name];
$message_value = $token->replace($message);

When cron run, Getting the SMS text as 'Hey Anonymous' This works correctly on site when user logins in. but not on cron.
So I tried to pass the user object to replace the token like follows but that doesn't work. Getting same result.
use Drupal\user\Entity\User;
$user = User::load($uid);
$message_value = $token->replace($message,['user' => $user]);

There are so many nodes created using this token. So I can't edit them all with new/custom token. So Is there any way to replace the user token, without writing a custom token?
The other workaround is to use str_replace like follows, but there might exists other user tokens in the same text. so not preferable.
  $message_value = str_replace('[current-user:account-name]', $name, $message);

Any suggestions?


texts: How to achieve the use exposure filter of views, head Title Update？

texts:
I use the exposed filter on a Drupal 7 website. I want to achieve that when the user clicks on the filter, the head of the title will also output the filtering term.

Any suggestions?


texts: How to add help text to tabs in admin/structure/types/manage/{node-type}

texts:
I maintain a module (http://www.drupal.org/project/csm) that adds two tabs to the node type settings form at admin/structure/types/manage/{node-type}. I'd like to add some help text to these tabs. In the picture below, there is help text set for the top four tabs, but not for the last three tabs.

I've had a look at the Drupal core code to see if I can work out how to set this help text, but have had no joy so far. How can I set it?

For the record, the code used to generate the last tab in the form is as follows:

$form['cnpt'] = array(
  '#type' => 'fieldset',
  '#title' => t('Node creation page title and status message'),
  '#access' => user_access('change ' . $form['#node_type']->type . ' creation page title'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#group' => 'additional_settings',
  //'#tree' => TRUE,
  '#weight' => 101,
  '#attributes' => array('class' => array('csm-form')),
  );


texts: how to create separate contextual filters for pages in views

texts:
I have created a view and it has a block and two pages say page1 and page2. If I set the contextual filter it applies for both page1 and page2. I have configured two contextual filters and I want first contextual filter to be applied for page1 and other for page2. Is it possible to do so? If not is there any alternative where I can have separate contextual filters for separate pages.

While filtering a views page it should evaluate only one contextual filter. Is it possible to do that?


texts: My custom javascript replace method for Fancybox and Vimeo works on some pages, but not all

texts:
So, I have beent tackling this issue since yesterday to no avail. I have been trying to integrate Vimeo videos into Drupal 7 and display them in a nice Fancybox overlay. I am using the following Modules in combination to try and achieve this: Semantic Fields, Field Collections, Custom Filter, and Fancybox.

I needed the videos to be inline with sections of Book content, so I originally wrote a custom filter that looked for [vimeo=1234]Video Title[/vimeo] in the body input and converted it into a link where the embedded player was in a div that would pop out as a fancybox. The custom script takes the original expression and finds the relevant data to create this. I later made a regular expression that looked for the custom field I created, which worked like a link and allowed the user to paste the complete vimeo url. I thought that method might be easier for the user inputing content, and the way multiple custom fields are rendered in their own div container also makes it easier for me to style in CSS (which was giving me problems with the [vimeo] inline tag method).

Here is the method that embeds the fancybox vimeo player. It's based on this (http://stackoverflow.com/a/4285098/1475099) solution, which helped me get thumbnails to work:

    function vimeoLoadingThumb(id, title, obj){

    var url = "http://vimeo.com/api/v2/video/" + id + ".json?callback=showThumb";

    var filtered_fancy = '

'+ title +'<\/a><\/div>

<\/iframe><\/div><\/div>';

    if(obj){
        jQuery(obj).before(filtered_fancy);
        jQuery(obj).remove();

    }else {
    document.write(filtered_fancy);

     }

    var id_img = "#vimeo-" + id;
    var script = document.createElement( 'script' );
    script.type = 'text/javascript';
    script.src = url;
    jQuery(id_img).before(script);

    var element =  jQuery('gallery_'+id).clone();

}

The obj parameter is only used when the original content to be replaced comes from the custom fields. While I got my [vimeo] tag to work exactly the way I wanted, I am having trouble using my custom fields! I am seeing the same kinds of warning messages on both methods of insertion, but only the [vimeo] tag fancyboxes work. Clicking the custom field links do not fire any javascript events. I compared the source codes between the two, as well, and I can see no real differences. I also know that both methods are playing nicely with the Vimeo API because I use the vimeo API to display the vimeo thumbnails and those show up, no problem.

Here are the warnings I am seeing for both approaches:

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.

and

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
Resource interpreted as Font but transferred with MIME type application/octet-stream: "http://a.vimeocdn.com/p/1.4.21/fonts/vimeo.woff". 33364975:1

Any help would be greatly appreciated!


texts: Choosing between template files and custom module

texts:
I wanted to add some custom functionality in my Drupal website, so I read some  tutorials (first, second ) and  decided to create custom template files for specific forms & exposed filters I wanted to change. And it worked perfectly!

But when I had to pass the changes to the original site I had to change the code a bit, so I tried with a custom module this time (not using template files) and it also worked like a charm!

I'm confused because both templating and custom modules can be used for providing the same functionality. But which is better - in terms of stability, performance, code reuse etc. ?


texts:
I have a clean Drupal 8 install with bootstrap theme.
I just want to add a simple link to the registration form in the user account menu and to it only be visible if you are not logged in.

The login and my account links are already standard in, why isnt the register button there? What would be the solution to this?

Creating the link normally in the menu -> add link option makes it visible all the time.


texts: How to NOT show link title, if link title is left empty

texts:
Using the link module I have one link field with the setting "Link Title > Optional Title". This allows users to enter a link url without entering a title.

The problem is, the (empty) title is replaced with $item['display_url'] which is redundant since it's followed by the linked url. To clearify my question here's two examples – and what I would actually want instead:

If the title is set to "homepage" and url is set to "www.example.com"
the result is homepage: www.example.com (url is linked)
If the title is left empty and url is set to "www.example.com"
the result is http://www.example.com/: www.example.com (url is linked)
What I want (instead of 2.)
If the title is left empty and url is set to "www.example.com"
the result should be www.example.com (url is linked)

I have actually found the piece of code that does the replacement – and commented it out. Since this is of course not good practice I would be very happy if anybody could point me to a direction, how to properly override or patch this behaviour.

PS: this is the actual code I commented out in link.module line 527:

  $item['title'] = empty($title) ? $item['display_url'] : $title;


texts: How to hide the content of nodes/ completely, and still maintain use within Drupal?

texts:
So, to start off, I've seen:

How do I hide nodes that shouldn't be directly accessed from users and search engines?
How to prevent access to Views-only content?
How can I restrict view pemissions to a node related child nodes?

All the answers to those questions make the proposal to make the node unpublished, which was the solution that looked cleanest to me, given that I was making some content types to be viewed exclusively with slideshows, i.e., having www.mysite.com/node/40 showing a list of all the raw images that make up my slideshow in a block elsewhere was not something I wanted. I only want the images viewable within the context of a slideshow.

However, when I followed these answers and made the content of the node unpublished, the content was inaccessible to the slideshow View: It was now blank to anonymous viewers. Is there something I missed in how to make a node unpublished, but still allow its contents to be accessed through Views, as a block?

I'm looking to do this without using the htaccess, hooks, or javascript options I've seen mentioned in the links above.

I can't imagine that having a list of content accessible nakedly under nodes/123 is actually an intentional feature.

One other qualification that makes this a tricky problem---there are ways of preventing access to node/123, but they can also hinder your own ability to create or edit nodes!


texts: Is it possible to set up preferrential IPs when in maintainance mode?

texts:
I've previously worked on Prestashop and there I had the choice to set my site in offline/maintance mode and then edit one ore more IP addresses in order other people to view the sites but not the commmon users and stills no login require and no additional host file settings.

Thanks


texts: Retrieve hidden field value & expose to .tpl file

texts:
I have a field collection set up for fields that make up a slider, one of these fields is for the alignment of text in the slider & is hidden on output. I'm trying to get the value of this hidden field & use it to set a CSS class in the .tpl file, I've managed to do this but only in the .tpl file itself. If I understand it correctly it's best practise to get the value of this field in a preprocess function & expose it as a variable to the .tpl file, I'm unsure how to do this.

This is what I have written in the .tpl.php file, and it works, but from what I understand it's not best practise.

$key = key($items[0]["entity"]["field_collection_item"]);
$alignment = $items[0]["entity"]["field_collection_item"][$key]["field_image"]["#object"]->field_alignment["und"][0]["value"];

I'm using the Drupal module fences to modify output so the code above is in the field--fences-xl-slider.tpl.php file.


texts: How do I use and administrative form and save a message?

texts:
I followed the instructions on Step by step guide to creating an admin form in Drupal 8.

I typed in a welcome text into the admin form and saved it, but after saving the form was empty again.

I am new to Drupal and php and don't know yet how to debug the code. I can not use Php-Storm because it is too expensive. Therefore I am using Visual Studio.

The website and database are running inside Docker. I mounted the folder for the modules, so I can write the module code from outside docker. I am working on a Ubuntu 18.04 machine.

This is the whole class:

namespace Drupal\welcome\Form;

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

class MessagesForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'welcome.adminsettings',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFormID() {
    return 'welcome_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('hello_world.adminsettings');

    $form['welcome_message'] = [
      '#type'          => 'textarea',
      '#title'         => $this->t('Willkommens Nachricht'),
      '#description'   => $this->t('Willkommens Nachricht, die beim Anmelden erscheint.'),
      '#default_value' => $config->get('welcome_message'),
    ];

    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);

    $this->config('welcome.adminsettings')
      ->set('welcome_message', $form_state->getValue('welcome_message'))
      ->save();
  }
}

I just learned how to inpect variables with ksm() and found that the value is stored in the welcome_message variable.


texts:
I imagine this has been asked before, I'm just struggling to find the right answer.

Using Books to create documentation for an open source project. We're covering 3 domains, Users, Developers, and Admins. Easy enough.

Where I am struggling is how to create versions of these books for each software release. Do I just create a new book for every version? 1.0, 1.1, 1.2, etc? Should I be using a taxonomy vocab for the releases? What is a manageable way to handle this?


texts: How can I add extra parameter to URL when click "apply" button of Views exposed filter?

texts:
I need to add extra parameter at the end of the page view URL when "apply" button of exposed filter is clicked.

For example,

normally URL looks like:

my-view?nid=1

But I need to add "my_parameter=1" at the end of the URL and it eventually needs to be:

my-view?nid=1&my_parameter=1

How can I do this?


texts:
I have added simple blogging functionality to my Drupal Site using a custom content type named Blog that I created.

One of the fields in Blog content type is a image field.

Inorder to display a list of teaser blog posts, I created a view with a page named Blog List.

This view displays a list of Blogs using the Teaser view mode.

This works fine until I try change the image style associated to the Teaser view mode for the Blog content type.

When the Image Style is set to None(Origional Image), all the images are visible for the teasers on my Blog List view page.

When I change the image style to anything else like "Medium 220x220" for example, the images for the Blog teasers do not display on my Blog List views page and it appears if their links are broken. I have also noticed that when I apply a Image style the Blogs teaser display image field, the image src is appended with something like "?itok=R1dYIZFH", when I temporarily remove this param, the image is displayed.

I am trying to do all of this through the UI.

Any help and suggestions would be greatly appreciated <3


texts:
I have a module that creates a new user and automatically logs

//set up the user fields
$fields = array(
  'name' => $login,
  'mail' => $to_insert['email'],
  'pass' => user_password(10),
  'status' => 1,
  'init' => $to_insert['email'],
  'timezone' => 'Europe/Paris',
  'roles' => array(
     DRUPAL_AUTHENTICATED_RID => 'authenticated user',
  ),
);

//the first parameter is left blank so a new user is created
$user = user_save('', $fields);
user_login_finalize();

However, I want to create a rule to send the information to the new user.
I would use the token [account: one-time-login-url] but it does not work.

What for?
How to refresh this token when I create a new user?

Thanks for your help


texts: Programmatically change the weight of a form element

texts:
I have a user activation/registration form with different attribute like

Captcha and security questions which are coming from different modules.

I want to change the display order of form elements.

and i am using this code in my custom module

function security_question_form_user_register_form_alter(&$form, &$form_state) {
  if ($form_id == "create_account_form") {
    $form['#pre_render'][] = 'security_question_form_alter_weight';
  }
}

function security_question_form_alter_weight($elements) {
  $elements['questions']['#weight']= -47;
  return $elements;
}

It's not working. Can any one have any solution?


texts: Drush command needs higher bootstrap level - Pantheon Drush Alias Setup

texts:
I just setup pantheon for one of my websites. So far I've done the following and the site works fine:

Version Drush: 5.3
Local Dev: Ubuntu 12.04

Git clone the repo to my local desktop
Copy the pantheon.aliases.php file to the .drush directory at ~/home

Now when i do a drush @pan.chouse.dev pm-list I get the following error.

~/websites/pan-chouse$ drush @pan.chouse.dev pm-list

Command pm-list needs a higher bootstrap level to run - you will need    [error]
to invoke drush from a more functional Drupal environment to run thiscommand.

The drush command 'pm-list' could not be executed.                       [error]
The directory /home/drupalpro/websites/pan-chouse does not contain a     [error]
valid Drupal installation

I also did a drush @pan.chouse.dev status and I get this:

  ~/websites/pan-chouse$ drush @pan.chouse.dev status  PHP
  configuration   :
  /srv/bindings/a59cd0c1631747ef8cda2b5e88fc5124/php.ini
                          /srv/bindings/a59cef8cda2b5e88fc5124/php.ini    Drush
  version       :  5.10.0
  Drush               :
  /srv/bindings/a59cd8cda2b5e88fc5124/drushrc.
  configuration          php

I'm not exactly sure what I'm doing wrong as it should technically work.


texts: Site seems to miss the "private" wrapper, how can I fix it?

texts:
I can not enable the private folder getting the warning as below:

Warning: file_exists(): Unable to find the wrapper "private" -
did you forget to enable it when you configured PHP? in file_save_htaccess()
(line 365 of core/includes/file.inc).

It's Drupal 8.6.12, multisite config, other sites use private folders.

How can I fix it ?


texts: Using Backup and Migrate Module to download windows compatible backup

texts:
I have created a Drupal7 based web-site on my hosting server. I have made changes to the themes, created views and done other customizations. I would like to create a duplicate copy of the site on my local laptop, so that I can test my changes locally before making them live on the site. I installed the Backup and Migrate module on my host server and downloaded a backup of the entire site to my windows 7 laptop. I already have a WAMP installation and all required services running for creating drupal7 site.

The file I downloaded looks like a tar ball of the entire drupal folder and the DB and the size is 106 MB. Since, it is a tar ball I could not open the existing file in windows. My questions:

Is there a way to get around the tar ball? I tried specifying zip as the compression format, but that did not help. I do not see any option to specify no tar.
What is the correct way to create a copy of the site locally, considering I have made changes not only to DB, but other files too. I have seen other options such as exporting the DB and FTPing the sites folder. If I were to do this, how do I FTP the sites folder to my windows laptop?

Thanks


texts: Vocabulary set by another hierarchy and combinations

texts:
I have to create a new taxonomy term that has no name field.

I created one master vocabulary.
Then I created another vocabulary and term having only entity reference field.
Default description field was deleted.
I would like to change hierarchy and combination of any terms from reference master vocabulary.

Normally, term has a mandatory name field and description field.
I'd like to change the name field type in the entity reference, but it is impossible.
After adding  a different entity reference field, it is an error to disable the existing name field.
Perhaps, the reason for the name field is probably because it is mandatory.

Name field of term, rather than being arbitrarily input, want to specification referenced by the fields of the other taxonomy terms.
Description field is same case. All field are refarence field from master vocabrary or others.
In other words, we want to make the vocabulary set by another hierarchy and combinations.

Do you have any idea?


texts: Image Migration from Drupal 6 to 7 fails

texts:
Happy New Year everyone,

I am fairly new to the Migrate Module and have come to a halt concerning image migration. To begin with, my problem currently is that when I run my migration, drush outputs: "New object was not saved, no error provided".

Now all I want is to get the images relating to a specific content type (educational_activity) and copy them over to my destination folder.

CODE:

class EduActFile extends EduMigration {

public function __construct() {

parent::__construct();

#Define variable for the default user id (user="grammateia") wherever it is used (uid, revision_uid, etc.).
$user=36;

// Describe the class for the Migrate UI

$this->description = t('Migrate files');

$query = Database::getConnection('default', 'migrationDB')
           ->select('node', 'n');
//$query->leftJoin('content_field_filename', 'fi', 'n.nid = fi.nid');
$query->leftJoin('content_field_images', 'fim', 'n.nid = fim.nid');
//$query->leftJoin('files', 'fil', 'fil.fid = fi.field_filename_fid');
$query->leftJoin('files', 'file', 'file.fid = fim.field_images_fid');
$query->fields('n')
      //->fields('fil', array('fid', 'filename', 'filepath', 'filemime', 'filesize', 'timestamp'))
      ->fields('file', array('fid', 'filename', 'filepath', 'filemime', 'filesize', 'timestamp'))
      ->condition('type', "educational_activity",'=')
      ->groupBy('n.nid');

$this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' => FALSE));

// Specify that we want to create files from the source data

$this->destination = new MigrateDestinationFile('');

// Remember what source record created each destination object and track migration status and allow rollback with MigrateSQLMap class

$this->map = new MigrateSQLMap($this->machineName,
    array(
      'nid' => array('type' => 'int',
                       'not null' => TRUE,
                       'description' => 'Node ID',
                       'alias' => 'n'
                      )
    ),
  MigrateDestinationFile::getKeySchema()
);

$this->addUnmigratedSources(array ('fid','filepath', 'filemime', 'filesize', 'timestamp'), t('Source fields that we will not be migrating'));

$this->addUnmigratedDestinations (array('timestamp', 'destination_file'));

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

// For each source row to be processed define data mappings to the destination field from source field

$this->addFieldMapping('value', 'filename');

// Specify the location of the source folder to find the files

$this->addFieldMapping('source_dir')
     ->defaultValue('C:/xampp/htdocs/protovoulia.org/sites/default/files');

// Specify the location of the destination folder to place the files

$this->addFieldMapping('destination_dir')
     ->defaultValue('C:/xampp/htdocs/testpaideia/sites/default/files/educational_activity');

// Use existing files

$this->addFieldMapping('file_replace')->defaultValue('FILE_EXISTS_REUSE');

// Ensure files are not deleted during rollback

$this->addFieldMapping('preserve_files')->defaultValue(TRUE);

}//construct ends

}

Do I need to use a different class to migrate files? Is my query wrong? Thanks in advance, your help will be greatly appreciated.


texts: How to aggregate results of search engines using drupal

texts: I want to develop a site with Drupal 7 that lists the search results of some popular search engines. Is there any module or I should develop a custom module for this purpose?


texts: I see all aliases besides the home page alias (At URL bar)

texts:
Why is that? I mean, why when I click the home page link at main menu, it is only the site's URL (www.example.com), and not the exact URL of the home page (www.example.com/Decorations-for-all-houses) that appears? how can I make the full URL appear at the home page?

It should be noted that this is the only page with this problem; in all other pages, the FULL URL is always displayed.


texts: Automatically translate double field select value, but not free text

texts:
I have created a content type with a double field field configured as a Select list & Text field with a list of predefined allowed values for the Select List:

0|my option a
1|my option b
2|my option c

When I create a node for that content type in my default language, I get to choose between the 3 allowed values and can input some free text in the text field (as expected).

However when I translate my node, I am unable to translate the options from the select list (I can choose between them but can't change them).

I would like to be able to translate the allowed values list once somewhere (ideally at content type level, but I'm happy to have an alternative) and have those values enforced at node level when I translate.

For instance:

Default language (e.g English): I create 1 node with 1|my option b as the select value and some free text
Translation (e.g. Spanish): when I translate the node to Spanish, the select value becomes 1|mi opción b (which can't be changed) and I can translate the free text for the input field

Is there any way to automatically translate a double field select value (from one language to another), but not the free text (which can be translated freely) ?


texts: How to do autocomplete in a Bootstrap modal form?

texts:
I've got a D7 page that constructs a Twitter Bootstrap modal form; it appears in response to a click on a button on the page.  I'd like to have in that form a textfield that uses the standard Drupal autocomplete mechanism; the problem is that the textfield isn't getting properly hooked into the autocomplete system.  I'm loading the Bootstrap versions of misc/ajax.js and misc/autocomplete.js into the page with drupal_add_js() so that they'll be around if the modal is invoked, but all the attached behaviors in autocomplete.js aren't getting invoked when the modal form is constructed and presented, and so the textfield stays a regular textfield.  Or so I think, anyway -- I'm kinda out of my depth here.

I suppose I could roll my own ajax code for the field, but the basic autocomplete behavior is so obviously the right thing that it ought to be used.  Any advice out there?  Thanks!


texts: How to add an item to the secondary menu in Drupal 7?

texts:
So far I've got the two standard menus in Drupal 7: the "main" and the "secondary" links, which are mapped to Main menu and User menu in the menu settings, respectively.

Now, I'd like to add a simple link to a contact form in the secondary menu, but I can't figure out how. Simply adding a link to User menu works fine when I'm logged in, but it doesn't show up for an anonymous user. It seems that the secondary menu doesn't show up at all for anonymous users, even if it is mapped to a custom menu (instead of User menu). Is there a way that one can configure the permissions for menus? If possible, I'd still like to have the logged-in menu links (like 'My account' and 'Log out'), as well as having some simple links that are always shown.

Is this possible?


texts: Altering styles in ctools automodal generated automodal

texts: So as my post history shows that I happen to like the Ctools Automodal module to carry me out of difficult Ctools logic to render a modal. It works as intended on a callback from hook_menu(), but I have no control over the style of the Modal generated, colors, size, and et cetera (typically set using a JS object in a pre_render hook with a drupal_add_js() call.) What's the best approach to do this, if its at all possible using this module?


texts: Creating a view to show a user the flag he/she has been flagged with

texts:
I have created 3 flags for users and only admin can flag it. Lets say the name of the flag is "Cool", "Boring", "Super". The admin goes to the profile of user A and flags him with "Cool" and "Super" flag. Now when 'A' logs in, he/she should see a view something like this:

Flags:
Super
Cool

How can i achieve this view.


texts: Progress of a user on completion of a book

texts:
Is there a way to show the progress of a user on navigation through a book?

The best solution will show % of pages that user opened/completed in current book.


texts: Autcache + Varnish modules installed but cache tables growing

texts: I have a site in Drupal 7, multilanguage and multidomain, and when I do a weekly manual database backup (apart from the automated ones), I see that the size of the mysqldump file is of about 200 Mb. When I run the cron (which is set automatically to once each 3 hours), clear the cache, and then, finally, TRUNCATE all tables with prefix "cache_", the size of the dumped file reduces 4 fold to 50 Mb. I have Authcache and Varnish modules activated, so I thought that the cache was functioning in another way. How is it possible that the cache tables are so full, even with cron updating each 3 hours? May I have something wrong in the configuration?


texts:
In hook menu, there is a url that is used to be called by some gps device to register its lcoation in the database.
Let say the url is
sitename.com/gps/location/123.123/456.456

But I want to make this url, so only authenticated devices/sources can call this.

How should we achieve this. May be we can use hash token, but I am not sure how to use this to verify the source which is calling the url.

Here is the code inside the hook_menu

$items['gps/location/%/%'] = array(
  'title' => '',
  'page callback' => 'gps_lcoation_store',
  'page arguments' => array(2,3),
  'access arguments' => array('access content'),
);

Any help?


texts: Swap out blocks based on domain name extension

texts:
We have a European site that is the same exact site for three different domain names. So www.mysite.eu, www.mysite.ie and www.mysite.ch all go to the same site. However, we would like to make very small subtle changes based on which domain extension they come from. Really, I just need to swap out a couple blocks based on the domain.

I know there is the Domain Access module, which we actually use on another site, but I really didn't want to have the huge overhead and configuration and headache of everything that comes with the Domain Access module, just to swap out a couple blocks and that's it. The rest of the site in it's entirety will be exactly the same for all three domains.

I have put a hack in place using JavaScript right now, but it's not the most elegant solution. I was wondering if there is something else I could try besides Domain Access.


texts: Customizable product bundles, user can add/remove products

texts:
I'm looking for ways to implement an e-commerce for an organic farmer who sells their products, he offers products and product bundles. Every product bundles has its own price. Each bundle are predefined products group. But I want that when the user buys, can unchoose at most, two products of the bundle and change them for another product in a predefined group of products.

I wonder if anyone knows how I can work this way the product bundles. I've been searching, I saw Tech Talk about commerce bundles, I tried commerce_bundle... but I can't find anything to do this.

Any idea or clue is welcome!


texts:
I can't seem to figure out how to get all this information in one line in a views template.

  Page @current_page of @page_count (@total Results Results)
</div

I can get the total result with {{ view.pager.total_items }}. I can get the current page with {{ view.pager.current_page }}. I can't get the page count, though.

I can get the page count in a preprocess function for the pager, but that doesn't really get me the value I need, where I need it.

/**
 * Implements hook_preprocess_HOOK().
 */
function acc2019_preprocess_pager(array &$variables) {
  // @see globals.api.php
  global $pager_total;

  $element = $variables['pager']['#element'];

  // Get the max page number for the current pager.
  $variables['pager_max'] = $pager_total[$element];
}

I can't seem to figure out how to get that value in my views-view.html.twig template in any way.

Can anyone help?


texts:
I'm trying to use entityQuery in Drupal 8 to perform an "and" within an "or" group. A simplified version of what I'm trying to do is this: Query for all apples, oranges and bananas that are ripe. The code I'd like to be able to use would look like this:

$oQuery = \Drupal::entityQuery('node');
$oOrGroup = $oQuery->orConditionGroup();
$oOrGroup->condition('type',['apple','orange'],'IN');
$oAndGroup = $oOrGroup->andConditionGroup();
    $aAndGroup->condition('type','banana')
    ->condition('field_ripe',1);
$oOrGroup->condition($oAndGroup);
$oQuery->condition($oOrGroup);

However this doesn't work because andConditionGroup() isn't a method of ConditionInterface.

Is there a way to do this with entityQuery or do I have to revert to using db_query()?


texts: How can I remove "Show row weights" as well as the weight column in D7?

texts:
This answer shows how to remove the "Show row weights" text from a form. However, as the comment to this answer suggests, it doesn't remove the weight column as well.

How can I update the following code to also remove the weight column from my form?

<?php
/**
 * Implements hook_js_alter().
 */
function MODULENAME_js_alter(&$javascript) {
  unset($javascript['misc/tabledrag.js']);
}
?>

Or, is there a better way to do this? This seems like a hacked way of removing the row weights.


texts: Device Geolocation doesn't work using multiple subdomains

texts:
I am using the module Smart IP and in particular its sub module Device Geolocation to detect the users position. The latter uses the method

navigator.geolocation.getCurrentPosition(success, error)

to get the position form the browser. Everything worked fine till I started to use subdomains as language detection method, like:

de.example.com
en.example.com etc.

Now the detection always fails, will say, calls the error handler function. In Chromiums console I get the message:

One or more of the given URLs is not allowed by the App's settings.  It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

In spite of the fact I gave the browser the permission to detect my position for each and every subdomain.

How to get the method navigator.geolocation.getCurrentPosition() to work with various sub domains?


texts:
I've looked at other posts but been unable to resolve the issue. I have a Text field (formatted, long) in a content type, when the node is viewed the HTML in the field displays correctly, when I view the fields in the database it is stored as raw HTML, however, when I add one of these fields to my view, the output is escaped as < and so on and therefore displayed in the browser as HTML rather than marking up the text.

I've seen a few posts suggesting modification of the twig template, however a) this didn't seem to work for me and b) I'm looking to do this within the view / module so it is applicable regardless of which theme is in use.

Any suggestions?


texts: How to add a field to be displayed alongside the title?

texts:
I'm trying to create a preprocess function to add one of my fields to be displayed alongside the title of my specific content type. So, instead of my title just saying Book Name, it'll say Book Name - 2018. Basically, the year would come from a field in the content type called field_year.

I have the following in my .theme file which doesn't seem to work but I really don't know where to go from here as I've not dabbled with preprocesses too much:

function THEME_preprocess_node__books(&$variables) {
  $node = $variables['node'];
  $variables['fields']['title'] = ($node->getTitle() + $variables['content']['field_year']['0']['#context']['value']);
}

Let me know what I'm doing wrong and what's the best way to go about this.


texts:
I created a custom bundle (content type) and I've created fields

One of those field is a file type field, is a video file, stored in the private storage. I installed the videojs module to allow to watch the video.

I need to show this field twice in the node page. One in the generic file formatter that allows the user to download the file, and I also need to play the video. I decided to set up as generic file formatter and customize the twig template to show again with the video player.

I achieve to show twice with the settings formatter (generic file) with this code in the node--mybundle--full.html.twig template

{{ content.field_sd_video }}

I thought it would be something easy like field+formatter:

{{ content.field_sd_video|videojs_formatter }}

But I can't find a simple way to achieve this.


texts: Programmatically create a node with a menu link

texts:
I created a node programmatically with the following code.

$data = array(
  'type' => 'inception_article',
  'title' => $msg->name,
  'body' => array(
    'value' => $msg->body,
    'format' => 'full_html'
  )
);

$node = Node::create($data);
$node->save();

I would now also like to create the menu link for the node, but I cannot figure out how to do that in Drupal 8.

How can I programmatically create a menu link for a node I create?


texts: How to hide certain content types from a Link field

texts: I created a content type for my slides in a carousel. I make a view to print them all and everything works perfectly. My only problem is that I have multiple use of the Link field from core and the auto-complete form spits out my slides node and my other nodes. How can I limit which node type are shown in all Link field? It doesn't matter if it's site-wide as they will never be needed in those fields.


texts: How can I get the Register form on the front page?

texts:
I've managed to create a new theme, customize the front page pretty much how I wanted it, and I've encountered a problem.

I need to get the register form (create new account) in a pop-up on the front page.

After following the instructions from Form API in Drupal 8:

    <?php

/**
* @file
* Functions to support theming in the themename theme.
*/

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\UrlHelper;

/**
* Implements hook_preprocess_HOOK() for HTML document templates.
*/

function themename_preprocess_html(&$variables) {

$form = \Drupal::formBuilder()->getForm('Drupal\user\register');

return $form;
}

I can't figure out what I'm doing wrong, because I get an error saying that is not a valid form. I have also tried using the form id as a parameter, still no valid form.

Could anyone please help? I could use a working example.


texts: Views and default menu block on the same page

texts:
I created a view to display a content type listing in a grid format. However, I cannot get the navigation menu block to show up together with this view.

This is the page using views.

This is a page which does not use views. The menu block is the default generated by drupal.

Is it not possible to display a default menu block with a view?


texts: Configuring Blocks and the use of wild cards

texts:
Quite inexperienced in Drupal.
I want to place a Block in my site, but I want it hidden on Front Page, on any node and on any user page (except /user/login and /user/register and /user/password).
If I chose to “Hide for the listed pages”:
/node/
/user/*
*
The pages: /user/login and /user/register and /user/password will also be excluded

Is there a will card just for numbers? That would allow me to exclude the user profiles but not those 3 pages?


texts: I am trying to create a custom module using webforms drupal 7 to carry out some form of validation. All i want the module to do to check if a value of one field (A) is entered then the other field (B) should be zero and if the value of field (B) is entered then the value of field (A) is zero. Anybody able to help? I am a newbee to drupal.


texts: How can I display a WebForm in a Modal Window

texts:
I am using Webform (4.11).  I have a 'simple' form with 2 fields that I would like to display in a modal dialog when the 'Apply' button is pressed.

So imagine I have a page with an apply button, and when the user selects this button, I need to know if they are an existing client (they are not logged in), and some other 'meta data' (second field).

Bottom line - I would just like to display the webform that has these questions, in a modal dialog.

I know I can create a custom module, to create a custom form, and use CTools to show the form in a modal window, but then I lose all the functionality that comes with the Webform module.


texts: Which is the database table in which Boost stores the cache expiry time of a node and what is the column name?

texts:
I was looking for a way to manually set the Boost expiry time of a node and happened to chance upon the boost_cache table. There is an expire column and I am assuming that it contains the timestamp denoting the expiry time of the database. Then I happened to see the timer column and now I am confused as to which column houses the expire timestamp.  Could someone explain?

Site runs on Drupal 6.


texts: How to trigger / launch a colorbox programatically?

texts:
I would like to launch a colorbox right after an user has successfully saved a new node.

The content of the colorbox is a drupal block which would contain instructions asking the user to share that newly created node to their social media.

I am able to set up a link which loads the block into the colorbox when the link is clicked.

I would like, however, to programatically call the "link clicking" event. So, how do I trigger, by JQuery or otherwise, a colorbox from my custom form submit handler?


texts: Assign to group using case tracker in drupal 6

texts: I am using Drupal 6 and meetings module and case tracker module. Individual assignment is possible. But Assignment to group i haven't got it working. Is it possible i.e. assignment to a group and each member in the group or role get a cloned item which is created.


texts:
Out of the blue I'm unable to login into my website:
http://karlssonwilker.com/dev_v2/kw/user

I type my username and my password and upon clicking "log-in" or pressing RETURN nothing happens.
Could it be something related with the database? Disabling javascript, css, removing any custom functions, or clearing the cache tables on phpmydamin seems to have no affect.

No idea what the problem is.

I had a test user created before I started having this problem. You can use it if you care to try.
user: test
pass: test

Anyone came across a similar problem?

Thanks!


texts: How do I install Commerce Kickstart as a Aegir installation profile

texts: I have been trying to get the most recent version of Commerce Kickstart to install as a profile in Aegir, but I have had no luck. I found the following note on the Aegir project site, and this note in the Commerce Kickstart issue queue. Has anyone gotten this to work?


texts: Views - Add an empty field to a view then use it as a link

texts:
I have been using the 'rewrite results' option to create links within a view table.  Several of these link fields are just plain text, which use replacement tokens to build the link.  These fields tend to point to a data set (like UID or title) which are already used in the table.  I have been thinking, it seems wasteful to use a field which requests duplicate data.

Example:
if I an displaying the NID of a node in a views table, I could use a replacement token to build a 'click here to view this node' link.

Also, I could just use the 'Link this field to the original piece of content' option on an empty field which uses 'rewrite results' to display 'click here to view this node.'

Either way, I'd like to know if there is a way to set up an empty (or static value) display field within a view.


texts:
I have two types of content: Content A and Content B. Content B has an entity reference field that points to Content A.

My problem is that I am trying to check by code if Content B has a defined value that is a field of content A.

I tried something like this:

$query = \Drupal::entityQuery('node');
    $group = $query->orConditionGroup()
      ->condition('content_a.field_one', 'uno')
      ->condition('contnet_a.field_two', 'dos');

    $entity_ids = $query->condition('type', 'content_b')
      ->condition($group)
      ->execute();


texts: Is there a method to show a menu as a jCarousel? My requirement is to show each menu item as element of a jCarousel.


texts: media_youtube plugin doesn't work with ckeditor 4.3.x

texts:
I try to setup D7 + ckeditor 4.3.x in conjunction with wysiwyg + media (v1) modules.

Everything is ok for text edition and image insertion with the media browser button in ckeditor.

The problem is: I try to add the media_youtube plugin and videos do not show in content. Instead I have a placeholder.

Downgraded to ckeditor 3.6 and everything worked perfectly again.

But I'd like to keep the new features in the newer version of ckeditor.

Any idea what the problem could be?

thks

pl.


texts: using EntityFieldQuery with flagging condition

texts:
I would like to perform a query to find the node flagged with a "myflag" based on a node field value. Is it possible to use EntityFieldQuery to accomplish that?
If not, how can I use Views api to do it?


texts: Change on/off values for existing boolean checkbox

texts: Trying to find most "soft" way to alter data for already existing checkbox field. Aiming to change the labels value for on/off but updating them from UI or programatically is not working out, field_config contains proper allowed values array. Im not sure where else too look, on node view Im still seeing 0/1 values event though I changed the on/off values to string representations. I know I can do it on node view alter but I want more general solution, also deleting the field base and recreating is not an option here. Any hints?


texts: Need clarification on adding JS to content item with JS injector and drupal_add_js

texts:
I want to put some js on my article. Original code form http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_p

is:

    <!DOCTYPE html>

This is a heading

This is a paragraph.

This is another paragraph.

<button>Click me</button>

My article is at:   http://xuzo.com/testing/node/44

Here is what I have done

put this code in content item source code:

This is a heading

This is a paragraph.

This is another paragraph.

Click me

Put this in JS Injector box:

$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});

and this for URL:

node/44

put this in my /public_html/testing/sites/all/themes/xuzo/template.php file:

drupal_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', 'external');

Flushed all cache
Not working!!! ;)

Additionally...for this line of code to load JS files locally:

drupal_add_js('misc/collapse.js');

Where to put the JS file? I take it misc can be any folder name? But where to put the files in relation to root? Sites/all ?


texts: How to implement a cron job for every minute and every 5 minutes?

texts:
In D8 I programmed hook_cron. I tested it several times but I cannot see any log in the watchlog.

The name of the module is nncbt. The code is placed in nncbt.module.

Any suggestions what I should do?

function nncbt_cron() {

    $last_run_per_minut = \Drupal::state()->get('nncbt.last_run', 0);
    // If 1 minutes passed since last time.
    if ((REQUEST_TIME - $last_run_per_minut) > 60) {

        \Drupal::logger('nncbt')->info('Runnning Cron every 1 minut log');

        // Update last run.
        \Drupal::state()->set('nncbt.last_run', REQUEST_TIME);

    }

    // Run the following every 5 minutes
    $last_run_per_5_minuts = \Drupal::state()->get('nncbt.last_run_5_minuts', 0);

    // If 5 minutes passed since last time.
    if ((REQUEST_TIME - $last_run_per_5_minuts) > 300) {

        \Drupal::logger('nncbt')->info("Runnning Cron every 5 minut log");

        // Update last run.
        \Drupal::state()->set('nncbt.last_run_5_minuts', REQUEST_TIME);

    }

}


texts: Do purchased themes need to be fully built from the ground up?

texts:
Really naïve newbie question....

I am brand new to Drupal after working in Wordpress for quite a while.  We bought a custom agricultural theme for $75 - it looked perfect for my project at work.  The sample had all the right stuff with content placed in areas I can customize to my project.

However, now that I have downloaded it, it is just "bare bones."  The structure for the content and images is nowhere to be found.  The drop-down menu isn't horizontal, the whole structure is absent. I thought this would be easier.  Do I have to build everything in Dreamweaver? Did I miss something? Are the themes merely "suggested formats?"


texts: Drupal 8 Views filer results by logged in user association

texts:
Hello Drupal Views Experts

First time Drupal site builder newbie to stack overflow and sounds like this is the smart place to ask a query.

I have a content type "Policies". This content type has a reference field to content type " Client". "Users" also have a reference to content type "Client".

What I am trying to display in views, either through filter criteria or contextual filter, is display a table of "Policies", but only display the results of which the logged in user has reference to.

I.E Logged in user is referenced to "Client A" of content type "Client". There are a few policies of content type "Policy" which also have a reference to "Client A" of content type "Client". I only want logged in user to be able to see content from views with the same reference to "client".

Is filter criteria the way to go, or contextual filters? As I said. I am a newbie site builder and guidance would be amazing if you have the know how.

Here's hoping.


texts: Taxonomy widget - select maximum level depth

texts:
I want to make a taxonomy field widget that allows me to select the maximum level depth of the taxonomy vocabulary. This widget should be used in node forms and the value (selected term) should be saved in the node object.

What is the best (Drupal) way to approach this?

I don't want to use hierarchal select.


texts: I have two content types, game and player. Each game can have a number of players assigned to it. I would like to have the capability to give votes to each player in a game. What are some ways to do this? Is there documentation, or blog posts with detailed examples?


texts: Unable To See Admin Dashboard, How to Manually change the admin theme

texts:
I started developing a custom drupal theme from scratch(http://www.codexworld.com/create-drupal-custom-theme-from-scratch/).

In appearance menu below disabled themes, there was a drop-down menu for admin theme with theme names and a checkbox. As a curious person when I set admin theme to my custom theme(i am developing) I was unable to see Website pages & the Drupal admin dashboard because theme is empty/under developement. How to get back the default admin theme?

Edit: After Using acrosman's answer(adding $conf['theme_default'] = 'bartik'; in settings.php) i can see pages but still unable to see admin panel because I am using that incomplete theme as admin theme

How to Manually change the admin theme in Drupal 7?

What I Found: drupal is a popular website cms but you can't change the admin theme very easily if you chosen a wrong theme as admin theme by mistake.


texts: Pathauto: Custom punctuation replacement

texts:
Instead of having Pathauto replace punctuation in the path alias with a default separator ( dash for example ), or remove it, can we somehow specify a custom input to replace with?

For example, " could be replaced with inches


texts:
RFC 2616, the document that defines HTTP/1.1, lays out the definitions of all the HTTP status codes. For 403 Forbidden, it says:

  The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity.  If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

But that's not how Drupal uses it: depending on the case, it either uses it for the default condition in callbacks (e.g. shortcut_link_add_inline())—essentially making 403 Forbidden equivalent to "Drupal doesn't understand the request"—or it uses it to inform the client it doesn't have access to the page (i.e. due to permissions like being an anonymous user).

In the case of the former ("the request isn't understood"), the more appropriate status code is 400 Bad Request:

  The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

And in the case of the latter ("the client does not have access to the page due to permissions"), it should either be 401 Unauthorized (if Drupal wants to give away that it's just a permission problem):

  The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials.

or 404 File Not Found (if it doesn't):

  The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

Emphasis mine (see also the final sentence in the definition for 403 Forbidden).

I realize it's been like this for many years, but what was the original rationale for making drupal_access_denied()—and by extension 403 Forbidden—the only response Drupal sends when it gets a request it doesn't like?


texts:
I try to figure out the meaning of View's sql statement.

This following is Views auto-generate sql statement:

SELECT taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_term_data.tid AS tid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name
FROM
{taxonomy_term_data} taxonomy_term_data
LEFT JOIN {taxonomy_term_hierarchy} taxonomy_term_hierarchy ON taxonomy_term_data.tid = taxonomy_term_hierarchy.tid
INNER JOIN {taxonomy_term_data} taxonomy_term_data_taxonomy_term_hierarchy ON taxonomy_term_hierarchy.parent = taxonomy_term_data_taxonomy_term_hierarchy.tid
LEFT JOIN {taxonomy_vocabulary} taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
WHERE (( (taxonomy_vocabulary.machine_name IN  ('book_category')) ))

What's the meaning of {...}?, It seems a table name, I try to copy above sql to mysql, But mysql alert me:

SQL Syntax error.

So I try to remove {...}, Like this :

SELECT taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_term_data.tid AS tid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name
FROM
 taxonomy_term_data
LEFT JOIN  taxonomy_term_hierarchy ON taxonomy_term_data.tid = taxonomy_term_hierarchy.tid
INNER JOIN taxonomy_term_data ON taxonomy_term_hierarchy.parent = taxonomy_term_data_taxonomy_term_hierarchy.tid
LEFT JOIN  taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid

But Mysql alert me:

Not unique table/alias: 'taxonomy_term_data'

What's the problem of Views's SQL?


texts:
I have a form that contains different set of fields that will be connected to different review type / content type. The values of the form will be copied to that specific review type using the rules set data value but I have a problem with setting the value of the rating.

For example this is the Overall review form:

Review type A: Rating 3/5
Review type B: Rating 2/5
Review type C: Rating 1/5

I need these ratings to be sent on each of the content type/review type.

On the rules I can see all the correct fields, but whenever I check the review type content only the rating is not set.

This is my sample exported rule of copying the rating from one node to another:

{ "rules_copy_rating" : {
"LABEL" : "Copy Rating",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_conditional" ],
"ON" : { "node_insert--overall_review" : { "bundle" : "overall_review" } },
"IF" : [
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_overall_review_rating" } },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_overall_ref_review" } }
],
"DO" : [
  { "entity_fetch" : {
      "USING" : { "type" : "node", "id" : [ "node:field-overall-ref-review:nid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "CONDITIONAL" : [
      {
        "IF" : { "entity_has_field" : { "entity" : [ "entity-fetched" ], "field" : "field_form_rating" } },
        "DO" : [
          { "data_set" : {
              "data" : [ "entity-fetched:field-form-rating" ],
              "value" : [ "node:field-overall-review-rating" ]
            }
          },
          { "entity_save" : { "data" : [ "entity-fetched" ], "immediate" : "1" } }
        ]
      }
    ]
  }
]

}
}

NOTE: My fivestar rating widget for the reference review type is "Stars (rated while editing)" NOT Stars (rated while viewing)


texts: Problems rendering drupal 7 user registration form with ajax in BootStrap 3 Modal

texts:
I have a subtheme based on bootstrap 3 and am trying to load user registration form(user_register_form) on front--page.tpl.php, I am adding #ajax to the submit button using form_alter

     $form["actions"]["submit"] = array(
        '#type' => 'submit',
        '#ajax' => array(
            'wrapper' => "user-register-form", "effect" => "fade",
            'effect' => 'fade',
            'callback' => 'my_form_submit_handler',
            'method' => 'replace',
        ),
        '#value' => t("Sign-up"),
        '#id' => 'user_register_form'
    );

I am rendering the form in two places on the same page (a) in a div which is a regular div
and (b) in a bootstrap modal div as mentioned here http://getbootstrap.com/javascript/#modals

     <?php
            if (user_is_anonymous()) {
                $form = drupal_get_form('user_register_form');
                 print drupal_render($form);
            }
     ?>

in case (a) the ajaxified form works very well, however in case (b) the form is no longer ajaxified , the submit button does not have the "ajax-processed" class attached.

I intend to open all my application forms using bootstrap modal and ajax however i am not able to do this as of now.
I want to know the right way to load any ajax form in bootstrap modal dialog
I know this is a fairly common problem with modal dialogs and drupal forms, but i am yet to understand what the reason behind this behaviour, any help or direction will be highly appreciated.

There is one more similar question that is unanswered here
Drupal load form with ajax callback in Bootstrap modal


texts: Restrict content access by user language

texts:
I'm building a large multilingual Drupal intranet, but have some trouble configuring the language settings.

There are about 6 different languages and a lot of sensitive content for each language. There are about 20 different roles (for each country), where each role can have access to 1 or more languages. E.g. All regular users in Germany should only be able to access German content, however a German manager should be able to switch between the German and English content.

Right now I'm struggling just to get a regular German user to only see German content, and a regular English user to only see English content. How would that be done?

If I select "Language negotiation: none" all users see the English content and no language-dependent stuff works. If I select "Language negotiation: by prefix only" all users are able to switch between all different languages by simply typing the prefix in the url.

Is it possible to accomplish what I'm looking for without writing my own access module?


texts: How to pass execution to form submit handler when there is an ajax callback in the form which calls drupal_session_regenerate?

texts:
The form submit handler of my custom form is not being called due to session reset. What needs to be done to ensure that it is being called after session regenrating.

I converted a 2 step form that registers the user in the first step and allows them to make credit card payments in the next step into a 'single' step form. The user registration and auto login are handled by Ajax callback which creates the users and then calls drupal_sesssion_regenrate. This if of course resets the form token and the form submit handler is not called. I want to make sure that execution passes to the form submit handler. How can we do this?


texts: How to set up Google+ authorship in Drupal 7

texts:
How do you set up Google+ authorship in Drupal 7?

So I can link my drupal website to our Google+ account so that our Google+ profile pic can appear in the search engines next to our site.


texts: Render comment parts individually with Panels/Page manager?

texts:
Is there any way to create panels template for comments (comments attached to node). So far I've only found that "Node comments" thing under the node tab (Variants -> content) which outputs default comments and Mini panels block which renders only one comment from random node.

I'm trying replace forum node template with panels and render node and comments with same layout.

Thanks.


texts: Avoid sql-drop or sql-sync drush commands in a particular environment

texts:
I'm syncronizing databases form stage to local environments with drush commands like:

drush @dev sql-drop
drush @stage @dev sql-sync

How can I protected that the @stage server reject to drop or sync its database like:

drush @dev @stage sql-sync
drush @dev sql-drop

I think this is a common problem, maybe there is some params that can be set in drushrc.php file. How can I manage that? Thanks!


texts: What file and directory permissions do I need in my Features directory?

texts:
I just tried to generate a feature on my test system and Drupal complained that the web server didn't have write permission for the Features directory. I changed the permissions from the normal 750 & 640 for modules directories to 770 and 660 and it worked fine.

I can't see any documentation that says you need to do this so I'm concerned something isn't set up correctly.

Should this work with the 'normal' permissions?


texts: How to populate a dropdown list from array in FORM API

texts:
Hopefully this is clearer, and my last question in a long time!

Using PDO I have connected to an external DB, I can query this and return an array of values, Using html/php I can populate a standard select box. However I am unsure how to do this in the Form API, taking the array from the second paragraph, or do I query within the form item that produces the drop down? I want to take the name and the id, display the name. So that I can store the ID later.

      $stmt = $conn->prepare("SELECT admin_name, adminuser_id FROM adminuser_tbl");
if ($stmt->execute()) {
$stmt->setFetchMode(PDO::FETCH_OBJ);
$user_list = array();
foreach ($stmt as $row) {
    $user_list[$row->adminuser_id] = $row->admin_name;
}
}

$form['user_list']=array(
    '#type'=>'select',
    '#title' => t('Users'),
    '#options' => $user_list,
    '#multiple' => false,
    '#attributes'=>array('size'=>4),
    '#weight'=>8,
);


texts: Checking if user is logged into Drupal from another php application using Drupal services and REST

texts:
I have an external php application that currently uses Drupal services to authenticate users.

It's working fine but users frequently enter incorrect credentials and Drupal's flood control eventually blocks the IP of my application. And therefore every user that attempts to login to my application.

The plan to get around this is to have users log directly into Drupal and redirect them to the app. And if they go straight to the app it checks to see if the user is logged in via services. If not logged in then direct them to Drupal's login page.

As far as I can tell I should be able to use /system/connect.json to get the current user, but I keep getting anonymous user and not the user currently logged into the browser.

When I retrieve the X-CSRF-Token using a REST console browser extension via /services/session/token I get the correct token for the currently logged in user .. But getting the token through the app using php_curl I get an new token with every request.

Is it possible for me to determine if a user is logged into Drupal in the current browser via services not knowing who they are? Or am I going about this the wrong way?


texts: How to render taxonomy field_custom in page--taxonomy--term.twig?

texts: I have a custom field in my taxonomy. How to render programmatically this taxonomy field in page--taxonomy--term.twig?


texts: Importing a bunch of users from csv spreadsheet file into Drupal 8

texts:
I have a large csv spreadhseet list of users with name, email, phone and username. The passwords can be the same for all as they will be blocked anyway.

I know there is an old tutorial of importing users via the migrate api in drupal 8 from here: http://www.metaltoad.com/blog/migrating-users-drupal-7-to-drupal-8

But that article is from 2014. Is there a new upto date way of doing this without the need to create a custom module? Is there a simple gui interface to get this imported? Or is there no choice but to make that custom migrate module?


texts: Migrate images form external source (not drupal) to Node Destination

texts:
I want to migrate external database table (not of a drupal website) to node destination having the content type : 'company_profile'
the migration is done except the image field witch has the machine name 'field_company_image'.

this is the class :

class CompanyProfileMigration extends BaseMigration {
  public function __construct($arguments) {
    parent::__construct($arguments);
    $this->description = t('Company Profiles.');

    $this->map = new MigrateSQLMap($this->machineName,
        array('uid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'description' => 'ID.'
                )
            ),
        MigrateDestinationNode::getKeySchema(),
        'typo3'
    );

    // Connect to the remote $databases
    $query = db_select(TYPO3_DATABASE_NAME.TABLENAME, 'cp')
        ->fields('cp', $this->queryParams['company_profile']['fields'])
        ->orderBy($this->queryParams['company_profile']['order_field'], $this->queryParams['company_profile']['order_field_operator']);
    $query->condition('cp.fe_user', 0, '<>');

    // Define source and destination for migration
    $this->source = new MigrateSourceSQL($query);
    $this->destination = new MigrateDestinationNode('company_profile');

    // Make the mappings

    $this->addFieldMapping('uid', 'fe_user')->sourceMigration('SwMigrateFeUser');

    // field_company_image
    $this->addFieldMapping('field_company_image', 'image')
        ->sourceMigration('CompanyProfileImage');
    $this->addFieldMapping('field_company_image:file_class')
        ->defaultValue('MigrateFileFid');
    $this->addFieldMapping('field_company_image:language')
     ->defaultValue('de');

    $this->addFieldMapping('created', 'crdate');
    $this->addFieldMapping('changed', 'crdate');
    $this->addFieldMapping('status')->defaultValue(1);
    $this->addFieldMapping('promote')->defaultValue(0);
    $this->addFieldMapping('sticky')->defaultValue(0);
    $this->addFieldMapping('language')->defaultValue('de');

    $this->addFieldMapping('path')->issueGroup(t('DNM'));
    $this->addFieldMapping('comment')->issueGroup(t('DNM'));

    // Back to local database again!
    db_set_active('default');
  }

}

The class that import images is called "CompanyProfileLogoMigration"
that's why I added the source migration when mapping the image field :

$this->addFieldMapping('field_company_image', 'image')->sourceMigration('CompanyProfileImage');

And the migration of the image files are done succefully (I can see them inside default/files directory, also inside "file_managed" database table are succesfully inserted!)

But, when I edit the nodes I don't find the image field filled up (the table "field_data_field_company_image" is empty !)

How can I improve this class or what im missing to make this relationship working ?

Thanks in advance.


texts: Drupal Commerce product in-cart status info in Views

texts:
How can I use information in Views about whether a particular product is in this user's cart? Particularly, how many times into a Views row for that product?

For example, on a view listing available products, I'd like to be able to stylistically differentiate the rows representing products the customer has already added to their cart, and/or show a field, empty by default, stating how many of that item are already in the user's cart.

I've looked at existing Commerce modules such as Commerce Views Display and Commerce Add to Cart Extras, but can't see anything directly relevant. I'm not sure how to proceed with creating something to do this short of writing a custom Views query which also loads the Commerce cart for each row, which I'd rather not do since I'm not sure how I could make it reasonably efficient.

Does anything exist to support this, or if not, is there a simpler/more integrated, less "reinventing the wheel" approach using the Views and/or Commerce API?

An ideal result would be a Views Field for commerce products outputting a simple number representing how many times a product with this product ID is in the cart. Turning that into all the above use-cases is easy (e.g. rewrite as a class product-in-cart-N then apply default styles to .product-in-cart-0, simply display the field with a label, etc etc).


texts:
I'm trying to load some data for a select in webform. But for some reasons, I can't trigger the hook.
this is the url where I think the hook should trigger :

/admin/structure/webform/config/options/manage/data_liste

I'm using Webform Version : 8.x-5.16 and drupal 8
function module_alterwebform_webform_select_options_info(){
  $items = array();
  if(function_exists('_get_data')) {
    $items['data_liste'] = array(
      'title' => t('Liste'),
      'options callback' => '_get_data',
    );
  }

  return $items;
}

function _get_data() {
  $options = array();
  $options['key'] = 'value';
  return $options;
}


texts: How to show contextual links / quick edit links for blocks

texts:
I'm building a Drupal 8 template/theme from scratch, and it is not showing the contextual editing options for my blocks when I view a site page. I.E., the little circles that are clicked to see options like "edit view," "configure block,"  etc.

I cloned the block.html.twig from the Bartik theme, so it has the attributes token that I thought was enough, like this:

<div{{ attributes.addClass(classes) }}>
 {{ title_prefix }}
 {% if label %}
   <h2{{ title_attributes }}>{{ label }}</h2>
 {% endif %}
 {{ title_suffix }}
 {% block content %}
   <div{{ content_attributes.addClass('content') }}>
     {{ content }}
   </div>
 {% endblock %}
 </div>

I can confirm the Contextual links module is active.

I have global access, so it shouldn't be a permissions issue.

Is there something more I need to do for this feature to be added in?


texts: Why can't I override my views theme template files?

texts: I am using D7. I am using one of the template file names suggested in the theming information in the view. Putting that template file in my theme templates folder. saving it and clearing the cache. The .tpl.php does not seem to be recognized and/or overwrite the default file. What am I doing wrong?


texts: Why isn't my custom form element theme function being called?

texts:
In my module I have a function that returns a form:

function mymodule_myform($form, &$form_state) {
    $form['fs_refine'] = array('#type' => 'fieldset');
    $form['fs_refine']['refine'] = array(
        '#type' => 'checkboxes',
        '#theme' => 'toggles',
        '#title' => t('Refine results by category:'),
        '#options' => array(
            1 => t('Cat 1'),
            2 => t('Cat 2'),
            3 => t('Cat 3')),
        '#default_value' => array(1, 2, 3)
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit')
    );
    return $form;
}

I render the form with:

drupal_render(drupal_get_form('mymodule_myform'));

I have the following functions in my module:

function theme_toggles($vars) {
    die;
}

function mymodule_theme_toggles($vars) {
    die;
}

function mymodule_toggles($vars) {
    die;
}

I want to call a theme function for my checkboxes form element so that I can customise the HTML output of each checkbox. My theme functions are obviously not being called, because my page would by dying if one of them was.

How do I fix this and theme my form elements using #theme?


texts:
I am trying to use 'migrate source csv' to migrate some content with taxonomy terms in drupal 8. If the field has only one term, I can use the following and it works out fineprocess:
  type:
    plugin: default_value
    default_value: adi
  title: title
  field_description: description
  body: note
  field_subject_terms:
    plugin: entity_generate
    source: subject_terms
destination:
  plugin: 'entity:node'

However, if it has more than one term, and I try with the following code, I get an error about th term is not an integer. I have also tried adding the iterator plugin to the code below, but still the same error.process:
  type:
    plugin: default_value
    default_value: adi
  title: title
  field_description: description
  body: note
  field_subject_terms:
    plugin: explode
    source: subject_terms
    delimiter: ','
    process:
      plugin: entity_generate
destination:
  plugin: 'entity:node'
migration_dependencies: null

Any help appreciated. Thanks


texts: hook_user_presave at user registration, how to get field_data_field (set to auto increment) to take a new and unique value

texts:
I'm trying to force a parallel identifier (to match up legacy system requirements) to correlate to uid by means of a field_data_field_foo table.

The field_data_field_foo was created in the Field UI and because I couldn't see any UNIQUE and AUTO_INCREMENT options I set them both for the column field_data_field_foo.field_foo_value in phpMyAdmin.

I assumed this would be enough to force the issue, but in development I setup a hook_user_presave() function in my custom module and with a break point inside it, for $account->field_foo I just get undefined....

field_foo   Array [1]
    und Array [0]

Because this is something that must be assigned uniquely and I'd like to assign at the point of registration should I be using a different hook? Or is there something else I'm missing?

Btw, it might be something more basic in Drupal that I'm missing as I'm not that experienced with it atm - i.e. due to the nature of this project, I've yet to spend time learning nodes and the like.


texts: building a query with the database api and groupby multiple fields in drupal 7

texts:
first of all I simplified my query so it might be more useable to other users on this site.

I'm looking for a solution to use group by on multiple fields.

This query selects the values of the pop_links module where only unique values can remain.
resulting in 1 value per day, node and hostname. ( to display only one click per hostname a day )

Here's my plain sql query:

SELECT cid, nid, from_unixtime(timestamp) FROM pop_links_stats p
GROUP BY date(from_unixtime(timestamp)), hostname, nid ORDER BY timestamp

Here is a simplified version of the drupal 7 query I'm currently using:

$query = db_select('pop_links_stats','p');
$query->fields('p', array('cid','nid','timestamp'));
$results = $query->execute()->fetchAll();

I'm also already using the join method of the db api but I don't know how to add the above conditions.

Adding this below will group the fields by every day but I want to groupby on 3 fields.

$query->groupBy('DATE(FROM_UNIXTIME(p.timestamp))');


texts:
I have two questions about twitter module.

I want to hide global twitter account from twitter_account_list_form, because authenticate user can delete global account, and i want to stop him.

I try with this in form_alter

    $pom_array = array_keys($form['accounts']);
        foreach ($pom_array as $key => $val) {
            if (is_int($val)) {
                if ($form['accounts'][$val]['#account']->is_global == 1 )
                    $form['accounts'][$key]['#prefix'] = '
';
                    $form['accounts'][$key]['#suffix'] = '
';
             }
        }

but without success.

And if node has option post to twitter.com, I want to hide that option also because authenticate can change message. I want in that case to post message for global and user's twitter account, if user already connected account with twitter.

Many thanks


texts: How to get date attribute in cart page using ubercart?

texts:
I am Trying to develop an event based Drupal website using the ubercart module.

I have to provide date and time field in product page, cart page and checkout page for users to book their tickets on specific time period.

I should also be able to limit the date and time based on booking count, similar to a movie ticket booking system.

Is there any possible module that provides this functionality?

FYI: I did try using Agreservations module but it is not yielding my expectation.


texts: How to get my custom 404/403 pages to work with Bootstrap?

texts:
I use this in my template.php for custom error pages:

  //custom 404 not found page
  $header = drupal_get_http_header("status");
  if($header == "404 Not Found") {
    $vars['theme_hook_suggestions'][] = 'page__404';
    drupal_add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external'));
  }

  //custom 403 access denied page
  $header = drupal_get_http_header("status");
  if($header == "403 Forbidden") {
    $vars['theme_hook_suggestions'][] = 'page__403';
    drupal_add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external'));
  }

And I have custom page--403.tpl.php and page--404.tpl.php (these don't exist as nodes)

And they work if it's non-Bootstrap theme, e.g. it works on Zen theme, but it doesn't work on Bootstrap theme. When you go to some random URL it just gives the default page not found error and doesn't load my custom pages.

And I don't get it why.

Also with Bootstrap theme you have to put your custom pages inside templates/system and put your custom functions inside page.vars.php.


texts: DS link to content - how to change the link?

texts:
I am using D7. I want to do simple thing with Views and DS: I have view with list of content type teasers and another view with list of the same content type full articles. In DS there is an option to link teaser's Title to it's content, so when pressed user can get the full content of that content type. But I want all teaser titles to link to the same page - to the View with all content types listed.

Do I have to alter any tpl for this, or is there any other way to do this?
Maybe it will sound silly, but I really don't get it, so please help me :)

thank you!
Ben


texts: How to split configurations in features to minimize conflicts

texts:
I need to put all configurations of a site to features. Some say that it is not a good idea to put all of the site configurations in one big feature. I have also experienced strange behaviour of the features ui when I tried it once.

My question is what kind of rules I need to implement on splitting the configurations between multiple features, to fulfil one important thing: Every small configurations, every new strongarm variable, or field, etc should be completly clear where to put to, to avoid confuse and conflicts in the future.


texts: SQL query to count comments for node type

texts: I am looking for a SQL query to count all comments for a specific node type. What code should I use to achieve it?


texts: How to create a view that shows a Managing User all content of their members?

texts:
I want to create a View that lists all content of authors who have the same value (text) as the viewing user. Actually they are members and the viewing user is the manager of the members. I have 2 profile fields that I think could be used to show the desired results:

1) an entity reference field called "field_ca_reference" to allow a member to reference a manager

2) a text field is set upon member verification that has the exact same value on both the member and the manager

How do I set up this view such that the manager sees all content of their members only?


texts: how to display labels of empty profile fields

texts:
I have enabled profile2 module. There is profile type called personal information and it has related manage fields.I want to display the labels for empty profile fields on profile page. The fields are visible when it contains information but how to display the labels of empty profile fields to prompt the user to fill out empty fields. Does anyone have the solution? Please help.
Thank you.


texts: Commerce Kickstart: How Do I Modify The Order Receipt Page To Add Order Date?

texts:
The receipt page that displays when one completes an order (or reviews in History) contains no order date (surprising).

Where is the code that renders that page and how does one modify it to display the order date field?

http://example.com/user/1/orders/6