texts: Changing page orientation of a pdf of a views generated by the Print module

texts:
The Print module (https://www.drupal.org/project/print) allows users to generate a PDF of nodes, views and panels. It allows for the selection of a default page orientation (portrait or landscape), and it allows for administrators to override the default orientation in specific nodes.

However, I can't figure out how to override the default orientation when creating a PDF of a specific Views output. I have one View that needs to be printed in landscape format, the rest in portrait. Perhaps a PHP snippet in the header of the view?

Any help will be appreciated!


texts: Relationship between an existing Household and a new Individual not added using civicrm webform

texts:
When trying to add a new CiviCRM Contact of type Individual through a webform to a existing Household, the required Relationship is not created, although it is set up on the CiviCRM setting of the webform.

The existing Household is selected using the "Existing Contact" field of the civicrm webform.
When trying for the second time, the relationship between the Household and the Individual is correctly added.
Any idea what might be happening? I'm working with Drupal 7.80 and CiviCRM 5.36.1.
Thanks in advance.


texts:
I set up a site in drupal, and I need to show the fields of date type in the same way as other fields. the problem is that those fields are inside a fieldset.

I'm try the solution code karate, buts it only changes the fieldset to a label.

What I want is showing those fields outside a fieldset, stay equal to the remaining fields.

I am using the following code.

/**
 * Remove fieldset from date inputs
 */
function mytheme_date_combo($variables) {
    dd($variables);
    return theme('form_element', $variables);
}


texts:
I used a PHP code to show results of this query:

SELECT COUNT(*) FROM mytable

I want to get the number of rows in a specific table. This query works fine in phpMyAdmin, but it doesn't work when I place it in a template file.

I mean it doesn't return the number of rows.

Do you have any idea?


texts:
I have a custom module that has a settings page.  Problem is, something about my hook_menu settings is also putting a link to this page in the main admin menu (along with Dashboard, Content, etc).

How do I keep my settings page without seeing the main menu item?

  // admin config option
  $items['admin/configuration/content/brd_contact'] = array (
     'title' => t('BRD Contact Form'),
     'description' => t('Configuration options for the BRD Contact Form module.'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array ('brd_contact_admin'),
     'access arguments' => array('administer brd_contact'),
     'type' => MENU_NORMAL_ITEM
  );


texts: dynamically choose filters/fields in an aggregation table on a View

texts:
I need users to customize which kind of aggregation to apply to a table (view).

Example: let´s choose counts of species X and Y in an area. This means apply two filters.
          I also want to give the option to choose fields 'species', 'area' and 'place'. The table resulting of applying these 3 filters would give a completely different table than before.

Insert all the (3) filters into the same view creates allways the same result. I don't think there is some way of let user choose 'disabling' one of the filters.

Should I create two different views (each one with its corresponding filters) inserted into a panel or there is some better way to solve that?

To make more clear, here are two screenshots:

1) Without 'Place' field (and filter): for especie Cuniculus paca, number of counts is 60.

2) With'Place' field: as for each especie we have different places names, the results are completely different.

In fact I think the question should not be exclusively about filters but also about Views.

There is a chance to avoid a Field to be 'executed' (applied to the resulting View) allways? 'Exclude from Display' with Aggregation options YES doesn't do any effect, the results are grouped by this new field also, changing completely all the results.


texts: I want to show multiple user profile pics on the same page as well as image upload field

texts:
I want to show multiple user profile pictures on the same page, as well as an image upload field where users can easily upload, add, and delete their profile pics. I want to use a single page.

How can I achieve this?


texts: How to replace the Bartik default menu with Superfish

texts:
Since the default Bartik menu doesn't allow me to create a sub menu with styles, I created a Superfish menu.
How can I replace the Bartik default menu with Superfish on the exact place?


texts:
Basically I want a classified ad system where users can pay extra to make their ad more visible - sticky at the top of lists, for example.

lm_paypal or pay-per-node for the simple payment for posting a classified, but how about the extra payment for making it sticky? Any ideas?


texts: Label for Child in Simple Hierarchical Select by using a module

texts: While using Simple Hierarchical Select Module, I have 2 levels of Hierarchy for my Phone. Is it possible to label for child by using a module ?


texts: Suppress watchdog a specific log message

texts:
I would like to tell watchdog not to write the "Cron run completed" to the log while leaving all other messages intact. How can I do this?

Thanks!


texts: Page not found when trying to access custom module

texts:
I've followed this post and made a custom module but when I try to access it from url domain.com/module/method I get 404?

Am I missing something?

Path (URL) to call custom module function


texts: Access custom billing field in rules using Commerce

texts:
I have added the field field_e_mail to the Billing profile type in Commerce and would like to use this for sending an confirmation email to the customer (customers never log in). However, I can't for the life of me get hold of the field in rules. I've tried to use Entity has field in different ways, but I still can't get it to work.

What can I do to get the field_e_mail field from Billing into rules and use it for sending a confirmation email?

This is where I am at the moment (test@test.com is just a placeholder where I'd like to put the field_e_mail value):

{ "commerce_checkout_checkout_send_order_activation" : {
"LABEL" : "Send an order notification e-mail (cloned)",
"PLUGIN" : "reaction rule",
"WEIGHT" : "4",
"OWNER" : "rules",
"TAGS" : [ "Commerce Checkout" ],
"REQUIRES" : [ "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
  { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "commerce_customer_billing" } },
  { "entity_has_field" : {
      "entity" : [ "commerce-order:commerce-customer-billing" ],
      "field" : "field_e_mail"
    }
  }
],
"DO" : [
  { "mail" : {
      "to" : "test@test.com",
      "subject" : "Order [commerce-order:order-number] at [site:name] test",
      "message" : "hello.",
      "from" : "no-reply@test.com",
      "language" : [ "commerce-order:state" ]
    }
  }
]

}
}


texts: How do I retrieve the user ID of the latest editor of a node?

texts:
I know how to get the user who created a node after getting the node object.

$node = \Drupal::routeMatch()->getParameter('node');
$uid = $node->getOwnerId();
$user = \Drupal\user\Entity\User::load($uid);

Since an alternative to retrieving values of the node object is for example $node->nid->value, I tried to get the revision user ID this way.

$ruid = $node->revision_uid->value;

Unfortunately, this doesn't work, although I see with the Devel module that there is a value. So what is the equivalent in Drupal 8 to $node->revision_uid in Drupal 7?


texts: Controlling access to documents for specific users

texts: I need customers to be able to access certain documents (PDFs mainly) specifically for them (they contain sensitive information).  The document information is setup in nodes.  I have looked at a lot of access control modules, but they all seem to focus on user roles.  I don't want a role for every customer.  What would be the best way to structure this?


texts:
I'm using a loop to loop through the items in a entity form list. I then use an if condition using the Conditional Rules module, within this loop.

I would like to break from the loop once this if condition is evaluated to true.

More details:

The exact situation is like this:

I have created a loop in Rules to look through a set of items of entity forms.
This loop has a "if condition" that uses a data comparison of a particular field.
Now if this "if condition" evaluates to true, the loop should not evaluate the rest of the items in the list on which the loop is to run.
Instead, it should break out of the loop.

Any suggestions?


texts: Googling didn't help a lot in this issue. I was wondering if there is a drupal module that inserts sort of a dynamic content in the side of the page the can be expanded and shrinked while pressing a button/arrow?


texts:
In my user edit form I want to add a text field where it asks name of class and I want to add other field List text type and it will display the grade for example:

Math        Grade 7
Now the issue is that teacher can add more than 1 class so and the option field I set unlimited elemts but it doesn't work properly because also I need to add element in List text.

I want to achive this:

Math   Grade 7
Bio    Grade 5

Add class

Issue:

Math Bio
Grade 7 Grade 5

one is not depending of other, please Help!!


texts: What module to edit theme css in my drupal site

texts: Is there a module that allows me to edit the theme css files within the drupal admin?


texts:
I have a strange thing going on here. I've a complex setup with Domain Access and Smartqueue Domain. I also have a view which filters the content to be shown depending on the Nodequeue status:

It does the job very well, but only for users with the "Bypass Access Control" permission (in this case only the super-admin). All other users, don't get the see anything but the title.
The title is rendered properly, only the images (and other CK Fields) are ignored. If you dpm the $fields in the view-template, you get NULL in your $*fieldname*->content...
The content itself, is perfectly visible for all users on the node-page.

Does anyone have an idea on how to tackle this issue? Disabling/Enabling the SQL rewriting doesn't make any difference...


texts: How can I extend Commerce Discount to apply discount on custom price field?

texts:
I have products with 2 prices, the Commerce default one commerce_price, and a custom field field_price_with_flight. In some cases, depending on the node display term value of a taxonomy,  I need to calculate and display the discount prices onto the custom price instead of default Commerce price.

If it can be achieved with rules, I'd appreciate a detailed answer because I'm not very comfortable with the use of rules, especially commerce ones.

How could I achieve that ?

EDIT :

I need to make it possible through discount module UI. I'll try to expose why with the business model below.

The site sells travels. Anytime, depending on sales, the owner decides to create new discounts, with parameters such as:

Limited time
A different discount value usually fixed amount but could be % sometimes
Applied on a selection of travels, choosed across discount UI whether per product or per category, with the help of Commerce Discount Product Category

The flexibility of Commerce Discount  does the job most of the time.
I could setup rules for one case, but this is just impossible to teach the site owner and sellers how to setup discount rules for each new one.

Now whenever you create a discount like that, The module creates a dedicated rule. Basic one exported below.

The challenge is that by default it will apply on commerce_price. I need to extend Discount module so that :

Or it detects the travel type has a field_price_with_flight value
Or we tell the module it is that case with a checkbox in the discount form for instance

and applies then the discount to field_price_with_flight.

Or, last, if possible, create a global rule that will overwrite each discount rule whenever necessary?

Basic rule created by discount

{ "commerce_discount_rule_discount_discount_example" : {
    "LABEL" : "Discount example",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-1",
    "OWNER" : "rules",
    "TAGS" : [ "Commerce Discount", "R\u00e9duction par produit" ],
    "REQUIRES" : [
      "commerce_discount",
      "commerce_discount_date",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "commerce_discount_compatibility_check" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "commerce_discount" : "discount_discount_example"
        }
      },
      { "commerce_discount_date_condition" : { "commerce_discount" : "discount_discount_example" } },
      { "commerce_product_contains_products" : { "sku" : "VE1201#2556#09-05-2016" } }
    ],
    "DO" : [
      { "commerce_discount_fixed_amount" : {
          "entity" : [ "commerce_line_item" ],
          "commerce_discount" : "discount_discount_example"
        }
      }
    ]
  }
}


texts: Removing second copy of ctools module from filesystem

texts:
I have a site where two version of ctools are on the filesystem.

The first version is in sites/all/modules - this is correct and where I want it
The second version is in sites/all/modules/contrib - this isn't correct and was placed there by custom formatters make file.

The registered path in the system table is sites/all/modules/contrib. I want to remove the contrib folder as it shouldn't exist and is causing issues when I want to upgrade ctools using make files.

Removing the folder gives an undeclared function error as drupal expects it in that contrib folder. Using drush registry rebuild isn't an option as the error still appears because ctools is embedded so deep.

