texts: Adding a "Like" operator via views query alter for taxonomy term name

texts:
I am trying to add a "Like" operator via views query alter for my taxonomy term name. My view is a block setup with a contextual filter set to show all results as shown below as I want to filter it per page, see info below how I am doing that.

Then within given pages, I'd like my content editors to be able to input parts of a term name (thus the SQL "Like" operator) to filter a view via the paragraphs view field contextual options field. For example part of a term name would be "Creative Commons" as shown below.

The code I have so far after using Xdebug is:
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewExecutable;

/**
* Implements hook_views_query_alter().
*/
function mymodule_custom_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  // Define the view display.
  if ($view->current_display === 'remix_icons_nf_block') {
    // Define the taxonomy term name.
    $name = $view->argument["name"]->query->fields["taxonomy_term_field_data_name"]["field"];
    // Add a like operator.
    $view->query->where[1]["conditions"][0]["operator"] = 'LIKE';
    // Now query the name using the condition above.
    $view->query->where[1]['conditions'][0]['value'] = '%' . $name . '%';
  }
}

However, this does not seem to be working (no views results show up on the page) and I am not sure what I am doing wrong.
Here is the output from Xdebug as well if that helps.


texts: how can i get a menu of a parent taxonomy term?

texts:
I know menus can be made of taxonomies, with taxonomy menu.

But the real huge problem i have is I CANT get taxonomy menu to show only one term's children in the taxonomy list.For example consider this taxonomy vocabulary:

creatures
-insects
--ants
--mosquitoes
-mammals
--rabit
--dog

I want the taxonomy menu to show only mammals links, how can i do that?


texts: Updating node field value using custom module validation

texts:
I currently have a custom module which calls a submit custom validation function. I am trying to update a value after the validation is run. Basically, if a value is present, update a field to say "Yes".

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

if( $form_id == 'stage_2_node_form') {
   $form['actions']['submit']['#submit'][] = 'sitefuncs_custom_submit';
}

} // end hook_form_alter()

function sitefuncs_custom_submit($form, &$form_state) {

        $banned = array(
        'better cures',
        'better nhs',
        'because it',
        'so what'
        );

  if (in_array($form_state['values']['field_stage_two_question_one']['und'][0]['value'], $banned)) { // if a banned word is the value of the input

$form_state['values']['field_stage_complete_text']['und'][0]['value'] = "No"; // set the value of the text input to No

} else {

$form_state['values']['field_stage_complete_text']['und'][0]['value'] = "Yes";

$messages = drupal_get_messages('status');
drupal_set_message(t('Your changes have been saved.'));

}

}

If anyone has any idea why the $form_state isn't updating the fields after I save the node, any help would be great!


texts: How to override logic of specific drush command?

texts:
I'm aware of validate/pre/post COMMAND hooks and I would like to replace the logic of the existing drush command on specific condition using policy commandfile with something else, e.g.

/**
 * Implementation of drush_hook_COMMAND_validate().
 *
 * Validate feature revert of specific module.
 */
function drush_policy_features_revert_validate() {
  if (strpos($args[1], 'rules') !== FALSE) {
    drush_invoke_process('@self', 'rules-revert-all');
    drush_print('Rules reverted in custom way!');
    return drush_set_error('POLICY_DENY', dt('Rules features already reverted.'));
  }
}

However the problem is when I return TRUE - the command which I want to override is called after than, on the other hand when I'm returning FALSE, the drush will fail with non-zero exit code which could cause some other issues (like breaking the deployment).

Is there any better way of overriding the logic of existing drush command without described side-effects? Secondly validation hook doesn't sound right to implement that kind of logic.


texts: Possible to pull the validate hook on forms not in form api

texts:
Is it possible to utilise the validate hook from within a node rather than a module? The code below works within a module calling a form with the form API. But if i was to have a variable in a node page, could i utilise the same function within the nodes html/php? if so how? or a similar validate function?

$mynumber= $_POST[mynumber];

e.g.

function form_example_form_validate($form, &$form_state) {
      if (!is_numeric($form_state['values']['mynumber'])){
form_set_error('mynumber', t('Validation: You must enter a valid number for the number field.'));


texts: Use taxonomy_get_term_by_name when there are duplicate names across multiple taxonomy categories

texts:
UPDATE: I see that most likely the best way to accomplish this is to grab the term id from $content['field_tags']. However I'm not sure how to do that.
Whenever I retrieve $content['field_tags'][value] all that gets returned is an array object. And when I attempt to render it all I get is the tag name.

I'm attempting to grab the taxonomy term id in the node template for a content type. I'm grabbing the taxonomy term by referencing the field that contains the taxonomy terms. Like so

$tag = render($content['field_tags'][$i]);

I then use taxonomy_get_term_by_name in order to grab the id for that term like so.

$term_array = taxonomy_get_term_by_name(render($content['field_tags'][$j]));
$term = reset($term_array);
$term_id = $term->tid;

It works like a charm except for one issue. I have a taxonomy category for tags as well as events, and when there is a term with the same name in both the 'event' and 'tags' category it grabs the event term id instead of from the 'tags' category, which I want.

Is there another way to grab the specific term id for the tag field? Would it be possible to grab the term id directly from this object?

$content['field_tags'][$j]


texts: How to make same javascript code work on more than one same kind of field?

texts:
I am using Field collection module and added some repeated fields. Each field has one button, on clicking the button, the text area is expands(toggling kind of). But the java code is working for only first field not for rest of the fields. I have added java script code through .info method. Thanks.

(function ($) {
     Drupal.behaviors.myfunction = {
         attach: function(context, settings) {
            $( "#button1" ).click(function() {
              $( "#p1" ).toggle("slow");
            });

 }}})(jQuery);


texts: Change JSO(N) parameters that have been set by another module

texts:
I am trying to override parameters that have been set by another module. The other module uses drupal_add_js() to set the parameters.

 $settings = array('color'=>'red','type' =>'round');
 drupal_add_js(array('MyData'=>$settings),'setting'));

This adds a JavaScript object to the drupal.settings data object. I want to override that in another module, and I don't know how. It seems to always "ADD" to the array and NOT override it.

The following code doesn't work.

$js = drupal_add_js(null,'setting'); //<-- get the JS
unset($js['setting'][1]['MyData']['color']);
drupal_add_js($js,'setting');

 $settings = array('color'=>'PINK'); // <- Change red to pink
 drupal_add_js(array('MyData'=>$settings),'setting'));

How can I do what I am trying?


texts: Drupal 7 Execute a mysql sql query in Views using Views PHP

texts:
I'm trying to do a custom sql query in Views for Drupal 7 and I have the following code in my views php, but I'm not sure if I'm doing this correctly.

<?php $xx = db_query('SELECT * FROM acl_node INNER JOIN acl_user ON acl_node.acl_id=acl_user.acl_id INNER JOIN users ON acl_user.uid=users.uid WHERE nid=201');

print_r($xx);
?>

After running that I get a big array, but none of the data in it. I tested the sql query and it is indeed working via my sql builder tool.


texts: How can i Use drupal 8 CMI between two different sites?

texts: I think, normally the CMI works between cloned sites, not different sites. Is there any way to do that with CMI ? or still we hardly depends the features module ?


texts:
When we deployed to a production site, CSS and images got broken.

One approach to mitigate this was editing settings.php, the base_url

$base_url = '/oursite';

(Where "oursite" is our domain, i.e. http:localhost/oursite/ )

But that also broke some functionality on our local site. For example:

The requested page "/oursite/?q=oursite/node/add/cmsdeliverable%3Ffield_demo_id_reference%3D1208" could not be found.

What other approaches can I take?


texts: Sending message body to email with PrivateMsg module

texts:
PrivateMsg Module sends email notifications that you have received a message to users. How to send the "Message Body" to the user in the email. So no need to login and see the message .

Any clues ?
thanks


texts: How do I use an array with an 'IN' condition on EntityFieldQuery::entityCondition?

texts:
I read that entityCondition should take an array, and I've constructed an array according to examples I've seen on the web. But no dice. I get the error below. If I use a string, the error goes away.

Here's my code:

$query = new EntityFieldQuery();
$types = array('commerce_product', 'produce_share');
$query->entityCondition('entity_type', $types, 'IN');
$result = $query->execute();

And here's the error:

Warning: Illegal offset type in isset or empty in entity_get_info() (line 7690 of /**/includes/common.inc).
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1573 of /**/includes/bootstrap.inc).
EntityFieldQueryException: Entity  has no base table. in EntityFieldQuery->propertyQuery() (line 1209 of /**/includes/entity.inc).


texts:
I have two kind of nodes Person and Survey. Unintuitively and for historic reasons, a Survey can be attached to more than one person, but a person only has one survey.

When a person node is displayed, the survey is embedded via a view.

I need to display that person's name in the survey view, however all attempts to find the person from the survey view result in a list of all people related, not necessarily the particular one being shown now.

How do I make the name of the specific person who were looking at available to the view?

So, eg if I go to http://example.com/person/Bob

Bob's details
Bob's survey
  Survey field 1
  Bob's name <--- How do i do this?
  Survey field 2

Thanks,
Chris


texts:
I need to add a menu item in my User menu which provides the facility for users to amend the content of a Content Type ( Sectors) i.e. so they can amend a sector. The User Menu only appears of course for logged in users.

I have tried setting up a menu option in the User menu which links to a View which displays all the Sectors so the logged in user can select one and amend it, this works fine, but the menu option is still displayed for anonymous users as well.

I have 'node/add' for other menu options to create content for content types, they behave properly in the User menu i.e. only appear when a user is logged in, how do I have an edit option for Sectors which only appears for logged-in user in the User Menu?


texts:
I'm trying to add a confirmation step when I upload a file (file_entity).  After I upload a file that exists already on the server, I want the user to be asked if he really wants to replace the existing file with the new one.

I can detect wether or not a file already exists on the site but I'm not sure how to add another step in the process before the file is saved ...

Can anybody point me in the right direction as to where to start ?


texts: How do you get the nid from an entity id?

texts:
I've got a field collection attached to a node. Given the entity ID of a given instance of that collection, how do I obtain the nid to which it's associated?

