texts: Database corruption after trying to reinstall Rules Module

texts:
I was getting a database error when trying to op the Rules UI so I tried to reinstall the module. I uninstalled the Rules Modules and Rules UI module then tried to install the Rules module and now every page of the sites gives this error:

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;sgda_arcade.rules_config&#039; doesn&#039;t exist: SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.access_exposed AS access_exposed, base.data AS data FROM {rules_config} base WHERE (base.plugin = :db_condition_placeholder_0) AND (base.active = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] =&gt; reaction rule [:db_condition_placeholder_1] =&gt; 1 ) in EntityAPIController->query() (line 152 of /srv/arcade/sites/all/modules/custom/entity/includes/entity.controller.inc).

Additional

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;sgda_arcade.rules_config&#039; doesn&#039;t exist: SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.access_exposed AS access_exposed, base.data AS data FROM {rules_config} base WHERE (base.plugin = :db_condition_placeholder_0) AND (base.active = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] =&gt; reaction rule [:db_condition_placeholder_1] =&gt; 1 ) in EntityAPIController->query() (line 152 of /srv/arcade/sites/all/modules/custom/entity/includes/entity.controller.inc).

Is there anything I can do to fix this?


texts: How do I completely overwrite an array in JSON serialized data field

texts:
I am storing an array as a JSON encoded serialized data field in Drupal 7 using the Serialized Field module.

If I have an array of 20 elements and try to overwrite it with an array of 10 elements, I would expect to only have 10 elements in the field. But instead I am getting the 10 elements (keys 0-9) from my new array AND THEN the higher keyed elements from the old array (10-19).

Is there a way to empty out the old previously stored array values before writing the new array values?

I have tried the following but nothing completely overwrites the field:

$node->field_test[LANGUAGE_NONE][0]['value'] = "";

$node->field_test[LANGUAGE_NONE][0]['value'] = NULL;

$node->field_test[LANGUAGE_NONE][0]['value'] = array();

$node->field_test[LANGUAGE_NONE][0]['value'] = array(NULL);

$node->field_test = array(NULL);

$node->field_test = NULL;


texts: Error adding one content type. Bundle missing in term references

texts:
I've got a problem on a Drupal 7.14 site when trying to add a new node to only one content type.

I get the following error message in the log:

EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7389 of /homepages/33/d169792374/htdocs/sites/yourfutureinautomotive.com/includes/common.inc).

I've tried the fixes outlined here as well as removing modules one by one and I'm not getting anywhere.

I've even reverted back to 7.8 to make sure I was on the same version as other people who were having the issue.

I'm open to any ideas or troubleshooting hints.

Ta

EDIT

As per @mojzis suggestion below I used the Devel dpm function. The following was output:

EDIT 2

vid: 14 is the problem. There is no vocab with vid of 14. Trying to hunt down a reference to it anywhere but not having much luck.


texts: How to send mails to users with bulk operations in drupal7

texts:
I want to select some users from a view with the field VBO , and to send to this users an email which cotaining a subject and a body. How can I proceed?

Thanks for the response.
I'm a new user of drupal and my authenticated user have to send a mail for selected user with VBO, and have to enter the contents of mail. (subject + body). After confirmation the system send to selected users the mail.


texts:
How do I modify a commerce product before saving or alter the validation?

Specific use case: SKU field of commerce product is required but I want users to be able to leave this blank and have a SKU field auto generated and filled into the field automatically before saving the product.


texts: What is the hook to alter links in the Book Outline tree?

texts: What is the theme hook to alter links in the book outline like theme_menu_link__menu does for menus?  Or is there a way to make theme_menu_link__menu apply changes to a tree view of the Books?  Not the book navigation but the Outline.


texts: Is there a means for telling which module or template files generated a block?

texts:
I am trying to find out what code generated a faulty looking devel block and want to know if there is a module that can tell where a block was generated or some other means.

Is there a module for that, something like the Module Summary, but with info on blocks?


texts:
I have a form with a set of radios. Each radio should have a corresponding button that 'deletes' the radio:

Radio1
    --delete button 1
  Radio2
    --delete button 2
  ...

How do I pass along index information when I click on a button? Buttons do not have convenient indexed values like the radios so I can't do something like

$index = $form_state['triggering_element']['values']

The only method that works at the moment is comparing the #id of the delete button one by one with $form until I find a match. What is a better way of going about this?


texts:
I imported the content of a website from Drupal 7 to Drupal 8, but some nodes contain something like this.

[[{"type":"media","view_mode":"media_large","fid":"403","attributes":{"alt":"","class":"media-image","height":"187","style":"display: block; margin-left: auto; margin-right: auto;","typeof":"foaf:Image","width":"480"}}]]

In Drupal 7 this is fixed by setting the filter "Convert Media tags to markup", which does not exist in Drupal 8.

How can I fix this in Drupal 8?


texts: #lazy_builder is rendering without a placeholder, and is cached like normal

texts:
I’m trying to use #lazy_builder to insert dynamic content into cached pages, but the content always gets rendered without a placeholder, and cached - what am I missing?
function my_theme_preprocess_node(&$variables){
$variables['events_dynamic'] = [
      '#lazy_builder' => ['events_dynamic', [NULL]],
      '#create_placeholder' => TRUE,
      '#cache' => ['contexts' => ['user']]
    ];
}

// In my module
function events_dynamic($layout) {
  return ['#markup' => 'THIS IS DYNAMIC CONTENT'];
}

Dynamic page cache is enabled and internal page cache is disabled


texts: How do I create an instance of an entity with all its fields attached?

texts:
I am trying to create an instance of 'commerce_customer_profile' entity with all the extra fields of the customers address.

I am doing this inside a FeedsProcessor that will import users and their addresses from Magento.

I don't want to have to create a fake $form_state array and then use field_attach_submit() as it doesn't seem right to me.

The only other way I have found so far is:

$billing_profile = commerce_customer_profile_new('billing', $entity->uid);
commerce_customer_profile_save($billing_profile);
$full_billing_profile = commerce_customer_profile_load($billing_profile->profile_id);

$entity is the current user being created.

Which will then give me an empty instance of the new entity ready to populate and save but again it doesn't feel right.

Any help appreciated.


texts: How can I download a results set with a form built in Entity forms?

texts:
We've tried entity forms for a project and the client wants that collected data in a spreadsheet. (This was never a mentioned spec before the project.)

Is this possible? Is there a way to download entity form submissions to a CSV or spreadsheet?


texts:
While using Simple Hierarchical Select Module, I have 2 levels of Hierarchy for my Phone.

However I want to add the label for Child list like:

Is this possible? then how?


texts: Ajax based dependent exposed filters in view

texts:
I have 5 content types viz CType1, CType2, CType3, CType4 and CType5 .

In CType1 I have two fields
Field A
Field B

In CType2 I have two fields
Field C (node reference - Field A)
Field D

In CType3 I have one fields
Field E (node reference - Field D)

In CType4 I have one fields
Field F (node reference - Field D)

In CType5 I have one fields
Field G (node reference - Field D)

I have created one view and in that view I have created views exposed filters ,Here I am filtering data based on filter (drop down selection) selection.

Here I have to load second drop down (or second filter values) values based on first drop down value and third drop down value based on second drop down value.(like hierarchical select)
Here all drop down values are node references values (From above content types).

I have tried views dependent filters module for this, but no result.

Any help will be appreciated?


texts:
I have a really horrible intermittent bug where a collection of nodes will reset to a previous revision.

Here is an image of the revisions tab on the node:

There are three unusual aspects:

The 'current revision' is at the bottom of the list and has lower vid than the rest.
The date of the 'current revision' is yesterday but the low vid implies it was created a while ago.
The revision log says "Updated by FeedsNodeProcessor" yesterday but the Feeds log tells me "Last run 1 week ago".

I'm hoping someone can point me in the right direction on where to look for a cause since I can't replicate the behaviour.

It feels like the vid in the {node} table has been changed. Along with the created date and revision timestamp.  I'm really not sure how that could happen, though...

EDIT: Current Hypothesis

I have a custom module that updates a field.  It uses a cron queue, so I'm wondering if the queue contains stale node data:

/**
 * Implements hook_cron().
 */
function ih_transcript_import_cron() {
  // Load all Video nodes.
  $videos = ih_transcript_import_load_video_nodes();

  $queue = DrupalQueue::get('ih_video_transcripts');
  foreach($videos as $video) {
    $queue->createItem($video);
  }
}

In my queue's 'worker callback', I should probably reload the node in case the object has been left in the queue for some time?  And ensure I set $node->revision = TRUE before node_save?


texts: Customizing the Tag page shown by default in Drupal 7

texts:
I made a field in one of my content types as Tags. On the site, they are shown as follows:-

mytag_1, mytag_2, mytag_3.. When I click on either of them, they show me all the pages which are tagged with the clicked tag. How is it doing is beyond me, as I didn't even enable the view.

This is the URL it uses:-
www.mysite.com/tags/mytag_1

Now, my question is how can I customise it. Now it uses node.tpl.php and shows all the pages. I wanna change the layout but don't know how to, as I don't know how these pages are generated.

I also tried making pages as node--tags.tpl.php but to no avail.

Any help?


texts: Change 'Log in', 'Log out', 'My account' menu text

texts: Is there a way that the default text in the account menu can be changed within the theme?


texts:
I have twig variables inside an array called social_media that contain colors.
When I perform {{ dump(social_media) }} I can see all the information like so

