texts: New users not created when migrate source is nodes instead of users

texts:
I'm working on a D6-> D7 user migration where I need the source to be a node, not a user. To get around the restriction of only one author per node, in the source D6 site we created a Source content type, and then in other node types (article, video, etc), we created field_source as a node reference field to reference Source nodes.

So now, in my user migration to D7, I need to get the data from the Source nodes instead of users. Here's what I have so far.

/**
 * Override of DrupalUser6Migration.
 */
class CNSUserMigration extends DrupalUser6Migration {
  public function __construct($arguments) {
    parent::__construct($arguments);

    $this->addFieldMapping('name', 'title');
    // Set a default password for all users.
    $this->addFieldMapping('pass')->defaultValue('Pass!234');
    $this->addFieldMapping('field_twitter', 'field_twitter_id_value')->description('Twitter ID');
    $this->addFieldMapping('field_job_title', 'field_source_title_value')->description('Job title');
    $this->addFieldMapping('field_bio', 'body')->description('Bio');

    // By default, the primary key is the uid from the users table,
    // but since our user source is a source nid, need to replace
    // uid with the nid of the source node.
    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'nid' => array('type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'description' => 'Source node nid',
          'alias' => 'n',
        ),
      ),
      DrupalDestinationUser::getKeySchema()
    );
  }

  /**
   * Override of DrupalUser6Migration::query()
   *
   * @return mixed
   */
  protected function query() {
    // Create query from scratch to get source nodes referenced from field_source
    $query = Database::getConnection('default', $this->sourceConnection)
      ->select('node', 'n')
      ->fields('n', array('nid', 'title'));
    $query->innerJoin('content_field_source', 'cfs', 'cfs.field_source_nid = n.nid');
    $query->innerJoin('content_type_source', 'cts', 'cts.nid = cfs.field_source_nid');
    $query->fields('cts', array('field_source_title_value', 'field_twitter_id_value'));
    $query->innerJoin('node_revisions', 'nr', 'n.nid = nr.nid');
    $query->fields('nr', array('body'));
    $query->distinct();

    return $query;
  }
}

So my query works fine and gets all the relevant Source nodes, but when I ran it the first time, I realized I had to change my source PK to be the nid of the Source node instead of the default uid from the users table. As you can see above, I overrode the map with a new MigrateSQLMap object in my constructor.  However, when I run the migration, it creates the first user from the query, but then all of the subsequent source records also point to that first new user instead of creating new users. Now that I've defined a new source PK, do I also need to do something on the destination side to cause it to create new users?

Thanks.


texts:
We are implementing apache solr search in drupal 7.. after installing the module if you run the index, the apache solr is returning results from the drupal tables (nodes,users,taxonomy,content type).
But we have created custom tables (example: product table) where apache solr is not able to index those table data.. how to make it index the custom created tables


texts: One account, one email, two different usernames

texts:
I am trying to create a social website that each member can create two different profiles with two different usernames, one public and one private. The member should be able to toggle between profiles the same way you do with facebook when you toggle between your main profile and a different page you own. The member is able to post new nodes as his/her private username or public username by simple toggling between the two.
I have been researching many modules such as profile2 and subuser. The problem with subuser is that you can switch between your main account and the subuser easily but you can't switch between your subuser and the main user except if you logout first. Also, with the subuser, you are required to add another email address for each subuser. It would better if there is only one email address access to both accounts. What is the best solution?


texts: Mandatory field (A or B) in a content type

texts:
I have a content type (external_document) that has an entity relation to an "event" and an entity relation to a "project."

I would like to be able to have some validation rule saying: All the documents must be "linked" to either an event or a project.

I am unclear on the following:

How  to do it on D7?
What is the proper name for that in Drupal so I can search it?
Is it the "Drupal" way of doing the content type with 2 entity relations?


texts:
I need to put three view blocks next to each other on a page. Therefore, I thought i could put some php code in a new page and manually put them next to each other with DIVs.

The problem is that I can't seem to output the views block.

I have tried multiple things:

//load the view by name
$view = views_get_view('woensdag');
//output the view
//var_dump($view);
--> this returns the view, so it is being loaded

$view_name = 'woensdag';

views_embed_view($view_name, 'default');
--> outputs nothing

views_get_view_result($view_name, 'block');
--> outputs nothing

echo views_embed_view('woensdag', $display_id = 'block')
--> outputs nothing

The delta  name of the view is woensdag-block_1, I have tried that as well.

Any ideas? I am using Drupal 7.


texts:
I would like to display a view block on a custom tab I created as follows, but the tab is always empty. The block has the option to be shown only on specified path node/%node/calendario-corsi. Is it correct to have an empty page callback?

function custom_morebuttons_menu() {

  $items['node/%custom_node_calendario_corsi/calendario-corsi'] = array (
   'title' => 'Calendario corsi',
   'page callback' => 'custom_node_calendario_corsi_page',
   'page arguments' => array(1),
   'access callback' => 'user_is_logged_in',
   'type' => MENU_LOCAL_TASK,
   'weight' => 10,
  );

  return $items;
}

function custom_node_calendario_corsi_load($arg) {

  $node = node_load($arg);

  if($node->type == 'centro' || $node->type == 'sede') {

    return $node; }

  return FALSE;
}

function custom_node_calendario_corsi_page($arg) {

  return '';
}


texts:
I have a content type that has a reference field to another content type, call it "associated".

When editing the content, I'd like the user to be able to search for the "associated" entity to link to, for example using a view with a exposed filter.

Is there any combination of modules that will allow me to do this?

So i'm basically after a select widget that bring up a popup or something similar.

Thanks,


texts: Menu item path saved as node/nid instead of alias

texts:
An alias supplied to the [Path] attribute of a Menu Link is converted to node/nid when saved, (along with a nice message: "The menu system stores system paths only, but will use the URL alias for display".)   This is implemented in core: function menu_edit_item_validate of menu.admin.inc.   (Drupal 7.22)

When moving nodes around between instances of the same site with node-export and uuid, node/nid is no longer valid, and results in menu links being dropped, or pointing to the wrong node.

A similar question was raised earlier:

How do I use URL aliases in menus?

But the solutions I think are for different use cases.  The suggestion of adding the alias and menu item together on node creation does not seem to work.   Our concern has nothing to do with how the node url is displayed.

UUID_path or maybe UUID_features seem to imply a solution, but if there is a resolution there, I don't understand it, and will appreciate any insight into how to handle this.

In the end, we need to have exportable menu links with path attributes that, one way or another stay, linked to an alias, regardless of nid.


texts: How to use drupal_add_html_head() to add the same metatag multiple times?

texts:
I have a node which has multiple images attached to it. And each image should also be printed in a <meta property="og:image" content="image_url" /> metatag. I have tried to use drupal_add_html_head() for each image in a template_preprocess_page(), but only the last image is printed as metatag.

function mytheme_preprocess_page(&$variables) {
...
    // add multiple og:image tags
    foreach ($images as $image) {
        $element = array(
            '#tag' => 'meta',
            '#attributes' => array(
                "property" => "og:image",
                "content" => $image,
            ),
        );
        drupal_add_html_head($element,'facebook_share_image');
    }
}


texts: How to limit flagging of articles to users with sufficient userpoints using Rules?

texts:
I am using User Points and Rules. Users earn points for publishing and commenting but are deducted points for flagging their articles for announcement on the front page (a kind of a fee). The fee per announcement is say 150 points.

Obviously, if they don't have at least 150 points, they should not be able to flag. So I need a rule that would check if the author has at least 150 points and if not - block the flagging action with an error message: Sorry, you don't have enough.

Yet, I just can't figure out how to set up such a rule. Any help would be highly appreciated.


texts: What is the best way to make a page that filters a content type using Ajax

texts:
I tried to use Finder module, but I had some issues with pagination and some weird issues when I parameter it to use Ajax, some friends told me that I can use the Views module, but they couldn't tell if it supports or could be hacked to support Ajax calls. (I mean by hacked being extended)

I'm new to drupal, it's been like a two days learning and practicing, and I would appreciate any proposition.


texts: Can I print an image from a separate content type in my page--front.tpl.php?

texts:
This is a question in reference to Drupal 7, using the Zurb Foundation base theme framework. I've created a specific content type that only has an image field in it for purposes of making the image itself content manageable by the user so they can add/remove as they'd like.

I thought that I could access that image with the following code in my page--front.tpl.php file per my Googling of the subject, however, I'm getting no output at all.

<?php print render(field_view_field('node', $node, 'field_my_image_field', array('label'=>'hidden')));
  ?>

I've also attempted several different variations of this to no avail.

How can I access and print out the contents of that field from that content type into my custom page template?


texts: How to reset node id to a lower number - Drupal 7

texts:
I have loaded thousand of nodes in different tests. How can I safely delete all the extra nodes and obly the database table to increment the node nid after the next valid (not deleted) nid? I.e., now I have 50 valid nodes, and the index starts at 250.000. How can I force it to start at nid = 51 without making the whole database crash ?

A secure way, please. Not low level, but with a module or something that respects referential integrity of the whole database.


texts:
Short version: How do you use CSS to define where a image is located on each Node?

I AM NOT TALKING ABOUT IMAGE STYLES: https://drupal.org/documentation/modules/image#styles

Long version of my question:

I have created a content type call image_content, in which I can create a node and upload a image to that node. That works great! but now what? I mean if load 10 images one one node, the are lined up hortizonaly, and thats pretty ugly. How can I use CSS to change the style of the images per node.

Now I understand, I could create a photo gallery, but I want more control of how each image is displayed. Example my background looks like a empty room. On node created by the image_cotent, I might want a image1 far left, and image2 far right. Basic CSS understanding can do this, but how would I do this node? The reason is I might want the images on node2 have a left-margin of 50px, but images on node1 to be margin-right-0px

Does this make sense?? PLEASE provide example if you can!


texts: How to check if a field has more than one value