When using entity_load, the nid for some reason is a protected property, so I can't access it. I must be missing something.

Update: using node_load on this entity ID returns false.


texts: Drupal Commerce Authorize.net gateway and POODLE

texts:
I got a notice today that Authorize.net is going to shut off their SSLv3 protocol on November 4 (7 days from today) in response to the POODLE threat.  I'm using Drupal Commerce's commerce_authnet module to accept credit cards on our web storefront, how can I tell whether I connect via SSLv3?  And if I do, how can I change that to connect via TLS or whatever I need to do?

Thanks.


texts: Author of question flags only nodes that are answer to his question (node reference)

texts:
I have 2 node types - questions as parents and answers as referencing nodes. I would like to display flags only for nodes created as an answer to a given question. This should be only selectable by the author, not everyone.(same as stackoverflow best answer) So far I found out that I can manually place in node-answer.tpl.php the link using:

<?php print flag_create_link('select_answer', $node->nid); ?>

This will print the flag on every answer node, but I would like it to be selectable only by the author of this particular question. (basically it is the same functionality as stackoverflow - author can select best answer) There is an API function flag_create_link($flag_name, $content_id), so I need to set $content_id to point to all referenced answers for a given question.

ANy idea how can I do it? Any advice appreciated.


texts: How to create a module to insert some analytics code in the footer of website pages?

texts:
I want to create a module for Drupal 7, with a simple scope. It's just to insert the analytics code in the footer of website pages and with an option to exclude some pages if required.

I just need a module configuration page with 1 text field to enter the Analytics ID. And a text area below it, just like in blocks configuration page, which allows you to show the block on specific pages.

After this info is saved, the code should be inserted in the footer of each page, with that Analytics ID.

Can anybody tell me what hooks I will need to implement this functionality?


texts: Login and registration form in a single page

texts:
Possible Duplicate:
  Print registration and login forms on same page

I found the LoginToboggan module, but it doesn't allow to register and log in from the same page.

What should I do to get registration and login form in the same page?


texts: $(...).find(...).once is not a function Drupal 8.2.5

texts:
I just updated core from 8.2.4 to 8.2.5 and now I am getting this error in my console which is causing some other JS items not to work

    Uncaught TypeError: $(...).find(...).once is not a function
        at Object.attach (eval at globalEval (jquery.min.js?v=2.2.3:2), <anonymous>:156:44)
        at Object.Drupal.attachBehaviors (drupal.js?v=8.2.5:168)
        at insert (ajax.js?v=8.2.5:1084)
        at Drupal.AjaxCommands.loadEditorsAjax.commands.insert (quickedit.js?v=8.2.5:523)
        at Drupal.Ajax.success (ajax.js?ojj3xe:155)
        at Object.success (ajax.js?v=8.2.5:505)
        at i (jquery.min.js?v=2.2.3:2)
        at Object.fireWith [as resolveWith] (jquery.min.js?v=2.2.3:2)
        at z (jquery.min.js?v=2.2.3:4)
        at XMLHttpRequest.<anonymous> (jquery.min.js?v=2.2.3:4)

Drupal 8.2.4 was using jquery 2.2.3 and so is drupal 8.2.5 so I am not sure what is going on here.

Any ideas? I tried updating jquery to 3.0.0 but that didn't work. Same error.


texts:
On my views-view-field template, I would like to print out 'field_images' if 'field_cover_image' is empty.
I tried this solution here but it throws me this error message.

Notice: Undefined variable: node in include() (line 45 of /sites/all/themes/mytheme/templates/views-view-fields--incubator.tpl.php).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /includes/common.inc).

Is there any other ways to check if a field is empty or not?
Thanks!


texts: Disable submit button if none selected using #states

texts:
The code

     $form['type'] = array(
      '#type' => 'select',
      '#title' => t('Type of new field'),
      '#options' => $field_type_options,
      '#empty_option' => t('- Select a field type -'),
      // '#empty_value' => 0,
      '#description' => t('Type of data to store.'),
      '#required' => TRUE,
    );

    $form['save'] = array (
     '#type' => 'submit',
     '#value' => t ('Save field'),
     '#states' => array(
       'disabled' => array(
         ':input[name="type"]' => array('value' => 0),
         // Tried value = NULL, value = FALSE - no luck
)),

);

The goal is to disable submit button if none selected from drop-down list. Which "value" should I provide? Tried "0", "FALSE", "NULL"


texts:
Issues migrating site config at various points in project lifecycle

Hi

My team and I have begun a new project for our company using the very latest version of Drupal 8 (version 8.5.6)

We wanted to use config migration in order to carry config changes from one developer across to another seamlessly and across to staging and production environments.

We are in the middle of testing the migration workflow and have run into a problem.

I started off the project by doing a standard Drupal 8 installation. I then did a migrations export (drupal ce), committed this to the repository.

My colleague proceeded to install Drupal also, also a standard install, composer install, drush cr etc., and then pulled the latest changes and ran drupal ci and ran into an error, namely:

[ERROR] An error occurred while trying to write the config file: "Entities exist of type Shortcut link and Shortcut set Default. These entities need to be deleted before importing."

Prior to this we had an additional issue where Drupal complained about mismatched UUID’s. We got around this by updating his UUID as follows:

Error received:

[ERROR] An error occurred while trying to write the config file: "Site UUID in source storage does not match the target storage.

Fixed with:

drush config-set "system.site" uuid "42e3c541-5ebc-4ec9-a8f0-e8c6ad1ccfb7

The above UUID was gained from my installation.

So now we are left with the first error explained above.

We tried deleting the shortcuts manually, as suggested in several places on the internet, but this caused his system to completely break.

I also thought possibly that instead of him doing a clean, standard install at the start of the work that he should have used a snapshot of my initial installation, and when we move the app to staging and/or development it will follow suit that we use backups for the initial setup to ensure the DB is in sync with regard to UUIDs, but I am not convinced this is the correct way to do it.

So, we are a little lost on exactly what is the recommended workflow for migrations, with the view that we will be using the workflow going into production also, e.g. after launch we will want to use config migration export/imports to apply changes made locally.


texts: programmatically get bundles from field collection?

texts: Say I have the machine name of a given field collection. How can I programmatically get the names of the node bundles where one would find this field collection? This would be the same information you see on the admin/structure/field-collections page.


texts:
I have main website ABC.com with 5 subdomains on Drupal 6.2

The problems I'm facing are bellow:1 - It is difficult for user content to migrate across the subdomains.
Detail: There are tabs on the top of USER PROFILE page for "My Content" and "My Images".
I was hoping that title links for all pages written by that user from all of the subdomains could be listed in that area
And also that all images from all subdomains uploaded by that user could go under "my images".

2 - Every time a change is made to the structure of the (site, taxonomy, blocks, configurations etc) the change has to be made on all 5 subdomains.currently we are doning indevidually.
Detail: Ideally, most of the administrative tasks should be implemented in a single change.
Things like content types, meta tag and post settings, taxonomy.
The structure of pages under site building, site configuration, user permissions.
All the things that make a site consistent in its look and function.

MAIN WEBSITE - ABC.com
SUB DOMAIN 1 - one.ABC.com
SUB DOMAIN 2 - two.ABC.com
SUB DOMAIN 3 - three.ABC.com
SUB DOMAIN 4 - four.ABC.com
SUB DOMAIN 5 - five.ABC.com

Database Structure:
There is only 1 database for MAIN site plus all 5 Subdomain with total 700+ tables.
MIAN website ie(ABC.com) tables doesnt' have any db_prefix.
ABC.com tables as follow:
- access
- accesslog
- actions
- users
    .
    .
- vocabulary
- watchdog

All sub domains have a db_prefix of subdomain with their table names like:
- one_access
- one_accesslog
- one_actions
- one_users
    .
    .
- one_vocabulary
- one_watchdog
- two_access
- two_accesslog
- two_actions
- two_users
    .
    .
- two_vocabulary
- two_watchdog

Any help would be appreciated.

Cheers
zafar


texts:
In Drupal 8, is there an easy way to configure a page so that its page header/title is not displayed on the page?

I have created a Basic Page, with /home as path alias, and Home as title. I set it as front page.  However, it displays 'Home' at the top of the page, just below the navbar and breadcrumbs.

Is it necessary to create a subtheme of the 'Bootstrap' theme, and somehow add custom CSS?


texts:
If I create a view for content types, then the filter allows me to display selected taxonomy terms on the view. Right now, I need to create a view for taxonomy terms and their related fields, but I only want to show some of them. When I select the filter of Taxonomy Term: Term, I do not get the option to select the terms I want displayed.

After I choose is one of, there is no option to choose is one of what. Is this a bug or am I doing this wrong?


texts:
This webcast has a walkthru of NH; it includes the NH.Access module. I assume that he is using 6.x, as a lot of stuff is still very much beta'ish in 7.x, including NH.

I'm wondering if there is a module that gives me the ability to assing a permission to a node and its children.

My current setup is replacing a "Per-node" permission system, so the current Node Access grant is acceptable. I would like to progress into a "Per-Hierarchy" permission, so that a user can create children and maintain them without my intervention.

I just want to be sure I'm not missing a "related module" that's functional.


texts: How do I specify a Forena PDO data source in settings.php?

texts:
I would like to override my Forena data sources in a local settings file for development. I would also like them in settings.php on production for database independent deployment.

I have checked the documentation but a full example is not provided. Can anyone provide a full example?


texts:
I am using webforms and I want to add a Select Option field with the list of all authenticate user names. And if any new user add in my site than it will add automatically in that list
Is that possible? if yes than how?


texts: Rewriting image output in views: how to provide replacement pattern inside twig tag?

texts:
In views I want to rewrite output of image field by using twig function drupal_image (see module Twig Tweak). When I provide the image path directly, this code works:

{{ drupal_image('public://myimage.jpg' , image_responsive_style, responsive=true) }}

But I can not manage to provide image path by a variable, like this pseudocode:

{{ drupal_image('{{ uri }}' , image_responsive_style, responsive=true) }}

The problem seems to be how to provide the variable {{ uri }} properly inside the surrounding twig tag.