array(10) {
["facebook"]=> string(39) "https://www.facebook.com/myfacebook/"
["facebook-color"]=> string(7) "#2d5f9d"
["twitter"]=> string(33) "https://twitter.com/mytwitter"
["twitter-color”] => string(7) "#51acef"
["youtube"]=> string(56) "https://www.youtube.com/channel/myyoutube"
["youtube-color"]=> string(7) "#e52d27"
["instagram"]=> string(35) "https://instagram.com/myinstagram"
["instagram-color"]=> string(7) "#f77737"
["linkedin"]=> string(83) "https://www.linkedin.com/company/mylinkedin"
["linkedin-color"]=> string(7) "#0077b5"
}

Performing {{ social_media.facebook }} works fine like so

https://www.facebook.com/myfacebook/

but {{ social_media.facebook-color }} outputs

int(0)

In fact every single color variable outputs this same value, while the others work fine. I considered the possibility that the # was causing a problem, but changing the colors to colors like 'Black' or 'Red' as a test, but I received the same outcome. I even tried using

{{ social_media.facebook-color|raw }}

But that did not have any effect. What could possibly cause some of my twig variables to only output int(0) while others output just fine?


texts: Hiding a View if empty when contextual filter is already used

texts:
On my content type "page", I give my client the option to upload a sidebar image while editing the page fields. In the manage display of the content type, the image is hidden.

I have a view in the sidebar that shows the side bar images. I placed a contextual filter of Nid, and set it to provide a default value using the Content ID from URL, meaning that only the sidebar image for that page will be displayed.

This works sweet, but on pages where a sidebar image isnt uploaded, the sidebar is empty, but the views headers are there, and forcing the main content to be pushed to the left as if the sidebar region has content.

Reading other solutions, people have used a contextual filter of Global: Null, and set the view to hide if empty. But this isnt working for me, probably as I am already using a contextual filter to determine the content from the URL.

Other advice of setting the "no results behaviour" of the field doesnt do anything, the empty block still renders because it has nothing to do with fields, it is only printing the view headers.

I'm a bit stumped! Any ideas?


texts: Creating slightly different sites using same code base

texts:
We are looking to create templated sites that have the same basic structure with the following differences. We would want to look up which site is being created based on domain/subdomain.

Same navigation, but links to different node. ex: About Page has different content
Different logo/header throughout the site.

Is there a module or suggested approach to do this?

NOTE: We want to use the same codebase and database.


texts: How to bulk add information to the profiles of users?

texts: I have hundreds user profiles where I want to add a one or two fields like the adress of the company they work for. For some group of users this adress will be the same and for others it will be different. How do I mass bulk add these kind of informations? Through the database? (I'm on phpmyadmin)


texts: How to programmatically render a node's teaser using the theme layer?

texts: How do I programmatically render a node's teaser using the theme layer?


texts:
I'm using views php to printing, and calculate some dates in my view.but when I try to print a date (06/01/2015) in the global php field it printed like: 16831 which is the node id
Value code:

  $load=$row->field_date_loading;
  return $load;

Out put code:

  echo $value;


texts: Content block doesn't show when query is added to the URL

texts:
I have a Drupal 7 page where some of my content blocks don't show up, if there is a query added to the URL.

Say my block is main_content, and it is shown all all pages except the listed ones, where no page is listed; the block appears correctly on on www.mydomain.com, but not on www.mydomain.com?gclid=xxx.

This is an issue for me because Google AdWords banners are linking to my page with a query attribute, and then the page does not display correctly.

What could be the issue here?


texts: How to have a separate image style for an image field for the 1st views row?

texts:
First I tried with views_conditional (which was already installed on the site) to check for 1st row and output the specific image but it does not seem to work as per this issue

Ideally I want to do it without installing an extra module.

I tried with THEMENAME_preprocess_views_view_field but the image was already rendered at this stage.  Have used the somewhat hackish str_replace but it does not actually work.

function THEMENAME_preprocess_views_view_field(&$vars) {
  if($vars['view']->element['#name'] == "free_write"
      && $vars['field']->field == "field_main_image"
      && $vars['row']->index == 1
      ){
    $html = str_replace("teaser_media_small","teaser_media_medium",$vars["output"]->__toString());
    $vars["output"] = Drupal\Core\Render\Markup::create($html);
  }
}

what is the proper way to do this in a preprocess function or perhaps in a twig template ?


texts: How to update multiple fields using ajax?

texts:
In content type there are three field . Each field are node reference to different content. Here I want to restrict value and create dependency on these field.
For example: I have one auto complete field "Country". On change of "Country", select list(i.e. State) field value is updated. On change of "State", "county" field is updated.
Everything is working fine.

When I change value of "Country", "State" value get change But "county" value hold previous value. How should I achieve this. How should I reset value of county

My code snippet is like

function module_form_alter(&$form, &$form_state, $form_id) {
  $form['field_country'][LANGUAGE_NONE]['#ajax'] = array(
    'callback' => '_state_list_callback',
    'event'    => 'change',
    'wrapper' => 'state-list',
    'progress' => array('type' => 'throbber', 'message' =>  'Please wait...'),
);
  $form['field_country']['#prefix'] = '
';
  $form['field_country']['#suffix'] = '
';

  $form['field_state'][LANGUAGE_NONE]['#ajax'] = array(
    'callback' => '_county_list_callback',
    'event'    => 'change',
    'wrapper' => 'county-list',
    'progress' => array('type' => 'throbber', 'message' =>  'Please wait...'),
);
  $form['field_county']['#prefix'] = '
';
  $form['field_county']['#suffix'] = '
';
}

function _county_list_callback(&$form, &$form_state) {
  return $form['field_county'];
}

function _state_list_callback(&$form, &$form_state) {
  return $form['field_state'];
}


texts: Many to many relationship between nodes Drupal 8

texts:
I am planning to create an app in Drupal 8 that uses a many to many relationship between nodes (Team and Players) where a team has many players and a player can have one or many teams; I am not sure if I need to create a custom table to keep their relationships or to create an entity to do that. In several posts I have seen that entities is the way to go, but since it is only to keep track of the relationship between nodes, it looks like an overkill, since, for the most part, the relationships will be created automatically.
Thank you!


texts: Is there a way to avoid the loss of EXIF data when resizing images on upload?

texts:
In Drupal 7, when editing a core image field, under Maximum image resolution, it states:

  Resizing images on upload will cause the loss of EXIF data in the
  image.

Is there a way (module) to resize images on upload without losing EXIF data, or is it in the nature of server-side resizing that this data will be lost?  I'm trying to keep the orientation of my pictures correct (resized pictures often appear at silly angles) but I also want to keep file sizes down at the same time.


texts: Drupal 8 what is the ajax event for auto complete dropdown?

texts:
Drupal 8, what is the ajax event for auto complete dropdown? i have created form alter, there i am altering my form field that is auto complete field, so now what is the ajax event for this auto complete drop down.

change,
select,
keyup all are not working for this.


texts:
My feeds importer is acting very strange and running the same import multiple times..

This is what my importer looks like:

class FeedsASUNewCareer extends FeedsCSVParser {
  /**
   * Implements FeedsParser::parse().
   */
  public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
    global $user;
    $source_config = $source->getConfigFor($this);
    $state = $source->state(FEEDS_PARSE);

    // Load and configure parser.
    feeds_include_library('ParserCSV.inc', 'ParserCSV');
    $parser = new ParserCSV();
    $delimiter = $source_config['delimiter'] == 'TAB' ? "\t" : $source_config['delimiter'];
    $parser->setDelimiter($delimiter);

    $iterator = new ParserCSVIterator($fetcher_result->getFilePath());
    if (empty($source_config['no_headers'])) {
      // Get first line and use it for column names, convert them to lower case.
      $header = $this->parseHeader($parser, $iterator);
      if (!$header) {
        watchdog('CAREER IMPORT ERROR', "Could not parse header");
        return;
      }
      $parser->setColumnNames($header);
    }

    // Determine section to parse, parse.
    $start = $state->pointer ? $state->pointer : $parser->lastLinePos();
    $limit = $source->importer->getLimit();
    $rows = $this->parseItems($parser, $iterator, $start, $limit);

    // Report progress.
    $state->total = filesize($fetcher_result->getFilePath());
    $state->pointer = $parser->lastLinePos();
    $progress = $parser->lastLinePos() ? $parser->lastLinePos() : $state->total;
    $state->progress($state->total, $progress);

    $careers = array();

    watchdog('careers', '
' . print_r($rows, TRUE) . '
');
    foreach($rows as $career) {
        // create career.
        $node = entity_create('node', array('type' => 'careers'));
        $entity = entity_metadata_wrapper('node',$node);
        // Set Entity properties
        $entity->title->set($career['alternate_title']);
        $entity->language = 'en';
        $entity->author = $user->uid;
        $entity->status = $career['status'];
        $entity->body->set(array('value' => $career['body']));
        $entity->field_alternate_title->set($career['alternate_title']);
        $entity->field_career_category_image->set($career['car_category_img']);
        $entity->field_careercategory->set($setCategoryId);

        // Save Career
        $entity->save(); //Save new Entity wrapper
        $node->tnid = $node->nid;
        $entity->save();
      }
    }

    // return empty set.
    $ret = new FeedsParserResult();
    return $ret;
  }
}

When I go to Content > Import and select this Feed Importer to use, it just gets hung up on the processing page and in my logs I can see my watchdog watchdog('careers', '
' . print_r($rows, TRUE) . '
'); executes over and over until I stop it. Keep in mind that watchdog is not in a loop, so the feeds importer is just running endlessly until I stop it.

What could cause the importer to act with such behavior?


texts:
I have an custom content type movie.By which users can create "movie" content.
The movie content type is simple containing a title, director's name and a poster.

Now,what i need is,  Each user should be able to create lists of movies.As example , one may create "10 most scariest movies" , "10 most comedy movies" etc.

I want the creation of list in the following way ,

1) User will give it a title to his list.

2) Then he will add movies to his list , which are already crated .(like the way one user can tag other user in facebook - user should be able to tag movies.)

3) After the list is created when a movie on a list is clicked, it should lead to the page of the corresponding movie.

How should i solve this problem??

I am using Drupal 7

Thanks in advance


texts: How do you contribute patches to Drupal core?

texts:
What is the proper process to contribute patches to Drupal core?

Let's say I find a bug in Drupal core, fix it, and create a patch.  How do I submit it?

If the bug is in Drupal 7, do I have to also fix it in Drupal 8, and submit two patches?  Does this also apply to documentation bugs/improvements?

Do all patches also require a unit test?


texts: Passing data-dialog-options and data-dialog-type dynamically to an  tag not opening modal