Changing the paths in the system table still brings up the undeclared function error, this could be caused by APC caching though.

Is there a simple way of removing references to this folder and using the copy of the module in sites/all/modules without causing such a huge impact?


texts: How do I apply a global filter on view tabs?

texts:
In Drupal 7, I have a view where I show different view tabs of different content types. I want to apply a global filter on those view tabs.

How can I achieve it?


texts: Translating a site where default is in two languages

texts:
Drupal is written in English. We have created some custom modules where the strings in the module are written in French. These are passed through the t() so can be translated.

I am a little confused how I can show my site in both French and English when the default site language English is in both language. Please could you point me in the correct direction?


texts: Implement hook_field_create_instance(), hook_field_delete_instance() and hook_field_attach_rename_bundle()

texts:
When creating a new field type (e.g. address or dimension), I am looking for the Drupal 8 equivalent of hook_field_create_instance() and hook_field_delete_instance() that are available in Drupal 7.
The same goes for hook_field_attach_rename_bundle().

The hook_field_create_instance() could be used e.g. for defining default values on existing entities. Let's say define the new field default value on existing Node instances after attaching (= creating a field instance) to a Content Type.

After digging around on the parent classes and interfaces of the classes that are involved in the definition of a new field type (FieldFormatter, FieldType, FieldWidget namespaces) + Field Types API, I found the PluginManagerBase::createInstance (and thus FieldTypePluginManager::createInstance) but didn't found a way to define custom code for these operations.


texts: I have a flag set in a rule to cache my site when it is selected. I need to only cache the homepage. There is not an option using the Cache Actions module to point to the homepage. Any ideas?


texts:
I just retrieve maintenance (archive FTP/SQL) of a website running Drupal 6.22…

But… I have an Debian 8 server with Apache 2.4, PHP 5.6 and MySQL 5.5... :)

==> So my question is : what is the upper version of these software (Apache, PHP, MySQL) can run Drupal 6.22 ?
I think PHP 5.3, but after ?
(I know that 6.22 is an old version but I will update after first run).

Really thanks for your help.


texts: Is there an easy way to check for http resources when I am switching to https?

texts: The company I work for is going to be switching to serving everything over https. This means that all referenced images/scripts/etc. need to also be server over https. Is there a way to see what links/references and such I will need to manually fix?


texts:
I wanted to show related taxonomy content in my page and I found this:

http://www.metachunk.com/blog/adding-related-content-view-drupal-7

and it worked perfectly. I wanted to know how it worked basically i.e the 5th step i.e

  Configuration on this filter: -> When the filter value is NOT in the
  URL: -> Provide default value -> Type: Taxonomy Term ID from URL ->
  under that, check the box "Load default filter from node page, that's
  good for related taxonomy blocks." -> now check the boxes of the
  taxonomies you want involved here

He says get Taxonomy term ID from URL and then says Load default filter from node page, that's good for related taxonomy blocks.

Basically what is it doing here ??   Is is trying to tell to block here that get the term ID from the given URL page's term ID selected?


texts: Is there a required format for table name prefix?

texts: I know that in MySQL installations it must end in an underscore like prefix_ but I want to know if that is also the required format for Postgres and SQLite.


texts: How to change the saving order of field_collection fields

texts:
I have a node with field1 and field2 (field_collection)

I am using hook_entity_presave($entity, $type) like this:

function txs_entity_presave($entity, $type)
{
    if ($type == 'field_collection_item') {
      ...do some stuff
    }
}

For now, this hook is called firstly for field1 and, only after field1 is saved, this hook is called for field2.

I would like the opposite because I need to retrieve the value of field2 to handle the "field1_presave".

Here are the details:

Here is the code inside the hook_entity_presave, when field1 is being presaved. This code is showing why I need that field2 must be saved before field1

if ($entity->field_name == 'field1'){
    $entity_w = entity_metadata_wrapper('field_collection_item', $entity);
    $node = $entity_w->host_entity->value();
    $node_w = entity_metadata_wrapper('node', $node);

    //HERE I NEED THAT field2 was already saved...
    //This is not the case...
    //the following line does not works in all cases
    $used_value=node_w->field2[0]->myfield->value();
    //as field2 is not yet saved, $used_value could be wrong
    if ($used_value=='something'){
        ...change something in field1
    }
}


texts: Is it okay to expose .yml or .install files to public?

texts:
As per my knowledge the static files like css/js inside core/modules etc should be read by http server user. So normally I give read permission recursively to http user for directories like core, theme, modules etc. But these directory contains some .yml or .install files e.g drupal/web/core/modules/user/user.install which gets downloaded automatically when someone visits my site example.com/core/modules/user/user.install .

So is it okay to expose those files to public ? and what steps can be taken to avoid it ? I checked some popular sites they also expose those files. So bit confused.

Note: Drupal default .htaccess may take  care of these thing for Apache server only but what about other servers like nginx ? However I think Drupal is hard coded to be used with Apache server only.


texts: Exporting and Importing configuration setting only

texts:
I have a development and a production site. Both are working in an offline environment, Drush and Composer are not installed.

The plan is to make all changes always on the development and during each "release" to simply synchronize the changes on the production site.

Currently this is working fine via UI  "Configuration Synchronization -> Import/Export " feature.

But I would like to execute this on the command level ( Linux ) and as it was mentioned, no drush is installed.

Question:
Is it possible to export just the CONFIG Table from MySQL database and import this on the production site? Would this be similar to the Import/Export mentioned above?


texts: How do I redirect users visiting a path matching a regular expression?