texts: add custom header in term listing tpl page

texts:
I want to add some header information in header of term listing. This is my requirement.

I achieve the listing of terms (store) with the help of term-taxonomy--store.tpl.php template but how to add Find stores alphabetically portion in header, because if I add that portion in term-taxonomy--store.tpl.php , it repeats with every store. what i have to do for that ?


texts: Programmatically select image style for use with custom file entity view mode

texts:
I have created an empty custom view mode for file entities with hook_entity_info_alter().

I would like to programmatically select settings for it, so that they can be deployed without a user having to go to the file entity display settings GUI and select "image" for type of file display and "original size" for the image style.

I cannot do this with hook_entity_view_mode_alter() because that appears to only fire for nodes, not for file entities.

How can I programmatically set the display settings for my custom view mode for file entities?


texts: How to unflag all messages when a users visits the Message page?

texts:
I am using the Message module in combination with the Flag module in order to build a simple notifications system for my site.

More specifically I have created a page in Views showing all (new) messages for the current user. The page is accessible through a menu link (called "Messages") in the front page. I have also created a message flag so users can flag/unflag there messages as new/old ones.

But instead of forcing the user to manually flag/unflag his messages, I would like all messages to automatically be unflagged (i.e. become old) when the user visits the messages page (or a certain context in general).

Any hints on how to achieve this?


texts: Need to override page/meta title on views page

texts:
I have installed meta tag modules,then enable the meta:views mudule for meta tags.
After that i have added meta tags from views interface.
Now I need to override these value on the basis of exposed filter dropdown.I mean when i change filter,then meta values should be changed.


texts: Drupal EntityFieldQuery() returns partial result set

texts:
I have used the following code to return the vids of all the playlists associated with a particular program.
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'station_playlist')
  ->fieldCondition('field_station_program', 'nid', $nid, '=')
  ->addMetaData('account', user_load(1));

$result = $query->execute();
if (!empty($result['node'])) {
  $node_ids = array_keys($result['node']);
}
return $node_ids;

The expected result is a list of all the playlists ids; however, this query returns only some of them (mostly the old ones). I have tried using the range feature as well but it does not work. Can someone please help in figuring out where the issue lies? Thanks!


texts:
I created rest resource plugin in a custom module and need to send some JSON data with the request, and access it in the post function. At the moment my post function does not do anything but return some dummy JSON data so I know it is working.

It seems that whenever I try to pass JSON data with the request, it will give me this error: "Could not denormalize object of type , no supporting normalizer found."

If I then try to get this data using file_get_contents('php://input'), it will give me a 403 forbidden error. But if I try to return the same data that I get from file_get_contents('php://input') from the post function, I get the normalizer error again.

I wasn't able to find much information on even making this REST resource and even less on this issue now, so if anyone has any input I would greatly appreciate it, thanks!


texts: How to make sure you're not on the production website in Drupal 7?

texts: I remember seeing some kind of module where it lets you know that your on a staging / dev site without the risk of you editing the main production site. Or is there other methods that others use to prevent accidents from happening.


texts: How do I alter a view query to use "OR"?

texts:
The following is the content of the $query object that is passed to a view.

[where] => Array(
  [0] => Array(
    [clauses] => Array(
      [0] => node.type in ('%s')
      [1] => node.status  0
      [2] => node.promote  0
      [3] => node.sticky  0
    )
    [args] => Array(
      [0] => test
    )
    [type] => AND
  )
)
[having] => Array()
[group_operator] => AND

I want to override it by using hook_views_query_alter(). The default operators are all AND, but I want to get the following query

[0] => node.type in ('%s') AND
[1] => node.status  0 AND
[2] => node.promote  0  OR
[3] => node.sticky  0

How do I make the last operator to use "OR"?

db_query("SELECT content_id, count(*) AS cnt FROM {votingapi_vote} WHERE value =1 AND value_type = '%s'" , "option");

How do I use the query in hook_views_query_alter()?


texts: Cannot install bootstrap theme in drupal 8 via composer fresh install

texts:
I set up d8 site with:

composer create-project drupal-composer/drupal-project:8.x-dev my_test_site --stability dev --no-interaction

Then installed the db and drupal with:
drush site-install

Fully working D8 (8.3.3) with no errors at all.

I go to curate the composer.json file with some themes and modules to play around with it to get familiar:

composer require drupal/bootstrap

When this command runs, it results in the following error:

  Could not find package drupal/bootstrap at any version for your
  minimum-stability (stable). Check the package spelling or your
  minimum-stability

Inside my composer.json (after install)

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/console": "~1.0",
        "drupal/core": "~8.0",
        "drush/drush": "~8.0",
        "webflo/drupal-finder": "^0.3.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "behat/mink": "~1.7",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": ">=4.8.28 <5",
        "symfony/css-selector": "~2.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
      "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }
    }
}

I've followed the solutions on  Installing Bootstrap theme using Composer , but it seems all the answers are all defaults already in my installation unless i'm missing something?

I've tried several different combinations of versions available for the bootstrap theme and it's the same message every-time. I have also tried to change my overall projects stability with no luck.

I'm not too familiar with composer so I am assuming I am missing something small. Going through the documentation I am literally finding nothing to help solve this issue with composer. I have had no issues installing bootstrap before everything was on packages.drupal.org

Any ideas to why I cannot install bootstrap theme as a dependency or am I approaching this entirely wrong?


texts: Autoload files by patterns instead of listing each file

texts:
Drupal's "autoloading" requires one to include the files in files[] declarations in the .info file.

When there are a lot of files, this becomes:

A large, huge, list.
Hard to maintain.