texts:
I am working on a field template to display images in a carousel (I'm using BootStrap). My field is named “galerie”
I copied field.html.twig from the core and saved it as field--field-galerie.html.twig
I managed successfuly to add the necessary markup for BootStrap carousel to work.

The wrapping markup displaying the carousel and its control shows up when there is only one image. I thought it would not. It opens after a {% if multiple %} condition and closes before the {% else %}.
My understanding is that {% if multiple %} only checks if the field is set to accept multiple values.

I don't know how to write an condition in twig checking if the field contains one image or more, to trigger (or not) the carousel thingee.


texts: Any success using Vagrant + Samba for Drupal Projects?

texts:
I was desperately hoping that I'd be able to mitigate the ridiculously awful performance of Drupal in our Windows + Vagrant dev environments by using Samba rather than Virtualbox shared folders, but so far I've had exactly zero success. Has anyone else succeeded? If so, anything you can share to help?

I haven't been able to get past this error when attempting to mount the network share:

  Failed to mount folders in Linux guest. This is usually because
  the "vboxsf" file system is not available. Please verify that
  the guest additions are properly installed in the guest and
  can work properly.

We're running:

Win7/Win8 host
Ubuntu 12.04 guest
Vagrant 1.6.3 + vb-guest plugin
Virtualbox 4.3.12

I've seen indications around the Google-sphere that I can SSH into the guest and do some magical symlinking, but my vagrant box is powered off when the mount fails. I can't access the box.

Help?


texts: Is there a base module that implements the slide in, slide out behaviour like the Admin module?

texts:
I am looking for a module that implements slide in and slide out on top functionality, similar to the way some websites slide out a contact form when you click the thingy at the side of the page.
 The Admin and Slidebox modules have that ability, but I am looking for some kind of container object that implements the slide in and out functionality.

PS. the tags are not the most accurate but are the nearest.


texts: Changing Allowed HTML tags: @tags for help text input field

texts:
I want to display a simple table under a form field as part of the help text for that field (file field to be exact). Am I being totally mental or is there really no easy way of changing the allowed html tags for this text area? At the moment I have displayed:

Instructions to present to the user below this field on the editing form.
Allowed HTML tags: a b big code del em i ins pre q small span strong sub sup tt ol ul li p br img

If there is no easy way, what is the next easiest way of doing it?

UPDATE:

Clive came up with a great way of doing it below with a custom module. You can also add to this using ctools to make the help text collapsible as follows:

// Implement hook_field_widget_form_alter()
function MYMODULE_field_widget_form_alter(&$element, &$form_state, &$context) {
  // If some condition is matched based on the element provided...
  if (isset($element[0]) && $element[0]['#field_name'] == 'field_test') {
    // Alter the description using your more permissive set of tags
    $reworked = filter_xss($context['instance']['description'], _MYMODULE_field_filter_xss_allowed_tags());
    $element[0]['#description'] = theme('ctools_collapsible', array('handle' => 'Help text', 'content' => $reworked, 'collapsed' => TRUE));
  }
}

// Provide a more permissive set of tags to be used with filter_xss()
function _MYMODULE_field_filter_xss_allowed_tags() {
  // Merge the new set of allowed tags with the less permissive defaults
  $new_tags = array('table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td');
  return array_merge(_field_filter_xss_allowed_tags(), $new_tags);
}


texts: drush make build script tries to download project itself from drupal.org

texts:
I use a drush make build script to install a profile. Just started that install profile project.

https://raw.githubusercontent.com/groovehunter/releasemanager/master/build-releasemanager.make

When I do

drush make "https://raw.githubusercontent.com/groovehunter/releasemanager/master/build-releasemanager.make" -v -y

it prepares the core and tries to download

Loading release_info engine.                                                  [notice]
Unable to clone releasemanager from                                           [error]
http://git.drupal.org/project/releasemanager.git.

but that's oviously not successful. THe code is on github only. I have no clue where drush get the information the project lives on drupal.org ?

Cleared drush cache, also manually, but Cannot get it now


texts:
How can I generate a HMAC code in Drupal 8?

In plain PHP, I would use hash_hmac(). Is there a more specific method/function, in Drupal 8?


texts: Media Youtube/Vimeo is being saved (or rendered) incorrectly as application/octet-stream

texts:
In Drupal 7, I am using panels/panelizer, media & media_youtube.

I have correctly set up my view mode for the Video file type, and have selected that view mode using 'Rendered entity' in my pane settings.

The video is rendering as a link to sites/default/files/[file youtube title].

The above problem is arising with a file field on a node, that is being rendered with panelizer.  When I add a video using a fieldable panel pane, it renders correctly (using the same view mode).

Any help you could provide would be much appreciated.

      F 16 Fighter Pilots.F 16 Fighter Pilots over


texts:
I'm trying to configure the Views UI so that users can only see specific panes (i.e. only fields, filters and style settings panes). I tested SimpleViews and Views UI: Edit Basic Settings modules, but it wasn't so useful.

Hiding panes with jQuery was also not a good way.

Does anyone have a solution?


texts: css class not removing in template preprocess

texts:
I have the following code.

function template_preprocess_image(&$vars) {

     if($vars['style_name'] == 'thumbnail'){
        $vars['attributes']['class'][]='';
        unset($vars['attributes']['class']);
        $vars['attributes']['class'][] = 'media-object';
       }

}

I am not able to remove img-responsive class from the this  field. I have tried several ways but not luck. Please help me.


texts:
I installed drush, and when I do "drush status" it says that my drush version is 6.6.0.

I want to have drush7 instead, so I downloaded it from github, and did following commands:

chmod +x drush.phar

sudo mv drush.phar /usr/local/bin/drush

drush init

I get following error: the drush command init could not be found.

When I do drush status, it still says I have drush6 version... what do I need to do?


texts: How to get field type of an object of Drupal\views\Plugin\views\field\EntityField

texts:
I want to filter the field type "links" out of my $handler:

/**
* Searches for the link field to use, if present.
*/
public function find_link_field() {
  foreach ($this->view->display_handler->getHandlers('field') as $id => $handler) {
    if($handler->fieldDefinition->type == 'link') { //-> protected properties!!
      return $id;
      break;
    }
}

As stated in the title, $handler is an object of type Drupal\views\Plugin\views\field\EntityField.
I'm writing a views plugin.
Also I implemented use Drupal\views\FieldAPIHandlerTrait;. But the method getFieldDefinition() is protected too!


texts: View filtering all records with no argument, empty text with invalid argument

texts:
I have a view with a block display that I need to filter by:

All records when no argument present e.g. /foo
All nodes with specified valid taxonomy term ID e.g. /foo/bar
Show empty text when taxonomy term ID is attached to no content e.g. /foo/baz

WHEN THE FILTER VALUE IS NOT AVAILABLE is set to Display all results for the specified field.
WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED is set to Specify validation criteria, Taxonomy Term.
Filter value type is set to term name converted to term ID.
Transform dashes in URL to spaces in term name filter values.
Action to take if filter value does not validate is set to Display contents of "No results found".

The view preview is working correctly, adding taxonomy_term_data_field_data_field_VOCAB.tid = 'xx' to the query but on the front-end it doesn't appear to be working at all.
I have Global: Null as the first entry under Contextual filters as the argument needed to filter is the second argument in the URL string.


texts: Add content from one content type into another content type

texts:
What is my current site setup:

I am working on an academic website using Drupal 7 and I'm working on adding content from one content type into another content type.

I have a Books content type and also a People content type.

Book has the following fields:

Image (image upload field)
Title (textfield)
Description  (rich text)
Publisher URL (text field)
Publish Year (text field)
People name (entity reference to the title on the People content type (multi
select))

People has the following fields:

Title (the person's full name) (textfield)
Description (rich text)
Email (text field)
Phone number (text field)
Office location (text field)
Biography (rich text)
Research (rich text)

My specific question:
How do I relate the book content type to the people content type so that the list of books written by the respective person appear on the public version of the person's people content type page?


texts: How to sort/delete comments by a particular user?

texts:
I have a relentless human spammer that is extraordinarily difficult to keep away. Spam filters are unhelpful as he does not use a set of frequently used words. Rather, his insults are more "subtle" to be captured by any regext.  Each time I block him, he comes back with a new username but soon the new user reveals his spammy nature. So I need to go through the list of comment to finds the one by him and delete them one by one. On the other hand, I don't want to disable comments auto-approval just because of one bad apple.

It is painful especially when you need to do it a couple of times a day! so I wish there was an easier way to sort and then delete comments of a particular user, and not involved direct querying the database?


texts:
On hook_update_N() the documentation says:

  mymodule_update_7000(): This is the required update for mymodule to
  run with Drupal core API 7.x when upgrading from Drupal core API 6.x.

  mymodule_update_7200(): This is the first update to get the database
  ready to run mymodule 7.x-2.. Users can directly update from 6.x-2.
  to 7.x-2.* and they get all 70xx and 72xx updates, but not 71xx
  updates, because those reside in the 7.x-1.x branch only.

Is it really mandatory to define an 7000 update hook? I saw some contributed module updates that starts with 7300, when the module version for Drupal 7 is 7.x-3.x.

I am a bit confused, because I read before the UPGRADE.txt file for Drupal 7 core that says:

  MAJOR VERSION UPGRADE
  To upgrade from a previous major version of Drupal to Drupal 7.x, after following the instructions in the
  INTRODUCTION section at the top of this file:

  In addition to updating to the latest available version of Drupal 6.x core,    you must also upgrade all of your contributed modules for Drupal to their    latest Drupal 6.x versions.

For me, it means that users can't directly update from 6.x-2.x to 7.x-2.x unless  6.x-2.x module was the latest in the Drupal 6.x versions. Is this correct?

What about eventual database updates defined by 7.x-1.x branch? Do they have to be reported in the 70xx updates?

Can a module version 7.2.x keep any other updates (e.g. 60xx, 71xx) or it should be clean and defined only updates about 70xx and 72xx?


texts: Why does default .gitignore suggest ignoring config directory?

texts:
In Drupal 8, perhaps the most anticipated feature is separation of configuration from content. It achieves this by storing configuration changes in a sites/default/config_* folder.
Why then does the default .gitignore file suggest ignoring this directory?
If I make changes to the site, I want those changes to be tracked to push them to the live site, or merged with another developer's changes.


texts: Cannot print View title in View template

texts:
How can I print the title of my view in views-view.html.twig?

I have tried both {{ title }} and {{ label }} but neither work.

You can see the title is set in the View, and the template is using {{ title }}


texts: Is there a token for the body of a content type? I'm using the Integrated Metatags module. I want to include some of the body text inside of the Meta Description tag.


texts: How to exclude nodes from a view if they appear on another view?

texts:
I have two views called 'slider' and 'latest news'.
The slider view lists 5 nodes with content type news, article and blog post and if a custom field is selected on this nodes.
The latest news list the 5 latest nodes with content type news.

What I want to do is to exclude nodes from latest news view if they appear on the slider view.
If the slider view has only the news content type, it would be easy to exclude nodes by using the offset feature but because the slider view could have nodes from all these three content types and it's uncertain how many nodes come from each content type I couldn't solve my problem.
How to exclude nodes from latest news view if they appear on the slider view?


texts: After updating I got these error messages

texts:
After updating my Drupal 8 test site from 8.3.7 to 8.4.0, I got these error messages:

  Mismatched entity and/or field definitions
  The following changes were detected in the entity type and field definitions.

  Webform submission

  The Sprache field needs to be updated.

  Absatz

  The Veröffentlicht field needs to be updated.
  The Behavior settings field needs to be updated.

What do I have to do? I don't know how and where I should update these fields. Should I update any database table, or is there another workaround?


texts:
I was wondering if there is a way to alter paragraph fields when the paragraph is set to "closed" in the Edit mode setting of form display. Because in that case the hook_field_widget_WIDGET_TYPE_form_alter does not return any of the inline paragraph fields inside the $element['subform']

To give a little more details, there's a paragraph field that holds some more native fields within itself. When I am trying to add/edit the node with which it is attached, i want to alter some fields within the paragraph. Since the paragraph is closed the fields within will be rendered via ajax call on the fly. I was looking for a way to alter them during this ajax call, that is just before they get rendered in the form so that I can alter their attributes.

Any idea?


texts: Paypal payments pro integration with drupal 6

texts:
I have a drupal 6 website which has the following workflow:

User logs into site.
User creates content through a custom module that I built.
This content is not a content-type, its custom content.
The user saves this content type, but cannot yet publish it.
User then hits publish.
He is asked how long he wants to publish the content for.
User selects from 15 days, 1 month, 2 months etc.
Depending on his selection he is provided a price for publishing the content for the interval.
If the user pays the amount shown, his content is published.
For each content page that he wishes to publish he will be provided the same options of selecting the interval and paying the price for the same.

I have three questions about this:

1: Are there any existing modules that would let me achieve this? (I did search and couldn't find any. My initial instinct was of-course ubercart, ecommerce etc... but I can't figure out how I would implement this specific workflow in any of these.)

2: If there aren't any existing modules for this, how would I integrate Paypal payments pro in my custom module? I can't find a straightforward tutorial anywhere.

3: Is it possible to use the payment backends of any other modules. I know ubecart provides a bunch of different payment methods. Is it possible to use these modules without ubercart and call them in a custom module?


texts: How to display current user name in webform field?

texts:
I have created one webform with Name,Email id, Address fields.
if user is login in name field already fill with 'login user name' and no one login then its fill with 'Anonymous'.

my issue is if user login its fill with login user name but not login then filed should be blank not fill with 'anonymous'.

Please help...


texts: Why do taxonomy_get_tree() & entity_load('taxonomy_term', etc..) give different counts?

texts:
I'm finding that I am missing some terms in a vocabulary when I try to get them all with taxonomy_get_tree($vid).

If I verify the count of terms in the vocabulary by getting the count of entity_load('taxonomy_term', FALSE, array('vid' => $vid)) when I compare the counts they are different.

Can anyone tell me why the counts would be different?

I was hoping to use taxonomy_get_tree() as it's much faster for the number of terms I have (> 10k) but it's useless if it's not going to deliver all terms.

Thanks for any info on this.


texts:
I'm using Omega3 and having just a couple styling issues with IE. (The site looks good in every other browser) Is there a simple way to detect IE and call an IE specific style sheet to fix these couple layout issues?

I've tried setting/unsetting css/js aggregation and clearing caches. Also tried adding this code to my template.php file and creating a ie8.css file:

drupal_add_css(path_to_theme() . '/css/ie8.css', array('weight' => 999, 'browsers' => array('!IE' => FALSE, 'IE' => '(lt IE 9)&(!IEMobile)'), 'group' => CSS_THEME));

I'm looking for a simple way to detect IE and add a couple lines of css. Thanks!


texts: How to get delta of a file from within hook_tokens

texts:
I am trying to create a delta token in my module.
In  hook_tokens, I manage to get the file object, but I have no clue on how to get the delta of my file...

Here is my implementation of hook_token_info

function artprod_token_info() {
  $types = array();
  $tokens = array();

  $types['delta'] = array(
    'name' => t('Delta'),
    'description' => t('Provide the delta of the field.')
  );
  $tokens['delta']['delta'] = array(
    'name' => t('Delta'),
    'description' => t('Provide the delta of the field.')
  );

  return array(
    'types' => $types,
    'tokens' => $tokens
  );
}

Here is the beginning of my implementation of hook_tokens

function artprod_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
  $replacements = array();
  if ($type == 'delta') {
    $file=$data['file'];
    foreach ($tokens as $name => $original) {
      // Find the desired token by name
      switch ($name) {
        case 'delta':
          $replacements[$original] = $file->delta();// NOT WORKING
          break;
      }
    }
  }
  return $replacements;
}


texts: View showing related nodes before unrelated nodes

texts:
I'm trying to create a view, which will show constant number of nodes.
I want it to show related nodes first, and after them (if there aren't enough related nodes) to show other nodes.
As far as i understand, contextual filters will remove all the unrelated nodes and I can't find sort order which will promote related nodes to the top.

Is there any way of doing this with views?


texts:
I need to get the node's view mode so that in the mymodule_page_attachments, I can add libraries conditionally if the node's view mode is set to full or default. I tried the following but not able to get the nodes view mode once I retrieve the$node` object.

How to get node's view mode in hook_page_attachments?

Here is what we tried:

function mymodule_page_attachments(array &$attachments) {
  $node = \Drupal::routeMatch()->getParameter('node');
  if(is_object($node)) {
     // we tried printing but that didn't result any view_mode field.
     ksm($node);

    // Goal
    if($node['view_mode'] == 'full' or $node['view_mode'] == 'default') {
       // proceed with my logic.
    }
  }
}


texts: How to prevent behavior-attached functions from being attached twice?

texts:
I have a behavior that adds on to some checkboxes.

(function($) {
  Drupal.behaviors.mymodule = {
    attach: function (context, settings) {

      $('.skip-line', context).on('change', function(){
        // some code
        if ( confirm(Drupal.t('Apply to all languages?')) ) {
          // applying...
        }
      });
    }
  };
})(jQuery);

It works very well, but checkboxes are in AJAX-loaded part. If I reload that part of the form, clicking on them makes confirmation popup twice. Now, I know I can test inside function if it's the first time in a row it's called, but I would prefer to make sure it is added to my element only once, and thus called only once. How can I do that?


texts: Accessing Drupal 6 data using Drupal 7 entities

texts:
I have a project where we have a legacy system built in Drupal 6 that has been heavily customized, with much of the data stored in custom tables.  We are currently planning a D6 to D7 upgrade, but we have an immediate need to access that data in a Drupal 7 instance, leaving the D6 site intact for now.

I would like to access that data using Drupal Entities and wrap each D6 table in a Drupal 7 Entity; however I'm having trouble making that work since the underlying assumption with the Entity API is that the data is stored in the local database, and this database is remote.  We can access the database directly from the Drupal 7 instance, and I have the database credentials loaded in settings.php.  I can query the data using Database::getConnection('default', 'legacy')->select(), so I know my connection is good; however I have no idea how to go about structuring an Entity class so that I can leverage EFQ, Views, etc. on this data.

I looked at Remote Entity API, but I"m not dealing with a RESTful service here, I have a direct connection to the D6 database.

Any assistance or hints would be greatly appreciated.  I've worn Google out.


texts:
I have created a custom module for Drupal 7 that displays a block, and I would like to add some CSS. The problem is that the CSS is not working.

This is the module code.

/**
 * Implements hook_block_info().
 */
function filter_search_form_block_info() {
  $blocks['filter_search_form'] = array(
    'info' => t('Filter Search Form'),
    // 'cache' => DRUPAL_CACHE_PER_ROLE,
  );

  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function filter_search_form_block_view($delta = '') {
  $block = array();

  switch ($delta) {
    case 'filter_search_form':
      $block['subject'] = t('block Title');
      $block['content'] = array(
        '#markup' => '

          <form id="filter-search-form-form">

              <input type="text" class="form-control form-text" name="txt_search">
                ' . t('Brigadista') . '
                <input type="checkbox" class="form-control" name="chk_brigadista">
                ' . t('Fuente Documental') . '
                <input type="checkbox" class="form-control" name="chk_fuente">
                ' . t('Encuadramiento Militar') . '
                <input type="checkbox" class="form-control" name="chk_encuadramiento">
                <input type="submit" value="' . t('search') . '">

            </form>

',
          '#attached' => array(
            'css' => array(
              drupal_get_path('module', 'filter_search_form') . '/css'
             ),
             'js' => array(
               drupal_get_path('module', 'filter_search_form') . '/js/'
             ),
           ),
         );
         break;
    }

    return $block;
}

This is the module .info file.

name = Filter Search Form
description = Module that create a Block for Filter Search Form, form with checboxes to filter search.
core = 7.x
package = CUSTOM

scripts[] = 'js/filter_search_form.js'

stylesheets[all][] = css/filter_search_form.css

These are the CSS styles.

#filter-search-form {
    float:left;
    background-color:red;
}

Why aren't the CSS styles applied to the module output? I cleared the cache with drush cc all.

The structure is:

css/

filter_search_form.css

js/

filter_search_form.js

filter_search_form.info
filter_search_form.module


texts:
I need to remove class .last from menu's
. I browsed this nice website for a solution and find some code that removes ALL classes:

function THEME_menu_link(array $variables) {
  //unset all the classes
  unset($variables['element']['#attributes']['class']);

  $element = $variables['element'];

  if($variables['element']['#attributes'])

  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '
' . $output . $sub_menu . "
\n";
}

And:

function mymod_menu_tree__menu_about_us($variables) {
  return '
' . $variables['tree'] . '
';
}

function mymod_menu_link__menu_about_us(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';
  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $class = "";
  $classes_of_this_li = $element['#attributes']['class'];
  if (in_array($classes_of_this_li, 'active-trail')) {
    $class = 'active';
  }
  $output = l($element['#title'], $element['#href']);
  return '
' . $output . $sub_menu . "
\n";
}

I need to remove only .last class and also somehow I need it to work only on a selected region. What I mean is that the function must apply to menus that are rendered i.e. in Sidebar region.


texts: How to convert a Drupal website to standalone exe file?

texts:
I'm trying to convert my Drupal website to a standalone .exe file. I tried some popular applications like ZZEE PHPExe or ExeOutputPHP, ZZEE PHPExe returns the error that /includes/boostrap.inc is not found in the output directory, while I copied that folder in there. The ExeOutputPHP errors File not Found and nothing else! it doesn't even tell me what file is not found!

Any suggestion to convert Drupal website to standalone exe file?


texts: How to get the current version of a node?

texts:
I programmaly want to set the current version of a node to a status in workbench "needs_review" however the current version of the node is not the published version of the node.

$vid
5000 = Published
4999 = Current revision

How to get the versionid of a node which contains the current version?

I tried several and I guess:

$vid = revisioning_get_latest_revision_id ($nodeid)
$node = node_load ($nodeid, $vid)

but this is of course giving an error as a answer as I'm using D7, the function revisioning_get_latest_revision_id cannot be found.

I also saw https://api.drupal.org/api/drupal/modules%21node%21node.module/function/node_revision_list/7.x
But do not understand how the get the current revision of the node.

Any suggestions?


texts: reference a view page with entity reference

texts:
I have an entity reference field for referencing and rendering a teaser display of nodes.

I would like to be able to include a View page in the list. I this possible in some way?


texts:
How do I easiest get an image (its path) from the article content type included in Drupal 8?

What I have is an entity. Using $image = $node->fields['field_image'] gives me a hell of a structure, though.

Is there no easier way to get the image path? Also I cannot find the URL in this, what I get is some sort of target_id (the file ID?).


texts:
I am working on Drupal 8, trying to get a page template for each vocabulary. I have tried using hook_theme_suggestions_HOOK_alter() to achieve this, but I was not able to do it.

I tried using Devel with kint(), but no debugging information is shown on my screen.

How can I add a template suggestion for a vocabulary?


texts:
When I go to admin/content I'm getting the following error, whereas at the same time node/{node_id} is accessible just fine.

  The website encountered an unexpected error. Please try again later.
      Recoverable fatal error: Argument 1 passed to Drupal\views\Plugin\views\field\EntityOperations::getEntityTranslation()
  must implement interface Drupal\Core\Entity\EntityInterface, null
  given, called in
  /var/www-drupal/core/modules/views/src/Plugin/views/field/EntityOperations.php on line 116 and defined in
  Drupal\views\Plugin\views\field\EntityOperations->getEntityTranslation()
  (line 74 of
  core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).

Can someone give me an insight what this error means and how I to solve it?


texts: how to have a different page from the front page?

texts:
In my site, all my pages are the same as the front page. For example, I have our team block and price table on the front page, but I also see them in blog posts or article pages.

Why is this happening? How do I have a different page from the front page?


texts:
I have a Windows 7 computer running MAMP and it works fine, although still a little slow. I have been working on a Druapl site for a few months now and normal page load times are around 3 seconds. I also work from a macbook from time to time. I am used to transferring the database and all the files needed to make my Drupal site operate from one setup to another. My Macbook used to work properly but now its slow as all hell. I'm getting 10-15 second load times for every page.

Recap: Using MAMP on both machines, one is running Mac OSX Yosemite, and the other is Windows 7.

Windows page load time is 3 seconds. Not bad, but not great.
Mac page load time is 10 - 15 seconds. Horrible.

I have to use my macbook as it is portable and can be used for my upcoming presentation. It used to work fine but is now ridiculous to work with. I'm sure there could be more optimization and tweaks done to my drupal installation to make it faster, but that can't be the problem with my mac's load times.

Edit:

So I got my site to perform better yesterday. The steps made no sense and it obviously didnt fix the issue because starting work today,  the server was hanging on all page loads again. I increased my max memory usage in my php.ini, and now its back to normal page load times. I still dont trust it though and will keep updating this question if anything further happens. Thanks All!


texts: Content tab takes a very long time to load

texts:
I have about 350 000 records in node table and about 600 000 in node_access and domain_access tables.

When I try to open content tab it takes about a minute to load.

As I found out with Devel module this query takes about 32 seconds to execute:

SELECT DISTINCT node.nid          AS nid,
                node.title        AS node_title,
                node.language     AS node_language,
                history.timestamp AS history_timestamp,
                node.created      AS node_created,
                node.changed      AS node_changed,
                node.type         AS node_type,
                users_node.name   AS users_node_name,
                users_node.uid    AS users_node_uid,
                node.status       AS node_status
FROM node node
         LEFT JOIN users users_node ON node.uid = users_node.uid
         LEFT JOIN taxonomy_index taxonomy_index ON node.nid = taxonomy_index.nid
         LEFT JOIN taxonomy_term_data taxonomy_term_data_node ON taxonomy_index.tid = taxonomy_term_data_node.tid
         LEFT JOIN history history ON node.nid = history.nid AND history.uid = :views_join_condition_
ORDER BY node_changed DESC
LIMIT 50 OFFSET 0

And this one takes 20 seconds:

SELECT COUNT(*) AS expression
FROM (SELECT DISTINCT node.nid          AS nid,
                      node.title        AS node_title,
                      node.language     AS node_language,
                      history.timestamp AS history_timestamp,
                      node.created      AS node_created,
                      node.changed      AS node_changed,
                      node.type         AS node_type,
                      users_node.name   AS users_node_name,
                      users_node.uid    AS users_node_uid,
                      node.status       AS node_status,
                      1                 AS expression
      FROM node node
               LEFT JOIN users users_node ON node.uid = users_node.uid
               LEFT JOIN taxonomy_index taxonomy_index ON node.nid = taxonomy_index.nid
               LEFT JOIN taxonomy_term_data taxonomy_term_data_node ON taxonomy_index.tid = taxonomy_term_data_node.tid
               LEFT JOIN history history ON node.nid = history.nid AND history.uid = :views_join_condition_1) subquery

I tested the first query and found out that the ORDER_BY causes the slowness.

Is there any way to make it fast?


texts: How to get the deepest route in taxonomy breadcrumb

texts:
I'm using Hierarchical select to save my nodes in a term and that term's ancestors.And I'm using taxonomy breadcrumb to display my node's breadcrumb.however I would like to display the deepest Breadcrumb for the node but it only displays the root term.e.g:
I have the following vocabulary structure:

parent1
--term1
--term2

and I have a node called node1 with term1 reference field.and hierarchical select also adds it to parent1.

Currently in the breadcrumbs what i get is : parent1 >> node1
what I want to get is : parent1 >> term1 >> node1


texts: How do I properly detect if region is empty?

texts:
I have condition for printing regions in my page template as is not empty, but it will always print empty regions no matter what. What is the proper way to detect empty regions?

For example, {% if page.local_tasks is not empty %}{{ page.local_tasks }}{% endif %} prints out

.

If I render the region in themename_preprocess_page() with var_dump(drupal_render($variables['page']['highlighted'])); I will get SafeString with placeholder token:

<drupal-render-placeholder callback="Drupal\Core\Render\Element\StatusMessages::renderMessages" arguments="0" token="a8c34b5e"></drupal-render-placeholder>

So, technically the region is not empty but I can do nothing about it.


texts: Serve Anonymous Pages when users are logged in for some pages

texts:
so essentially I have a Drupal website with great performance for anonymous users and terrible performance for logged in users.

What I am looking for is a way to serve some pages that logged in users access as if they were an anonymous user.

In custom development this would be done using a:

cache-control:public

header for varnish, but obviously when viewing that page anything such as the users profile information and the login status must not be shown so its not cached in varnish.

I was hoping there would be a config change or module that could perform this without having to write a custom module,

any ideas would be greatly appreciated


texts:
I am using Drupal 7 and i have the following problem:
I have

The content type: issue,

Two views (which select nodes from the content type issue) with each view appearing from a different menu link

Two menu blocks, each one of them appearing based on the view i have selected from the corresponding menu link

I want the titles of my view nodes to be links to the content of type issue. I want, by clicking on this title, one menu block (from the  previous two) to be appearing based on the view I have clicked the title.
I can't solve this problem with two different aliases. Any ideas??
Examples:
Here is the first case:
I have a view which lists Issues nodes and the activity block is appearing on the left. By clicking on the titles, i go one more level inside and i have this result:
Now, another view which lists the same Issues nodes,as above, exists in my site in a different point:. With this view, the resources menu block is appearing on the left. By clicking the titles from this view, i want to go one more level inside (as above) and display the resources menu block and not the activity menu block, as in the first case.

Following the instructions with Contextual Filters as follows, I have the following results:By clicking on a title from the first view :
and by clicking on a title from the second view:
As we can see, although the appropriate blocks appearing in each case, but i don't see the original content that includes each view node.
I thought that having two different url aliases for each view node the problem could be solved. But this couldn't be a solution, sine by testing this case if i click the title from any view, only the resources block is appearing. Apart from this, i want the URL aliases to be defined automatically and Pathauto module doesn't allow this functionality: for a content type to define two different patterns
Any other ideas please???


texts: Programmatically get the current url of the page from where a Webform in a dialog has been loaded

texts:
The below link will open the webform (contact) in a dialog:

Contact

this same link has been placed on many pages in my Drupal 8 website.

After the Webform is submitted, I want to know the url of the page from where the Webform has been loaded.

So say the above link is placed on the page of url: /my-hobbies, when a user will load the Webform from this page and submit it, I want to Programmatically know that the webform has been submitted from this url: /my-hobbies

In a CustomHandler, I have tried:

$current_path = \Drupal::service('path.current')->getPath();
\Drupal::messenger()->addMessage(t("This webform has been loaded from this url: $current_path"));

but the above code returned the path of the webform itself.

is this even possible in php ?

UPDATE #1:

The main idea behind knowing the current url of the page is because after the webform is submitted, i want to refresh the page from where the Webform is loaded and I am doing the refresh by redirecting the user to the same page url.

I am using below code to automatically close the Webform and redirect the user:

// Redirect the user using "Ajax Response".
// @See: https://www.drupal.org/project/webform/issues/3002966
    $response = new \Drupal\Core\Ajax\AjaxResponse();
    $response->addCommand(new \Drupal\Core\Ajax\RedirectCommand('/home'));
    $form_state->setResponse($response);


texts: Sorting entities in a view by a field in a 'sibling' entity

texts:
At its most general, my question is how you can sort entities in a view by a field in a related entity. This is best illustrated with a lengthy example which is more specific, though still quite abstract. It describes sorting by 'sibling' or 'child' entities (depending on what you count the view as showing).

Suppose that you have entities in the following structure:

Entity A1 (of entity type A*) related to (colloquially, a 'child' of) entity U1 (of type U*)
Entity B1 (or type B*) is also a child of the same entity U1

Here is my particular example:

User P has 2 profile2 profiles, A and B

Now suppose you have a view of entities of type U* (in my example, a view of users) - i.e. when first creating the view, you chose U* (here, users) from the 'Show' menu. You've added relationships to A* and B* in this view, and made it show the name field of U* (here, 'User: name') and the fields of A*, filtered by a field in A*. Given our specific entities, the view would show:

U1
A1 field 1
A1 field 2

This means that though this is a view of U* entities in the 'i.e.' sense above, it could also be called a view of A* entities in the sense that if you'd added B* fields they'd show under a duplicate of the U* name. Given our specific entities, the view would show:

U1
A1 field 1
A1 field 2

U1
B1 field 1
B1 field 2

This makes my example either about 'child' or 'sibling' entities.

Sorting the view by a field of B* (e.g. B* field 1) doesn't work. Applied to this abstract example, my question is how to make it work.

As requested in comments, here is the SQL query and results for an instance of this example. The SQL:

SELECT users.name AS users_name, users.uid AS uid, profile_users.pid AS profile_users_pid, profile_users__field_data_field_weighting.field_weighting_value AS profile_users__field_data_field_weighting_field_weighting_va, 'profile2' AS field_data_field_do_you_plan_to_donate_a_ce_profile2_entity_, 'profile2' AS field_data_field_if_so_to_which_causes__profile2_entity_type, 'profile2' AS field_data_field_if_so_until_when__profile2_entity_type, 'profile2' AS field_data_field_would_you_like_to_give_any_profile2_entity_
FROM
{users} users
LEFT JOIN {profile} profile_users ON users.uid = profile_users.uid
LEFT JOIN {field_data_field_do_you_plan_to_donate_a_ce} profile_users__field_data_field_do_you_plan_to_donate_a_ce ON profile_users.pid = profile_users__field_data_field_do_you_plan_to_donate_a_ce.entity_id AND (profile_users__field_data_field_do_you_plan_to_donate_a_ce.entity_type = 'profile2' AND profile_users__field_data_field_do_you_plan_to_donate_a_ce.deleted = '0')
LEFT JOIN {field_data_field_weighting} profile_users__field_data_field_weighting ON profile_users.pid = profile_users__field_data_field_weighting.entity_id AND (profile_users__field_data_field_weighting.entity_type = 'profile2' AND profile_users__field_data_field_weighting.deleted = '0')
WHERE (( (profile_users__field_data_field_do_you_plan_to_donate_a_ce.field_do_you_plan_to_donate_a_ce_value IS NOT NULL ) ))
ORDER BY profile_users__field_data_field_weighting_field_weighting_va ASC

The results:

Tom Ash
Do you plan to donate a certain amount either until you retire or until you die?:
Everything over £14,000 (~$22,000), and at least 10% of income
Weighting:
NO RESULT, BECAUSE SHOWING DIFFERENT

Tom Ash
NO RESULT, BECAUSE SHOWING DIFFERENT PROFILE
Weighting:
432

My research so far (~3 hours): Googling; looking through dozens of StackExchange answers; searching the Views issue queue; as had no responses here yet, added a support request in the Views issue queue.


texts: Is there any built in function to render image file extension like jpg, png etc?

texts:
Is there any built in function in Drupal 7 to render image file extension like jpg, png etc on node load.

I have tried image_get_info etc.


texts:
It is the t() function and the way I assigned value to a body field

$my_body_content = t('!frequency new comment(s) sent to !title', array('!frequency ' => $frequency , '!url ' => $url , '!title ' => $title));
$ewrapper->field_body->set(array(
        'value' => $my_body_content
) );

the $frequency, $title and $url are already set. This is the configuration of the body field (it allows a tag)

But it is what I get

Why it doesn't render the HTML ?

UPDATE :

I edited the body by UI like this

and it worked! sounds the problem is because of the PHP code


texts: Commerce / State Machine: Custom workflow orders stay as carts forever

texts:
I'm trying to set up a custom workflow in Commerce. When I check out, the order is marked as "paid", but it remains a cart (it's shown under "Carts" not "Orders") even though it has been paid. What am I doing wrong?
In MYMODULE.workflows.yml:
mymodule_subscription:
  id: order_mything
  group: mymodule_order
  label: 'Subscriptions'
  states:
    draft:
      label: Draft
    completed:
      label: Completed
    canceled:
      label: Canceled
    refunded:
      label: Refunded
  transitions:
    place:
      label: 'Pay for order'
      from: [draft]
      to: completed
    cancel:
      label: 'Cancel order'
      from: [draft]
      to:   canceled
    refund:
      label: 'Refund order'
      from: [draft, canceled]
      to: refunded

When I change the Workflow to Default on the Order Types page (admin/commerce/config/order-types/default/edit), upon making a payment, the cart successfully becomes an order.
For the payment method, I'm using Commerce Stripe.
After more debugging, I found the problem.
When I have the group as mymodule_order, it doesn't work.  If I change the group to commerce_order, it works.  So do all custom workflows have to have the commerce_order group?


texts: Is there any way to force blocks created by views to display even when there is no result?

texts: I have similar question with "Display a block even if it is empty" about blocks generated with views 3.5.


texts: update node field without node be updated

texts:
I want to update a field of node programmically,I did it with below code

$node = node_load($nid);
        $node->field_share_counter['und'][0]['value'] = intval($node->field_share_counter['und'][0]['value']) + 1;
        node_save($node);

but after update with this method the node will be update,I mean in content show that this node recently update, I want update custom field without the node updated.also I know db_update is suitable for update a field of table in db but in here I dont know how achieve this job.

tnx


texts:
I am using the Organic Groups module. When I create a new group, and check off the "Private group" checkbox, the group will be private; so I am expecting that every comment will not be visible in Recent comment block.

Is it possible to ignore comments made inside a private group?


texts: How to turned off the translation on the node reference with entity translation?

texts:
I have a multilingual site and I am using the feed module to import content. My site has two languages:

English and Arabic.

During import the node from excel value all the fields value save except node reference field value in Arabic language.

Previously i am having same issue for term reference. But it is solved by disabling Select taxonomy terms by language on  "admin/config/regional/i18n/select". But Node reference issue still there is there any settings present for this.


texts: Drupal 7, show drupal blocks only on specific pages with PHP code?

texts:
I were working on drupal 7. In block configuration, under pages i went for an option
"Pages on which this PHP code returns TRUE (experts only)"

Added the following code:

<?php
global $user;
$username=$user->name;
if($username=="admin")
{
   return TRUE;
}
else
{
  return FALSE;
}
?>

It's shows me an error message at the top of the screen:

  Notice: Undefined property: stdClass::$name in eval() (line 3  of C:\xampp\drupal77\modules\php\php.module(75) : eval()'d code).

I don't know, how to fix it out. Please help me out.Thanks


texts: Displaying view as row-based table, not as grid

texts:
Currently I have my view style set to grid (row style); but they're not displayed too nicely. Is there anyway I could modify the views grid php file so that I can have them displayed as a real table? If you set the view to table, you get all your fields as columns. I want to have something like

Feature A          x
Feature B          y

etc. so that they display nicely in a table view in iOS.


texts: How I can pre-populate a webform field with the node title and node link?

texts:
In some page I have inserted a link "Contact me for info" that links to a webform page.
I would that some fields of the webform form are be pre-populated with the node title and node link from the previous page.
How I do it?


texts: "created date" issue with multiple languages

texts:
I am working on a site with 3 languages: English, Finnish, and Swedish. The default language is Finnish; the site is using English and Swedish translations.
I sent a request to Drupal with Postman trying to create an article but only the default language (Finnish in this case) works correctly. With the other ones, the creation date is overridden by the current date and time. This happens even when I switch the default language to another one of the languages, and the other two will have a wrong creation date / publication date.
How can I fix this?


texts: How to get total of a field for all the nodes?

texts: I've payment content type. One of the fields of this content-type is Amount. In a view (page display: table format) I'm listing all the payment nodes (subjected to some filtering). In the same view I want to calculate the total amount amount of all these filtered nodes & display. How?


texts:
I'm trying to figure out how to trigger an element with a link in a form using trigger_as.

I tried the following snippet. The button ajax callback works, but the link doesn't. The link does seem to use the right name and value in trigger_as (as seen in the js console), but the post callback doesn't return anything.

$form['add_more'] = array(
  '#type' => 'submit',
  '#value' => t('Add another item'),
  '#attributes' => array('class' => array('add-more-submit')),
  '#submit' => array('field_add_more_submit'),
  '#name' => 'result_fields_add_more',
  '#ajax' => array(
    'callback' => '__update_fields',
    'wrapper' => 'example-wrapper',
    'effect' => 'fade',
  ),
);

$form['add_more_link'] = array(
  '#type' => 'link',
  '#title' => t('add'),
  '#href' => '#',
  '#process' => array('ajax_process_form'),
  '#ajax' => array(
    'callback' => '_update_fields',
    'wrapper' => 'example-wrapper',
    'effect' => 'fade',
    'event' => 'click',
    'trigger_as' => array(
      'name' => 'result_fields_add_more',
      'value' => t('Add another item'),
    ),
  ),
);

I tried to follow this example, but didn't work: http://drupal.org/node/753270#comment-2910362
I also didn't find an ajax link in the rules module, only a button with an ajax callback.
I thought I followed the documentation correctly: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#ajax_trigger_as

EDIT: One fix is to trigger the submit event through javascript code, but I was really hoping the form api would be able to handle this itself: https://drupal.stackexchange.com/a/34375


texts: How to define CSS for Custom Display Suite Layout

texts:
I have added a custom layout for Display Suite on Drupal 8. Everything is working except the CSS for the custom layout is not working.

This is my layout in my theme folder:

mytheme.layouts.yml

ds_3col_guide:
  label: Guide - Three column stacked
  category: Display Suite
  class: '\Drupal\ds\Plugin\DsLayout'
  type: partial
  template: templates/ds/ds-3col-guide
  library: ds/ds_3col_guide
  icon: templates/ds/ds-3col-guide.png
  regions:
    header:
      label: Header
    left:
      label: Left
    middle:
      label: Middle
    right:
      label: Right
    footer:
      label: Footer

The CSS for this is located here: templates/ds/ds-3col-guide.css

Do I add the CSS reference to mytheme.layouts.yml or to mytheme.libraries.yml?
Would this be the right way to add it?

css:
  theme:
    templates/ds/ds-3col-guide.css: {}

Thank you for taking the time to read this.


texts: How can I generate thumbnails for PDF files?

texts:
I am working on this website which has a documents gallery that will be updated periodically. One of the core requirements is to generate a thumbnail from the uploaded PDF file(First Page of the PDF file) and to be displayed in the documents gallery page(Implemented with views). I have installed Imagemagick on my test server and configured it in PHP.ini and also installed the drupal module successfully. But I have not been able to go beyond that because of the following:

I can't upload a pdf to an image field so there is no way of applying an image style to the uploaded pdf
I can't find any Drupal 8 Module that can generate the thumbnail and attach it to an image field in the content type.
I tried installing spatie/pdf-to-image, which is supposed to be able to do that, via composer but it doesn't show in the admin/modules page and I can't find any folder with it's name in the modules directory

Please can anyone point me in the right direction on this? A module which can perform this task or how I can create one myself. This is my first drupal website and this requirement has made life hell for me in the past two weeks. Any help on this will be really appreciated.


texts: Create new content node upon user creation with populated fields from user profile fields d7

texts:
why is it that ordinary tokens appear in fields where use is made of the "token field" and "field default token" modules?

I created a rule which creates a node with the username in the user creation form. I need to have fields in this new node to be populated by custom fields in the user creation form using tokens.

ordinary tokens work fine, tokens from custom fields either turn out as blank for the "field default token" module or as the token name in "token field" module.

Am I missing something?

More Information as requested in the comments:

I have custom fields on the standard user profile. When a user account is created, a content node is created, using the "rules" module. That node's name is pulled off the user profile using the "token" module, the token being for one of the custom fields. This works 100%. Now I want to do the same for two fields in the new content node, i.e. pulling content from the user profile's custom node's and placing them into the content node. This can be done with "field default token" or "token field". For some reason only standard drupal tokens work, tokens for custom fields don't, as described.


texts: Same module with different versions in several places

texts:
This the directory structure of my drupal 8 installation:

├── composer.json
├── composer.lock
├── drush
├── LICENSE
├── load.environment.php
├── phpunit.xml.dist
├── README.md
├── scripts
├── vendor
└── web
    ├── autoload.php
    ├── core
    ├── index.php
    ├── modules
    │   └── custom
    │       └── xyz (version 1.0)
    ├── profiles
    │   └── custom
    │       └── qwer
    │           └── modules
    │               └── custom
    │                   └── xyz (version 1.1)
    ├── robots.txt
    ├── sites
    │   └── example.com
    │       └── modules
    │           └── custom
    │               └── xyz (version 1.2)
    ├── themes
    ├── update.php
    └── web.config

Which version of xyz module "win" in this structure ? For example:
- A site installed with qwer profile (sites/example.com).
- A site installed without qwer profile  (sites/example.com).
- Another option ?

I would like to know the preference that Drupal has when it have the same module with different versions in several places


texts: View of related nodes by continent or country without taxonomy terms

texts:
I have a content type called Packages.Each content has two fields:
Title and Continent(this field was created using the module Countries).

I have created five contents of content type Package:
Title        Continent

 London      Europe

 Madrid      Europe

 Paris       Europe

 Brussels    Europe

 Tokyo       Asia

I want to make a block of related nodes by the continent.

For example: if I am viewing the node of London in the block of related nodes show the cities on the same continent in this case: Paris, Madrid and Brussels.

I want to do this without terms of taxonomy, otherwise I'll have to create a vocabulary with more than one hundred fifty terms.


texts:
I have a submission handler for my custom form that doesn't work. I tried many solutions, but nothing works.

My_Custom.module

 [...]
function tournament_menu() {
    $items['tournament/newteam'] = array(
        'title' => 'Créer une nouvelle équipe',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('form_newteam'),
        'access callback' => TRUE,
        'file' => 'form_tournament.inc',
    );
}
 [...]

form_tournament.inc

function form_newteam ($form, &$form_state) {

 [...]
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Créer',
    );
    $form['actions']['submit']['#submit'][] = 'form_newteam_submit';

    return $form;
}

function form_newteam_validate($form, &$form_state) {
    //Validation logic
}

function form_newteam_submit($form, &$form_state) {

    drupal_set_message("Bla bla submit !");

}

My validation function works.

I try all this code In form_newteam() function.

$form['actions']['submit']['#submit'][] = 'form_newteam_submit';
$form['#submit'][] = 'form_newteam_submit';
$form['#submit'] = array('form_newteam_submit');
$form['submit'] = array(
 '#type' => 'submit',
 '#value' => 'Créer',
 '#submit' => array('form_newteam_submit'),
);

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'Créer',
  '#submit' => 'form_newteam_submit',
);


texts:
It seems simple enough to create a form in Drupal 7 with the Form API, however, everything I find shows that you have to use hook_menu() to add a page and then generate the form that way.

I would like to create a standalone form, then just display the form using drupal_get_form() and drupal_render() to render the form.

How do I create a custom form without creating it's own page?


texts: Changing a node field without going to the admin section?

texts:
I have a page listing articles (in teaser view mode), one of the fields of the article is a taxonomy term reference.

Is there a method allowing users to change this field and save the new article with this new taxonomy term chosen by the user (without going back to the admin section, just in the teaser view mode)?

Thanks in advance


texts: How to hide some fields from user in add content page?

texts:
I have a content type with some fields created using cck module in Drupal 6 . I want user just fill in some of them in create content page and doesn't see others which will fill later by admin.

How can I do it in drupal 6 ? Is it possible ?


texts:
I am using the bootstrap theme together with panels_bootstrap_layouts.
The bootstrap layouts option does show up and I can successfully add my content (2 views) to my panel with boostrap layout (2 colums stacked): one view in the left column and one view in the right column.

My problem is that when I save and view the page, the views are displayed one on top and one on the bottom but never left and right as they are suppose to be even when the browser is at full screen size. The theme seems to correctly be informed of the viewport size because when I resize the browser window to smaller width, then the main menu changes aspect as it is supposed to for smaller screens. My panel however does not change aspect, my views are always top/bottom and never change to left/right.

Is there a setting somewhere I should change in order for panels_bootstrap_layouts to correctly follow the fluid design and rearrange panels according to viewport width?


texts: Use text field as contextual filter in views? Or related content not based on taxonomy

texts:
I'm trying to figure out if it would be possible to use text field as contextual filter in views?

Say I want to have EVA or block that takes certain Field-A from current node as filter. Then EVA or block shows other content type that has the same Field-A text.

Sort of related content but not based on taxonomy.


texts: Auto import Facebook page photos as nodes for views display

texts:
I have some experience using feeds and views, and I've looked at a few modules designed to integrate Drupal with Facebook. But I'm unable to figure out how to set up an importer to automatically pull Facebook photos from a page and turn them into nodes. I'd also like to map three fields for views display: image, description and FB album title to Drupal taxonomy term.

Suggestions on how best to approach this?


texts:
I have a content type where we reference Taxonomy terms in one of the fields. When the field was created it was set up to Unlimited entries for that field.

The issue is that we need to change this field from Unlimted to Limited to 1.

There are a few nodes where more than one term was referenced. Which means that we can no longer change this fields storage settings until the nodes that have more than one record are changed to 1 term only.

My questions is how to set up a view that will show only nodes that have two or more terms referenced.

Error:
There is data for this field in the database. The field settings can no longer be changed.

What needs to be changed:
There are 65 entities with 2 or more values in this field.

Solution:
If we can change those 65 entries, I know we will be able to limit this filed to 1 term.

How?
The question is how do we find those nodes? I can't set up a view that will exclude nodes with 1 taxonomy term but show all with 2 or more.


texts: Template suggestion does not work for table in a custom block / Might there be a way around?

texts:
I created a block on pages of the "Author" content type that lists all the articles the author has contributed to in a table (via contextual filter). Now I want to customize the table layout. I already did this before in a similar case, where I show the table on a page, not in a block. There I get file name suggestions for the template inside HTML comments like that:
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table__articles' -->
<!-- FILE NAME SUGGESTIONS:
   x views-view-table--articles.html.twig
   x views-view-table--articles.html.twig
   * views-view-table.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/MYTHEMEFOLDER/templates/views/views-view-table--articles.html.twig' -->

But in my latest case, the table in a block, I only get this suggestion:
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table' -->
<!-- BEGIN OUTPUT from 'themes/MYPARENTTHEMEFOLDER/templates/views/views-view-table.html.twig' -->

Note that it outputs the template of my parent theme, not my actual theme.
I did some research and found this issue, which currently is not resolved and the proposed patch not included inside the Drupal code. Is this the reason I cannot create a custom template or is there something else I can do?
If not, how would I create that table of referenced articles on the author's page?


texts:
As a module maintainer, I want to add a dependency to one of my existing modules, so that my entity can use a field type plugin declared by the dependency.

What steps do I need to take to make sure that:

entup doesn't WSOD because my new field depends on a non-existent module.
Drupal end-users get prompted to download and install the new dependency.

I did find another similar issue -- What is the protocol for adding a new module dependency to a module that has only had a dev release? -- which deals with Drupal 7. This will help address question #2, but doesn't speak to the added complexity of entup.

I also found an issue dealing with deployments via drush -- Enable new modules dependencies on deploy -- but this doesn't address my questions either.

Any other tips or advice?


texts: How do i run the equivalent of single configuration import from a hook?

texts:
I have a hook_update_N that is changing a field.  It is deleting the field and recreating it with the same name but a different field, formatter, and widget.

The problem I'm having is that there is a view that is using my field and when I delete my field the view is being deleted and my site then throws an error.

I have the views.view.view_name.yml file saved in a directory.  Is there a function or set of  functions that will import the view from that file?


texts: Email body encoding problem with Cyrillic letters

texts:
All emails sent from a website are received as unreadable characters in body.
The email title is displayed properly though.

The site is only in Russian language. This happens on a clean install as well.

Here are the headers just in case:

MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Drupal Webform (PHP/5.2.17)

This happens no matter the email provider (Gmail, Yahoo etc.).

Which settings should be changed so the emails are sent properly?

Thanks


texts: I want to display the all true/false questions in same page using quiz module. Is it possible?

texts: I have installed drupal 7 quiz module in my project.I want to display the all true/false questions in same page. Is it possible?


texts:
Using Drupal 8, I am trying to create a view plugin to add a relationship to an existing view.
I'm basing the code off of this example https://www.foreach.be/blog/how-build-complex-filters-drupal-8 since I haven't found an explanation of how to add a relationship in D8.

I don't have any error messages but I'm not sure what I need to do to get this working.

I have a class file for the plugin at module_name/src/Plugin/views/relationship/CustomRelationship.php

// CustomRelationship.php

<?php

namespace Drupal\custom_module\Plugin\views\relationship;

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Add custom view relationship
 *
 * @ingroup views_relationship_handlers
 *
 * @ViewsRelationship("custom_relationship")
 */

class CustomRelationship extends RelationshipPluginBase {

  /**
   * Relationship plugin.
   *
   *
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->valueTitle = t('Node Revision');
  }

  public function query() {

    $configuration = array(
      'table' => 'node_revision',
      'field' => 'nid',
      'left_table' => 'node_field_revision',
      'left_field' => 'nid',
      );

    $join = Views::pluginManager('join')->createInstance('standard', $configuration);
    $this->query->addRelationship('node_revision', $join, 'node_field_revision');

  }

}

And in the main module folder there is a views.inc file

// custom_module.views.inc

<?php
/**
 * Implements hook_views_data_alter().
 */
function custom_module_views_data_alter(&$data) {
  $data['custom_module']['custom_relationship'] = array(
    'title' => t('Node Revision'),
    'help' => t('Provide node revision relationship.'),
    'relationship' => array(
      // ID of relationship handler plugin to use.
      'id' => 'custom_relationship',
    ),
  );
}


texts: Performing an HTML substitution from AjaxResponse rather than using a wrapper

texts:
I have an autocomplete textfield whose autocomplete_route_parameters is updated on the onChange event of a textfield, which is filled by a jQuery UI datepicker. Everything works, but after the update of the list the datepicker, which was closed after the selection of the date, shows up again. So I thought, well, I'll just use jquery to close it again.

This means that the ajax callback cannot simply return a renderable array, but rather an AjaxResponse; the problem is that I don't understand how to use a form element inside a ReplaceCommand. If before the change I had

function seduta_senato_form_datetime_changed(array &$form, FormStateInterface $form_state) {
  return $form['struttura-input'] ;
}

now I should say something along the lines of

function seduta_senato_form_datetime_changed(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse() ;
  $response
  ->addCommand(new ReplaceCommand('#ajax-wrapper', "
" . $form['struttura-input']->??? . '
'))
  return $response ;
}

but the form element has to be rendered somehow, otherwise it will simply appear in the HTML as Array.

I thought this would be simple, since for sure the functionality that renders the changed element is already there, but the research I made gave me only rather intricate solutions. Any help or hint would be greatly appreciated!


texts: How to avoid submitting a form when creating a new content, depending on some criteria?

texts:
Let's suppose I have a content type Person, and I don't want the field Name to contain the text AAA.

What would be the best way of avoid submitting the form if that happens?

For example:
- Hiding the Save button
- Submitting it, but return to the same page with that field marked as red, or just show a message...

This is just an example. I'm asking it because sometimes I need to do a query to the database and see if some records exist, or something like that...

Edit:
I have edited the template.php file under the theme folder I'm using, and I have added the functions:

theme_theme()
theme_formId($form)

In the 2nd function, I've modified the form to see Drupal is calling this function, and yes, it works...

Then I did the following in the 2nd function:

$form['#validate'] = array('my_validate_function');

and under my_validate_function($form, &$form_state) I just wrote form_set_error('', t('Testing...')); and nothing seems to be happening: I can still create a new content without problems :(

What am I missing here?


texts: Prevent Redis Cache from clearing ALL keys

texts:
We are using the Redis module and Redis Database as cache with the following setup:

$conf['redis_client_interface'] = 'PhpRedis';
$conf['redis_client_host']      = 'redis.internal';
$conf['lock_inc']               = 'sites/all/modules/contrib/redis/redis.lock.inc';
$conf['cache_backends'][]       = 'sites/all/modules/contrib/redis/redis.autoload.inc';
$conf['cache_default_class']    = 'Redis_Cache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

Also we have our custom module that writes some keys to the database as well.

The problem is that periodically entire redis cache is cleared out ( flushed ) together with our custom keys...

How do we prevent that ?

Can Redis Cache just handle its own keys ?


texts: Create a view in D7 that displays and links the taxanomy term and displays and links nodes associated with the term

texts:
I'm trying to build out a HTML list menu of taxonomy term followed by nodes associated to that term as a sub HTML list. All items should be linked as well. Can this be done?

Example below:

Taxonomy Term 1

Associated Node 1
Associated Node 2
Associated Node 3

Taxonomy Term 2

Associated Node 4
Associated Node 5
Associated Node 6
Associated Node 7
Associated Node 8
Associated Node 9

Taxonomy Term 3

Associated Node 10
Associated Node 11

Taxonomy Term 4


texts: How to login into Drupal using Google Apps username and password?

texts:
We are looking for a way using which users can login into Drupal site using their Google Apps account user name and password. We use 'Google Apps for Education' and we do not want maintain separate username and password for our Drupal site.

We would also like to limit access to certain users having Google Apps accounts. Something like filtering or pre-approved account list. And, users' account should be created automatically when they login for the first time, and they should not need to fill any additional account information in Drupal, it should be directly pulled from Google Apps account.

Is there any module for Drupal 7 that provides this functionality? I have already tried OAuth, Loginza.ru, OpenID etc. like approaches and these are not what we are looking for.

If there is no such module, how shall I proceed with writing a custom module for the same?


texts: Add a prefix to a views field pre_render

texts:
Our Drupal distribution is to be used with different currencies defined by a custom variable...when we display nodes in a view with the price field we don't add the currency prefix...i want to add it through im guessing hook_views_pre_render? How can i inject a prefix using my custom variable?

This is what i am thinking:

if (in_array($view->name, $views_with_prices)) {
//dsm($view->result);
foreach ($view->result as $activity) {
  //dsm($activity);
  $price = $activity->_field_data['nid']['entity']->field_average_price['und'][0]['value'];
  if ($price != 0) {
    $activity->_field_data['nid']['entity']->field_average_price['und'][0]['value'] = variable_get('my_currency') .  $activity->_field_data['nid']['entity']->field_average_price['und'][0]['value'];
  }
}
}

but ideally i'd like to use a specific prefix functionality that comes with cck fields if possible or views equivalent.


texts: Permission base on the administration menu?

texts:
I have used hook_permission to limit user for some places and to created a permission rule. However, I have not combine two permission from another modules for my custom module.

I'm working on a module that would allow user to used the Administration Menu when user are on a Desktop and used the  Mobile Friendly Navigation Toolbar when the user is on a mobile.

I'm using the hook_page_build to hide the css from mobile or desktop display.

So now I'm trying to limited the hook_page_build to user that only have access to the Administration Menu and the Mobile Friendly Navigation Toolbar.

To be more specific here is the permission that I want user to have enable before this module is been load.

Access administration menu

And the another permission that user need to have is  Use the administration navbar.

Once these two permission have been granted the my custom module is going to be able load. How can I do this ?


texts:
Trying to create a node page through web-service.But returns 415 Unsupported media type

This is how I have done


texts: how to group users with similar role with organic group?

texts: I am working on a site where I want to group all the users having content editor roles to content editor group and all the users having content creator roles to content creator group.How do i do that with organic group ?thanks in advance :-)


texts:
I am putting together a complex Drupal user driven website. One thing I need to accomplish early on is to put users into groups as they register.

Can anyone tell me how I can get them to register particular details which they will not be able to amend in the future? Such data as the users gender etc....?

Thanks.


texts:
I have an image style which has Desaturate and Scale & Crop turned on.

I call it using this:

<a href="<?php print image_style_url('gallery_full', $image['uri']); ?>"><img src="<?php print image_style_url('gallery_thumb_grey', $image['uri']); ?>" />

It outputs the image resized but doesn't desaturate it. There are no errors.

Any ideas?


texts: How to send a mail to a user with views rules when a date is passed?

texts:
I have created a date field for all users (in Drupal 7). This date is the end of the user's subscription. When the date of this field is passed, I want to send a mail to the user to tell him he can subscribe again (to access our website).

So, I have created a view with a display rules (with module views rules). I have listed all users who have the field date not empty and filter to have only date passed. I have 2 fields in this view (user name and date). I have edited field info and enable my 2 fields (Data type : user and data type : date) :

After, I have created a rule wich react on the event "Cron maintenance tasks are performed" and created a view loop on the display rules of my view. In the loop i have added 2 actions : change the date value to exit the user from the view, and send a mail to this user :

When I Launch the cron, nothing happen. The date is not changed, and the mail is not send. I don't know what configuration I have forgot. Do you have an idea please ?

Thank you for help me.

My rule in export format:

{ "rules_relance_e_mail" : {
"LABEL" : "Relance e-mail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "cron" : [] },
"DO" : [
  { "VIEW LOOP" : {
      "VIEW" : "dates_de_relances",
      "DISPLAY" : "views_rules_1",
      "ROW VARIABLES" : {
        "name" : { "name" : "Nom" },
        "field_date_de_relance" : { "field_date_de_relance" : "Date de relance" }
      },
      "DO" : [
        { "data_set" : { "data" : [ "field-date-de-relance" ], "value" : "+1 year" } },
        { "mail" : {
            "to" : [ "name:mail" ],
            "subject" : "Test relance",
            "message" : "Test mail",
            "language" : [ "name:language" ]
          }
        }
      ]
    }
   }
  ]
 }
}


texts: I have a custom table with pagination. But I would like to get the next page using ajax. I have searched in core but didn't find any direct solution.


texts: Change the way a node is themed based on an argument added to a URL

texts: I am currently trying to eliminate my need for the panels module from a site I am working on and don’t have a lot of PHP experience. How would I go about changing the way a node is displayed based on an argument added to a URL? (E.g. http://example.com/node/123/argument.) I already have the node type themed but I need to display the node in a different form based on the argument. Thanks in advanced for your help.


texts: return other indexed fields using SearchApiQuery($index)

texts:
I created an index that indexes taxonomy terms.
I indexed the term name + field_skill type text.
The current result shows only the term id + score.

I want to show also the field_skill.

 $term = 'drupal';

 // Select an index.
 $index = search_api_index_load("terms");
 $query = new SearchApiQuery($index);

 // Conditions.
 $query->condition('name', $term, '=');
 // $query->condition('language', $language->language, '=');

 // Fetch results.
 $results = $query->execute()['results'];
 dpm($results); // returns only ids and score I want to return other indexed fields


texts: Image widget crop not returning multiple derivatives in JSON API

texts:
I'm using below modules for image crop

https://www.drupal.org/project/image_widget_crop
https://www.drupal.org/project/cloudinary
https://www.drupal.org/project/consumers
https://www.drupal.org/project/consumer_image_styles
https://www.drupal.org/project/jsonapi

Returning data in JSON API.

Using multiple paragraphs for images. I have 1 image as logo & 1 image as content.

For 1 image it's showing correct image width & height, X & Y co-ordinates (derivatives).

But for multiple image it copy same height, width, x, y co-ordinates to other images.

So it's not showing image wise derivatives for multiple images.

Once image is uploaded it saved to cloudinary.

{
"meta": {
"derivatives": {
"box": "http://res.cloudinary.com/XXX/image/upload/s--CJHoE3mM--/c_crop,h_400,w_400,x_29,y_46/test.jpg?itok=4GARJEFS",
"thumbnail": "http://res.cloudinary.com/XXX/image/upload/s--vlxu-1hL--/c_fit,h_100,w_100/test.jpg?itok=hed-1-Mh",
"wide": "http://res.cloudinary.com/XXX/image/upload/s--4-Vk3FhO--/c_crop,h_200,w_356,x_76,y_86/test.jpg?itok=GOzme5ht"
}
}

Does anyone faced this issue?


texts: How to index 'pages' that are views, while using access control to hide component content?

texts: I have a site that relies on some complicated relations to compose views for parameterized site 'pages', but don't want anon users to see the raw unformatted bits that are linked together to form these pages. I use access control to keep those private, and disable query rewriting so the same users can see the views, but this seems to mean anon page searches don't find the pages containing the restricted content, even when I think I'm selecting the page search settings correctly and including the paths to these views. Would really appreciate some suggestions....


texts: how to ad a location(not GPS) to view 'who's online'

texts:
the view 'who's online' Shows the user names of the most recently active users, and the total number of active users. I want to add a location to this view.
Not a geolocation, geocoder but a UNIT of the company

example
Every shift 8 to 10 co workers choose 12 units beforehand. I want to display in which unit my co workers are, when online. The location is not able with GPS, because lack of signal.
I tried to made a contenttype with the 100 units. Every shift co workers have to choose 12 units beforehand.

I'm looking for the best way to add a field_unit to the view 'who's online'.
when using geolocation, geocoder or adressfield is to complicated

co worker has to choose simple 'im here, sector unit 1' 'im here, sector unit 2' 'im here, sector unit 3' ect

The location is not able with GPS, because lack of signal.

What is the most simple solution to display and log this
I looked for modules that schedule, also looked the webform module. But im looking for a more simple solution

When possible I like to add 'previous unit' and 'next unit'.

Is there a module for this? I have looked for schedule modules and tried webform, but was to complex

workflow:
- I create a contenttype UNITS, with 1 text formatted field field_unit
- I create content (every unit is a single content)
- I create a field field_unit

now i can't add the field to the view 'who's online'?

how to solve this


texts: Is it wise to edit the default Google Analytics path exclusions?

texts:
The Google Analytics module has a default configuration under the "Pages" tab: "Add tracking to specific pages". The listed exceptions are:

admin
admin/*
batch
node/add*
node/*/*
user/*/*

I'm using Webform, which generates confirmation pages like node/125/done by default. I could of course create specified paths for each of my webform confirmation pages, but there are many on the site (over 50), so the easier route would just be to remove node/*/* from the GA exclusions.

What repercussions might arise from this?


texts: How to load the current entity object (Profile 2)

texts:
Problem

I'm trying to load the current entity object, in this case a profile2, profile page.

I've been using
Is there a way to load the current entity object?, to try and solve this. Where am I going wrong?

So Far

I have the following code running in a custom form inside a block. The block appears on the profile page.

function mymodule_form() {
    $node = menu_get_object('profile2', 1);
    dpm($node);
}

The path of my page is: localhost/drupal5/profile-main/154

I have two kinds of profile 2, machine names main and school, however the following doesn't work either.

$node = menu_get_object('main', 1);


texts: Custom Field Type is missing in Feeds Importer

texts: I've got a problem with feeds importer. I've created a custom field type, and added a field with this field type to my content. If I try to import data via feeds importer, in mapping, this field is missing. Do I have to tell my custom field type that it is useable within feeds-importer?


texts:
I have a site in Italian and i want to translated it into various languages. My problem is that I put around the net number of links to my site and now if I translate it all the urls will be changed (it will be added /it or / en ... etc.) and not recognized by the various links I've posted.
How can 'solve the matter in your opinion?
Thanks!


texts: Creating node in installation profile but body field stays empty

texts:
I am trying to generate nodes in my installation profile. The weird thing is that everything works except the body. First here is the code I use:

$date = new DateTime();
$node = new stdClass();
$node->type = 'article';
$node->status = 1;
$node->uid = 1;
$node->title = 'Test title';
$node->promote = 1;
$node->created = $date->getTimestamp();
$node->timestamp = $date->getTimestamp();
$node->sticky = 0;
$node->format = 3;
$node->language = LANGUAGE_NONE;
$node->teaser = '';
$node->revision = 0;
node_object_prepare($node);
$node->intro[$node->language][0]['value'] = 'introtext index';
$node->body[$node->language][0] = array(
    'value' => 'Body text test',
    'summary' => '',
    'format' => 'filtered_html',
    'safe_value' => 'Body text test'
);
node_save($node);

The weird thing is.. This code works perfect when I add it in the index.php. But when I add this exact same code in the installation profile everything works except the body(it stays empty).

I tried the next two possibilities see below:

$node->body = 'Body text test'

$node->body[$node->language][0]['value'] = 'Body text test'

I also replaced $node->language for 'und' on all possibilities.

Still I find it weird that my code works in the index.php but not in the installation profile. Does anybody have a clue what I am doing wrong or what needs to change?


texts: About shaping the Drupal "add content" pages

texts:
My question is that do you change the Drupal "add content" pages appearance and fields for your final version of project?

Actually, I really do not know how it is conventionally provided for Drupal customers. If you customize those pages, how do you do it?

Thanks


texts:
The default password encryption in Drupal 6 is MD5. Is it right? I want to change it to something more difficult like crypt and sha1.

Is there any module for this purpose, or do I have to hack the core myself?


texts:
i just recently learned that i must unistall the module before delete it from modules folder ( "I thought that the deleting is the unistall" ), so can you please give a solution to delete the disabled modules from database ?
and is that make a problem?


texts:
I write some PHP code in my views, i.e. in contextual filters and the PHP area of view, but when something goes wrong, it becomes very difficult to find errors as line numbers thrown in error does not holds good.

Which way can I trace it ,or is it not advisable to write PHP code in views directly?


texts: Easier way to get a field's value when given a node object from node_load

texts:
I'm trying to get a CCK text field's value using node_load() - the code goes like $nodeObject->field_name['und']['0']['value'];

Is there a simpler built-in function like get_cck_field_value(node $nodeObject) that I can use, or do I write it myself?


texts:
Is there the ability through contrib module or hooks to modify how the apache solr sort block sorts queries?

Currently, it seems it supports these queries out of the box:

Relevancy
Title
Author
Date

What i would like to have is to remove Author, Add a field to sort title from a-z and z-a. Is that possible?


texts: multisite with shared user, shared session,separate role

texts:
I'm trying to build Drupal multisite with separate DB but shared user, session and separate roles.

I did this in settings.php:

Master/default/parent site:

$databases['default']['default'] = array (
  'database' => 'db_name',
  'username' => 'db_user',
  'password' => 'db_pass',
  'prefix' => 'pre_',
  'host' => '192.168.xxx.yyy',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

child/other sites:

$databases['default']['default'] = array (
  'database' => 'otherdb',
  'username' => 'otherdb_user',
  'password' => 'otherdb_pass',
  'prefix' => array(
    'default'            => 'otherdb.pre_',
    'sessions'           => 'db_name.pre_',
    'users'              => 'db_name.pre_',
/*  'user__roles'        => 'db_name.pre_', */
    'users_data'         => 'db_name.pre_',
    'user__user_picture' => 'db_name.pre_',
    'users_field_data'   => 'db_name.pre_',
  ),
  'host' => '192.168.xxx.yyy',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

i grant db permission for otherdb_user to access below in 'db_name':

'sessions'
'users'
'user__roles'
'users_data'
'user__user_picture'
'users_field_data

the problems:

but seems like the session didn't really work, expectation: login session should maintain across sites

User roles in child site shows empty (but no error) when I assign role A in parent site while in child site the role is not available, my expectation it should get the role 'authenticated user' by default.

Am I missing any configuration?

any advise?
thanks in advance
AnD