texts:
I'm trying to create a dynamic way to open a modal window in drupal. The current structure work like this.
Testing 1
For that to work and open the modal, I had to add via inline
data-dialog-options="{&quot;width&quot;:800}" data-dialog-type="modal"
What I want is to add the data-dialog-options and data-dialog-type dynamically when the use-ajax class is added to the element.
I tried:
jQuery(document).ready(function() {
    $('.use-ajax').attr({
        "data-dialog-options":'{&quot;width&quot;:800}',
        "data-dialog-type":"modal"
    });
});

And even thou it added the attributes to the tag, it is not opening the modal:
Testing 1 ```


texts:
We have a lot of languages on the site and a node needs to be translated in every one of them.
We create the node in English and then some people translate the content to their language. So when there is no translation available the content remains in English. The translators only have edit permissions for the nodes in there language.
To not have to give them more access we create the nodes that should be translated.

Now when creating a node we have to click translate several times to create a node for every language.  I'm looking for a way to do this in one click.

One way i was thinking of this is by selecting the node to be translated and do something like the existing bulk operations to translate them.

Or by using rules to create a translation for every language when the node is created.

Anyone with experience in this field?


texts: What is the proper way to return the results of custom module's form submission?

texts:
After spending hours and hours online researching, I'm more confused than ever about something that seems like it should be a very straight-forward task - Using my module's custom form, How do I display the results of a form submission that queries the db?

Here on d.se, Clive and Kiamlaluno provide 2 approaches. Clive suggests using a multistep form, and Kiamlaluno suggests making values globally accessible by storing them in the $_SESSION variable.

Clive's approach doesn't make much sense to me. I'm not trying to print the value of a form field (after checking if it has been submitted), I'm trying to print a list of items retrieved from a database.

Kiamlaluno's approach seems a bit more workable. Indeed I could query a db, store the results in the session, and return those as the return value of a page callback on another page. Ultimately, however, this seems awfully convoluted. First, if this were indeed a best practices way, then why don't more tutorials discuss details about it? What logic would be used to set and unset the variable? PHP is horrible at handling large arrays - what if I have a large result set? How do I handle pagination if I want to divide up the result set across pages? Also, isn't the session variable available only to logged in users?

Looking at Views, Views exposed filters seem to use URL query strings. Is this the correct way? After a form submits redirect to another page, append the query string to that page, pass those parameters 'page arguments', and then query and return data in the page callback based on those arguments?

On Drupal.org there is a thread that has almost 4 years of activity from people confused about this very topic. This comment says that you have to create a $form_state['storage'] variable and "then print it in your form definition." What in the world does that mean?!?!?!?

So, I'll pose my question again. I want to query a database using a form in my custom module, and I want to return a list of results (preferably paginated).

How can I accomplish this?  I'm looking for an extremely thorough answer that I can play with in practice.


texts: Unable to access Admin panel of Drupal site at Localhost, migrated from server

texts:
There is one my online website in Drupal. I did a Setup on Localhost for Testing Purpose. But unable to get it working correctly.

Using WAMP
Used Migrate tool.

I tried:

Deleted .htaccess file.
Base URL set.
Tried to access all possible Admin URL, sitename.com/admin .
Clean URL disabled on localhost.

Problem:

All pages working fine that means FRONT END IS FINE. But while accessing BACKEND for user or admin is just not working. It says PAGE NOT FOUND.
When I use admin URL as following:
sitename.com/?q=admin  = It redirects to https://localhost/sitename/?q=toboggan/denied&destination=admin

I'm not sure how it is adding https. Page says: unable to connect
If I use sitename.com/admin it says: "Page not found".

Please suggest the solution.


texts: More efficient use of function by storing the result?

texts:
So I have a custom module that is simply one function that during Commerce checkout goes through the order or cart to create an array saying how many "products" of type 'event','donation' and 'product' there are in the cart.

Now this all works great and I use it to do multiple things such as:

Change the title page of the checkout if someone is "donating" rather
than "purchasing"
Show or hide certain checkout panes depending on whether a 'donation' or 'event' is in the cart
Render a checkout progress bar which shows certain checkout pages, again dependent on the product types currently in the cart.

My issue now is that on render of the Checkout Details page I have this one function executing 4 separate time. How would I go about triggering it once for each load of a page and storing the array in a place that can be accessed by multiple modules and template files?


texts: How do I begin to debug an EntityMetadataWrapperException error on searches?

texts:
When trying to run a drush cron on a Drupal 7.54 site, I see the following error.

$ drush cron

  WD cron: EntityMetadataWrapperException: Invalid data value given. Be
  sure it matches the required data type and format. Value at node(): .
  in          [error] EntityDrupalWrapper->set() (line 756 of
  /var/www/html/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
  Cron run successful.

A similar error occurs in WatchDog  when we try to search on any term:

$ drush wd-show --tail

  641742  15/Feb 15:47  notice  search  Searched Content for test.
  641743  15/Feb 15:47  error  php   EntityMetadataWrapperException:
  Invalid data value given. Be sure it matches the required data type
  and format. Value at node(): . in EntityDrupalWrapper->set() (line 756
  of /var/www/html/

How do I begin to even understand how to investigate such an error? This seems to be an issue for a few other people too.

Misc:
In this instance of D7.54, we have enabled: Entity Reference (entityreference) 7.x-1.2, Entity API (entity) 7.x-1.8, and - Entity tokens (entity_token) 7.x-1.8. We also running on RHEL 7.2 with PHP 5.4.16.

What I've tried so far:
I have commented out this section of code (using a development copy):

<?php
/**
       * Overridden to support setting the entity by either the object or the id.
       */
  public function set($value) {

    if (!$this->validate($value)) {
       /*throw new EntityMetadataWrapperException(t('Invalid data value given. Be sure it matches the required data type and format. Value at !location: !value.', array(
        // An exception's message is output through check_plain().
        '!value' => is_array($value) || is_object($value) ? var_export($value) : $value,
        '!location' => $this->debugIdentifierLocation(),
      )));*/
    }

But this is obviously not a sustainable exercise. It does seem to at least produce the results.

Question:
Short of changing the module code myself -- not a great option -- what other options could I employ? Is there a way to rescue search page without directly editing this module?

Update: So this works if I allow searches only on users. The error is thrown when Content is searched.


texts: How to increase the speed of exposed autocomplete field in views using drupal 6?

texts: I have an exposed auto-complete taxonomy filter, It takes time(2sec) to load the values. How to increase the performance to load the values quickly and I'm using views 2.x.


texts: Getting data out of Profile2 with field_get_items()

texts:
I am trying to access my profile2 fields in template.php. I get profiledata, but I also get an error message:

  EntityMalformedException: Missing type profile2. in entity_extract_ids() (row 7663 of /includes/common.inc).

Should not the entity type in field_get_items() be 'profile2', or is it another value?

$profiledata = profile2_load_by_user($variables['comment']->uid);
$lastname = field_get_items('profile2', $profiledata, 'field_lastname');


texts: Drush API for downloading module from a script

texts:
I am trying to download module using Drush API via drush script as following:

#!/usr/bin/env drush
<?php

// check if we can bootstrap
$self = drush_sitealias_get_record('@self');
if (empty($self)) {
    drush_die("I can't bootstrap from the current location.", 0);
}

// goes to site directory
drush_op('chdir', $self['root']);

drush_include_engine('drupal', 'environment', drush_drupal_major_version());

//****how to download module

drush_module_enable(array('uuid'));

drush_print("Done.");

While i see an Drush API for enabling, i don't see for downloading a module
How to download a module via Drush API from the script? Is there Drush API for automatically detect dependencies, download them and enable? Thank You

Drupal 7, Drush 5.8, Mac


texts: Drupal8: tableselect form element. Drupal::service('renderer')->render($element) return empty rows

texts:
I have custom field widget with two fields:

product_lines (checkboxes)
sales_partners (tableselect)

I need to ajax-reload sales_partners tablesect values depending on product_lines input

In my Widget->formElement() i have:

...
$sp_table = $this->getSalespartnerTable($product_lines);

$element['product_lines'] = array(
  '#type' => 'checkboxes',
  '#title' => $this->t('Select product line'),
  '#default_value' => $product_lines,
  '#options' => $this->getProductLinesData(),
  '#ajax' => array(
    'callback' => [$this, 'updateSalesPartnersTable'],
  ),
);
$element['sales_partners'] = array(
  '#type' => 'tableselect',
  '#header' => $sp_table['header'],
  '#default_value' => $sales_partners,
  '#options' => $sp_table['options'],
  '#empty' => $this->t('No sales partners found'),
);
...

in Widget->updateSalesPartnersTable($product_lines) I have:

...
$table_data = $this->getSalespartnerTable($allowed_product_lines);
$sp_field = &$form['field_access_settings']['widget'][0]['sales_partners'];
$sp_field['#options'] = $table_data;
$sp_field = \Drupal::service('renderer')->render($sp_field);

$response = new AjaxResponse();
$response->addCommand(new ReplaceCommand('#edit-field-access-settings-0-sales-partners', $sp_field));
return $response;

So, I use the same function to generate values array for tableselect and I am sure it returns valid data. The widget works fine on initial page load:

but when the salespartners table is reloaded by ajax it displays empty rows:

The culprit, I think, is this string (returns empty table rows despite valid $sp_field table array):

$sp_field = \Drupal::service('renderer')->render($sp_field);

but I have no clue how to solve this.


texts: How do I unpublish a user's content with rules?

texts: How can I unpublish a certain user's content when a certain rule triggers?


texts: Drupal Commerce: How to theme Product Field

texts:
On the product display node of Drupal commerce, you have the "Product field".
This displays all the products that are attached to the product display.
The products are displayed in a drop down menu.

By default, any fields on the product are displayed above the drop down menu. How can I theme this field, so the field are displayed below the drop down menu.


texts:
I am trying to create a simple on/off link using jquery and ajax. Basically what I want to to is add a link to a page that when clicked will insert a row into my database and update the text of the link. Then when clicked again, that record will be deleted from the database.

So far everything works as expected but the problem is that the second time the link is clicked, the record is deleted like it should, but the page refreshes and redirects to the homepage.

I am following the "plus 1 vote widget" example from Pro Drupal Development and am trying to alter the code to suit my needs. Following is my .js file.

$(document).ready(function() {
  $('a.toggle-visibility-links').click(function() {
    var parentDiv  = $(this).parent();
    var toggleSaved = function (data) {
      $(parentDiv).html(data.toggleon);
    }
    $.ajax({
      type: 'POST',
      url: this.href,
      dataType: 'json',
      success: toggleSaved,
      data: 'js=1'
    });
  return false;
  });
});

Here is my "toggle_visibility" module code

/**
 * Implementation of hook_menu().
 */
function toggle_visibility_menu() {
  $items = array();
  $items['toggle-visibility'] = array(
    'page callback' => 'toggle_visibility_toggle',
    'access arguments' => array('toggle profile'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/*
 * page callback
 */
function toggle_visibility_toggle() {
  global $user;
  $toggle_sql = "SELECT * FROM {toggle_visibility} WHERE uid = %d";
  $toggle_result = db_query($toggle_sql, $user->uid);
  $num = mysql_num_rows($toggle_result);

  if (!$num) {
    db_query('INSERT INTO {toggle_visibility} (uid, visible) VALUES (%d, %d)', $user->uid, 1);
  } else {
    db_query('DELETE FROM {toggle_visibility} WHERE uid = %d', $user->uid);
  }

  if (!empty($_POST['js'])) {
    drupal_json(array(
        'toggleon' => 'Toggle My Profile On'
        )
    );
    exit();
  }

  //UPDATE THIS TO RETURN TO THE SAME PAGE
  $path = drupal_get_path_alias('node');
  drupal_goto($path);
}

/**
 * Implementation of hook_theme().
 */
function toggle_visibility_theme() {
  return array(
    'toggle_visibility_link' => array(
      'arguments' => array(),
    ),
  );
}

/**
 * Return a message for no results
 */
function theme_toggle_visibility_link() {
  drupal_add_js(drupal_get_path('module', 'toggle_visibility') . '/toggle_visibility.js');
  global $user;
  $toggle_sql = "SELECT * FROM {toggle_visibility} WHERE uid = %d";
  $toggle_result = db_query($toggle_sql, $user->uid);
  $num = mysql_num_rows($toggle_result);

  if ( $num == 0 ) {
    $link = 'Toggle My Profile Off';
  } else {
    $link = 'Toggle My Profile On';
  }
  return $link;
}

Not sure what I'm missing.

Thanks!


texts: $is_front is not available in all templates

texts:
As far as I know $is_front is a global template variable in Drupal 7 and therefore the variable is available in all templates.

Now for Drupal 8 it seems that this is no longer true. I tried to call for $is_front in page-title.html.twig and realized that $is_front was not available here.

Using template_preprocess_page_title(&$variables) I could add $is_front to the template.

*Why is Drupal 8 not providing $is_front in the same style as Drupal 7? And what would be the  way to check for frontpage in a template where $is_front is not available?**

It also seems that drupal_is_front_page() is not available anymore.

Should I go like:

  try {
$variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();

 }

      catch (Exception $e) {
        // If the database is not yet available, set default values for these
        // variables.
        $variables['is_front'] = FALSE;
        $variables['db_is_active'] = FALSE;
      }

(taken from template_preprocess_page)


texts: Show the logged in user their account status

texts: How do I make a Views block(or by other means) to let the user who is logged in know of their account status i.e. when it is awaiting approval, or was not approved?


texts: Webform radio button sets common functionality

texts:
I have 2 sets of radio buttons which have different data and because they are radios, you can only select a single option per set.

However, I am trying to achieve a setup which will allow only one selection between the 2 sets of radios.

So, if I select an option in set#2, any previously selected option in set#1 will be deselected and vice-versa.

Can anyone help with this?

ps: I know JavaScript should fulfil this need but I am trying to find alternative solutions in case javascript is switched off and the functionality breaks.


texts: Display only the last submission per user of a webform in views

texts:
I have a webform. I want to create a view of all submissions to the webform, but I only want to display the last submission for any particular user based on the "Webform submissions: Completed" field. i.e. I only want one row per user if they have submitted the form multiple times.

Is it possible to create a filter that will do that?


texts: Where drush make downloading my projects?

texts:
I have created a drush make file through drushmake.me

Which is, I've created a file my.make in public_html folder and run the following command:

drush make my.make

It shows all the files downloading ok, but when I am checking my public_html folder it's showing nothing in my public_html.

I don't understand where all the projects are downloaded.

Any idea?


texts: How can I change a field's widget type on its node edit page?

texts: I have a node type that uses Fuploader image field widget. When a user creates new a node of this type, I want them to be able to use the fuploader widget to upload images. When the user edits that node at some point, I want to switch to the normal imagefield widget. How can I accomplish this?


texts: $form_state['redirect'] vs drupal_goto() in Drupal 6

texts: What is different between $form_state['redirect'] and drupal_goto() to redirect user to a step in multi step forms in Drupal 6 ? I used $form_state['redirect'] but no redirection happend so I use drupal_goto() .


texts: In node.html.twig, how do I use the readmore flag?

texts:
In node.html.twig the instructions clearly state:

 * - readmore: Flag for more state. Will be true if the teaser content of the
 *   node cannot hold the main body content.

I can't seem to access this variable. To test, I have a clean install of Drupal 8. In node.html.twig I have tried:

{% if readmore %}

Some content

{% endif %}

My 'Some content' text does not display regardless of whether the node's body is summary trimmed or not.

If I add {{ dump(readmore) }} it returns null. Again, regardless of whether or not the teaser is trimmed.

How do I access and use this 'readmore' variable?


texts: How to get statistics of (internal) referrers for landing pages?

texts:
I'm building a Drupal 7 site. Here's a use case that I'm not sure how to deal with:

for a campaign, we have a specific landing page.
we promote the landing page through different means (newsletter, flyers, website).
we want to track the effectiveness of each promotion.

As a sample, I have mydomain.com/mylandingpage?promoId=[n] and I want to track how many people accessed that page through promoid=1 vs promoid=2.

I do not necessarily have a form on the landing page, i.e. knowing how many users submitted a form after seeing a promotion is a different use case (and one that can be solved with a hidden form field).

How can I get statistics for what I need? The only thing I can think of is making special redirect URLs for each promo, e.g. mydomain.com/mylandingpage/promo1, but that would become messy/cumbersome very soon.

I'm aware of Google Analytics, but I'm looking for an internal solution.

Any ideas?


texts: Is using Drupal for a frontend and a non-Drupal API for a backend possible?

texts:
For my design, I want to have Drupal handle all security and presentation.  My backend is an api that returns JSON.  All I could find showed Drupal as "headless," where Drupal was the back end.

I am trying to avoid building too much into Drupal and being dependent on it.

Is using Drupal for the frontend and having separate API for the back end possible?  It sounds like I have it backwards, but I do not to build everything in Drupal.  I want to do all the Database and Business logic outside of Drupal.

Edit:  This is for an Intranet where I hit many databases.


texts:
I just emptied the cache in my Drupal database via MySQL, and all of a sudden I'm getting this error on my home page? Help! How can I fix this? It almost seems like a table was deleted by accident?

Original

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'databasename.entity_test_type' doesn't exist:
  SELECT et.* FROM {entity_test_type} et; Array ( ) in
  entity_test_entity_info() (line 73 of
  /var/www/drupal/true-001/sites/all/modules/contrib/entity/tests/entity_test.module).

Additional

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'databasename.locales_source' doesn't exist:
  SELECT lid, location FROM {locales_source} WHERE source = :source AND
  context = :context AND textgroup = 'default'; Array (
  [:source] => An AJAX HTTP error occurred. [:context] => ) in
  _locale_parse_js_file() (line 1563 of /var/www/drupal/true-001/docroot/includes/locale.inc).


texts: How do i force a text format and hide the format selector in a formatted text field?

texts: I Want to force a certain text format in a user profile text format field and hide the text format selector dropdown. How do i do it? This is for Drupal 8.


texts: Monthly change images directory Drupal 8

texts:
I am working on a news portal site.
We have a lot of posts and also a lot of pictures are saved daily.

At the moment, the size of /sites/default/files directory is around 6GB and contains almost 23k files. And that is a problem.

What I want is to have directory for every month, for example:

/sites/default/files/3-17
/sites/default/files/4-17
...

Does anybody know how to do this?
Also, is there a way to keep live posts working?


texts: How do you strip HTML from the node summary that appears on taxonomy node listing pages?

texts:
I've tried using hook_preprocess_node() inside of a if statement for arg(0) == 'taxonomy', but changes to the node aren't carried through to display.

What is the best way to make the teasers appear in plain text (stripped HTML) when listing in the taxonomy node listing page?


texts: How to disable updates during migration?

texts:
For the past couple years, something has confounded me about Drupal Migrate: there is a --update option and a --needs-update option when using Drush, but Migrate seems to update on it's own without using either of these options.

Seems like drush needs a --no-update option IMO.

My problem is, I have over 100K files that need to be migrated, and I'm having issues like the following:

drush mi ImageAttachFileMigration --limit=10000
Processed 10000 (0 created, 10000 updated, 0 failed, 0 ignored) in 311.4 sec

That doesn't happen every time, but I'm lucky to get a few hundred created.

This is my code in hook_register_migrations():

  // File Migration for Image Attach Images
  $file_arguments = $common_arguments + array(
    'machine_name' => 'ImageAttachFileMigration',
    'description' => t('Import Drupal 6 File references to be used by content types that used image attach in D6.'),
    'user_migration' => 'RanchoUserMigration', // User migration must be run first so the ownership can be set.
    'default_uid' => 1,  // Seems appropriate
    'source_dir' => 'http://example.com/',  // See https://www.drupal.org/node/1540106
  );
  Migration::registerMigration('DrupalFile6Migration', $file_arguments['machine_name'], $file_arguments);

I know there's a way to disable hooks, but I'm not even sure what's triggering the update.

Any ideas?


texts: How should I add punctuation to ElasticSearch highlighting snippets?

texts:
I have implemented ElasticSearch in a website for one of our clients.
We did this by using a SearchAPI Page, instead of a View (which I read here and there), but I think that doesn't matter to my question.
We are running the rendered HTML through the Elastic API. Apart from the excerpts it works completely fine.
When enabling highlighting, the returned snippets/excerpts are lacking all punctuation, which makes the snippets quite unreadable and ugly. (Apart from that, the highlighting works fine).
I have been Googling it quite a while, but I can't find anything about it.
So either it is the default and no one cares, or we are doing something wrong.
At this point I don't know what extra information to give to make answering my question easier, but if you need anything please ask.


texts: Add class to "link to content" view field

texts:
I'm using Drupal 8 and building a view. I have a field, which happens to be a title field, and I have set it to link to content. I would like to know how I can simply add a btn class to the anchor tag. Right now the output looks like this:
... custom text ...

I know I can use the Rewrite Results view feature to accomplish this, however, I need more power than that because I am building a theme for a client. The theme needs to be more generic, so I need to be able to accomplish this in a template. Is there template suggestion/hook that would allow me to override this in a template such as .../templates/views-view-field--link.html.twig? Or is there a theme function that I could use to override the markup by adding the class I would like?
I've considered using the views-view-field.html.twig template and overriding the node_view type to accomplish this, but I'm not sure how to do that whilst keeping the custom text a user could be using because it's really hard to debug the field options.
Edit
I forgot to mention, this needs to rely on Drupal core. I can't expect the user to install any additional modules for it to work.


texts: Why are my Simple Hierarchical Select fields not opening in multifield edit form?

texts:
My User Registration form has a multi field. In the sub fields, I have used term references as simple hierarchical select. As I need adding new value option as well. Data is added through these fields.

But when a user navigates to its edit profile page, these select fields are not shown.

Any suggestions about what is missing or wrong?


texts:
I have a content type that has the field field_data_latitude.  I see in the database the existence of a table called field_data_field_latitude that contains the values for this content type .  When I populate it via mysql, the value does not show up in the CMS.  Are there other tables I'm supposed to populate?

I also noticed a table called field_data_field_latitude..I popualted that as well but the value is not visible in the CMS.


texts: Find all contexts in which a block appears

texts:
Is there a quick way to find, for a particular block, all of the contexts that can display it?

(I'm curious about Drupal6 and Drupal7.)


texts: Redirect User to their Profile Page After Saving

texts: Each user has a "Edit" tab/button on their profile. They click it, edit their profile, and when it is saved, they are kept on that page. I want the user to be taken back to his/her "View" or profile page.


texts: Exporting webform information programmatically

texts:
I have a Drupal site that uses the Webform module. It has many options for downloading the results via the Drupal interface but it doesn't have anything out the box to get the data programmatically (JSON ect).

Is this possible? Authentication will still be require i.e only Drupal users for the site should be able to access this information via the JSON request.


texts: How do I use sendmail on Debian/Ubuntu to send emails without SMTP or other modules?

texts:
I have a Drupal 8 installation and it's not sending emails. I've configured postfix and tested using sendmail command line. PHPMailer module is installed via composer. When I submit passowrd reset request, error message is "Unable to send email. Contact the site administrator if the problem persists."

I checked the /var/log/mail.log file and the following error is shown: "Recipient addresses must be specified on the command line or via the -t option"

How can I use sendmail with Drupal 8? This seems like it "should" be easy, but all documentation I've found says install an SMTP module.

Thanks for any clues / advice.


texts: Synchronous XMLHttpRequest on the main thread is deprecated error at the end of ajax call

texts:
I'm a developer on a freelancing site (the only one actually) and I'm trying to allow anonymous users to bid on a project too. For this reason, I have the following code to check whether the username the anonymous user typed exists in the database, and show them a warning if it does. Now, everything works great, except that if the username exists in the database, I get the error at the end of the post and we can't check again because all Javascript executing is halted. What am I missing?

function tubitekuz_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case 'webform_client_form_97':
      $form['submitted']['kullanici_adi']['#ajax'] = array(
        'wrapper' => 'webform-client-form',
        'method' => 'replace',
        'effect' => 'fade',
        'event' => 'blur',
        'async' => 'false',
        'callback' => '_tubitekuz_check_username',
      );
      break;
    default:
      break;
  }
}

function _tubitekuz_check_username($form, &$form_state) {
  $parents = $form_state['triggering_element']['#array_parents'];
  array_pop($parents);
  $element = &drupal_array_get_nested_value($form, $parents);
  $exists = FALSE;
  $username = $form_state['values']['submitted']['kullanici_adi'];
  if (!empty($username)) {
    $exists = user_load_by_name($username);
  }
  if ($exists) {
    form_error($element, 'Kullanıcı adı kayıtlı, lütfen başka bir kullanıcı adı seçin');
    $error_selector = '.webform-client-form';
    $commands[] = ajax_command_replace($error_selector, theme('status_messages').drupal_render($form));
    return array('#type' => 'ajax', '#commands' => $commands);
  }
}

The error

  Synchronous XMLHttpRequest on the main thread is deprecated because of
  its detrimental effects to the end user's experience. For more help,
  check http://xhr.spec.whatwg.org/


texts: How to adapt the name of a custom Drush command?

texts:
I saw the interesting answer to the question about "How can I get a list of content types with drush?", which starts like so:

  You can create a drush command named content-type-list.

But I wonder what it should look like if the command should be named something else, eg mijn-contenttypes-lijst (instead of content-type-list), and use drush drush mcl (instead of drush ctl)?

Some reasons why I may want to use another name:

Because it conflicts with something else in Drupal for which I already used content-type-list and/or ctl.
The command is hard to remember (eg because it's not in my native language), so I want to adapt it to another name.

What exactly would I have to change in the code included in that answer, which currently looks like so:

<?php
/**
 * @file
 * Drush commands related to Content Types.
 */

/**
* Implements hook_drush_command().
*/
function drush_content_types_drush_command() {
  $items['content-type-list'] = array(
    'description' => dt("Show a list of available content types."),
    'aliases' => array('ctl'),
  );
  return $items;
}

/**
 * Callback for the content-type-list command.
 */
function drush_drush_content_types_content_type_list() {
  $content_types = array_keys(node_type_get_types());
  sort($content_types);

  drush_print(dt("Machine name"));
  drush_print(implode("\r\n", $content_types));
}

PS: I understand I can create aliases for it also (as shown in the linked answer), but that's not what my question is about. E.g. if I want a command that does something different.


texts:
I've added a custom static field to comments. This static field is custom php code but I need to access the specific comment ID using php code in it. So how can I get the comment ID for every comment in the static php field?

Thanks


texts: Use computed field to calculate Field collection

texts:
I have a field collection named values. It contains the fields:

Amount
Price
Total

The "Total" field calculates the Price*Amount.

Now I created a new field outside the field collection called "Subtotal".

How do I sum all the values of the "Total" field in a node to populate "Subtotal"?
I tried a lot of code which I found but none seem to work.

I tried this code but it gives as a warning: undefined index at line 5

$field_items = field_get_items($entity_type, $entity, 'field_values');
$total = 0;
foreach ($field_items as $item)
{
  $total += $item['field_total']['und'][0]['value'];
}
$entity_field[0]['value'] = $total;

Thank you in advance!


texts: How to let user add multiple sub-content fields in the main content?

texts:
If I want user to create a main content which can be able to add multiple sub-content for example
I wanna do apartment renting website. User have to create the apartment details which contain these fields; Title, Description, Address, Facilities etc.
As 1 apartment usually have multiple different units, user have to add their available units in the apartment node which contain fields; Unit title, room size, bedroom, bathroom, price. And they can add many units as they want.
The question is
 what module should I use? Can I use Organic Group module or something simpler then that?

I'm new for Drupal, learn by myself from scratch, anyone please point me the direction.


texts: Addind a meta noindex tag within template.php

texts:
I would like to add a meta tag noindex from within the template.php file of my theme.

The purpose is to remove two nodes 404 error page from google's index, I would like to do it like so :

// in mytheme/template.php
function my_theme_preprocess_node(&$variables, $hook) {
   $node = $variables['node'] ;
   // '123' would be nid of the 404 presentation page
   if($node->nid == '123'){
   /* META NO INDEX CODE GOES HERE */

Is this possible to do in my theme, without using any module at all ?


texts: How do I define a template file for a specific node ID?

texts:
I'm trying to define a custom template file for a specific node, using the node ID.
I read a lot of topics saying to create a node--X.tpl.php file in the templates folder.

That's what I did; unfortunately, even after flushing the theme cache many times, nothing changes.

Is there anything more I have to do?

I am using Drupal 7.


texts: No access stats for user after registration

texts: Just noticed a new user who joined today has in access stats, "never". How can that be recording never when they have logged in? drupal 7.19 core profiles.


texts: How can I limit the allowed quantity in the cart to one item?

texts: I am using Drupal 8/Commerce 2. How do I limit the quantity in the cart to one item so that users can't order more than one item per order.


texts:
I have two forms (A & B) in custom module. Form A containing three fields(each field is dependent drop down) and Form B containing only one field (markup field to show data).
The problem is that when I change either field from Form A then its dependent fields within form A an also markup field from Form B should be updated via ajax.

Here is the callback function used in FORM A. After calling, it returns fields from Form A. But I want it also return field of FORM B.
(One Callback to render two forms at a time)

<?php
 function mymodule_ajax_callback($form, $form_state) {
     return array(
        '#type' => 'ajax',
        '#commands' => array(
            ajax_command_replace("#key_wrapper", render($form['keys'])),
            ajax_command_replace("#display_wrapper", render($form['display'])),
        ),
     );
 }
?>


texts: Spam bots hitting user/register non cached pages generate load, how to prevent?

texts:
I have SpamBot installed, still bots can hit the user/register page that is not cached by Boost and generate load if they do it recursively. Any tips to prevent them?
Or, the only solution is http://www.fail2ban.org/wiki/index.php/Main_Page?


texts: How to add HTML5 attribute "autocomplete" to form fields?

texts:
According to an accessibility test, I have to add the HTML5 attribute "autocomplete" an the proper tags to all form fields on my website where the user fills in his/ her personal data.

E.g. "Your E-Mail" > autocomplete="email", "Your Family Name" > autocomplete="family-name", etc. (The proper tags are listet in the WHATWG HTML standard https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill)

Some of the fields are in Drupal core (like the user registration form), others are webforms (like an event registration).

What is the best way to achieve this in Drupal 8?


texts: Image upload not working in field collection which is inside another field collection

texts:
I can able to choose the image file but when I upload the image, which clears the file chosen.

It is working in my localhost but when moved to server it is not working


texts:
I have a node that has a field created with Field Collection module.
Field is composed of 3 subfields: dropdown list and 2 text boxes.

I want to get values from those 3 fields in my Rule.

How would I reference those fields?

I have installed Advanced Entity Tokens module.

thx!


texts: How to get php error logging working properly in a production site

texts:
OK, I'm clearly missing something about how error logging is supposed to work.  This is a D7 production site, so my goal is to get errors written into a log file, but not show up on the screen.  I've added the following to the end of my site's settings.php file:

error_reporting(E_ALL); // just to get going; I'll scale this back later
ini_set('display_errors', 0); // don't display errors on the screen
ini_set('log_errors', 1); // log errors...
ini_set('error_log', 'syslog'); // ...in the syslog (I'm running this on Fedora 15,
                                // so I think this should work (although I'd happy to
                                // have the logging happen somewhere else

My reading of all the docs makes me think that this should work, but when I put the following into a module file as a way of forcing some errors:

$x = 1 / 0;
$foo = $bar + $baz;

I still get the divide-by-zero warning and the undefined variable notices coming up on the screen via drupal_set_message, and comparable messages in watchdog.  If I instead do error_reporting(0), I get nothing on the screen, and nothing in watchdog.  In no case do I see any messages showing up anywhere in /var/log.

I'm clearly doing something wrong, no?  Can anyone see what it is?


texts: How to display the table select query values in the same form in drupal 7?

texts: Just newly working on Drupal 7. Using Form API I created a text field with one submit button. I need to pass the text field's value in the select query as a parameter. I need to output the result set of the select query in table layout. Please help me out by providing a set of codes.


texts:
I've created a custom module to show On This Days in a block but they are not changing each day until I flush the caches.
I call the entity:
public function build() {
    $query = \Drupal::entityQuery('node');
    $query->condition('status', 1);
    $query->condition('type', 'on_this_day');
    $query->condition('field_filter_date', '-' . date("m-d"), 'CONTAINS');
    $entity_ids = $query->execute();

...
and then return from the build function like this:
return array(
        '#markup' => $content,
        '#cache' => array(
            'max-age' => 0,
        ),

Any ideas?
I'm thinking entity cache or something but I'm quite new to this and not too sure


texts:
How can I send an email from the D7 UI to specified email addresses?

I want to type in some text, type in some recipient addresses, and click send to send it from the site's address.


texts: Create New User After Subscribing with Simplenews

texts:
I want new Subscribers to a single Newsletter using SimpleNews to automatically be set a Role so that they are already then registered on a site. I have already tried a custom Rules Set but the Role creation doesn't appear to happen and I'm wondering what I'm doing  wrong in my approach to the Rule.

The frontend process is i) Anonymous user subscribes via the Simplenews Subs Block ii) send them they are now subscribed.

The backend is something like:

i) User Subscribes as an Anonymous user (i.e. not logged in)

ii) Subscribe to Newsletter type

iii) Set Role from initial 'Anonymous' to 'Subscriber' Role and assign to a Profile type.

Also, I'd like to reduce the 'confirm' email process which currently needs to be given by the end user to confirm a subscription.

I appreciate that some 'hacking' my be needed in the Simplenews core to reduce certain features and would appreciate any advice on this.

I'm sure this is easy to do and I'm merely missing something in my efforts, would someone like to share what I'm doing wrong in the above Rules structure?

Thanks.


texts: Where is views exposed form's submit handler located?

texts:
When views exposed form is submitted without ajax it redirects to somepage like http://example.com/reports?taxonomy=tid&date=27%20F6%20f2005 etc.

I am curious to know ,in views module,inc file where it's submit handler is located,where is ajax callback?

I tried for some hours but no luck.

I know about hooks like form alter but that's not a concern.

I have no specific requirements,just for drupal learning :)


texts:
How can I override a Profile2 profile page using Panels in Drupal 7?

The page I'm looking to override is the edit for for one of the new profile2 pages.  Here is an example URL: http://example.com/profile-user_settings/%uid/edit


texts: What is the best practice for showing a specific node within a specific page?

texts: I'm using the boostrap_carousel module which creates a custom content type for a slideshow. I'd like to have a block for one of these carousels to show on the home page. I'd also like to have a carousel embedded on most of the interior pages. What's the best practice to render a specific node that would be created using that content type within the front page and within another node?


texts: How to set up multiple occurences of same event with RNG?

texts:
I am trying to find out what is the easiest way to handle this use case:

We host the same event in different cities. So event A will go to city X then city Y then city Z.

So all the information about the event is the same, just different dates and locations.

It is the same event so nobody will attend more than once. But many people will consider which city to attend the event (it may be the same distance if they go to city Y or city Z).

I assume each event should have its own RNG registration.

But what would be the easiest way to set up this thing with all the shared information?


texts:
I am working on site, on site for certain set of basic pages i want to provide a numeric navigation with previous/next buttons. Is there a module to achieve it easily or else we need to hard code it.

Please suggest me some solutions to get this functionality.


texts: Views information not bolding used templates

texts:
The templates used in my views are not bolded (template information). I do not know if this due to a module interaction.I have checked with different administration themes but does not show up anything.I would like to know how to get back this valuable information.

I have also tried an alternative solution that did not work. I have enabled the theme debug mode, and looked for the template used in the source code. It show the default template while i have a another (specific) one.

I have been looking around without any success!


texts: Allow a role to assign user roles but not to manage user permissions

texts: on Drupal 7 how I can give to the "special" role the possibility to manage roles of other users (add a role to a user, remove, add more than a role, etc.), but not the possibility to manage all user permissions?


texts:
Possible Duplicate:
  What is basic concept behind hooks?

How does comment_field_extra_fields() implement hook_field_extra_fields()? How is a hook implemented by another function?  Does it extend another class to use a hook function?


texts: How to alter the query that selects node in the admin/content page

texts:
i need to alter the list of nodes displayed in the admin/content page (the basic administrative page for content) depending of the role of the user. For example if the user has a role, i want him to display only pages with content type = article.

I thought i could modify the query using hook_query_alter

function provintegra_query_alter(QueryAlterableInterface $query){
    fb($query);
}

but i was wondering on how to add the condition i need and how to find the correct query to modify. Of course other solutions arre accepted, but i can't use views because i need to have a page that it's exactly like the one that is displayed normally (with the same filters and links for editing). I need to restrict visualization to certain content types (articles for example but also user defined content types) and if possible to content created by the user


texts: Sending an email to everyone with a certain role

texts:
Me: Small business owner with no coding or Drupal background who wants to learn by doing instead of hiring a developer for every small thing.

Goal: I have a Drupal 7 website and would like to send different types of emails to users of specific roles using the Rules (or an easier way if you care to suggest it). I've explored using Rules to accomplish this with some success by cloning similar ones and making small changes, but making one from scratch is more challenging. I've wrapped my head around scheduling the event and creating the email in the action, but specifically editing the condition is a barrier. I assume that the element "User has role(s)" is what I should use, but I'm confused on how to drill down the "data selector" under the USER area. I'd like the system to evaluate all members of the site and email everyone with a specific role...I don't see an appropriate option. Maybe I'm looking at the wrong condition element. Little lost - I'm sure it is a painfully obvious to someone who knows what they're doing.

All constructive suggestions and guidance welcome on how to accomplish this - trying to learn!


texts: Does node_delete() function deletes the attached media files as well?

texts:
I'm deleting my 'articles' created before Sat Nov 1 00:00:00 2014 GMT from Drupal 7.34 site, but I'm not sure whether the node_delete() delete the media files as well?

Below is my processing code:

<?php

// Fetch the NIDs of 'articles' created before Sat Nov 1 00:00:00 2014 GMT
$query = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', 'article')
->condition('created', 1414800000, '<') // 1414800000 = Sat Nov 1 00:00:00 2014 GMT
->orderBy('created', 'DESC')
->range(0, 100);
$result = $query->execute();

// Code to delete my articles in bulk
while ($record = $result->fetchAssoc()) {
  $nid = $record['nid'];
  echo $nid;
  node_delete($nid);
}

?>


texts:
I am currently using the module (uc_feeds_product_importer.zip) suggested on this link https://drupal.org/node/1802908 to import products. Using this above module there is no access to import product file downloads.

uc_feeds module does a great job by providing access to import product attributes. How to update/enhance this module to import file download feature as well?


texts:
I have the Developer user role which should only access the developer_html input format. I am trying to grant the necessary permission with user_role_grant_permissions().

I got this piece of code here
and also tried to edit according to my requirement, but failed.

function filter_update_7008() {
  // Build the list of permissions to grant.
  $permissions = array();
  foreach (filter_formats() as $format_id => $format) {
    if ($permission = filter_permission_name($format)) {
      $permissions[] = $permission;
    }
  }

  // Grant text format permissions to all roles that can 'administer filters'.
  // Albeit anonymous users *should not* have the permission, we cannot presume
  // that they do not or must not.
  if ($roles = user_roles(FALSE, 'administer filters')) {
    foreach ($roles as $rid => $name) {
      user_role_grant_permissions($rid, $permissions);
    }
  }
}


texts:
I have a Views 3 block whose block title I would like to set using PHP in the header section. This would enable me to use tokens from the views results, which is not possible from the UI.

In the case of a views page I was able to set the page title via the following PHP command in the header section:

$view = views_get_current_view();
$view->build_info['title'] = 'My Page Title';

However, I was not able to do the same thing for block titles via

$view = views_get_current_view();
$view->build_info['title'] = 'My Block Title';

This is probably because the build_info['title'] command only edits the page (or node) title. Does anyone know of an analogous command to set block titles?


texts: How do I add module theme elements to drupalSettings

texts:
I have a module "flot_d8" which is a wrapper for a javascript library. I would like to streamline the way this library is called from other modules (flot_examples in this case). I currently call it like this from src/Controller/FlotExample.php

$data[] = [
  'data' => [
    [0, 12],
    [7, 12],
    NULL,
    [7, 2.5],
    [12, 2.5],
  ],
];
$div_id = 'placeholder';
$drupalsettings['flot_d8'][$div_id] = ['data' => $data];
$output[] = [
  '#attached' => [
    'drupalSettings' => $drupalsettings,
  ],
  '#theme' => 'flot_d8_my_template',
  '#data' => $series,
  '#options' => NULL,
  '#div_id' => $div_id,
];

Is there a way to force the flot_d8 module to add the $data to drupalSettings instead of passing this task to the flot_examples module in every single class function?

I tried this

function flot_d8_page_attachments_alter(&$page) {
//$div_id = $output["#div_id'];
//$data = $output['#data'];
//$options = $output['#options'];
  $page['#attached']['drupalSettings']['flot_d8'][$div_id] = ['data' => $data, 'options' => $options];
}

But I know this isn't the right way to access $div_id, $data, and $options. Can I use the value in $output['#div_id'] in hook_page_attachments_alter()?


texts: What is correct destination for fid in destination image field?

texts:
I am attempting to do a simple migration of an image from a D6 CCK file field to a D8 file field, and for some reason it's not working. Following best practices, I've run a separate file migration - named 'file' - and so now I want to just migrate the fid reference during the node migration. In my blog node migration, I have this in the process section:

field_image:
  plugin: d6_cck_file
  source: field_thumbnail
  migration: file

where field_image is the name of the D8 file field, and field_thumbnail is the source D6 field.

The problem is that the image reference is not being migrated to the D8 field (field_image). In going through the code with my debugger, I'm noticing that the CckFile::transform() method is not being called at all (although __construct() and create() methods are being called), and that's where the finding of the fid in the file migration happens.

Is there something I'm missing in my config? It seems pretty straightforward, so I'm not sure what I'm missing.

Thanks.

UPDATE: After doing some debugging, I found that when the process gets to this line in MigratExecutable:processRow() where the $destination is field_image:

$value = $plugin->transform($value, $this, $row, $destination);

the value of $plugin->id is get, not d6_cck_file. I can't understand why, since the plugin name is clearly defined as d6_cck_file in the migration config.

UPDATE 2: After doing some reading, I'm thinking I might need to use the iterator plugin, since both my source and destination fields are multi-value fields (i.e. they are allowed to have multiple values, even if they actually don't).  So I'm trying this:

  field_image:
    plugin: iterator
    source: field_thumbnail
    process:
      field_image_target_id:
        plugin: migration
        migration: file
        source: fid

but that's not getting it either. Still debugging...

UPDATE 3: So with this most recent setup, my destination id is being found correctly, but the issue seems to be the destination. field_image_target_id is the name of the db field where the value is stored, but apparently not the destination value to use. I also tried 'field_image/target_id, but that didn't work, either. What would be the correct destination?


texts: Administration views change filter on my content type fields

texts:
I'm using Administration views and I would like to be able to search by the last name field in my "Registration" content type. Currently, I can search by first name via the 'title' field on the content type as I replaced title field with my "first name" field. But now I would like to search on "Last Name" field.

Please provide a recommended approach to resolve this.


texts:
I have been trying the below issue when clearing the cache on DEV.
Drupal\Core\File\Exception\FileWriteException : The specified file 'temporary://file9PWd0P' could not be moved to 'public://google_tag/primary/google_tag.script.js'. dans Drupal\Core\File\FileSystem->move()
Can anyone help me how to fix this issue.
Thanks


texts:
I've got a content type which consists of many (arbitrary number) key/value pairs.

What I'm looking for is a module like Options Element, which I can add to my custom content type. Are there any modules like this?


texts:
I have the following path mysite/basic-page/about-us
I need translate it to:


texts:
I've created a bid module that allows the users to bid on an auction through a node reference. I'm using hook_form_alter() to create the form on the 'create bid' page, and I would like to perform some SQL queries dealing with the referenced node.

How do I load the node reference?


texts: How to change the day and month language?

texts:
Working on multilingual site, I want to change the language of the month in dutch language. For that I have created a module.

<?php
function mymodule_format_date($timestamp, $type = 'custom', $format = 'd M', $timezone = NULL) {
  return format_date($timestamp, $type, $format, $timezone, 'nl');
}

and on the node file put the date format in t() function

<?php print t(format_date($created, 'custom', 'd M')); ?>

but no luck. Please help.


texts: Remove links from pictures to products inside cart

texts:
I am using Drupal 6, and latest version of the Ubercart module. I am using this code to remove links from products names and images. However, links from images are not stripped. What should be wrong wit this code?

function <MODULENAME>_tapir_table_alter(&$table, $table_id) {
  switch ($table_id) {
    case 'uc_cart_view_table':
      foreach (element_children($table) as $i) {
        $table[$i]['image']['#value'] = strip_tags($table[$i]['image']['#value'], '');
        $table[$i]['desc']['#value'] = strip_tags($table[$i]['desc']['#value'], '

');
      }
      break;
  }
}


texts: How To Create Combined Search Filters In Views?

texts:
I am currently working on a view that allows me to search "title" of a content type along with 3 other exposed filters. But now I want users to not only be able to search "title" but also "category" field of the same content type, except "title" and "Category" fields need to be one filter.

I tried using contextual filters but I'm afraid I don't quite understand the best method. I'm currently using global:combine fields filter but instead my views results (which worked fine previously) no longer works. I'm trying to avoid complicated coding. Any suggestion?


texts:
I am creating a webform for my users to submit it but i have one question.
How to redirect users to login before they submit a webform?


texts:
Apparently if you take the "minimal" installation, it does not create the user picture field. I tried to manually create it, but now the Simple Facebook Connect module is not synching profile images, because it can't find the default user_picture field.

This is what the facebook module does:

// Try to download the profile picture and add it to user fields.
if (user_picture_enabled() && $picture_url) {
  if ($file = $this->downloadProfilePic($picture_url, $fbid)) {
    $fields['user_picture'] = $file->id();
  }
}
$new_user = User::create($fields);
$new_user->save();

I can confirm that it is able to get the $file, but the problem has something to do with the fields.

How do I correct recreate the "user_picture" field?

This is returning false:

function user_picture_enabled() {
      $field_definitions = \Drupal::entityManager()->getFieldDefinitions('user', 'user');
      return isset($field_definitions['user_picture']);
}

How do I add this field definition again?

I looked in the minimal.install file. I was hoping to find the code that enables user_picture, but all I could find was:

\Drupal::configFactory()->getEditable('system.theme.global')->set('features.node_user_picture', FALSE)->save(TRUE);

There is nothing in standard.install. I tried running the following, without any luck.

\Drupal::configFactory()->getEditable('system.theme.global')->set('features.node_user_picture', TRUE)->save(TRUE);

How do I get my user_picture field back without adding it manually, since I would end up with field_user_picture?


texts: How to link taxonomy term with current loaded NID?

texts:
I want to link taxonomy term with current loaded node
I am using

$nid = arg(1);
$term=taxonomy_term_load($tid)
print $term;

but noting happened.
Please tell what is the correct way


texts:
Almost everywhere I search I find the following example for using dpm() or sdpm() with the Devel and the Search Krumo modules:

Paste the following code in your theme's template.php file, save, and clear cache.
function foo_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    sdpm($form);
  }
}

This is working fine.
But how can I see the other components, like Menu and its components or any block?
I tried following for menu but it is not working.
function mymodule_menu_link_alter(&$item, $menu) {
   sdpm($menu);
}


texts: Checking if personal contact form exists

texts:
I am using a custom user-profile.tpl and I want to add a 'contact user' link to the viewed users personal contact page.

How can I check that the user in question has a contact page enabled? Is there a variable I can look at, or maybe a db query that can be run?

I am not using tabs on the user profile page.

Thanks,
Paul.


texts: Adding multiple buttons on node submit form - every button submits the form

texts:
I am adding several buttons to a node form.  The result is something that looks like this pastebin.  The pastebin is a somewhat truncated version, here is the real short one:

$form = [
  '#submit' => [],
  '#actions' => [
   'submit' => [
     '#type' => 'submit',
     '#submit' => ['node_form_submit']
   ],
   'skip_done' => [
     '#type' => 'submit',
     '#submit' => ['skip_done_handler']
   ],
];

I thought that if $form['#submit'] was empty then the only submit handlers that would be called are the ones on the respective buttons.  I'm either completely wrong in my understanding or I've misconfigured something.

Should this work they way I'm expecting it to?  If so, what am I doing wrong?


texts: How to make textfield with ['#ajax']['keypressed'] = TRUE trigger only on click and not on blur?

texts: When I specify ['#ajax']['keypressed'] = TRUE for textfield, trigger runs not only when I click ENTER (as it is mentioned in documentation), but also when textfield loses focus (must be blur event in JavaScript). So how can I avoid this?


texts:
I'm trying to switch to the dev version of Views. Repository instructions worked and I was able to git clone Views.

However, listing the available branches with git branch -a only shows * 7.x-3.x
.

And trying to add a "dev" branch with pull returns an error:

$ git pull origin 7.x-3.x
From http://git.drupal.org/project/views
 * branch            7.x-3.x    -> FETCH_HEAD
Already up-to-date.
$ git pull origin 7.x-3.x-dev
fatal: Couldn't find remote ref 7.x-3.x-dev

What am I doing wrong?


texts: How to limit direct access to URLs of nodes that are shown in a video gallery created with Views?

texts:
I have made a video gallery using Views. But I only want that the page accessible to public and prevent access to each of the videos individually.

The videos had to be created as a type of content, so all of them have accessible ULRs like /content/video-1, etc.


texts:
I have a field that is configured to have multiple/unlimited dates with end date.(field_date)
I want to calculate the difference of all the dates using a loop.

This is the code used for calculating single difference. How to use this in a multiple scenario?

$start_value = $entity->field_date[LANGUAGE_NONE][0]['value'];
$end_value = $entity->field_date[LANGUAGE_NONE][0]['value2'];
$timezone = $entity->field_date[LANGUAGE_NONE][0]['timezone'];

$start_date = new DateObject($start_value, $timezone); $end_date = new DateObject($end_value, $timezone);
$duration = $start_date->difference($end_date, 'hours');
$entity_field[0]['value'] = $duration;


texts: Adding multiple HTML pages as nodes as part of workflow

texts:
I've just started using Drupal. I'm in the process of building my first web site (I'm not a web designer but have a reasonable knowledge of html, css and python and some comprehension of the DOM).

My workflow is to produce content in markdown and then produce html files locally before uploading to my site. I've looked at a few options to try and do this in Drupal but am struggling to make headway.

All I really want to do is grab a bunch of html pages at a time from a folder (in ubuntu linux) and add them in as basic page nodes with the filename as the node title.

I've tried the feed module and import_html and migrate but they all seem to be set up to take a SQL table rather than a simple html table. I don't need anything parsed or mapped other than full text to "content" as full html and file_name to title.

Any help appreciated. This is pretty fundamental to the way I work, and after three days of trying to crack it, I'm stumped.

adding that I have reviewed the following question

How to add multiple HTML nodes in Drupal and viewed the video and followed the link but the former doesn't cover html and my import doesn't show up as a node and the latter has several PHP code fragments and I'm not sure how to bring them together into a single script and where to put that script.


texts: Why are my $messages delayed one page refresh?

texts:
I have a page with a very simple template:

<!DOCTYPE html>

<title>TEST REGISTRATION PAGE</title>

    <?php
        print drupal_get_form('user_register');
        print $messages;
        print $closure;
        print $main_content;
    ?>

Basically, it displays the registration form and nothing else.

I enter some bad data on the form — an already used username (admin), and no email address.
I click "create new account".
The page seems to submit and reload, but nothing has happened — no error messages are displaying.
I refresh the page (F5).
Firefox displays "to display this page, Firefox must send information that will repeat any action that was performed earlier" — so I know that my POST went through previously.
I click "resend" in that dialog window.
My error messages appear — "e-mail address field is required", "the name admin is already taken".

This occurs for all of the forms I've tested so far, not just the registration form.

Why is this happening? What can I do to fix it so that the error messages display the first time?

I'm happy to do whatever I need to do debug this, but I need some direction to start looking in. :)


texts: How to overwrite form submit? "Please enter some keywords" - Cant see my error

texts:
I have managed to get quite a few modules up and running and i'm now on my last sprint and got caught off guard by this small issue.

I simply want to change:
  if ($form_state['values']['search_block_form'] == '') {
    form_set_error('keys', t('Inserisci alcune chiavi di ricerca per cortesia'));
  }

however I cannot get my module to see my function. Here is the details
Module: esos_search_form_language

Code:

<?php

function esos_form_alter(&$form, &$form_state, $form_id){
  if ($form_id == 'search_form'){
      $form['basic']['keys']['#title'] = 'Inserisci le tue chiavi di ricerca';
      $form['basic']['submit']['#value'] = 'Ricerca';
  }
  if ($form_id == 'search_block_form') {
      $form['search_block_form']['#default_value'] = t('Ricerca...');
  }
}

function esos_search_form_language_form_submit($form, &$form_state) {
  if ($form_state['values']['search_block_form'] == '') {
    form_set_error('keys', t('Inserisci alcune chiavi di ricerca per cortesia'));
  }
}

All of my code is working except the esos_search_form_language_form_submit function and I assume it is something really simple I am doing wrong. Can anyone help?

I tried using esos_search_form_language_submit, esos_submit as naming conventions too just in case it was that but with no luck.


texts: How to set up this view of commerce orders...?

texts:
Really hope someone can help me with this as am completely stuck, sorry it's a bit long but I don't know what else to do...

I'm working on a commerce site for a client that offers blocks of pilates classes. Users will purchase blocks of 6 classes in order to book onto them.

I have one product in the store called 'standard-6-block' at a price of £45.

I then have a product display called 'Class (Block)'.

The Class (Block) nodes will list 6 dates using just a text field with an unlimited number allowed (although each block will just have 6 classes added)

Blocks of classes run for 6 weeks, hence the 6 dates in each node, and will be added every week.

For example there may be one Class (Block) node with 11/01/2017, 18/01/2017, 25/01/2017, 1/02/2017, 8/02/2017, 15/02/2017 dates.

There will then be another node added a week later with 18/01/2017, 25/01/2017, 1/02/2017, 8/02/2017, 15/02/2017, 22/02/2017 dates.

This is because users may start blocks of classes at different times so we've agreed blocks will be added each week.

I now need my client to be able to run reports using a views page to show who has booked on to each class. (Not each block of classes (node) but individual classes in blocks (dates in the 'Class Dates' field in the node).

I've created one test order in my store which has purchased just one block of classes. There are currently 4 blocks of classes available to purchase on the website.

My view settings are:
View of: Commerce Orders

Relationships:
Commerce Order: Line items, (Line items referenced by commerce_line_items) Commerce Line item: Product, Commerce Order: Owner, (Products referenced by commerce_product) Commerce Product: Referencing Node, Commerce Order: Payment Transaction

Filters:
(Node referencing products from field_product_type) Content: Class Dates (exposed) and is REQUIRED!

Now when I run the report and enter a date for example 18/01/2017, the view doesn't just show the ONE order in the store IE this user has registered and paid for this class, it shows all 4 of the nodes that have been added.

Really hope that makes sense...? Thank you so much for taking the time to help me


texts: Replicating a page.tpl Region in Omega's structure

texts:
I have a theme with a specific region and it is being printed using some PHP within the page.tpl.php file. It is also using a .js file and a .css file both within the PHP.

Here is the current code found within my old site's page.tpl.php file that allows for my region to show up:

<?php if (isset($page['sidepulltab'])) : ?>

            <?php print render($page['sidepulltab']);?>

<?php endif;?>

I have added to my subthemes .info file 3 lines (.js, .css and region):

scripts[] = js/stylepicker.js
stylesheets[all][] = css/stylepicker.css
regions[sidepulltab] = Side Pull Tab

I am not sure how to transfer this type of PHP region within Omega's Subtheme under the Appearance tab.

I tried adding the above code to page.tpl.php file which I copied into my subtheme from its original Alpha theme location. I do get my CSS and DIVs to show up, however my block region isn't printing inside.

Note: I'm using Omega 3, I have also cleared the cache. The region is showing up as "disabled" inside the Omega3 Apperence tab.


texts: Is it possible to export/import content types from one site to another

texts: is there a way to import/export content types between diff Drupal websites?, assuming they are the same versions of Drupal


texts: Creating readable links for nodes in a view

texts:
I have 2 views setup - one is for a directory listing of nodes and the other displays an individual node from that directory.

The directory view is visible at /directory and can be filtered by letter (e.g. /directory/b will show all nodes whose title starts with b)

Currently, the directory listings link to /directory/show/[nid] but I would like them to be friendlier. For example /directory/show/example-title.

I can get close to this if I check 'Output this field as a link' on the Title field and set the 'Link path' to directory/show/[title]. However, that displays the link as /directory/show/Example Title.

Is it possible for this link to be displayed as /directory/show/example-title somehow?


texts: Access a field from page.html.twig template

texts:
I would like to display an image above the page header.
The image is stored in a field (its name is “image”) related to a node (its type is “article”).
I can display {{content.field_image}} using the node--article.html.twig template.
But as the

{{ title }}

lives in the page-title.html.twig template I can no longer access the image.

Can someone help me finding the right way to write a preprocess function?
I already used

function [my_theme]_preprocess_page(&$variables) {
  $site_config = \Drupal::config('system.site');
  $variables['site_name'] = $site_config->get('name');
  $variables['site_slogan'] = $site_config->get('slogan');
}

But I can't find a way to do the same again with my image


texts: I have a content type called 'message' which has tags. The idea is that when viewing a message, the sidebar shows a block that lists titles of other messages who have the same tags as the one the user is currently viewing. I reckon this can be done with a view, though I have no idea how to work this out.


texts:
Is there a reason to be using \Drupal::database() vs \Drupal\core\Database\Database::getConnection()?

How do I know when I can chain my query methods and when I can not? For example

$db = \Drupal\core\Database\Database::getConnection();

$query = $db->select('node', 'n')
  ->fields('n', ['nid'])
  ->condition('type', 'blog');

$results = $query->execute()
  ->fetchAll();

vs

$db = \Drupal\core\Database\Database::getConnection();

$query = $db->select('node', 'n');
$query->fields('n', ['nid']);
$query->fields('nb', ['body_value']);
$query->join('node__body', 'nb', 'n.nid = nb.entity_id');
$query->condition('n.type', 'blog');

$results = $query->execute()
  ->fetchAll();


texts: Custom compound field type with taxonomy term

texts:
I'm trying to create a custom compound field with 2 fields types, using Fields API.

So far, I have something like 'telephone' core module, that store just one string, but I can't even start to add taxonomy field (entity_reference field type) to compound my custom field.

I searched for a hint on core, but no success. Any hints are appreciated.

Drupal 8.0.5.


texts: Ubercart or learn a new ecommerce package?

texts:
Im a big Drupal fan which is why Ubercart is the obvious choice for me when it comes to ecommerce. Ive made a couple of Ubercart sites and I havn't been massively impressed.

Ubercart doesn't seem very powerful when you need extensive business logic, can be hard to theme and has javascript reliance. Admittedly ive only played with others like magento and zencart, but Ubercart doesn't seem to lead in its field the way Drupal does in its.

Im reluctant to learn a new ecommerce package due to the time required, but the javascript reliance alone makes me wonder if I have to. Has anyone else had a Drupal background and faced a similar dilemma with ecommerce?

Thanks