Is there a way to e.g include with patterns. Say lib/*.php?


texts: How do i create a breadcrumb based on Main Navigation Menu in programatically?

texts:
I want to display the breadcrumb according to the main navigation menu.

If i've a menu structure like
a->b
  ->c
  ->d
e->f
  ->g
Now if i go to menu a->c, now the breadcrumb shows Home > c but i want it as like a >bHow to do it programatically ?


texts: Views Load More: Showing X number of item initially

texts: I have a view which shows 6 items per page using Views Load More (Ajax). However what I would like to do is, on the very first page I would like to show 6 items and when clicked on Load More button it should show 3 items and so on. Is it possible?


texts:
I'm not familiar with drupal. Using raw SQL, I'd like to extract votes given to each node, but I wonder how vote_rating is related to node?

I see that the votes are stored in field_vote_rating of this table:

mysql> DESCRIBE `field_data_field_vote`;
+-------------------+------------------+------+-----+---------+-------+
| Field             | Type             | Null | Key | Default | Extra |
+-------------------+------------------+------+-----+---------+-------+
| entity_type       | varchar(128)     | NO   | PRI |         |       |
| bundle            | varchar(128)     | NO   | MUL |         |       |
| deleted           | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id         | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id       | int(10) unsigned | YES  | MUL | NULL    |       |
| language          | varchar(32)      | NO   | PRI |         |       |
| delta             | int(10) unsigned | NO   | PRI | NULL    |       |
| field_vote_rating | int(10) unsigned | YES  |     | NULL    |       |
| field_vote_target | int(10) unsigned | YES  |     | NULL    |       |
+-------------------+------------------+------+-----+---------+-------+

I'm aware of Drupal's database structure schema, which looks like so:

But I cannot figure out how to make a query to connect them.

My question: How to make a raw SQL query to get the node/node_votes pairs?

Any suggestions?


texts: How do you apply timezone formatting to a date?

texts:
I'm trying to build my own output for a date field *see Group multiple times by day (multi-value date field) *, but the problem I'm having is how to apply the timezone?

This article -> Date value to different date format and nearly every other reference out there tells me that it should be applied by default. But it isn't.

What I'm doing is theming the field with:

function theme_field__field_times($vars){
    $dates = $vars["element"]["#values"];
    foreach($dates as $item){ // there are many dates, so we'll cycle through each one
        $date = ('U', strtotime($item['value'])); // convert to unix time
        print('This date renders as: '.format_date('$date', 'custom', 'D d/m/Y - g:ia', '', date_default_timezone_get());
    }
}

Which outputs, for example, 27/07/2011 -1:10pm. The value should be 27/07/2011 - 11:10pm, or the date that my function spat out +10hours - the timezone ('Australia/NSW') that should have been applied...

date_default_timezone_get() is returning the correct timezone.

If I let Drupal render the dates using it's default field theming, the dates are right.

So why isn't the timezone being applied? How do I fix it?


texts: Commerce - Require login only for specific products

texts: I'm building a commerce site using drupal commerce. I know how to have anonymous users checkout, I know how to require login before checkout, but I can't figure out how to specify for each product if it requires a login or not...


texts: Send order notifications when user is anonymous

texts:
I find that when anonymous users are ordering something from my site I cannot send order notification messages using the "out of the box" Commerce rules.  The error message that I get says that Rules is unable to create the message entity, and the apparent reason that it cannot is that the parameter that the Commerce rule provides [commerce-order:owner] does not work [???] for anonymous users.

I can and have fixed this by changing the parameter to [site:current-user], but am wondering if there is some other way to get this to work.  [Like, for example, setting an order property?]


texts: How to display Commerce Order Owner role in Views fields?

texts:
Using Drupal 7.58 and Views 3.18

I am simply trying to display Commerce Order Owner role on a View. Using the Commerce Order:Owner relationship, I have access to a large set of user fields and properties... except the User role? Did I miss anything here?

EDIT : I am using Aggregation on my View (if you want to replicate this issue)

EDIT#2 : interesting workaround here, simply add the user role field before activate the aggregation... Still, I could not manage to build a chart and only a list of roles counted per user, using Table with aggregation options display

Related question : How to add the "user role field" in View showing users


texts: Can't set a file->description field in a paragraph programmatically

texts:
I am running a drupal 7 migration into Drupal 8 paragraphs. I am retrieving the source fid, mapping from the file migration, getting the dest file id, getting the source file description, and then creating a new file paragraph that just contains a public_file field.

Problem is that I can't find a way to set the description field of the file? I can create the paragraph with the file fine.

I have tried the following (where field_files is the name of the field in the paragraph)

$file->set('description', $file_title);

.

$file->field_files[0]['description'] = $file_title;

.

$paragraph->set('field_files', $file);
$paragraph->set('field_files_descriptions', $file_title);

I have tried creating a test paragraph through the front end containing a description field and inspected the values, and there isn't anything obvious where I can set the value,

$testparagraph = $paragraph->getFields();
$testfile = $file->getFields();

The description value is only here in the paragraph entity

$testparagraph['field_files']->list[0]->values['description']

I'm at a bit of a loss where I can set this description.


texts: Colorbox trigger builds clunky html instead of array

texts:
There is this view of which I configured the fields as follows:

Gallery images: exclude from display
  - Background: in cck, this is a separate image field with multiple values called 'Gallery images'

Title: default

Custom text:
  - Exclude from display
  - No results behavior: Hide if empty checked + Hide rewriting if empty checked

Colorbox trigger:
 -  trigger field: custom text
 -  popup: [field_project_gallery_images]
 -  No results behavior: Hide if empty checked + Hide rewriting if empty checked

This works nicely in itself, colorbox shows a nice slideshow after clicking on the custom text. The problem is that the colorbox trigger should only be output if there are actually images uploaded to the gallery images field. I other words, Hide rewriting if empty checked leaves me with no success.

Which isn't a surprise when dpm($fields). It shows the gallery images field as one chunk of HTML entirely instead of an array. dpm($fields) output comes down to the following if that makes sense:

    <?php

$fields['colorobox']['content']['Meer foto's

 Prev Next

']

?>

No wonder there is no 0 to interpret as an empty field. This way, I can't loop through it and hide if count 0. To count the characters of the HTML would be way too dirty. But then, what can I do?


texts:
Problem statement: When users pay for an order at paypal, in almost 50% cases(for both verified and unverified paypal users) the transaction slip(for business account) does show shipping address(confirmed address), but for other 50% users it is saying "We have no shipping address on file" even if users enter shipping details on paypal review page.

Using Paypal Express Checkout payment Method.

Currently we are passing NOSHIPPING=1

What should be the parameter for NOSHIPPING ? What could be the problem ?
Please help.


texts:
After deleting some fields and paragraph types, I have stale values in the entity field map - these cause notice-level errors in the /admin/reports/fields page, and seem to occasionally trigger weird exceptions.

I've tracked the stale data to entity.definitions.bundle_field_map entries in the {key_value} table. Unfortunately, neither running cron nor synchronizing the configuration nor clearing the cache seems to update this.

I've deleted the entries from the table entirely, but they just stay gone. Is there a way to completely rebuild the map from the active configuration?

Update: For future reference, this problem (and similar entity schema corruption) was a likely consequence of mucking around with unalterable internals (type, machine name, etc) of existing fields. Never do that; this system is complex, easy to break, and basically impossible to get back into a consistent state without reinstalling or reverting to backup.

Any changes to the storage of a field should be done by creating a new field, copying data, and deleting the old field. Even if you want to retain the existing machine name, it is easier to follow these steps twice (using a temporary field) than to try to touch the internals.

(Also, some aspects of the schema seem to be updated by cron, so before reusing a deleted field's machine name, make sure to run cron to let it perform cleanup.)


texts: Google Analytics custom dimension for anonymous/authenticated users

texts:
I use Drupal 6 and Google Analytics module. I'd like to have custom dimensions to add segmentation for anonymous/authenticated users. I have added a custom dimension with [user-role-name] token. But I have a lot of roles for authenticated users, and then I get a long list of roles in GA data. I'd like to have only anonymous vs authenticated.

Is there anyway I could filter it with GA module in order to send only this two roles names?
Thanks.


texts: Webform - Show the preview page on confirmation instead

texts: I have a Webform and there are options that you can set a "preview" page if you want to. I think it's very nice displayed but I want to show this instead on the confirmation page so when a user submits the form it will get posted but the form will be displayed on the confirmation page as it did on the preview page. like a confirmation, this is your Webform that was sent it.


texts: How to create new group for products in drupal commerce?

texts:
I am using the Drupal Commerce module (in Drupal 7) for products.

I need to create different-different group like phone and shirts. And need to add parameters for phones.

Also I need variation by using taxonomy.

Please refer to the image below for more details:

Some more details:

I am using 2 attributes: Color and Memory, implemented as taxonomies (vocabularies). But they are not showing as a select list on the cart page.
Color is a vocabulary, with terms in it like black, silver and red.
I added Color on product type fields and checked 'attribute option'.
But still this widget not showing up on the cart page (it's only showing the selected value).

Or to phrase it in yet another way: I need attribute on cart page. I have added attribute by using taxonomy, but it's giving me only a link. Which means that when I select 'black', then it only shows 'black color' on the cart page (it does not show a 'select option').


texts:
I would like to be able to theme the view/edit tabs.

That is, I'd like to add a class to the <li>.

Any help with this would be much appreciated.

Cheers in advance.


texts: Send data with post to other drupal page not working

texts:
I'm trying to send data from a html form to another drupal page.

The Form (in JavaScript):

var data = { // JS Object with data to send
            priceUnit: '131.97',
            priceTotal: '131.97',
            priceCount: '1',
            articleNumber: 'XYZ'
        };
        // Form creation
        var form = document.createElement("form");
        form.style.display = 'none';
        // link to drupal site
        form.action = "../configurator/process_order";
        form.method = "post";
        form.target = "_blank";

        // Create form Content from JS Object data
        for (var key in data)
        {
            var input = document.createElement("input");
            input.name = key;
            input.value = data[key];
            form.appendChild(input);
        }
        document.body.appendChild(form);
        form.submit();

On the other page, I am trying to access php $_POST but there is no output:

<div>
     <?php
         echo $_POST['priceUnit'];
     ?>
</div>

But, if I add var_dump($_POST); in my module: configurator.module:

function configurator_process_order()
{
    var_dump($_POST);

    $modulePath = drupal_get_path('module', 'configurator');

    $content = file_get_contents($modulePath . "/Trader/PHPWebPages/processOrder.php");
    return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}

I get the following output:

array (size=4)
  'priceUnit' => string '131.97' (length=6)
  'priceTotal' => string '131.97' (length=6)
  'priceCount' => string '1' (length=1)
  'articleNumber' => string 'XYZ' (length=3)

So the form has submitted it's data but I cannot access it on my drupal page.
What am I doing wrong?


texts:
How can I add a line item in Ubercart 2 that adds up the total cost of all items, not the sell price? I have tried to clone the generic line item hook, and add something like this for the callback:

for each($op->products as item){
  $cost += $item->cost;
}

I need this line item to appear in the cart (I'm using the ajax cart), in the order pane before the user completes checkout, and in the emails that the store owner and user get. Do I need to create a little module for this code outside of uc_order? I don't remember the code exactly as it's on my work computer, but I think I'm putting it in the wrong place. Thanks for any pointers.


texts: Does anyone know what it means when drupal appears to fail but displays this black box in the browser?


texts: What is the purpose of Views "Attachment", "Content pane" & "Context"?

texts:
I've just made a Views for a content type.

In one views, I need a page for the content type and a preview of 4 newest posts on the front page.

Page is not the problem. For front page preview, I just confused about the purpose of "Attachment", "Content pane" & "Context". I don't know which one to use for front page preview.

"Context" does not have more link, and "Content pane" is not for Panels pane since Panels module is disabled.


texts: Rule fetches only single taxonomy term from multiselect values

texts:
I have created a Rule which is supposed to fetch all the selected term from a taxonomy term field (a field that holds a list of taxonomy terms). But when the rule is executed, it fetches only one taxonomy term instead of all. The field is set to hold "unlimited" values.

Rule is:

Entity type = taxonomy term
Condition => content-type = course
Data selector => node:field-autodealer:name

The rule is supposed to add all users from selected groups into a course.


texts: 404 Not found : Could not find the controller. Services module

texts:
I have installed services module and enabled Resource-> node. Now i am using postman to test default services. My configuration details:
endpoint is "apis". Server is "REST". localhost url http://drupaltest.localhost.com. Also as per given in README file, i have downloaded spyc.php file and placed into servers/rest_server/lib/.

So when i am calling api http://drupaltest.localhost.com/apis/node its showing me result. when i am calling
http://drupaltest.localhost.com/apis/node/retrieve,
i am getting error: 404 Not found : Node retrieve could not be found.
And for http://drupaltest.localhost.com/apis/node/create error: 404 Not found : Could not find the controller.

Is there i am missing any configuration or any permission issue?


texts: How to create many workbench moderation flows / scenarios

texts:
I want to manage many content types with the workbench moderation module. Every content type should have its own states and transitions. I tried Workbench Moderation Profile module, but it has many bugs (it's in alpha) that causes many problems for me so I'm looking for any alternatives.

I don't mind developing a custom module, but I don't know how this could be achieved. Are there other solutions here?


texts: Is there a standard way to control which node or entity links appear in which view modes?

texts:
My module adds a link to the node view, from within hook_node_view. Is there a "Drupal" way to let the site builder control which view modes should show that link?

Right now, I'm using a multiselect control on the module's admin settings page.


texts:
Is it possible to read the query string and it's values from the &$page param in the hook_page_alter function?

If not, is it possible at all?


texts: Problem using two TB Mega Menus one above the other

texts:
I am using Drupal 7 with the TB Mega Menu module. I have one menu positioned below the other in the following configuration:

__________________________________________
|  Menu bar 1                            |
------------------------------------------
|  Menu bar 2                            |
------------------------------------------

Both Menu bar 1 and Menu bar 2 have drop down menus. The problem is that when Menu bar 1's drop down menu is being displayed, it is showing up behind Menu bar 2. I thought this was a z-ordering problem and tried changed the values for both menus but it doesn't change the outcome.

I looked at the javascipt code for TB Mega Menus and don't see anything in there about z-ordering either.

There must be something I am missing/overlooking. Any ideas as to what I should be looking for in order to get this to work?


texts: How to onclick-trigger a non-native jQuery plugin's action?

texts:
I've installed a 3rd-party jQuery plugin (it's an accordion).  It displays on my page, and works as expected.

I want to trigger one of the plugin's actions (open a particular slide) when I click on an image on my page.

I can't seem to get the  code &/or syntax for doing that right.

The plugin I've installed is "EasyAccordion" (http://www.madeincima.eu/blog/jquery-plugin-easy-accordion/).  It's .js source is posted here: http://pastebin.com/55JB4pr2.

I'm using the plugin on a Drupal7 page.

I don't think that the specific plugin, or the fact that it's been used in Drupal, is relevant to the proper jQuery usage.

jQuery's bundled with Drupal.  I init the plugin on my page with:

    ( function ($) {
        Drupal.behaviors.myEasyAccordion = {
            attach: function(context,settings) {
                $('#accordion1',context).easyAccordion({
                    autoStart:     false,
                    ...
                });
            }
        };
    })(jQuery);

In my markup, I have

    ...

     ... EASYACCORDION MARKUP ...

    ...

Again, with this init & markup, the accordion appears/works as expected.

On the same page, in another  I've added an image-link, i.e.,

    ...

     ...  EASYACCORDION MARKUP ...

    ...

I want to click on the image in the "myImg" div, and have the EasyAccordion snap to a specific open 'pane'.  The activation of a particular pane is addressed, I think, by the

    line #127                jQuery.fn.activateSlide = function() {

function, as seen at the pastebin-link I provided above.

Iiuc, I need to add code to the init function above, to tie the image-click to an action execution in the EasyAccordion.

My question is -- how?

I think I need to fire off (e.g., for slide #3),

    jQuery(this).activateSlide(3);

adding some variation of,

    $('#myImg').click(function () {
      ...
    });

to the init, attaching it to the EasyAccordion init's function().  Something like?

    ( function ($) {
        Drupal.behaviors.myEasyAccordion = {
            attach: function(context,settings) {
                $('#accordion1',context).easyAccordion({
                    autoStart:     false,
                    ...
                });
 ---->          $('#myImg',context).easyAccordion({ ...
 ---->          ?????????
 ---->          });
            }
        };
    })(jQuery);

So far the right syntax has eluded me.  At least, I can't get the click-on-image to actually cause the specified item to 'activate' in the EasyAccordion.

These two posts,

http://stackoverflow.com/questions/5492258/easyacordion-jump-to-desired-slidenum-jquery-plugin
http://stackoverflow.com/questions/6243870/easyaccordion-jquery-plugin-callbacks

I think are close.  But I'm still not getting the syntax to crowbar into my Drupal.behaviors... stanza right.

Any guidance?


texts: Views and contextual filter as user id from url

texts:
I want to create some views that shows the content created by the user, content flagged by the user and so on. I also need that when user a views user b then user a can see the content created by user b and so on. So i though i under Contextual filter i passed a default values as User Id from url. However when i visit the page i just see the view heading and no content.Please Help

Regards


texts:
I accidentally deleted a view in my D7 website. Good for me I had backup from yesterday, so I put that on my local drupal and exported the view.

The View is getting added successfully but when i visit a node where the view should appear it doesn't and the block panel of the website returns this:

Notice: Undefined index: kontakt-block_1 in _block_rehash() (Zeile 420 von /var/www/drupal-7.19/modules/block/block.module).
Notice: Undefined index: kontakt-block_2 in _block_rehash() (Zeile 420 von /var/www/drupal-7.19/modules/block/block.module).
Notice: Undefined index: kontakt-block_4 in _block_rehash() (Zeile 420 von /var/www/drupal-7.19/modules/block/block.module).
Notice: Undefined index: kontakt-block_6 in _block_rehash() (Zeile 420 von /var/www/drupal-7.19/modules/block/block.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'rubel_zf-views-Kontakt-block_1' for key 'tmd': INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => views [:db_insert_placeholder_1] => Kontakt-block_1 [:db_insert_placeholder_2] => rubel_zf [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => -1 [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => -1 ) in drupal_write_record() (Zeile 7194 von /var/www/drupal-7.19/includes/common.inc).

If I delete the View again the blocks panel opens without a error.

any idea how I can fix this? A lot of work was done in the meantime and the bad thing not only by me. Other employees did add content. All that well be gone ;(


texts: How do I override role based permissions?

texts:
I have a user who is a member of two groups, A and B. A allows access to manipulating an entity, but B does not allow access to the entity.

I need to dynamically set the permission when the user access the entity. I am currently looking at hook_permission() but I found the role based permission restrictive when trying to do this. Is there a way to do this?


texts: How to get the value from the url in the function argument?

texts:
When I pass nid value in the url like '/abc/[nid]', I want a function to receive that nid value

the code is as the following:

function ort_view_menu() {
          $items['ox_view'] = array(
            'title' => 'Viewed Details',
            'description' => 'g a report',
            'page callback' => 'abc',
            'type' => MENU_CALLBACK,
            'access callback' => TRUE,
           );
return $items;
}

function abc($nid) {
$rows = array();
$node = node_load($nid);
}

What changes do I need to make in hook_menu() to catch the nid value in the page callback function


texts: Status report says database out of date, but update.php and drush say up-to-date

texts:
Drupal 7.39, all modules updated to their latest version using Drush 6.6.0. When I look at the status report it says 'database out of date'. When I do drush updb or call update.php both report that the database is up-to-date.

How can I find out where the problem is?


texts: How can I limit a list of node tokens to only a particular node type?

texts:
We have many content types and fields, and the "Edit Node Type" page is taking about 30 seconds to load.  The culprit appears to be a module that lists all of the available "node" tokens, using this code:

$form['modulename']['token_help'] = array(
  '#theme' => 'token_tree',
  '#token_types' => array('node'),
);

'#token_types' => array('node') gives Node tokens for every content type, even though the form will only pertain to the one Content Type.

Is there a way to limit the token tree to display only node tokens pertaining to a specific content type (without using Token Tweaks module)?


texts: How do I find the lost administrator login credentials? I have deployed locally an old Drupal 7 website and I can't find the administrator login credentials since Windows had crashed 3 years ago.


texts: ApacheSolr - No Documents or Data in Index

texts:
For reasons unknown to me, Apache Solr isn't indexing any of the Articles that I create.

I have about 10 articles, just for testing, and Solr tells me that no documents have been indexed, nor have any documents been sent to the server for indexing.

I've tried reinstalling everything and deleting the Solr & Search Index to no avail.

What am I doing wrong?


texts: Use image field in an entity query condition

texts:
How to use image field in a condition of an entity query?

To get X nodes which have no image as value of field_image I've tried this:

$nids = \Drupal::entityQuery('node')
->condition('type','X')
->condition('field_image',NULL , '=')
->execute();

it doesn't work I got always empty result.


texts: restrict a field's content based on a selected taxonomy term

texts:
I have a content type with a number field and a field for a taxonomy. I'd like that, when the user creates a node of this particular content type, the value that appears in the number field changes to a preset depending on the taxonomy term chosen.

For example, The taxonomy term is a restaurant and the number field is a price, if the user chooses an specific restaurant the price changes depending on the restaurant chosen.


texts: local language variables to use in code for queries(NOT GLOBAL LANGUAGE)

texts:
I'm building a site in multiple languages (Italian and English) and I would like to ask you to intervene on the code to add selections 'if' to my queries to the user's local language.
At first I place conditions using as a reference global $ language but I understand that it is wrong as it does for the whole site and not a single user.
I saw on the internet that you can use sessions but how do they do? I would also switch to change languages. I have no idea how to do.
I went in configurations -> REGIONAL AND LANGUAGE -> languages -> detection and selection .. here that I have to give exactly?
How should I do help me please!


texts: Convert an already created custom content type into a new module

texts:
Is there a tool that automates (or helps) the creation of a module based on a current custom content type ?
I have two new content types (forms) created using the Drupal user interface, now I realize I need to customize it further and would like to create a module to pack them all. Since I already done a lot of work building the (big) forms I was wandering if there is some kind of trick (or module) to accomplish this.


texts: View is removing iframe from custom text

texts:
I'm using a global custom text field within a view that is meant to display an embedded youtube video.

However in the actual render of the view it's completely removed from the dom.

My first assumption was that ckeditor was not allowing the iframe tag and removing it itself. However I have it setup to allow iframe tags, and if I go back and edit the Global Custom text it still appears. If it didn't allow it I'm assuming it would not appear in the editor the next time I open and edit the field.

Also I'm able to embed iframes in the body text of nodes just fine. It's specifically in views.

I also attempted creating iframes with different src's in different divs but I still had the same behavior.

Are there other possible causes of Drupal removing iframes from custom text in views? Is this the expected behavior? If this is the expected behavior is there away around this?

EDIT: Forgot to mention that 'Strip HTML tags' is also turned off.


texts: How to add a function to web form submit button?

texts: On a Drupal site, when a form submission is done. I need to trigger a SMS. I am unable to edit the form submit code. Please let me know how to add a function to webform submit button. So that on SUBMIT button click the SMS function get executed as well the form data goes to the database.


texts:
I have a long text (plain text) field connected to my content type. The field contains plain html code.

Is it possible to print this field without sanitizing it's content. I mean raw html output of it's content.

And the main thing is to do that without coding, just from admin area. :)


texts: How to use another theme's template file

texts:
I have a template file for a entity type inside my theme's folder.

How can I use the same template file in the admin area which uses the Seven theme?

Thanks. M


texts: Which are the file_save_upload() validators?

texts: In the file_save_upload() function, what keys can $validators take? I cannot find answers anywhere.


texts:
So I'm using the $block['content'] = right now to display the html for my module. But I can't bake any php into it with it laying inline like that.

How can I make a call to my custom template file that I've added to my module directory?


texts: Inside TWIG Template, how to determine if a paraph is empty or not

texts:
I have a paragraph called "Square cta" that I'm using like an old field collection.  It has 2 fields in it - a text field (field_cta_text), and an Image (field_square_cta_image).

I have a content type called "Show Page" in which I will upload an image and put in the cta text for.

I then have a view that shows all of the show pages and I reference the square_cta in my template - node--view--seasons.html.twig - like so

{{ content.field_square_cta }}

This works great for displaying the image inside the field_square_cta for the show and it acting as a link back to the Show Page node it's in.

Where I am having trouble, is not all shows have the field_square_cta populated.  For those show pages, I want to just display the of the node instead.  I have been unable to figure out how to write my if logic to determine if the field_square_cta is undefined.

Here is what I was trying to do:

{%  if content.field_square_cta %}
  {{ content.field_square_cta }}
{%  else %}

{{ label }}

{% endif %}

The conditional is always going with the if, never the else, even when I don't have any data inside the content.field_square_cta.  I have been unable to determine the proper syntax for checking if that is empty or not.

Any help would be greatly appreciated.


texts: Allow a user to flag the same node/user multiple times

texts:
The flag module allows flags to be defined per user.  For example, User 1 can flag Node A and B, and User 2 can flag Node A but not Node B.

In this situation, a flag is either on or off per user.  However, is there a way to allow a single user to flag the same piece of content multiple times?

Use case: I have created two content types, Message and Reply.  I want to limit the number of times that users can reply to a message (say, to 3).  To do this, I was going to use Rules to automatically flag the original message each time a user writes a reply.  However, since content is either flagged or unflagged, I don't see any way to allow a user to flag the content multiple times.

Any ideas on how to approach this use case are welcome, including using modules other than the flag module.


texts:
I am running Drupal 7.26 with nothing fancy; I have started to encounter a corruption issue with the menu system. We started seeing the following error (truncated to fit). Doing a drush or a manual clear cache doesn't fix it, setting menu_router.weight to NULL yes, truncating both the menu_links and menu_router tables still produces the error. Links oddly menu still appear on the site, but only some not all.

I suspect that the issue might be caused by a page view (using views3) with a set path, but I can't see why that would be as it is again just a normal path.

  PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column
      'weight' at row 9: INSERT INTO {menu_router} (path, load_functions, to_arg_functions,
      access_callback, access_arguments, page_callback, page_arguments, delivery_callback, fit,
      number_parts, context, tab_parent, tab_root, title, title_callback, title_arguments,
      theme_callback, theme_arguments, type, description, position, weight, include_file) VALUES
      .... (truncated) ....
      (:db_insert_placeholder_184, :db_insert_placeholder_185, :db_insert_placeholder_186,
      :db_insert_placeholder_187, :db_insert_placeholder_188, :db_insert_placeholder_189,
      :db_insert_placeholder_190, :db_insert_placeholder_191, :db_insert_placeholder_192,
      :db_insert_placeholder_193, :db_insert_placeholder_194, :db_insert_placeholder_195,
      :db_insert_placeholder_196, :db_insert_placeholder_197,); Array (
      .... (truncated) ....
      [:db_insert_placeholder_180] => Ajax callback for view loading.
      [:db_insert_placeholder_181] => [:db_insert_placeholder_182] => 0
      [:db_insert_placeholder_183] => sites/all/modules/contrib/views/includes/ajax.inc
      [:db_insert_placeholder_184] => volunteering/opportunities [:db_insert_placeholder_185] =>
      [:db_insert_placeholder_186] => [:db_insert_placeholder_187] => ctools_access_menu
      [:db_insert_placeholder_188] => a:1:{i:0;a:2:{s:4:"type";s:4:"none";s:8:"settings";N;}}
      [:db_insert_placeholder_189] => page_manager_page_execute [:db_insert_placeholder_190] =>
      a:1:{i:0;s:13:"volunteering_";} [:db_insert_placeholder_191] =>
      [:db_insert_placeholder_192] => 3 [:db_insert_placeholder_193] => 2
      [:db_insert_placeholder_194] => 0 [:db_insert_placeholder_195] =>
      [:db_insert_placeholder_196] => volunteering/opportunities [:db_insert_placeholder_197] =>
      Volunteering opportunities [:db_insert_placeholder_198] => t [:db_insert_placeholder_199]
      => [:db_insert_placeholder_200] => [:db_insert_placeholder_201] => a:0:{} ) in
      _menu_router_save() (line 3837 of /var/mysite/dev/includes/menu.inc).


texts: Set value in $form_state['storage'] seems to change before validation

texts:
I am sure that I do not understand something fundamental about Drupal's form API but I hope that someone can help me with that:

I want to create some kind of custom CAPTCHA as the CAPTCHA module states that with caching enabled on your project problems could appear and my project really needs caching via the Boost module. The idea was the following in my forms building array:

  $number1 = rand(0, 10);
  $number2 = rand(0, 10);
  $form['numbercheck'] = array(
    '#type' => 'numberfield',
    '#title' => 'Please fill in the sum of '. $number1 .' and '. $number2,
    '#required' => TRUE,
  );
  $form_state['storage']['checksum'] = $number1 + $number2;

Then in validation I wanted to do the following check:

 if($form_state['storage']['checksum'] != $form_state['values']['numbercheck']) {
  form_set_error('numbercheck', 'The sum was not correct');
}

But every time I fill in the form the following happens: say the first random number is 1 and the second number is 2 - I fill in the correct value "3" but get an error "The sum was not correct". Using Devel module and dpm()-function to get the values of $form_state['storage']['checksum'] and the single random numbers I realize that this value changed after submitting the form - while viewing the form the value is correctly "3" but when validation starts the value change to let's say 4 because the then newly created numbers in the then newly created form are maybe 1 and 3.

I tried

$form_state['rebuild'] = FALSE;

in form building function as I thought that the form may be rebuild before validation starts and therefore the random numbers were newly created as well as the $form_state array may be changed but this did not solve my problem.

I hope that somebody can help me out with that - thank you very much in advance!

Best,
Tobias


texts: is there any option in drupal to create a node for a particular user?

texts: I am going to create a medical lab examination system.In which i would have to display lab results to users individually.i will implement it by creating individual node for different different users, is there any option in drupal to create a node for a particular user ?


texts: How to make anonymous all quiz submissions?

texts: I am trying out the quiz module and would like to be able to anonymize all quiz submissions, is this possible? Perhaps though a query_alter hook?


texts: How to configure relationships created by the User relationships module

texts:
I've managed to get my UR module setup. My users can now add each other. However, the only problem am faced with is that when Alice adds Bob and Bob accepts the friend request, only Bob can see Alice's name in their current relationship list; in Alice's current relationship list Bob does not appear.

Furthermore, Alice does not get a confirmation when their friend request is accepted. How can i go about fixing this problem?

I am using Drupal 7 and the zen sub theme.


texts: How to use hook_block_view_MODULE_DELTA_alter on Views-exposed form?

texts:
I want to use hook_block_view_MODULE_DELTA_alter to modify a Views-exposed form. The URL path to the configuration page for the block is:

admin/structure/block/manage/views/-exp-resources_by_subject-page/configure

As you can see, it's delta value is -exp-resources_by_subject-page, which means my hook_block_view_MODULE_DELTA_alter now becomes:

function mymodule_block_view_views_-exp-resources_by_subject-page_alter(&$data, $block) {}

This, of course, returns an error:

Parse error: syntax error, unexpected '-', expecting '('

I don't want to use hook_block_view_alter as mentioned here because, as that is called for all blocks.


texts: Change Product type's referenced Variation type

texts:
Once a Product type is created, I cannot change Variation type in Product type. Is this a feature, or is there a way to change it?

Is it safe if I change it in the database?

This is useful because I want to use entity_clone and create multiple similar Product types and change the variation type after the clone.


texts: Is it possible to add a class to single pane (like the left side) on a panels page? I'm using a grid based theme and it would be nice if i can just add things like 'grid-5 alpha' to a certain pane.


texts: howto set a category for a webform/entityform question ...?

texts:
I need to have students fill out ~50 questions on their studies abroad -- and show their answers on pages in drupal (form submissions are drupal content). questions can belong to 10 different categories. I'm trying to use either webform or entityform ... but coming up blank here on how to give each question an associated category Views can use.

I can use field_group to group questions under a specific category, but the field_group setting is not useable in Views. I'm aiming for a view of something like this photoshop mockup:

Any ideas are appreciated :)

I have looked into making a Views Filter for the field_group field. But field_group stores the data for a group in a serialized $data field per Group ... I dont think views as an sql-query-builder can do anything meaningful with data in that format (or am I wrong) ... ?


texts:
I created a views page displaying "full posts" of any content type.

Next I gave the page URL to be "test/%"

Next I added a contextual filter for Nid

Check "Specify validation criteria" below
"validator" set to content
and "Filter value format" i set to "node IDs separated by , or +"

Now in my preview I put "1+2+3" and I only get node 1. Node 2 and 3 dont show up.

site.com/test/1+2+3 also only gets node 1

How can I get multiple nodes on 1 page?


texts: Programmatically showing the summary of a post

texts:
What's the PHP code to call summary of a post (teaser) in a custom page?

I use Drupal 6 and I want to show a small part of a specific post in a custom page.


texts: How to display background images from CSS included by modules

texts:
I'm working to take a single page "site" built in jquery/css and convert it to a D6 module.

the code contains more than one css file which has classes like this:

background: url('images/stadium.jpg') no-repeat left top;

The question I have is:
How do I get those images recognized?

Normally, in the tpl.php files I include with my module I set up my image like this and everything is fine:

<img src="print base_path().drupal_get_path('module','my_module'); /images/my_image.png" />

I don't know how to get images call from css classes to appear, and I can't build the path out all the way manually since I don't know where, or in what theme my module may end up.

If anyone has any ideas, or docs they can point me to I'd appreciate it.
if you need any clarification please let me know.

Thanks!
Steph


texts: Listen and respond to ajax_command_replace()

texts:
I have a page where a block is dynamically reloaded when the user clicks a link. Rather than writing my own js, I'm trying to do this the Drupal way and using Drupal's own ajax_command_replace() like so:

function page_callback($type = 'ajax') {
    if ($type == 'ajax') {
    // Load block
    // ....
    $commands[] = ajax_command_replace('#block-watch-notifications', $output);
    $page = array(
       '#type' => 'ajax',
       '#commands' => $commands,
    );
    ajax_deliver($page);
}

And all this works just fine.

The problem is that I need to respond to this event on my page. The js event DOMSubtreeModified would work here if it were reliably implemented by browsers, but it's not.

However, jQuery's AJAX command also issues its own series of global events, including ajaxComplete. The problem is that, however Drupal is doing its AJAX magic, it isn't raising this event.

How can I listen for ajax_command_replace() having done its work on my page?


texts: "jquery_file_upload.id is part of the primary key but is not specified to be 'not null'"

texts:
I have installed the jQuery File Upload module, and I get the following error:

  jquery_file_upload.id is part of the primary key but is not specified to be 'not null'

What does that error message mean, and how can I resolve it?


texts: Create custom block module with sorting of block content

texts:
I am using Drupal 7.
I want to create a module which shows All the latest posts in Group with sorting options for the posts(a dropdown for sorting posts in block with various options).
I am using organic group module for group management.

I have created a block module which can fetch the content for the particular group, but I am not able to manage sorting drop down form.

Does any one have idea, how to display form in block output and then sort that form.

I am also using file attachment with posts in group. So my sorting parameters includes no of files in post, postdate(i can get using views), Most viewed, Most comment,

Note: I want to build custom module because first I tried with Views module, but I am not able to get various sorting parameters which i need for sorting


texts: Get entities that share the Entity Reference field

texts:
Let's say that I have two content types:

Article

title
body
field_ref_term

Page

title
body
field_ref_term

Those two content types are sharing the same field: "field_ref_term" wich is a "Entity reference" field type, to another entity called 'Term' (or something else, it doesn't mind).

What I'm trying to do is, when displaying a particular content of type "Page", I would like to be able to display a list of content in a block who shares the same value for the "field_ref_term" field.

It's a bit like the "Content: Has taxonomy term ID" contextual filter from Views and Taxonomies, where you set the value to "Taxonomy term ID from URL" then check "Load default filter from node page, that's good for related taxonomy blocks".

Do you think this is currently possible with Entity Reference ?

Thanks


texts: An AJAX HTTP error occurred using commerce coupon percentage

texts:
I'm able to create coupons with no errors. When I enter coupon code into the field and click on the submit button I get the following error.

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText:

Drupal version 7.28

Commerce Coupon Percentage 7.x-1.0-beta7

dblog messages

// first error
Rules Warning:
  Unable to get a data value.
Error:
  Unable to get the data property code as the parent data structure is not set.
// second error
Rules Warning:
  Unable to evaluate condition commerce_coupon_discount_coupon_codes_exist_on_order.
// second error
PHP Error:
  EntityMetadataWrapperException:
  Unable to get the data property coupon_id as the parent data structure is not set.
  in EntityStructureWrapper->getPropertyValue()(line 438 of /homepages/
  36/d385915579/htdocs/bbp/sites/all/modules/entity/includes/entity.wrapper.inc).


texts: How to style an "all day event" to have it styled like any other event?

texts:
I am on Drupal 7. Everything works fine in Calendar module, except when I add the all day event then the styling is changed, I wanted the same styling for all the events.

  "All day events" are created by "date_all_day" module which comes with
  "date" module.


texts:
I have a Quicktab with 2 tabs. The block is placed in user profile.

Now I want to show one of the blocks only when the user visits his own profile and hide it when he is visiting other profiles. How may I do this?


texts: How to disable views pager programatically in certain cases

texts:
I have a paragraph which shows a view. The editor may set some options as argument filters, sort and show/hide pager. "Normal" fields are used to collect these options and template_preprocess_paragraph__PARAGRAPH_TYPE actually builds the view. The filtering works well, but I am not able to get rid of the pager if the editor desires to disable it while limiting the amount of items shown at the same time ($view->setItemsPerPage(0); is not an option here). Here is some simplified code from mytheme.theme:

function mytheme_preprocess_paragraph__content_list(&$variables) {
  $view = Views::getView('content_list');
  if (!$view) {
    return;
  }

  // Simulate user input:
  $order = 'DESC';
  $disable_pager = TRUE;
  $items_per_page = 12;
  $filter_args = [1,2,3,4];

  $display_id = 'embed_content_list_title';
  $view->setDisplay($display_id);
  $view->setHandlerOption($display_id, 'sort', 'title', 'order', $order);

  if ($disable_pager) {
    $display = $view->getDisplay();
    $pager = [
      'type' => 'none',
      'options' => [
        'offset' => 0,
        'items_per_page' => 50,
      ],
    ];
    // This doesn't work:
    $display->setOption('pager', $pager);
    $display->setOverride('pager', $pager);
    // This neither works:
    $view->display_handler->setOption('pager', $pager);
    $view->display_handler->setOverride('pager', $pager);
    // I also had no luck with:
    $view->pager = NULL;

    $view->setItemsPerPage($items_per_page);
  }

  $view->execute();
  $variables['content']['content_list'] = $view->buildRenderable($display_id, [$filter_args]);
}

How can the pager be disabled in above code? A workaround might be using different displays, one with pager enabled and another with pager disabled. But I would prefer to solve it with just one display (as I already have multiple displays and would have to build both versions for each display).


texts: How do you set the #options paramater for checkboxes and radio buttons?

texts:
I'm attempting to create a a form using the Form API and I'm unable to get checkboxes and radio buttons working properly. Although they show up in the form, only the first option of each one is displayed, that option is displayed with the title of the form:

I also have a select box on the page which is displaying fine, and I'm passing through the values to the select the same way I'm passing it through to the radio/checkboxes, with an array.

How do you pass values through to the #options parameter for checkboxes and radios, or do I simply having a careless error somewhere in my code (featured below)?

Code for the radio buttons and checkboxes:

 $facts = array(
        'Ponycon' => t('Attended Ponycon'),
        'PurhcaseMerch' => t('Purhcased My Little Pony: Friendship is Magic merchandise (dolls, cards, shirts, et cetera)'),
        'PurchaseShow' => t('Purhcased Episodes'),
        'Meetups' => t('Attended Brony meet-ups'),
        'Fanclubs' => t('Part of a MY Little Pony: Friendship is Magic fanclub (Facebook, local, et cetera)'),
    );

$form['fan_activities'] = array(
    '#type' => 'checkbox',
    '#title' => t('Which of the following have you done?'),
    '#options' => $facts,
    '#description' => t('Brony activities'),
);

$fdisc = array(
    'friend' => t('A friend told me about it'),
    'ads' => t('Advertisments (commercials, billboards, et certera)'),
    'Internet' => t('The internet, but not through an ad (forum, website article, et cetera)'),
    'Other' => t('Other'),
);

$form['discoverry'] = array(
    '#type' => 'radio',
    '#title' => t('How did you first hear about My Little Pony: Friendship is Magic?'),
    '#options' => $fdisc,
    '#description' => t('How you discovered the show'),
);

Code for the working select box:

        $fchoices = array(
        'RainbowDash' => t('Rainbow Dash'),
        'TwilightSparkle' => t('Twilight Sparkle'),
        'Rarity' => t('Rarity'),
        'PinkiePie' => t('Pinkie Pie'),
        'Fluttershy' => t('Fluttershy'),
        'Applejack' => t('Applejack'),
    );

    $form['favpony_area']['favpony'] = array(
        '#type' => 'select',
        '#title' => t('Who is your favourite Pony from the mane six?'),
        '#options' => $fchoices,
        '#default_value' => variable_get('favpony', 'RainbowDash'),
        '#description' => t('Your favourite Pony frmo the mane six'),
    );


texts: How do I create a rule to display a system message to users before 10 minutes of an event?

texts: I am developing a telecalling management system in drupal 7. I have a content type 'Leads' which has a field 'Next Call date'. It is a date field. I want to remind the online user who created the lead(content) about the next call time by a system message. How can I create rule for it?


texts:
I'm building a custom module (say 'mycalc') with a custom block with a custom form inside.
Now I want to attach a library to the form and add some styling and live manipulation.

I created the mycalc.libraries.yml like this:

myform:
  version: 1.x
  css:
    theme:
      css/mycalc.css: {}
  js:
    js/mycalc.js: {}
  dependencies:
    - core/jquery

I added the js/mycalc.js and css/mycalc.css files with few basic lines.
Then in the src/Form/MyCalcForm.php (where is set the MyCalcForm class), i edited the buildForm method adding this just before the return():

$form['#attached']['library'][] = 'mycalc/myform';

But there's no js nor css loading.
What's wrong? Please help!


texts: How to expose the URL alias of a taxonomy term in a View?

texts:
I have a View showing Taxonomy Terms as JSON, and want to expose the URL aliases of those terms:
{
  "terms" : [
    {
      "term" : {
        "name" : "Media centre",
        "term_id" : "4547",
      }
    },
    ...

Some of the terms have URL aliases manually set, while others are automatically generated.
How can I expose the URL alias of each term as a field?
{
  "terms" : [
    {
      "term" : {
        "name" : "Media centre",
        "term_id" : "4547",
        "term_url_alias" : "/about/news/media-centre"   <<<<<
      }
    },
    ...

No field relating to Path, URL or Alias appears under fields or relationships. My issue sounds similar to How to use url alias in views for taxonomy terms? but the answer didn't fix my problem.


texts: Adding a specific field of a content type in the display of another content type

texts:
Sorry I didn't know how to put my question easily, so I detail my problem here.

I use Entity Reference to reference various fields in my contents, and it works good.

Now, I have a "Fruits" content type, with a field named "Picture".

I have another content type, which contains a reference to the fruit "Name", but I want to display the picture and not only the name.

How can I do ?


texts: How to invoke a search api from drupal site for Ubuntu Unity lense?

texts:
I'm creating a simple Unity lense for my college site which is based on Drupal, but I don't know how to adapt this command for Drupal API. Please help, it's python.

  We now create our query url, using the Wikipedia opensearch API url = ("%s/w/api.php?action=opensearch&limit=25&format=json&search=%s" % (self.wiki, search))

I'm using template to write lense following Wikipedia example http://developer.ubuntu.com/2012/04/how-to-create-a-wikipedia-unity-lens-for-ubuntu/. I don't know python but Im familiar with C. This Drupal API calling is the only problem I have to successfully develop a lense. Please help!


texts: Commerce Kickstart Facet Displays Item Count Even With Option Disabled

texts:
I'm using Kickstart2.

I imported a new set of Categories and Collections using a Taxonomy Feed Importer. Seemed to work OK but now, the facet display -always- shows the item count for -all- search vocabularies, even though I have that option disabled in each search field eg.

admin/config/search/facetapi/search_api%2540product_display/block/field_category/edit

I can't see how the Feed Import would cause this so maybe that's a red herring, but regardless, this worked properly -before- my import and now I can't turn this item count off.

Any idea how to get rid of these?


texts: Product Bundles & referenced products in Drupal Commerce

texts:
What is the preferred way of retrieving referenced products when using hook_commerce_checkout_complete on a line item that is of type Product Bundle.

As an example, the customer has added Product ID 5 (which is a bundle consisting of Products 3 & 4).

How can find it's referenced products at the point of checkout completion?


texts: View's row style output is NULL, template file not found in ./

texts:
I'm theming a block view that displays content that is related to the current node. When I preview the view results they show up fine, but the content doesn't render in my theme.

When I examined more, I noticed the views-view-unformatted template renders correctly and contains three rows as expected, but each of the rows just contains the value NULL.

The theme information tool in Views gives the following error regarding row style output:

  Row style output: views-view-fields.tpl.php, views-view-fields--read-next.tpl.php,
  views-view-fields--default.tpl.php,
  views-view-fields--default.tpl.php, views-view-fields--block.tpl.php,
  views-view-fields--read-next--block.tpl.php (File not found, in folder ./)

I created the file views-view-fields--read-next--block.tpl.php with the following content:

<?php foreach ($fields as $id => $field): ?>
    <?php print $field->content; ?>
<?php endforeach; ?>

Unfortunately that did not help. The file is still not found and nothing is rendered. Other things I've tried:

Disabling devel_themer
Clearing all caches
Restarting Apache
Checking file permissions
Changing the view formatting back and forth a few times
Edit: Rescanning the template files

What can be the problem? I don't know where to look next. I'm using Views 7.x-3.10.


texts:
I've made a module which will parse a few RSS feeds, and automatically creates new content. But I've got an issue creating images.

Since D7, cron are run anonymously, so I think my problem comes from here.
Is there a way to allow anonymous user to create images?

Here's the way I'm doing it. It works if I call FeedController::import via a route, and connected ; but not if I call it through Drupal's cron task.

rssfeed.module

<?php
use Drupal\rssfeed\Controller\FeedController;

function rssfeed_cron() {
  FeedController::import();
}

src/Controller/FeedController.php::import

public function import()
{
  $params = array();
  // some stuff to fill $params array

  $hash = ...;
  $src  = ...;
  $alt  = ...;

  $data = file_get_contents($src);
  $size = getimagesize($src);
  $extension = image_type_to_extension($size[2]);
  $file = file_save_data(
    $data,
    sprintf('public://rss/%s.%s', $hash, $extension),
    FILE_EXISTS_REPLACE
  );

  if ($file) {
    $params['field_image_main'] = array(
      'target_id' => $file->id(),
      'alt' => $alt
    );
  }

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


texts:
I have a simple form with method GET as follow...

function MYMODULE_form($form, &$form_state) {
  $form['#method'] = 'get';
  $params = drupal_get_query_parameters();
  $form['cat'] = array(
    '#type' => 'select',
    '#title' => t('Categories'),
    '#options' => $categories,
    '#default_value' => isset($params['cat']) ? $params['cat'] : '',
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
}

GET actuly bypasses the default submit and validation functions, which is ok for me.
I want to submit this form without submit button, when value in 'Categories' field is changed.

function MYMODULE_form($form, &$form_state) {
  $form['#method'] = 'get';
  $params = drupal_get_query_parameters();
  $form['cat'] = array(
    '#type' => 'select',
    '#title' => t('Categories'),
    '#options' => $categories,
    '#default_value' => isset($params['cat']) ? $params['cat'] : '',
    '#ajax' => array(
      'callback' => 'MYMODULE_form_submit',
    ),
  );
}

How should I do this?


texts: Can't get neither CKEditor nor WYSIGYG Module to work!

texts:
I have the Drupal 7.21 installation and I am using a downloaded theme (premium responsive). I am trying to install an editor for my website entries but I have not been able to get it to work. This is the information on the two I have tried:

CKEditor version 4.0.2 and CKEditor Module 7.x-1.12
OR
WYSIWYG Module version 7.x-2.2 with TinyMCE 3.5.8

I have carefully checked the installation instructions for all and they are correctly installed. I have been able to enable both (not at the same time, obviously) without any errors. However, when I try to add content I don't see the toolbars, only the plain white box.

So far it has been very frustrating. I have checked every thread that describes similar problems and tried every suggestion but it just won't work.

Can anyone provide a suggestion?

Thanks!


texts: How to get a count of number of nodes created per week in views and show the week

texts:
I am creating a view to breakdown the number of node published per week using views. I were able to create a view that will show me the breakdown day or month but there is no option for week. How will I do that?

and the result

Also how do I make it show the first day of that week or the first item publish for that week.

Any help is appreciated.

** update**

I were able to get the right mysql query:

SELECT COUNT(DISTINCT node.nid) AS nid, MIN(node.nid) AS nid_1, 'node' AS field_data_field_published_at_node_entity_type, YEARWEEK(DATE_FORMAT((DATE_ADD('19700101', INTERVAL node.created SECOND) + INTERVAL -14400 SECOND), '%Y%m%d')) AS node_created_yearweek FROM node LEFT JOIN field_data_field_published_at field_data_field_published_at ON node.nid = field_data_field_published_at.entity_id AND field_data_field_published_at.entity_type = 'node' WHERE (( (node.status = '1') )) GROUP BY field_data_field_published_at_node_entity_type, node_created_yearweek ORDER BY node_created_yearweek DESC LIMIT 55;

How can I add the query to the view?

update 2
base on you answer it is grouping by day showing week:

update 3

and the list is still the same grouping by day showing week.
The numbers in parenthesis are the number of item published that/a day of the week.
Example on week 21 we published item 6 days in that week and in the parenthesis is the number of item published for each day.

upate 4 some progress
removed sort criteria

expected output but all years (last 3 years) are combine


texts: Adding an Attribute to a Script Tag Before Src

texts:
I'm working with CloudFlare and have identified a script that needs the data-cfasync=“false” attribute applied so CF doesn't touch it.

This script is defined in a library in a custom module.

my-custom-library:
  version: 1.x
  header: true
  js:
    //path/to/external/library.js: { type: external, weight: -400, attributes: { data-cfasync: "false" } }

I can get the attribute on the script tag in question but it's always after the src. Per the CloudFlare requirements it needs to go before src.

How can I can move this attribute to where it needs to go?


texts:
Thinking how to achieve what I need, looking into possibilities. I have a content type that is used for all kind of locals: restaurants, clubs and so on. Now, what I want is to have a list of nearest 3 events that will take place in that specific place.

So far I was thinking about creating new type of nodes for events. Let's say: Event content. Seems logical, right? Now, using Entity Reference I should be able somehow to add relation between an event and club (not sure about this one yet). Next step would be displaying this added event on the node of that club. How could I achieve that? Creating a View and putting it into the node display somehow? Block?

Really could use some ideas for that.


texts:
I have a simple merge query, with one key and three fields, something like:

$query = db_merge('product')
->key(array(
  'id' => $id_product,
))
->fields(array(
  'name'   => $form_state['values']['name'],
  'symbol' => $form_state['values']['symbol'],
  'weight' => $form_state['values']['weight'],
));

Usually it works all right, but some combinations of data passed to it and data already in database cause me headache. I'm sure I would be able to know what's wrong and why, if only I could grab actual SQL query that goes to my database.

Usually I would do:

  kpr((string)$query);

It works well for insert for example, because insert has __toString() well implemented. Sadly, implementation of MergeQuery::__toString is somewhat nonexistent:

public function __toString() {
}

It isn't even a proper implementation of this magic method, as it should always return string, but OK, I can assume it was on purpose. Anyway, this changes nothing: I can't simply cast it to see it.

What other options do I have, to see queries generated by db_merge() / MergeQuery for database interaction debugging?


texts: Group id not shown when view is empty in Drupal 8?

texts:
I am new to Drupal 8. I make custom view field (programmatically) and pass session variable to it.Session variable contain group id.
The problem is that when the view is empty i mean no content in view then the group id not shown.When the view is not empty the group id shown.check out below code.

logged_in.views.inc

<?php

/**
 * @file
 * Contains logged_in\logged_in.views.inc..
 * Provide a custom views field data that isn't tied to any other module. */

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Render\Markup;
use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\system\ActionConfigEntityInterface;