texts:
My question is the same asked in How do I redirect from /index.php/event/* to /event? but for Drupal 8.

Since the module suggested in the accepted answer for that question doesn't have a version for Drupal 8, how can I achieve the same with Drupal 8?


texts: Node Metatag data migration with the Migrate-Update\Drupal-Upgrade module

texts:
I ask this for freshmen like myself, and others, who want to make sure they are making the best migrate-update possible:

I have created a local copy of a Drupal 7 site and have also created a brand-new Drupal 8 site. I have no content to migrate-update into the Drupal 8 site besides Nodes, their Metatag data, and a list of Redirects. I've already installed the modules Migrate update, Metatag, and Redirect (via GitHub) in the Drupal 8 site as well.

Is here something special that needs to be configured after the installation and enabling of the module in the Drupal 8 site to which I plan to migrate and upgrade content?

In other words, should I configure something in the D8 site Metatag module settings to insure a stable and correct migration of each node's meta title, description, and keywords from the D7 site?


texts: Implementing callback function in hook_menu()

texts:
In the link given below ,
https://drupal.org/node/224333
So as given in below statement you do not have to declare the callback path* what does this mean?
I have hook_menu() in d6 which is as follows :

$items['ort/add/ion'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'ort_add_ion',
    'access arguments' => array('access content'),
    'file' => 'ort.tion.inc',
  );

Does the link say that for d7 you do not need page callback or something different?

In Drupal 7, you do not have to declare the callback path in hook_menu(), and the callback function is far simpler.

Drupal 6:

<?php
// This function must be pointed to in hook_menu() in D6.
function my_callback_function() {
  // ... Much work to build the form ....

  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);

  $output = drupal_render($form);

  // Final rendering callback.
  print drupal_json(array('status' => TRUE, 'data' => $output));
  exit();
}
?>

Drupal 7:

<?php
// No path needs be set up to point to the function, and $form and $form_state are provided.
function my_callback_function($form, &$form_state) {
  // Often you would select a portion of the form to match #ajax['wrapper']
  // rather than processing the whole form.
  return $form;  // Either HTML or a render array may be returned.
}
?>


texts: How does the Drupal session system work?

texts:
I would like to implement the familiar "Remember me" functionality on user login forms, i.e. if a registered user leaves the browser without hitting the log out link, (s)he will still be logged in when visiting the website afterwards. A quick search leads to the Remember me module, whose description states:

  (...) the default Drupal behaviour is to remember your session for the extent of 3 weeks and 2 days. (...) Can you imagine the colossal risk this places on users accessing your service from public terminals or shared workstations, with no means to their disposal of securing themselves against this threat.

If the first sentence is true, it seems that I do not need the module to accomplish my need. Indeed, I can safely exit Firefox without loosing my session for "a while" (I do not know the exact time interval). However, other users on my website complain that they are immediately logged out after closing their browser.

So now I want to know the ins and the outs of the matter. Are sessions handeled differently for different browsers and, if yes, why? Does Drupal remember sessions for the extent of 3 weeks and 2 days and, if yes, why was this long time interval chosen? Is not using a module like Remember me indeed a risk?


texts: Gray overlay and no dialog when clicking Image button in CKEditor

texts:
Attempting to get CKEditor and Media to work together on a Drupal7 site. Things are mostly working great, but when I click the regular Image button (or double-click an image, or use the context menu to access image properties), I get only a gray overlay and no dialog window.

I'm using CKEditor 7.x-1.18 with the 4.10.0 FULL library locally installed (in libraries), as well as CKFinder 3.4.4 (also in libraries), all with Media 7.x-2.19 and the Media CKEditor 7.x-2.5 bridge module.

When I click the Image button, I get this error in console:

TypeError: Drupal.settings.picture is undefined[Learn More] plugin.js:152:15
init/<
http://example.com/sites/all/modules/picture/ckeditor/plugins/plugin.js:152:15
n
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:10:222
CKEDITOR.event.prototype</<.fire</<
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:12:42
CKEDITOR.dialog
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:594:500
openDialog
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:642:134
openDialog/<
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:642:492
e
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:258:175
y
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:258:332
v
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:258:412
A/e.$.onload/<
http://example.com/sites/all/libraries/ckeditor/ckeditor.js:259:327

I'm not Drupal-technical enough to understand this error entirely. But my intuition is that I don't have something configured correctly. (Installation instructions I have found are so ancient, I'm not even sure the module supports this version of CKEditor.)


texts: How can I automate the site setup process during installation?

texts:
I have this client requirement:

  While installing Drupal, user needs to do most of the configuration
  himself.

  Select the logo.
  Select the theme.
  Select the type of website he wants like blog, website, forum, eCommerce and when he does it, it should come along with its own configurations.

I know I need to use an installation profile. Is there any other way to do it? If an installation profile is the only way, then how can I meet all these requirements?


texts: Parameters and key value pairs for VotingAPI

texts:
My services definitions list notes that to 'select votes' using VotingAPI I have to POST the parameters 'type' (mandatory), and to 'set votes' I have to post a 'votes' array (mandatory) and 'criteria' array (optional). What are the key pair results I need to call these APIs? For 'type' I have tried 'percent', 'points', 'node', 'vote, but none of those work. For the votes array I need entity ID but how/where can I find the entity ID? I am needing to set and select votes which have been submitted on nodes.
Thank you


texts: How do I count the number of unique visitors to Pages

texts: How do I get the number of Unique visitors to the page? I need to get Unique visitors on each page or at the content level, how can I get it?


texts: How do I override an endpoint provided by a module in a feature?

texts:
I am using the Services module and Drupalgap, which provides a service endpoint by default.  I want to make changes to the available services on the drupalgap endpoint, and I manage configuration on my site using Features, so I want to override the endpoint provided by Drupalgap.

However, if I check the box in the Features UI, it doesn't add the drupalgap endpoint because it's already "owned" by the Drupalgap module.

I dug into the code and the Drupalgap endpoint is provided by drupalgap_default_services_endpoint().  I tried adding the exported service configuration in mymodule_drupalgap_default_services_endpoint() and clearing the cache but it doesn't look like this gets picked up.

So, how can I override a service endpoint in a module's code with my own code for that endpoint?  If there's no way to do it, I guess I can cut and paste the exported, updated code over the endpoint in the Drupalgap module, but that seems like the wrong approach.


texts: Drupal 7 : Programmatically validate form by form ID

texts:
Intro - i am trying to implement Sales Force form within Drupal FAPI but now it requires to add captcha so i need to send first request to internal page so i could validate captcha and only after this i can redrect user to Sales Force.

So I want to do such thing :

i have page /contacts and usual form coming from my module that
was created within FAPI
the form has some standard validators
when it is submitted to the same page where the form is, e.g. /contacts, the
validation works fine i can get the errors, but i want to send first
POST request to e.g. /forms URL and validate it there, but /forms
knows nothing about the form and thus validation is not called

The question is :

Basically, i need to validate form separately without rendering it on a new page. Can i do something like this :

drupal_get_form($formId)->validate() ?

Update #1 :

I am already using Captcha module but Sales Force usually is implemented this way - there should be a form on my site with the fields which SF is aware of, when this form is submitted to SF page (external site) SF gathers needed data from the POST request and redirect user back to my site ... but in this case there will no be any validation because right after submit user will be redirected to SF site, Drupal will not process such requests.

Now i really need this validation before submit so i created new page (internal) and want to trigger validation on this page but the issue is that form is located on the page "Contacts" and i am trying to send and validate data to the empty page "Forms".

If i simply send POST to Contacts (where the form is) then validation works fine, Forms does not trigger validation at all.

And as i already said i have form array that describes all fields and validators for them, then i render this array as a form on a Contacts page so i cannot understand why do i need to add hook_form_alter and create some extra validation function on a Forms page if i already described all validation rules on Contacts page?

Update #2 :

Seems that i already got the answer from Wolwerine, i would like to explain why i so willfully wanted to have initial form on a Contacts page and validate it on a Forms page.

I have Parallax site, i.e. single-page-application, which means that eveything in this application should be done without page reloading including those two requests for the issuing form :

validation request
final request to Sales Force after validation

As a result all requests are done within AJAX.

Page Contacts contains main layout and HTML form and any request to this page will return me tons of HTML which i will not be able to analyze in JS and understand whether this request and validation were successful or not.

Of course i can parse these HTML results and try to find some validation errors in this HTML but IMO this is not the case.

So i created separate page that does not include main layout and neither content, i.e. some kind of page that will work only with AJAX request and return exact type of response that i can get in this case HTML, JSON and so on without messing them up.

Thanks, i appreciate your help and upvoted all answers that look helpful.

P.S. This is how i do validation on a Forms page now :

<?php

$data = $_POST;
$form = drupal_get_form($data['form_id']);
$errors = form_get_errors();

if ($errors) {
    print json_encode(array('errors' => $errors));
    die();
}

$c = curl_init();
curl_setopt($c, CURLOPT_URL, $data['destination']);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($c);
curl_close($c);


texts:
this function caches the output, so it doesnt work if I want to change dynamically between two template files. For example user-profile.tpl.php and user-profile-project.tpl.php

Code:

function hook_theme_registry_alter(&$theme_registry) {
  $tmp1 = arg(0);
  $tmp2 = arg(1);
  $tmp3 = arg(2);

  if ($tmp1 == "user" && is_numeric($tmp2) && !$tmp3) {
    $user = user_load($tmp2);
    $roles = $user->roles;
    if (in_array('project', $roles)) {
     $theme_registry['user_profile']['template'] = 'user-profile-project';
    }
  }
}

So how can I do this differently?


texts: SQL error for "node.entity_id" when using Linkit AJAX query

texts:
I use Linkit module in the CKEditor interface when editing content. But a SQL error happens when Linkit module executes a query to retrieve content:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'node.entity_id' in 'where clause': SELECT DISTINCT
  field_data_title_field0.entity_type AS entity_type,
  field_data_title_field0.entity_id AS entity_id,
  field_data_title_field0.revision_id AS revision_id,
  field_data_title_field0.bundle AS bundle FROM {field_data_title_field}
  field_data_title_field0 INNER JOIN {node} node ON node.nid =
  field_data_title_field0.entity_id WHERE
  (field_data_title_field0.title_field_value LIKE
  :db_condition_placeholder_0 ESCAPE '\') AND
  (field_data_title_field0.deleted = :db_condition_placeholder_1) AND
  (node.status = :db_condition_placeholder_2) AND (node.type IN
  (:db_condition_placeholder_3, :db_condition_placeholder_4,
  :db_condition_placeholder_5)) AND (field_data_title_field0.entity_type
  = :db_condition_placeholder_6) AND(( ( EXISTS (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid = :db_condition_placeholder_7)
  AND (na.realm = :db_condition_placeholder_8) )OR( (na.gid =
  :db_condition_placeholder_9) AND (na.realm =
  :db_condition_placeholder_10) )OR( (na.gid =
  :db_condition_placeholder_11) AND (na.realm =
  :db_condition_placeholder_12) )OR( (na.gid =
  :db_condition_placeholder_13) AND (na.realm =
  :db_condition_placeholder_14) ))AND (na.grant_view >=
  :db_condition_placeholder_15) AND (node.entity_id = na.nid) )) AND
  (node.entity_type = :db_condition_placeholder_16) )OR
  (node.entity_type <> :db_condition_placeholder_17) )AND ( EXISTS
  (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid =
  :db_condition_placeholder_18) AND (na.realm =
  :db_condition_placeholder_19) )OR( (na.gid =
  :db_condition_placeholder_20) AND (na.realm =
  :db_condition_placeholder_21) )OR( (na.gid =
  :db_condition_placeholder_22) AND (na.realm =
  :db_condition_placeholder_23) )OR( (na.gid =
  :db_condition_placeholder_24) AND (na.realm =
  :db_condition_placeholder_25) ))AND (na.grant_view >=
  :db_condition_placeholder_26) AND (node.nid = na.nid) )) ORDER BY
  node.title ASC; Array ( [:db_condition_placeholder_0] => %preva%
  [:db_condition_placeholder_1] => 0 [:db_condition_placeholder_2] => 1
  [:db_condition_placeholder_3] => analysis
  [:db_condition_placeholder_4] => og_basic_page
  [:db_condition_placeholder_5] => subsite_og
  [:db_condition_placeholder_6] => node [:db_condition_placeholder_7] =>
  0 [:db_condition_placeholder_8] => all [:db_condition_placeholder_9]
  => 1 [:db_condition_placeholder_10] => nodeaccess_rid [:db_condition_placeholder_11] => 0 [:db_condition_placeholder_12] =>
  nodeaccess_uid [:db_condition_placeholder_13] => 0
  [:db_condition_placeholder_14] => nodeaccess_author
  [:db_condition_placeholder_15] => 1 [:db_condition_placeholder_16] =>
  node [:db_condition_placeholder_17] => node
  [:db_condition_placeholder_18] => 0 [:db_condition_placeholder_19] =>
  all [:db_condition_placeholder_20] => 1 [:db_condition_placeholder_21]
  => nodeaccess_rid [:db_condition_placeholder_22] => 0 [:db_condition_placeholder_23] => nodeaccess_uid
  [:db_condition_placeholder_24] => 0 [:db_condition_placeholder_25] =>
  nodeaccess_author [:db_condition_placeholder_26] => 1 ) in
  field_sql_storage_field_storage_query()

Query is faulty when retrieving nodes whose content type uses the "title" field (from module "title") instead of "title" core attribute. It concerns the SQL segment where DRUPAL queries node_access table. If I use my admin account, which has "Bypass content access control" permission, error doesn't appear.
I found some posts where they suspect OG is responsible, but if I inactivate OG on my site it doesn't solve the problem.
Any help will be welcome.
Best regards,
Pierre


texts:
I have a view and I want to override the query by writing my own using the Database API of Drupal. I already wrote a function that overrides the query and returns the result set I need:

function kviews_views_pre_execute(&$view) {

if($view->name === 'custom_fans_evolution'){

    $sql = db_select('node', 'n'); //Initial table select

    $sql->join('field_data_field_metric', 'm', 'n.nid = m.entity_id'); //Join the metrics table
    $sql->join('field_data_field_values', 'v', 'n.nid = v.entity_id'); //Join the values table
    $sql->join('field_data_field_page_connection', 'p', 'n.nid = p.entity_id'); //Join the pages table
    $sql->join('field_data_field_value_date_date', 'd', 'n.nid = d.entity_id'); //Join the dates table

    $sql->fields('n', array('title')) //Add fields - chained
    ->fields('d', array('field_value_date_date_value'))
        ->fields('v', array('field_values_value'))
        ->condition('m.field_metric_value', 'page_fans', 'LIKE')
        ->condition('p.field_page_connection_tid', 69, '=')
        ->condition('d.field_value_date_date_value', strtotime(date('Y-m-d')), '<')
        ->condition('d.field_value_date_date_value', strtotime(date('Y-m-d').' -8 days'), '>')
        ->orderBy('field_value_date_date_value', 'ASC') //Order results - chained
        ->range(0,15); //Limit results - chained

    $view->build_info['query'] = $sql;

}
}

The query executes successfully, in PHPMyAdmin it returns the right data and in the preview window of the view it displays the right amount of rows. All I get though is the label of the field I choose in the UI:

How can I map the fields I get from the query to the fields I add to the Views UI? Or maybe I need to add the fields to the view using a hook?

Thanks!


texts: Hook on product page view in Drupal commerce

texts:
I want to run page view event from tracking with Google Analytics/piwik on Drupal commerce using my own Module.

Which hook can i use in Drupal commerce to run my own code? I just need to find the best hook that is called when page view is fired for the product.


texts: How to add db_select condition by using two concatenated fields?

texts:
So I have users with a field_first_name and a field_last_name and I need my query condition to be something like:

"field_first_name + ' ' + field_last_name LIKE :q".

Currently I have:

->condition(db_or()->condition('fn.field_first_name_value', $q, 'like')->condition('ln.field_last_name_value', $q, 'like'))

so if first name is "John" and last name is "Smith" and I search for "John S" I get nothing because it doesnt match the first OR last name, I need to check if it matches the firstname + the last name.

How do I do this in Drupal 7?


texts:
I need to run jquery code in my content type form so i added jquery-1.8.0.min.js file in info file of my theme.

after clear all caches something wrong happened, the "add more" button on date field stop working, i'm sure it's from adding the js file.

Any suggestion?


texts: How to modify a cck field of Node A when Node B (referenced from Node A) is modified

texts:
Drupal 6 Question:

I have two content types - a Property and a Task. The Task content type has a CCK Node Reference field that references the Property node it belongs to. When I modify a certain field in the Property node, I need to automatically update the "field_task_status" within it's referring Task node to "Complete".

I've been able to accomplish this with Rules 1 and VBO, but It seems like building a multitude of VBO views and triggered rules just to handle switching the Task node's status to "complete" or "pending" is a bit overkill.

Is there a more efficient way of doing this through a small custom module? I've heard that VBOs are heavy on the server, and I don't want to run into problems with the VBOs bogging down site.

I was initially thinking that I could write a query to get the nid of the referring Task node, and use that to load that Task and subsequently modify the value of its "field_task_status" ... I'm not a developer by trade, but I can put the code together if I have some idea of where to start.

Edit: Here's my attempt at coding a custom module, it's not getting me what I want...am I even close?

function mymodule_task_updater($property)
{
 $task_id =db_result( db_query(
 "SELECT tn.nid FROM content_type_task_notification tn,
 content_field_property_reference p, node n
 WHERE  n.nid=p.field_property_reference_nid
 AND tn.field_task_notice_type_value='Realtor Assignment'
 AND  p.field_property_reference_nid='%d' ", $property->nid ));

 $task = @node_load( $task_id );

if($task && $property->field_realtor_reference[0]['value'] == NULL)
   {
    $task->field_task_notice_status[0]['value'] = 'Pending';
    node_save($task);
   }
}


texts: Organizing uploaded files in folders created by date

texts:
This could be very trivial, but I haven't been able to find a good solution.
I have an image field associated with a content type called article, and I wish to organize the files uploaded during content creation in a way that they go to a sub folder (within files/article) which uses the day's date as name.
For example, if the article is created on April 15, then the associated images (the ones added through the image field) go to files/articles/15-04-2011/filename.jpg; the articles created the day after will have their associated files in files/article/16-04-2011/filename.jpg.


texts: How to add vocabulary terms to a taxonomy category

texts:
I'm trying to get my module to install a vocabulary on enable/install but something about adding terms to it isn't working. any idea why this function isn't working?

function _vocabulary_add_items() {
  $vocabulary = taxonomy_vocabulary_machine_name_load('usertype');
  if($vocabulary === TRUE) {
    $terms = array(
        (object) array(
            'vid' => $vocabulary->vid,
            'name' => t('Economy'),
            'description' => t('Basic user account'),
            'format' => '', // default
            'weight' => 0, // default
            'vocabulary_machine_name' => $vocabulary->machine_name, // optional
        ),
        (object) array(
            'vid' => $vocabulary->vid,
            'name' => t('Deluxe'),
            'description' => t('Deluxe user account'),
            'format' => '', // default
            'weight' => 0, // default
            'vocabulary_machine_name' => $vocabulary->machine_name, // optional
        ),
        (object) array(
            'vid' => $vocabulary->vid,
            'name' => t('Ultimate'),
            'description' => t('Ultimate user account'),
            'format' => '', // default
            'weight' => 0, // default
            'vocabulary_machine_name' => $vocabulary->machine_name, // optional
        )
    );
    foreach ($terms as $term) {
        taxonomy_term_save($term);
    }
  }
}


texts:
Right now I'm working in a tpl file and in a specific place I have <?php print render($submitted); ?> and this works just fine. However, later when I do <?php print render($content); ?> it will render the submitted by link there as well. Normally I just:

<?php
  hide($content["comments"]);
  hide($submitted); //this does not work like it does with hiding comments and links
  print render($content);
?>

However, the copying the way to do it for comments and links does not work with submitted and it continues to render the submitted by in the content.


texts:
I'm having an issue with my menu on the responsive size. For some reason my menu doesn't collapse so I cannot see any of my items on my menu on a tablet or a mobile. Using the inspect element I check and all the pages from my menu are in the html but the collapsing part is not working anymore. I'm currently using the Project Bootstrap .

Can anyone provide me some tips on how to troubleshoot this problem?
Any help will be appreciated.


texts: Computed twig Automatically update the computed value using Ajax

texts:
Whe I use computed twig with "Automatically update the computed value using Ajax" checket, it create "update" button next to my computed twig field. How I make the field update really automaticlally without this update button.
Thanks.


texts: Can I highlight an invalid form field without assigning a message for it?

texts:
I have a form which presents three input fields which are later combined into a single phone number. When that phone number doesn't validate (doesn't match /^\d{10}$/), I want to show a single message saying the phone number is incorrectly formatted, but I want to highlight all three input fields. Is this possible? The best I have come up with is this:

form_set_error('firstBox', $theMessage);
form_set_error('secondBox', " ");
form_set_error('thirdBox', " ");

This way, all fields are highlighted and I get the message only once, but I still get bullet points for the empty messages...

Is there a better solution for this?


texts: How to use Panels for styling/layout Ubercart 3 Product Kits?

texts: I'm using Panels to build a layout for Produck Kit in Ubercart 3 but I can't show the product links that appear in the normal product kit, Is there something I'm missing? I have tried adding "Node Links", "Node Content", "Attached files" but no luck. Please help. Thanks


texts: How to access past DrupalCon website that requires password?

texts:
I want to browse DrupalCon websites to learn stuff from past DrupalCon.

Below is partial list:

Chicago 2011    March   http://chicago2011.drupal.org/
Copenhagen  2010    August  http://cph2010.drupal.org/
San Francisco   2010    April   http://sf2010.drupal.org/
Paris   2009    September   http://paris2009.drupalcon.org/
Washington, D.C.    2009    March   http://dc2009.drupalcon.org/
Szeged  2008    August  http://szeged2008.drupalcon.org/
Boston  2008    March   http://boston2008.drupalcon.org/

However, a lot of them (e.g Copenhagen, D.C, Szeged, Boston) require user and pass to login. Not sure why some Con are open to public, some are closed.

Is there a way to obtain an account to access them? or Is there an alternative way to find content of those DrupalCon?

Thanks.


texts:
I'm trying to add a simple class to a link outputted via print render($content['field_tags']). I'm using the Bootstrap theme. These are the approaches I've tried so far:

Hooking into template_preprocess_node - no luck here as the html isn't generated yet.
Hooking into template_field - this contains exactly what I expect but the links being generated don't obey the classes set here.
Hacking node.tpl.php and manually outputting the terms - this sort of works but it's not the best solution.

This is the output as it is at the moment:

drupal

I don't want to add any more modules as there has to be a code solution to this, I'm not sure what I'm missing here. How do I add a class to link outputted in field_tags?


texts: views_get_view in combination with i18nviews only translates part of header

texts:
I'm using the following code to get a view and render it

  $view = views_get_view('viewname');
  $view->set_display('page');

  $view->set_arguments(array($type));

  $view->pre_execute();
  $view->execute();

  return $view->render();

Works great but some fields of the exposed filters and the header are not getting translated. I'm using the i18nviews modules.

Any ideas?

Thanks


texts: Blog Site navigation missing! Drupal 7.x

texts:
Hi Drupal specialists,

since today I cannot see the "page 1 of x" on the bottom of my blog page. Also the "more" button from the "latest blog posts" block is w/o functionality. I did not change anything and yesterday it was working perfect. The main menu "blog" only shows my lastest 10 posts and this is correct (I list 10 posts per page) but in total I have more than 40 posts so it should list page 1 of 4... :-(

checked for updates but all modules and the core are up-to-date.

Any idea?!

Thanks
Christian


texts: Problem with commerce_checkout_page_info() function

texts:
I've been poking around in various forums trying to change the hard-coded values for the Checkout Page buttons and titles. For semantic reasons, I want to change the last submit button from 'Continue to next step' to 'Complete Submission'.

I have had success in changing the other buttons with combinations of hook_form_alter() and how hook_menu_alter()

function bartik_form_alter(&$form, &$form_state, $form_id){
dpm($form_id);
dpm($form);
if (commerce_form_callback($form_id, $form_state) == "commerce_cart_add_to_cart_form"){
    $form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value']=t("Add to Inquiry List");
    }
if(strpos($form_id, 'views_form_commerce_cart_form_default')===0){
    $form['actions']['submit']['#value'] = t("Update List");
    $form['actions']['checkout']['#value'] = t("Submit List");

    }

However, I am having problems changing the final submit button in the commerce_checkout_form_review form. I've tried the method suggested here http://mtt.desk.com/customer/portal/articles/1430204-how-to-customize-the-label-of-the-drupal-commerce-button-on-the-order-review-page, both as a module and as a function in the theme template, but neither method produces an error or gives me the desired text change.

function co_button_commerce_checkout_page_info_alter(&$checkout_pages) {
$checkout_pages['review']['submit_value'] = 'Submit Order';
}

So, I've been trying a couple of different variations, but I'm still not sure how to target the buttons on that form. I have also tried this little if statement, but it's still not effecting the change.

if(strpos($form_id, 'views_form_commerce_cart_form_default')===0){
$form['buttons']['continue']['#value'] = t('Complete submission');
}}

TIA, any advice would be greatly appreciated.

I think this is the relevant portion of the array

buttons (Array, 4 elements)
#type (String, 8 characters ) fieldset
#attributes (Array, 1 element)
continue (Array, 6 elements)
#type (String, 6 characters ) submit
#value (String, 21 characters ) Continue to next step
#attributes (Array, 1 element)
#suffix (String, 59 characters ) <span class="checkout-processing element-
#validate (Array, 1 element)
#submit (Array, 1 element)


texts: Help with contextual filter and entity reference fields

texts:
I have a content type with an entity reference field that allows users to assign multiple other nodes to be referenced from the current node.

I am trying to create a view that will list the related nodes for the current page.

What Relationship/s and contextual filters must be set to achieve such a thing?

I have read a number of other posts asking similar questions, though most seem to be in reference to Drupal 7 and their suggestions either do not work, or appear to not exist in Drupal 8.

I can get a list which shows all the other nodes that reference the current node by setting a contextual filter to: Content:field_related_pages and setting the default value to Content ID from URL this, however, is the exact opposite of what I want...

I have tried creating a relationship based on the Entity Reference field, however there are two options I can see:

Content referenced from field_related_pages
Content using field_related_pages

I have also tried using a contextual filter of: Content: ID with the default value set to Content ID from URL

I feel like I have attempted every conceivable combination of the above and none seems to work. Can someone please put me out of my misery and incompetence and please how to get a contextual filter to show a list of nodes related to the current via a entity reference field?


texts: Setting up the private file directory (nginx)

texts:
Problem

I'm trying to set-up a private file directory for Drupal on an LEMP stack (Ubuntu 12.04, nginx, MySQL, PHP), I wasn't 100% sure about the permissions or set-up so I thought I'd ask, how should you do it?

So Far

It needs to be a folder which is writable by the webserver but not accessible from the web.

Example:

Location: drupal_root/privatefiles

Permission: chgrp 775 www-data privatefiles

Nginx config: (goes into /etc/nginx/sites-available/mysite):

server {
         listen 8080;
           root /srv/www/mysite/public;

           location ^~ /privatefiles {
             internal;
           }

        ...
        }

Would that be enough? It recommends on the official page to have the folder outside the Drupal root. What difference would this make?


texts: Probably corrupted database by deleting records from node / node_revision

texts:
I did something where everybody said never ever do it: some weeks ago I deleted records from the node- and/or node_revision tables manually (DELETE FROM TABLE ...), and thought it won't harm.
But now I see that it definitely did harm, as my search function doesn't work anymore the way it should be.

Is there something I could repair or very hard to recover?

Many thanks for help.


texts: How do I programatically attach fields to a node defined in hook_node_info()

texts:
I've got a module which defines a node type. I also need to attach a few fields to this node.

I'm defining the node in hook_node_info(), and I'm creating fields in hook_install(). However, isn't this going to create the fields before the node? Isn't hook_install() executed before hook_node_info(), meaning that I'll be attempting to attach the fields to a non-existing node type at that point?

How do I define a node type programatically, and also attach fields to the node type programatically upon module installation?


texts:
I have a paragraph template where I print a field, for instance :

{{ content.field_products }}

In this template, I can get the paragraph id with :

paragraph.id()

I need to pass this paragraph id in the field template. What is the cleaner and simple way to do this ?
I found a solution like this :

{{ content.field_products|merge({666:paragraph.id()}) }}

and then I get the value in field template like this :

{% set paragraphId = items[items|length-1].content %}

But this is dirty and generate a warning "Message d'erreurUser error: "4" is an invalid render array key in Drupal\Core\Render\Element::children() (line 99 of core/lib/Drupal/Core/Render/Element.php)." that I can understand giving that it's a dirty hack and drupal try to render my "666" array.

I'm probably gonna get the array with "666" key I added in a preprocess_field(), create a new variable for the field template et delete this diabolic hack from $variables to remove the warning due to a tentative to render this fake array, but I guess there is a better way to do ? I want simply to pass a variable from a template to its child...

thanks !


texts: HDI display the human readable node type at the end of the breadcrumb

texts:
I want to modify the default breadcrumb to append the machine readable string of the current node type to the breadcrumb. I believe I can do this via template.php.

I am using drupal 7.


texts:
I am creating theming view using row style theme named as

  views-view-fields--slider-block.tpl.php

and here is code for it:

<?php
$string='

';

foreach($fields['field_slider_image_fid']->handler->view->style_plugin->rendered_fields as $row) : ?>
<?php $i=1; ?>
<?php $i=$i+1;?>

<?php

if($row['field_image_position_value'] == 'left') {
    $string.="

".$row['field_slider_image_fid']."".$row['field_image_text_value']."
";
}
else {
    $string.="
".$row['field_image_text_value']."".$row['field_slider_image_fid']."
";

}
?>
<?php endforeach;  ?>

<?php
$string.="

";

echo $string;
?>

Now it is working fine when there is exactly one node in the view. But a problem occurs when the view contains more than one node, e.g. if the view contains 5 nodes, this template renders 5 times causing duplication.

Anyone have ideas on how to resolve this?


texts:
I'm trying to use PHP-EWS library, to make a connection with Exchange.
So I declared two libraries like this :

function mymodule_libraries_info() {
    $libraries = array(
        'php-ews-master' => array(
            'name' => 'php-ews-master',
            'vendor url' => 'https://github.com/jamesiarmes/php-ews/',
            'download url' => 'https://github.com/jamesiarmes/php-ews/archive/master.zip',
            'version callback' => 'mymodule_callback',
            'files' => array(
                'php' => array(
                    //Main classes
                    'src/Client.php',
                    'src/ClassMap.php',
                    'src/Autodiscover.php',
                    'src/Type.php',
                    'src/ArrayType.php',
                    'src/Request.php',
                    'src/Enumeration.php',
                    'src/Response.php',
                    //Others classes
                    //'src/Request/BaseRequestType.php',
                    'src/Request/FindItemType.php',
                    'src/Request/FindItemType.php' => array('autoload' => TRUE),
                ),
            ),
        ),
        //Soap connection
        'php-ntlm' => array(
            'name' => 'php-ntlm',
            'vendor url' => 'https://github.com/jamesiarmes/php-ntlm/',
            'download url' => 'https://github.com/jamesiarmes/php-ntlm/archive/master.zip',
            'version callback' => 'mymodule_callback',
            'files' => array(
                'php' => array(
                    'src/SoapClient.php',
                ),
            ),
        ),
    );

    return $libraries;
}

Next, in a custom function, I used the main function to connect my user :

//Load libraries
libraries_load('php-ntlm');
libraries_load('php-ews-master');

$timezone = 'Eastern Standard Time';
$email = 'myuser.onmicrosoft.com';
$pass = 'mypass';
$client = new \jamesiarmes\PhpEws\Client('outlook.office365.com', $email, $pass);
$client->setTimezone($timezone);

My first question is, why I need to use the full namespace \jamesiarmes\PhpEws\Client to use the class and not just Client ?
After the connection I want to get all events from the calendar of this user. So the first class used is \jamesiarmes\PhpEws\Request\FindItemType. I put it in my library files and used it, but I got this error :

Fatal error: Class 'jamesiarmes\PhpEws\Request\BaseRequestType' not found in /usr/share/myapp/sites/all/libraries/php-ews-master/src/Request/FindItemType.php on line 14

I got this error because the class \jamesiarmes\PhpEws\Request\FindItemType extends another class BaseRequestType

class FindItemType extends BaseRequestType

Why, when I included the class \jamesiarmes\PhpEws\Request\FindItemType aren't the classes loaded or extends in this class not loaded ?
In the librarie, there is a class called ClassMap.php which list all classes used by the library, there is maybe a way to use this class to load all classes ?

I tried to use this librarie out of drupal with composer and autoload.php. And I just need to call this, and it works :

require_once './vendor/autoload.php';
use \jamesiarmes\PhpEws\Client;
use \jamesiarmes\PhpEws\Request\FindItemType;

So maybe in drupal I don't have this autoload which load automatically all the classes used ?
I tried a lot of things but for the moment, It's work when I call all the classes one by one in my files declarations in the librarie, but the array is too big...

Thank you if you can help me


texts:
Currently I have a view called authors_under_book. When I enter the ID of a book, the view should show me the author's properties.

I have asked on Drupal.org, but I didn't get any solution.

How can I achieve what I want to do?


texts: Is there a way of making the google analytics available for previewing on the drupal 7 site?


texts: How could I send daily or weekly email in cron() function?

texts:
I have a content type in which I have drop down list with the values of "daily" and "weekly" and one field is of email. I want to setup the cron function like when the value of that drop down list is "daily" then email will be send daily to the email address of whatever entered in the email field and when the value is "weekly" then the email will be send weekly.

I don't have any idea about this. How will I do this?


texts: Get value of a field attached to a user entity based on currently logged in user

texts:
I add a taxonomy selection to the registration from config/account called field_user_class.

Now for my module I need a function that returns the this field value for the currently logged in user, and shows it to them.

I just need the function to return this field for the logged in user.


texts: modified value in form_state but it is not being saved

texts:
in the validation of my form i pass the form_state by reference and I modified the form state value of one of the fields with $form_state['values']['field_total_payment']['und'][0]['value'] = $total_payment;

I also tried  form_set_value($form['field_total_payment'], array('und' => array(0 => array('value' => $total_payment))), $form_state);

and I add a second submit to check if the value is there and I can see that with both pieces of code it is in the form_state['value'] , but it is not getting saved to the node.

What is missing for this information to be stored into the database?


texts: how to change the value of the form in the preprocess functions or get the value of the function preprocess

texts:
I need to get the value of preprocess function and write it in the form #default_value, while my form is a variable that preprocess functions
I create custom module

<?php
/**
 * Реализация template_preprocess_comment()
 **/