/**
 * Implements hook_views_data().
 */
function logged_in_views_data() {

  $data['views']['table']['group'] = t('Custom Global');
  $data['views']['table']['join'] = [
    // #global is a special flag which allows a table to appear all the time.
    '#global' => [],
  ];

  $data['views']['logged_in'] = [
    'title' => t('Logged in'),
    'help' => t('Checks if a user is logged in.'),
    'field' => [
      'id' => 'logged_in',
    ],
  ];

  return $data;
}

<?php

namespace Drupal\logged_in\Plugin\views\field;

use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;

/**
 * A handler to provide a field that is completely custom by the administrator.
 *
 * @ingroup views_field_handlers
 *
 * @ViewsField("logged_in")
 */
class LoggedIn extends FieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function usesGroupBy() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function query() {
    // Do nothing -- to override the parent query.
  }

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();

    $options['hide_alter_empty'] = ['default' => FALSE];
    return $options;
  }

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

  /**
   * {@inheritdoc}
   */
  public function render(ResultRow $values) {
    // Return a random text, here you can include your custom logic.
    // Include any namespace required to call the method required to generate
    // the desired output.
     //    $logged_in = \Drupal::currentUser()->isAuthenticated();
    // $logged_in = \Drupal::currentUser()->id();
       $logged_in = (int)$_SESSION['groupbysession']['group_id'];
        return $logged_in;
  }

}

All Session

Add Session


texts: I need to switch themes based on URL paths and content types. I would have used ThemeKey, but it's not in a ready state. What are people using in Drupal 8 to do these things?