function comment_email_form_preprocess_comment(&$variables){
    $variables['content']['email_form']['email']['#default_value'] = 'New value!';
    $variables['content']['email_form'] = show(drupal_get_form('comment_email_form'));
    dsm($variables);
}
/**
 * Создаем форму, которая будет хранить данные email адресов бригад и отправлять письмо.
 **/
function comment_email_form($form, &$form_state){
$query = db_select('comment', 'c')
    ->fields('c', array('cid', 'nid'));
$result = $query->execute();
$comments = array();
foreach($result as $value){
    $comments[$value->cid] = comment_load($value->cid);
 }
  $form['email'] = array(
    '#type' => 'textfield',
    '#access' => TRUE,
    '#default_value' => 'test123',
    '#required' => TRUE,
  );

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

  $form['#validate'][] = 'comment_email_form_validate';
  $form['#submit'][] = 'comment_email_form_submit';
  return $form;
}

Thanks for any help.


texts:
I have a problem with MySql request on Drupal 8.
I want to translate this request to Drupal:

SELECT x.camp AS camp, x.code AS espece, y.des AS designation, x.pf AS pf,
ROUND( SUM( x.pn - x.qte ) , 3 ) AS qte
FROM apport.apport x, apport.cereale y, apport.operation z
WHERE x.code = y.code
AND x.ope = z.code
GROUP BY x.camp, x.code
ORDER BY x.camp, x.code

This request works on PhpMyAdmin.

So, I do this:

    $query = $db->select('apport.apport','x');
    $query->join('apport.cereale','y', 'x.code = y.code');
    $query->join('apport.operation','z', 'x.ope = z.code');

    $query->fields('x', array('camp', 'code' ,'pf'));
    $query->fields('y', array('des'));

    $query->addExpression('ROUND(SUM(x.pn-x.qte),3)','qte');
    $query->groupBy('x.camp')->groupBy('x.code');
    $query->orderBy('x.camp','ASC')->orderBy('x.code','ASC');

    $result = $query->execute();

    $tableau = array();

    foreach ($result as $record) {
        $row['camp'] = $record->camp;
        $row['code'] = $record->code;
        $row['des'] = $record->des;
        $row['pf'] = $record->pf;
        $row['qte'] = $record->qte;

        $tableau[] = $row;

        print_r($tableau);
    }

But it doesn't work. The problem comes probably from here:

    $query->addExpression('ROUND(SUM(x.pn-x.qte),3)','qte');
    $query->groupBy('x.camp')->groupBy('x.code');

Because when I comment the above two lines, I do get a result.

Any help please ?


texts: Easiest method for conditional fields in a form

texts: What is the easiest way to get some javascript magic for enabling/disabling form fields based on another field's value? This sounds like something there should be an helper for somewhere, but I can't find it. I am looking for a solution that is not restricted to nodes.


texts:
I am trying to create a new custom tab that appears on all routes that are descendants of entity.{entity_type}.canonical. I have tried extending the DeriverBase class, specifically overriding the getDerivativeDefinitions method. I created the tab itself by extending LocalTaskDefault and overriding the getRouteParameters method. The tab appears when you visit a standard Drupal user path such as www.mysite.com/user/1/ or www.mysite.com/user/1/edit. However, when we add our new custom user routes such as www.mysite.com/user/1/subscribe, no tabs appear. Is there a special way to define local menu tasks on custom routes? A sample of the code:

 $this->derivatives['recurly.subscription_tab'] = [
  'title' => $this->t('Subscription'),
  'weight' => 5,
  'route_name' => 'recurly.subscription_list',
  'base_route' => "entity.$entity_type.canonical",
];

foreach ($this->derivatives as &$entry) {
  $entry += $base_plugin_definition;
}

Thanks in advance of any help.


texts: Unexpected Entity Reference Autocomplete behaviour

texts:
I'm using Entity API, Form API and Entity Reference Autocomplete in Drupal.
I have a relationship between two types, clubs and courses, each club can have many courses so basically the table course contains a column called goclid which references the club id number like so:

// hook_schema()

$schema['course'] = array(
    // other fields...
'goclid' => array(
    'description' => 'Reference to the club',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ),

// ... a few lines later...
'foreign key' => array(
  'related_club' => array( // join alias
    'table' => 'club',
    'columns' => array('goclid' => 'id'),
  ),
),
// etc.
);

Then I include a field like so in the course form:

$form['goclid'] = array(
    '#title' => t('Reference to the club'),
    '#type' => 'entityreference',
    '#era_entity_type' => 'club',
    '#default_value' => isset($course->goclid) ? $course->goclid : '',
    '#required' => FALSE,
);

Now, the autocomplete gives suggestions only when I type an id number, and then populates the field value with the label (name of the golf club).
What I want is exactly the opposite: I want to get suggestions by typing the name of the club, and then when I choose one, the form field should be populated with the id number of that object.

Why is Entity Reference Autocomplete behaving in an unexpected way? What can I do to obtain the desired behaviour?

EDIT: to understand the solution look not only at the answer but also at the comments that I left below the answer; the answer itself only explains how to get the suggestions working but does not explain how to build and save the entity object in your submit function.


texts: Validate Node Before Saving With EntityMetadataWrapper?

texts:
I am creating nodes with EntityMetadataWrapper that need to be checked with the unique_field module. I noticed that duplicate nodes are being saved because EMW doesn't validate the node before saving as mentioned here:

https://drupal.org/node/643972

How can I enforce my unique_field settings for this node when creating and saving with EntityMetadataWrapper?


texts: Linking organic groups - or am I overlooking a better solution?

texts:
I'm attempting to use Drupal 7 with organic groups to create a network of groups for local affiliates of a national organization. Initially we want users in each group to be able to post private content inside of the group, which is not a problem. However, since local affiliates tend to share ideas and files we'd also like a group administrator to be able to "link" their group with another trusted affiliate so that users of the two affiliates can have access to the content in the linked groups.

I realize the people in each group can be added to other existing groups, but as far as I am aware this is on an individual basis and thus would not be sustainable going forward as members that are added and removed from their primary group would not automatically have their membership changed in the other affiliated groups.

The closest thing I've seen is http://drupal.org/project/og_affiliations but it's no longer being updated. I was wondering if anyone has any ideas for approaching this setup or if there might be a better solution than OG that I'm overlooking?


texts: How to I call a preprocess function for a view from a custom module?

texts:
Lets say I have a view called widgets.

On a given page, /widgets/manage/ I want to add use a function that calls drupal_add_js and drupal_add_css to change the behaviour and appearance.

If I wanted to make a change to the widget view in a theme, I'd change this file:

views-view--widgets--page.tpl.php

But, I want to change this in a module, so I can easily switch a feature on when I enable a module.

I don't need to add any other template files, I just want to call a few functions in PHP.

What is the best way to do this, and what would be the relevant hook to use here?


texts:
how is the body json format for update (PATCH) one profile via REST api in Drupal 8? and the endpoint?
i can create one profile correctly follow this instructions , but for update? What json body format is correctly?
i have no found documentation about this, Thanks for responses.


texts:
Need:

If we select a value in a drop-down list field(A), then we need to display and set as required field(B).

Note: the field(B) is a date range.

I tried to add states with a hook form alter

$form['field_b']['#states'] = [
      'visible' => [
        ':input[name="field_a"]' => ['!value' => '_none']
      ],
      'required' => [
        ':input[name="field_a"]' => ['!value' => '_none'],
      ],
  ];

As you see I use: '!value' to negate a value and '_none' for no value. So, It will not be required if there is no value selected

This code didn't work. It display the field B, but it is not mandatory.

We found that there is an issue with core
https://www.drupal.org/project/drupal/issues/2855139

At the end issue was closed, but it didn't work for us. It worked with texte fields but not for our rage date.


texts: How do I populate an address field in php?

texts:
I want to import data from a external source and so am writing a module that creates content by populating the fields of node bundles in code. I followed this guide which is great.

So I am working on adding lists of properties (flats and houses) that belong to estates. I am using an address field to store the address and found this comment on the address field module page that tells me that the address field is an array and so I can access each element and set it in turn.

But what are the address field element and how do I get a list of them? Can they be anything I want? Does the create content form create the array when the form is submitted and therefore the form labels are just a guide or do I have to match them in my code? For example, a UK address has two textboxes for address (address1 and address2) that do not match any of the element names in the module documentation.


texts: Running a custom query alongside Drupal Registration Query

texts:
Good afternoon all.
I would like to implement a custom query during the registration process of my registration. I've taken a look around online and can't find the information anywhere, so if anybody knows where the registration query is ran, so that I can add another query to it that would be awesome. Thanks in advance.
EDIT
The Query that runs alongside will go into a seperate game database, so alongside of the standard query it will also run
This was my old query, so maybe it can help show what I'm trying to run.

  $server= "****";
    $user= "****";
    $pass= "****";
    $gamedb= "****";

$link = mysqli_connect("$server", "$user", "$pass", "$webdb") or die( "Error:" . mysqli_connect_error());
$username = mysqli_real_escape_string($link, (string) $_POST['username']);
$email = mysqli_real_escape_string($link, (string) $_POST['email']);
$password = sha1((string) $_POST['password']);
$query="INSERT INTO user (`username`, `email`, `password`, `permissions`)
VALUES ('$username', '$email', '$password', '1')";
mysqli_query($link, $query) or die ("Error:" . mysqli_errno($link));
mysqli_close($link);


texts: Add a trademark to a word everywhere on a site

texts:
I've tried a few different techniques now but I can't get one to work reliably across all content. What I need to do is have all instances of the business name include a trademark symbol:

ie -> DinosaurCakes  becomes DinosaurCakes&tm;
or
Would you like some DinosaurCakes? becomes Would you like some DinosaurCakes&tm;

The javascript version I was trying to do was looping through the page on load and replacing the string with the function I found here-> http://james.padolsey.com/javascript/find-and-replace-text-with-javascript/
But it isn;t digging in to all of the child nodes for some reason and so some versions of the string don;t get replaced.

I then tried to do it in Drupal via hook_page_alter with:

function dinosaur_page_alter(&$page) {
    // attempting to add the DinosaurCake (tm) marks using page_alter
    // find all '#markup' and then scan for terms
    function display_array(&$your_array){
      foreach ($your_array as $key => &$value){
        if (is_array($value)){
          display_array($value);
        }
        elseif (is_string($value) && $key === "#markup") {
          $value = str_replace(array('DinosaurCakes"), array('DinosaurCakes&tm;'), $value);
        }
      }
    }
    display_array($page);
}

However, using this method, it doesn't work on headings and does apply to title attributes and pathnames which of course breaks everything.

Any ideas on the best way to attack this?


texts:
How do I add a print stylesheet in Drupal 8?  Here is what my libraries file looks like in my theme...

global-styling:
  version: 8.0
  css:
    base:
      css/style.css: {}
    theme:
      css/print.css: { media: print }

Does that look correct?  If it is correct, should I also include print media queries in the print.css file?  Or do I not need those media queries because of the "media: print" annotation in my libraries file?

Since I can't inspect the print-preview source, how do I know what classes to use in my print CSS?

(And is there anything else in Drupal 8 that influences the print styles?  I am working on a site I did not build, and it has print styles, but I don't know where they are coming from.  I thought maybe they were coming from the base theme, but I removed the base theme from my theme's info file and I continue to see styled output when I print-preview the page.  The styled output is bad, and needs to be corrected, but I don't know where it's coming from.)


texts: Specifying the length of an integer in hook_schema

texts: Why does Drupal not allow you to specify the integer length with type int in hook_schema?


texts: Use AJAX with form button to clear checkboxes in separate forms

texts:
I have a case where I need to have a Clear button on a form that not only clears out the form it's on, but also clears out checkboxes in other forms and clears data from ctools_object_cache.

The page is a custom search page created by the apachesolr module.  In the sidebar I have multiple blocks that are just 'checkboxes' form elements of taxonomy terms (each block is a separate vocabulary).  The checkboxes are used to select terms, which are written to ctools_object_cache using #ajax in the form when selected.  What I need is to have a Clear button (or link) on the search form that does a few things:

Clears the search field
Deletes items from ctools_object_cache
Deselects the checkboxes in the sidebar forms
Selects a specific checkbox in another sidebar block (labeled "All")

Is it possible to do this using a #ajax button with Forms API?  Or do I need to just write it as a separate Drupal behavior in jQuery?  I know Drupal forms can be handled in jQuery, but I haven't used it before, so I'm not sure where to start.

Thanks.


texts: How can I automatically rotate images based on EXIF data prior to image styles being applied?

texts:
I have a website where users can upload pictures of themselves.  Many of these pictures are taken with  mobile phones and as a result a lot of them are shot such that the picture is vertical, but it is uploaded as horizontal because Drupal ignores the EXIF data.  This can be fixed using the Image Cache Actions module (autorotate submodule), but if I do so, this breaks the Manual Crop module, which I use to trim the pictures as necessary.

Is it possible to somehow have Drupal automatically rotate all images upon upload based on their EXIF data if available, such that image styles would be applied to the rotated image, not the original image?


texts: Error messages aren't displayed when submitting the form

texts:
I want to display an error message when I submit a form. I added an AJAX callback to the form, and the error message appears after I refreshed the page.

I first tried the following code, but it doesn't work.

$response = new \Drupal\Core\Ajax\AjaxResponse();
$message = drupal_get_messages();
$output = $response->addCommand(new \Drupal\Core\Ajax\PrependCommand(".region-highlighted",$message));
return $output;

I also tried the following code.

$status_messages = array('#type' => 'status_messages');
$text = \Drupal::service('renderer')->render($status_messages);
return $text;


texts: File to import not found or unreadable [omega 4] Windows OS

texts:
I have installed omega 4 theme successfully with the help of this link on Windows 7 machine. Working with the theme is awesome, however when I enabled the sub theme ohm, there I am getting issues. I have made a change to the following line in ohm/sass/layouts/hero/hero.layout.scss

.l-constrained {
  width: 95%;

to

.l-constrained {
  width: $desk;

$desk is a variable declared in sass/variables/_grid.scss file.

Afterwards I am getting following error.

  sass/layouts/hero/hero.layout.scss (Line 1 of sass/variables/**/*:
  File to import not found or unreadable: ../../variables/_colors.scss

I can see there is slolution mentioned here, buit don't know how to implement it in omega 4 config.rb file.

Edit:

This is the problem of gem sass-globbing on Windows. If you are using it on Windows version having this issue, than try following solution sass-globbing does not support Windows 7. If it does not work, try the following alternative (not the best solution but it works). Add following line in ohm/sass/layouts/hero/hero.layout.scss

// Globbing from within sub-folders only works with relative paths.
@import "../../variables/colors";
@import "../../variables/grid";
@import "../../variables/legacy";
@import "../../variables/typography";


texts: How to make drush un-install modules without confirmation

texts:
I want to create a drush command that reinstall some modules.
I've done something like this:

  $modules_to_uninstall = array("my_module1", "my_module2", "my_module3", "my_module4", "my_module5");
  foreach($modules_to_uninstall as $name){
    $args = array_merge(array('pm-uninstall') ,array($name));
    call_user_func_array('drush_invoke', $args);
  }

but, when I run the command in drush, it always asks me if I want to uninstall that module.

The following modules will be uninstalled: my_module1
Do you really want to continue? (y/n): y
my_module1 was successfully uninstalled.                                                                                [ok]
The following modules will be uninstalled: my_module2
Do you really want to continue? (y/n): y
my_module2 was successfully uninstalled.

[ok]
    The following modules will be uninstalled: my_module2
    Do you really want to continue? (y/n): y
    my_module3 was successfully uninstalled.
....

$modules_to_uninstall = array("-y my_module1", "my_module2", "my_module3", "my_module4", "my_module5");
  foreach($modules_to_uninstall as $name){
    $args = array_merge(array('pm-uninstall') ,array($name));
    call_user_func_array('drush_invoke', $args);
  }

I've try those but it's useless.

Some suggestion?


texts: Are these cases of genuine help or someone trying to inflate their commit count?

texts:
I maintain a few modules from drupal.org, and lately I've noticed the phenomenon of people who inflate their commit count, who come to an in-development module page, suggest a patch that consists of very simple standards-compliance work (indentations, stray spaces, adding a generic README file, etc.), and ask you to commit it.

Any contribution is nice, of course, but I go to the user's profile, and see that they have hundreds of similar one-off, minimal-contribution commits, and the "work" appears to be a case of artificially inflating their contribution score.

My questions are:

How does one benefit from inflating their commit count?
Are there legitimate cases of someone who wants to be helpful, even if the commit is simple?
If I suspect someone is inflating their commit count, how can I report this?


texts: Mapping split taxonomy terms to new vocabs in nodes in migrate_d2d

texts:
I have a use case in a D6->D7 migration (using migrate_d2d), where I need to split terms from a large vocabulary into two new vocabularies in the D7 site. I achieved the splitting into two new vocabularies just fine in the taxonomy migration (see here for details on how), but the problem is getting the new mapping to work during the blog node migration so that the nodes are attached to the proper vocabulary field in the destination node.

So here's the setup:

D6

People and Organizations (vid 4)

D7

People and Organizations (field_people_organizations, vid 9)
Journalists (field_journalists, vid 5) Non-Journalists
Non-Journalists (field_non_journalists, vid 7)

In my blog node class constructor, I've added this:

$this->addFieldMapping('field_people_organizations', 4)
  ->sourceMigration('PeopleOrganizations');
$this->addFieldMapping('field_people_organizations:source_type')->defaultValue('tid');
$this->addFieldMapping('field_journalists', 4)
  ->sourceMigration('PeopleOrganizations');
$this->addFieldMapping('field_journalists:source_type')->defaultValue('tid');
$this->addFieldMapping('field_non_journalists', 4)
  ->sourceMigration('PeopleOrganizations');
$this->addFieldMapping('field_non_journalists:source_type')->defaultValue('tid');

However, what this does is just populate all three taxonomy reference fields with all terms from the People and Organizations field in the source. For instance, if the D6 People and Organizations field has Term A, Term B, and Term C, and in D7, Term B should be in Journalists and Term C should be in Non_Journalists, I get all three terms in each term reference field instead of Term A in field_people_organizations, Term B in field_journalists, and Term C in field_non_journalists.

I did a query that joined the D6 db with the D7 db using the migrate_map_peopleorganizations table in the D7 site, and the terms themselves are correctly populated in the D7 tables, so I know that's not the issue. I suppose I could do some wrangling in prepare() to move the terms to the appropriate field in the blog node, but it seems there should be an easier way to map to the new vocabulary. I'm guessing I would create a field on the fly and map to it in prepareRow(), but I'm not sure what I would put in that field, since the second parameter in addFieldMapping() for taxonomy terms is the source vocabulary, and there is no source vocabulary for the new ones.

Thanks.


texts:
I am trying to work out how to create a Drupal dev environment using Docker.  I am trying to use the Docker containers for Drupal (https://hub.docker.com/r/library/drupal/) and MySQL (https://hub.docker.com/r/library/mysql/) to set up a Drupal server.

I am assuming that I need to link the MySQL container to the Drupal container.  I have created a docker-compose.yml file which seems to run fine on docker-compose up (I am using a Mac).

docker-compose.yml file:

drupal:
  image: drupal
  ports:
   - "8080:80"
  links:
   - db
db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: mysql
    MYSQL_DATABASE: drupal
    MYSQL_USER: drupal
    MYSQL_PASSWORD: drupal
    MYSQL_ALLOW_EMPTY_PASSWORD: yes

After docker-composer completes, I can access the Drupal site from my web browser.  The Drupal installation works up to the point where I have to enter the database details.  At this point it fails:


texts: create a field that display value from an other one?

texts:
I'll try to give a clearfull explanation of my question... but it's an hard one to explain, and my english is not really good... but let's try and I hope someone could help me. :)

I have a site running with Drupal 7

In this site I have an event calendar (with date)

And the entity registration module.

The point is:

When my user create a multiple event date I get a display like this:

 event 1 - date_of_event_1
 event 2 - date_of_event_2
 event 3 - date_of_event_3

 event description

 registration form:

 name:
 e-mail:

What I want is to be able to have a field in my registration form like that:

Choose your date: date_of_event_1 []  |  date_of_event_2 []
([] = some check boxes)

So I search for a module that allow my form to display a field referencing my dates...

I can easily display my dates values on a view. So I think there is a way to use the same filter on a field?

I've made some researches but I didn't find anything.

Maybe someone heard about something like that?

Thanks for reading!

Just adding some informations:

I have some hopes with the field-reference module...

But here the problem is my registration form is an other type of content and it's display in the related node by using a field "registration" (that came with the module)

So field reference doesn't find my date value in my form because it's not really in the same content. :(


texts: The website encountered an unexpected error. try again later

texts:
Hi guys I get this message when trying to get acces to my web loging as admin this is the error
The website encountered an unexpected error. Please try again later.
is only when trying to get access to manage the content posted for other users overlay=admin/content
this is the information I have from recent los messages

Location    admin/content?render=overlay

  Message   PDOException: SQLSTATE[42S02]: Base table or view not found:
  1146 Table 'gamesswa_gamenetcouk.field_data_field_link_text' doesn't
  exist: SELECT t.* FROM {field_data_field_link_text} t WHERE
  (entity_type = :db_condition_placeholder_0) AND (entity_id IN
  (:db_condition_placeholder_1)) AND (language IN
  (:db_condition_placeholder_2)) AND (deleted =
  :db_condition_placeholder_3) ORDER BY delta ASC; Array (
  [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] =>
  31 [:db_condition_placeholder_2] => und [:db_condition_placeholder_3]
  => 0 ) in field_sql_storage_field_storage_load() (line 412 of /home/gamesswa/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

I have been for days trying to fix this but i cant, could anyone please help me with this, thanks


texts:
The instructions in default.settings.php say

  This variable will be set to a random value by the installer. All one-time
   login links will be invalidated if the value is changed. Note that if your
   site is deployed on a cluster of web servers, you must ensure that this
   variable has the same value on each server. If this variable is empty, a hash
   of the serialized database credentials will be used as a fallback salt.

but this explanation of salting says

  A new random salt must be generated each time a user creates an account or changes their password.

and goes on to clarify that each salted hash (eg password) should have its unique salt stored along with the hashed+salted password in the database.

Am I misunderstanding the article I read on salting, or is Drupal using a faulty practice for the sake of convenience, or is the article wrong, or is there something else going on?


texts: Drupal 7 site display unexpected symbols

texts:
My site working very effectively on my localhost, but when I move the working site's all folders and files to Live Server i.e to cPanel, Its only display unexpected symbols that are given below.

‹Ý0M™å‘/ðë¥R!ŒH6L¨½¯Tl³/)4-/`4A‹.iÌ$³·†1‚š–b·Ê¹¢jZ-"¯i!¶=Ç¡Wô¶Ö¢c.kžu›pW:W_R–ÚF½¶™Õj!jWÒj5ƒ°µöÃb‚¹hB:=ú…4Íçÿ Ÿ>ÿ’ubK-NeýS¥#™Ú÷<‘FªR%•ûöËÝÍÍ—õm{£òùÅ<CR€u"Ôµ±/”hŒJ¨w}F{¼”Zï¦‘‡oýùZ,Oä¿G{ð&i:¯y`ðŠkë#o¥ F`xMû&©Lh¥26ˆÊaäÁ(•¤l¬æ š×+8]r¯Bš%êðÐ¸¢Zœ%<_I6Ðq¤*dÏÔ¡zssSyAþƒT²É¶iDƒ¡âž™r t%K,¡¨²,i©LLùzxI{¨å‘ÀŸêŸG°²ƒ#ˆÔ    ¬Ë$KÔk¾„÷À;ÈB;ß^¬gå‘%éZÀ£kÒOX·™sß—“fêIùk—†<6©{[õzuÃüçà5¸W} µ—Em«(½‚öWEm·^¯„ÍŠv²Ï˜ªS6“„*°iY2qh·HÈ|NÁõÕúG§¤HšëÖHñµ’):àR âÈ¡–}j.•¬†E»êv×µ@1G³”Êb“–ÈêÂ¶N€Ê]™’q'”±P‹ØM¹ø‘¦1Ãº‰+n;Øûxm%ø}ð0úG,_VŒ6q;zVLsÌ½k–Ô6j¯1ç]Îß`5å•pˆl›Â½ÆkàUÏÜ'¬00Ø½~öY‰¬©Ëœ”“z´XRVŽ6?õÊÅ•“€È&aEaµè!Î‹c¹}ËìóˆÉL%j[®HÓ]Htd¦ôÜ®/wI†,qÖ¥i F®*kèèþÕøDqºÙW3ß`þ©êˆ.Úw=Y.½fž2ëÌKZÖñ¦GÉ<Ÿˆ9$Ø¡pù#gk> W%!:Žçèt©#ÆÔ"ƒƒU~–¸’¿šµÚVù<±"ä"òXNas•øý$i€¨3Õ¬·>i¦_Õ6WÅõrQËªåQ‡C%œÙyÙ)…lÒòºmŽ™OÅÉ”s¼•Ÿ“ìý|ò÷ÑC'ÔÚwùõ'Ygçô8Ú<áZ›í_¯ò´J- .xwø„*¾‹…œ€õ‘â;°`Ð|Ê£íí» ‡ƒþmÛql»ÕøñÓÁáþåþ'ÇiaãÚÕ_õ´‹üõC³OI¦”I„~µ0ÑpFUßÚ³ÚŽUµb(Ÿ%¬Ëo¡ê¸ý`FìBUX{_--ô#uGG‰kA÷ÎÇƒóð ÷ã«wÿ•þ>è½ ¶w½_Þ~<Œ/6?ü1ŒÞ}8í¥ÁÕ[  °WQã:l"ko£:Þ–mà¥Žbç-µe;¦nÑúoã´s÷ÒßÝÚS›Ý`±KÆ–K³7ª»Éd©vO³?´ó ¢=‡X–Ü»Ï‡›ðÃíŽ¹4 %‡:…Ò,†öÄj0üL;Ã‡€—ÙRà…Z ªì@XXÍ·ª…\¹âM¢¬=™4Êž3¨HúÝ1j”Ì[8°HÒÍ7Q=‘S{àR\‰“Û.ò`í"v/âÍÌt’k\:_• o²WóI%¢ÚÓy©qôFö1‘GJÕù£v)´`}fùv‘j¥ˆî   ™e|ÚÙŸ{BëtN{,±sÈ}KÞŸÌƒ˜9?È>÷ðU Ó!”Ù&lýDK¿\Ù‹DÄòÉrŒ¼wjÿžÊï#:£|R¿[ý\hD¼§ùö Ûs]èŒæeŽ`s‹À¶4tŠ<ì¾6:òÉQwä‰~€ÿ²ž¿áyQKÅpümÓfLå'Ù7x†¬¼¨yœf«á+Ûp#%ºÙ%Ä [·@ÿ /¡ôØoY!ûŽ¿ð)Ià¦øÚŽp¿iåXD?‹lZƒµ(ˆG4°Ç›•&«uÐ"¶¬9seN   UP’Cú¸§Ë˜FÅÞ Vk#\ë÷£“äŸÿìC7î³†ß‰i79ó—S#%Æ Ê––r¬nÊ”Œ",–Ð J5)ÓViavy"a· ’Ï|â'"öÅY§ÙR„¹ˆ;" 8.Ï,—©ob ,ãÓð“Õº\ãú…•É”ŽíP«zmŽ$*ÈÌábÈîZÑ—}FD4‡Ï äßÓ4!X¼×"(´š0†úÄÏR€×È‚f…ûOhŒc«u†Ÿ»&o¶ô¿ø,åÐÎq!‚²&£ÂÖkhÏÜ½¬CŸ7=e§_‡Õ*McÑ¢AÌÚ5˜Âl}cqáæ–5¬ÍPÚû¤dó` ¢žQü37öqëâòã#²rHÞì_¼{zBÞœž“w§¿5œx;S•¢˜LÞó ivtà`AŒ(f[zI–IxžLÃßÌ+õ9ÆªsYF=›£;%ý¬«´d   §5¼µ¡a  Má˜Ð!   „ˆg…ý ~Çc;/³Pã-+‹guƒƒ Ï@ë8]lxº7Ì Ç  ë–™”…{–«ÝÈÊTm~¯Éz¹Y‡c˜Îm6Íúœcgƒ….øÇÉ.oºh8šØLM8F3¬ÖÑ¨§Ì}F„¾8hÏVÔÏ¥Õ×ÎÊ¥Q„âåÔ¬ˆõ§ýó÷ót]J&¤¡-K%þ.Üá!œÓî“NÌ_u9>·É!í3ù€Î†9$Ï?Ò—·§¾¸PÍ7¨ùP%…¸B¹â@ïÈf”Ev]ˆ   ÈduYYÃ!^gø¾ß©ß%å´=˜fúcšÌ&Ü{“Êö&Ø_‹mj´/¹ø«iáÿÑÍéUi) Ì-LpüÂò‹i´–fÇyk‹ñéãRZ`RùË¡¤=]éB›g°K»©·¼t1œå6Æáf³ùÀe5Ó°vfÖtÙ¬&Oókw»¸g6ª3Œõ¹wžöì×‚ª•ûð9æõ×¾#ƒùHô\,s.ÇKÛÚ]æ¶5Ó=(0ö8ÓË/’¦.Ë²_áÖW0w;¼ïnŸû‘×É1lI×Ççwïÿ¼&ºí¦RD]æê© ôóÜ~o8K`UàwüîŸÑüâÄ÷”„ åÿ¹c¼IÂb&žÍðVÝv…POðšcc³dÿ†FÄsB[¼…Û|l3ÚÆß>7f2ÏiD'-ñí‚¥SH‚ÂaÊüÜšÁq!ÓÌ¾,16S¦9I7)‰S®Ìºb”Kç §¯ŠÜ`œðõ†¶ÄgßxYˆ9YÝD.ò¦±Äé\ ÄPÚPó¹¾ˆ±Z—ØBþ†ñ/ä h¿/¾¬+ÀÎ_ ‚kPiÙ±¸7Ä+&ÓžÑ8×½äL÷N¤9—°Ò¼_Ö§–Y‹mÏ0õÙ¶¸1f‹*b7šÈ4ô»güS+x;Añíû(NÕQHy°’¥.ÞœºŒ(ADš|c0|cB!lëN‹,oÖ£‡½ööŸÂ¶Iþ'uÀƒ$a‘g±)sY„j9ñ  ™ê*RùJ FTÄB”Çbe{}šHŒ±>\¾±w,æ1]ëñà’C¢K˜Ã³ñ^¿&E¯3i_žkXYÏ‘þŽïD:Á?ö’0¿¸¿ìs<1#z(äÝ5«õïÅu1   °YŽVTz`„‘ÍþŠ)hê›uÉÿ_ÌÅ…ô´ÓÃÜÜÆæŽ5Æâ##î\4fí”©ÂDÀ!ªD7o0”E\Ð½MY™L>ÞiáísßgQŽGvÜ”~ö‹£†?<¦    lÀ'[gþßøûm/¾Ýýø×ôìXþöúUxö·íŸÅîéÉka„¸ƒJ  ÿÈx:Úx:zÀvI ›ZÚ\×™µY>ÜóLÄ-žˆ‡ÙMÊ?ÿ›Œÿ‰©r ³v¶!7|ªïKðdý/oþŽ¿;K

I also change the permissions of index.php but nothing works for me.
Also my index.php works, when I write die('test') in index.php it displays "test" on the page. I think the problem is in these two lines of code in index.php,

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

If any one know how to fix this error, Please let me know I'll be very thankful to all of you.
Thanks in Advance...


texts: How to change an existing theme to a responsive bootstrap theme?

texts:
I wonder how to update an existing non-responsive Drupal 7 theme to a responsive bootstrap theme? Any hints for that?

The following steps are required:

Install bootstrap theme.
Create a bootstrap subtheme.
Make sass tools ready to compile scss files.
Start theming.
Create a new bootstrap subtheme that looks like the old non-responsive theme.

So how can I create such a new responsive subtheme?


texts: How to write PHPUnit test for any function that has external dependencies?

texts:
I have 1 function that returns value of any field of particular content type. For this I need to load my current user and a node from where I will retrieve value.

But loading user calls User class and when I run the test, it says undefined method - user_load.

My function is:

public static function get_ctype_field_value($field) {

    $user = user_load(\Drupal::currentUser()->id());
    $ulm = get_type_id($user); // another function in some class, return value 445
    $local_market = \Drupal\node\Entity\Node::load($ulm);
    $llf = '';
    if ($local_market) {
      // Get the field value from the LM.
      if ($local_market->hasField($field)) {
        $localmarket_field = $local_market->$field->value;
      }
    }
    return $localmarket_field;
  }

AND my test function is:

class MyControllerTest extends UnitTestCase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = ['node'];

  /**
   * Users to use during this test.
   *
   * @var array
   */
  protected $users = [];

  /**
   * Nodes to use during this test.
   *
   * @var array
   */
  protected $nodes = [];

  protected function setUp() {
    parent::setUp();
    $container = new ContainerBuilder();
    $methods = get_class_methods('\Drupal\Core\Entity\EntityManager');

    $entityManager = $this->getMockBuilder('\Drupal\Core\Entity\EntityManager')
  ->disableOriginalConstructor()
  ->getMock();

  }

  public function test_get_ctype_field_value() {
    $originalString = 'field_vat';
    $expectedResult = '10.00';
    $econtroller = new myController(); //controller where function resides
    $this->account->expects($this->once())
      ->method('user_load');
    $this->users[] = $this->account->load(1);
    $result = $econtroller->get_ctype_field_value($originalString);
    $this->assertEquals($expectedResult, $result);
  }
}

Please suggest any way to write PHPUnit test for this function.

The error I'm getting is:

  Error: Call to a member function load() on null


texts: How can I get $_POST data in a callback?

texts:
I've implemented hook_menu roughly as follows:

function sample_menu() {
    return array(
        'path/to/things' => array(
            'page callback' => 'callback_function',
            'access arguments' => array('access content'),
            'page arguments' => array(),
            'type' => MENU_CALLBACK
        )
    );
}

I want to be able to post data to this url. So says $_POST is the following array:

array(
    'data1' => 'value1',
    'data2' => 'value2',
)

How can I access $_POST['data1'] and $_POST['data2'] inside the callback? Directly accessing $_POST seems to not work (it's var_dumped as empty).


texts:
I've got a Date field in Drupal that I want to preprocess. Unfortunately

$node->field_date_time->value;

Gives me a value off by one hour (8:00 when expected is 9:00). I believe the issue has something to do with the way Drupal stores the date vs how it displays it later (taking into account Timezones). I tried passing in the default timezone to the DateTime object but that didn't help. I also tried using the \Drupal::service('date.formatter') to format the date but the result is still off.

When debugging I found that by using:

$node->field_date_time->date

I can see the expected date under a protected DateTimeObject property (see screenshot).

Does anyone know how to extract it or maybe there's something else that I'm missing? I'm running Drupal 8.1.9


texts:
Im using smartip to show taxes to users by country, but I have a problem:

If a user is browsing the web with a USA IP but the order address is France?

So I have to use two conditions when calculating product price:

One user IP is in USA
And order address comparison is USA.

This doesnt work, I suppose when calculating product price the order is not complete, so i dont know how solve it.


texts: help using hook_url_outbound_alter() to append "#id" to node/edit url

texts:
My node/edit form pages are long. When the user visits the node/edit page, I wish to direct the user toward the interesting part of that page. This part of the page has the id :   <div id = "my_id">

I try to use hook_url_outbound_alter to change the path node/xxx/edit into the path node/xxx/edit/#My_id

I began testing for a specific example with the code below. But it doesn't work : the path stays as original.

function MY_MODULE_url_outbound_alter(&$path, &$options, $original_path) {
  if ($path == 'node/17609/edit?destination=node/17592') {
    $path = 'node/17609/edit?destination=node/17592#my_id';
  }
}

(I think that the Pathauto module could have done this but I can't install it on my website for incompatibility reason)

Thanks for your help


texts: How to avoid duplication of data using feeds module?

texts: I've set up a CSV importer using the Feeds module. My CSV is not a drupal file but one that i have, of my own. I've mapped the name of the coupon(a column in my CSV file) onto the title of my content type "coupon". This is just a test run. On importing the same data twice, it's being duplicated. I want the repetitive data to be deleted. Can someone help please?


texts: Rule to create a new view when a node is created

texts:
I have an event registration site that uses the Entity Registration module for its registration forms. There is also an admin section that uses the Views Data Export module to export all of the registration details.
The trouble is there is no views field (like there is with Webform) that says get all fields from this registration.
As the site hosts multiple events throughout the year, it means that I have to create a new view for each event.

Is there a way to use rules to create a new view or (preferably) view display when saving a node of the Event type.