texts: Getting all unique pairs without GROUP BY

texts:
I have table with the following structure:

id | sender_mail | recipient_mail | username | subject | message | created
1    aa@test.com    bb@test.com        aaa       xxxx     yyy       10
2    bb@test.com    aa@test.com        bbb       xxxx     yyy       11
3    cc@test.com    bb@test.com        ccc       xxxx     yyy       12
4    bb@test.com    cc@test.com        bbb       xxxx     yyy       13
5    dd@test.com    gg@test.com        ddd       xxxx     yyy       14
6    gg@test.com    bb@test.com        ggg       xxxx     yyy       15

What I want is to get all unique pairs between columns sender_mail and recipient_mail where one of those columns has a value of email I'm passing in to the query. For example, if i put in bb@test.com as argument, the desired output should be:

id | sender_mail | recipient_mail | username | subject | message | created
2    bb@test.com    aa@test.com        bbb       xxxx     yyy       11
4    bb@test.com    cc@test.com        bbb       xxxx     yyy       13
6    gg@test.com    bb@test.com        ggg       xxxx     yyy       15

I tried out this SQL query:

SELECT *
FROM messages AS m
WHERE
    m.sender_mail = 'bb@test.com' OR
    m.recipient_mail = 'bb@test.com'

GROUP BY m.sender_mail, m.recipient_mail

It seemed to work when I passed the query to database directly (sequel pro). But when I put this code in a Drupal controller, an error gets thrown out:

  Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]:
  Syntax error or access violation: 1055 'drupal.m.username' isn't in
  GROUP BY:  SELECT m.sender_mail, m.recipient_mail, m. username,
  m.subject, m.message, m.created

After googling, I found out that Drupal 8 enforces ONLY_FULL_GROUP_BY for SQL.

What is the workaround for this? How do I need to alter my query?


texts: Custom module shows in list but not in permissions

texts:
I have a simple module I created and it shows up in modules config panel and I have enabled it. The functions are called and the output even shows:

function products_help($path, $arg) {
  if ($path == 'admin/help#first') {
    return t('Products Help');
  }
}

function products_perm() {
  return array(
    'access products' => array(
      'title' => t('TBYT Products'),
      'description' => t('Administer TBYT Products'),
    )
  );
}

function products_menu() {
  $items = array();

  $items['products/winnipeg'] = array(
    'type' => MENU_CALLBACK,

    'title' => 'Enjoy shopping in Winnipeg',
    'page callback' => 'list_products',
    'access arguments' => array('access products')
  );

  return $items;
}

What am I missing? I cannot find this module anywhere under permission configuration...I expect to find the option for allowing "access products" to authenticated user???

Any ideas?


texts: Embedding a webform inside a node content

texts: I need to embed a webform inside content, which is a node. How can this be implemented?


texts: How to make services node output of file to use external URL instead of public:// URI

texts:
I've got a basic web service defined in Drupal that returns JSON describing existing nodes on the server. Contained in the output is the key-value pair:

"uri":"public://audio_snippets/01 Australias.m4a"

Is there a way for the client website that consumes this service to convert the public:// URI into something a browser can actually download, like http://www.mywebservice.com/audio_snippets/01Australias.m4a


texts: theme_key does not switch theme when URL user//edit is called

texts:
Hello fellows and Gurus,

I am having a problem with a mobile theme of our standard website (running Drupal 7)

We therefore have two URLs:

mywebsite.com
m.mywebsite.com

We use the ThemeKey module to redirect to the correct theme/templates. We also tried Mobile Tools, but it does not work any better, so it is currently disabled.

For most pages, the url detection works and successfully redirects to the mobile theme when m.mywebsite.com/<somepage> is called.

However, when user wants to edit his own profile (m.mywebsite.com/user/<uid>/edit), the standard page is shown instead.

Same happens with the "cancel account page" (m.mywebsite.com/user/<uid>/cancel).

However the registration page (m.mywebsite.com/user/register), and the forgot your password page (m.mywebsite.com/user/password) works OK. Even when the user is connected for the latter.

Any ideas of what could be wrong in our configuration/code ?


texts: How to define multiple file downloads for a single library in drush make

texts:
I am trying to create a make file for the closedquestion module following the instructions in the readme file.

I know the below configuration snippet doesn't work - due to the fact that I am overwriten the first declared download with the second.

; Closedquestion libraries

; * Put jquery.json in sites/all/libraries/jquery-json
;   get it from: http://code.google.com/p/jquery-json/
;   This should result in one of the files (you might have to rename it):
;   - sites/all/libraries/jquery-json/jquery.json.js
;   - sites/all/libraries/jquery-json/jquery.json.min.js

libraries[jquery-json][download][type] = "file"
libraries[jquery-json][download][url] = "http://jquery-json.googlecode.com/files/jquery.json-2.3.js"
libraries[jquery-json][download][sha1] = "2bf6472f96791d6f8a5a405fe6eabe87babf8931"

libraries[jquery-json][download][type] = "file"
libraries[jquery-json][download][url] = "http://jquery-json.googlecode.com/files/jquery.json-2.3.min.js"
libraries[jquery-json][download][sha1] = "2a4615b93c65dd50f92117c570121035a0327fee"

I also tried renaming the second to jquery-json-min & defining a directory_name, but that just throws an error that the folder already exists as would be expected.

libraries[jquery-json-min][download][type] = "file"
libraries[jquery-json-min][download][url] = "http://jquery-json.googlecode.com/files/jquery.json-2.3.min.js"
libraries[jquery-json-min][download][sha1] = "2a4615b93c65dd50f92117c570121035a0327fee"
libraries[jquery-json-min][directory_name] = "jquery-json"

Any input on how this could be solved would be much appreciated.


texts: I'm looking for a way of mergin 2 fields into html select item. First field is links to other nodes within drupal, second field is links to another external content. Now I would like to merge these fields into html, which I could program "onChange" to follow selected link. Any ideas? Should I override both .tpl.php for that field, then with jQuery build one select? Or maybe this could be done easier, before rendering? Or maybe views might be enough? View, type of entity, added to certain node.. but then I have problems finding way of displaying those fields at the same time. Any advices?


texts: How do I hide the submission button basing on some conditions?

texts:
I have a webform with a mandatory Yes/No button. I want to hide the submission button if No is selected.
How can I set up the logical condition for achieving this?


texts: User profile edit form cannot be submitted

texts:
I'm changing user profile edit page to reorder input fields and put them in div tags.
I have added following code into template.php.

function MYTHEME_theme() {
  $items['user_profile_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
    'template' => 'user-profile-form',
    'preprocess functions' => array(
      'MYTHEME_preprocess_user_profile_form'
    ),
  );
  return $items;
}

Also I have created file user-profile-form.tpl.php and put code there

  <?php print render($form['picture']);?>
  <?php print render($form['field_first_name']);?>
  <?php print render($form['field_last_name']);?>
  <?php print render($form['field_gender']);?>
  <?php print render($form['field_my_categories']);?>
  <?php print render($form['field_about_me']);?>
  <?php print render($form['field_education']);?>
  <?php print render($form['field_experience']);?>
  <?php print render($form['account']);?>

  <?php print render($form['actions']);?>

Form is being displayed as expected, but clicking submit button has no results. What have I missed in code to make it work?


texts:
I have created the view of indexed fields of custom entity products where I have data from various vendors like Amazon, Flipkart, Ebay. For indexing, I have used search_api module (database search). When I am searching data through it, It shows me data like this-

Amazon

Product 1

Product 2

Product 3

Ebay

Product x

Product y

Product z

Flipkart

Product a

Product b

Product c

But, I want products to be listed side by side in the form of -

Amazon Ebay Flipkart

Product 1  Product x  Product a

Product 2  Product y  Product b

Product 3  Product z  Product c

Is there any way to show the grouping results in the above form through table?


texts: How do I give an inline image in a simplenews email an absolute url?

texts:
The output from field--text-with-summary.html.twig gives each inline image a relative url of this form:

<img alt="Image 1" data-entity-type="file" data-entity-uuid="5ed6da76..."
src="/sites/default/files/inline-images/image1.jpeg" />

These inline image tags are presumably generated by CKEditor; i.e. they are not fields with which I can use individual twig filters.

I have hacked replacing each relative url with an absolute one in the items array within the render array but these links are overwritten (somewhere) after preprocessing in the final rendering.

What is the correct way to do this?


texts:
I have content type recipes and a view page that list all of my recipe nodes, that view has an exposed filter block that i placed in header. So in header i have views exposed filter ( search terms ) that works as recipe finder.

Now on that view page with results i want to add more exposed filters (3 select drop down) that will filter my selected taxonomies.

Problem is  if i just add those filters in my view, they will all show up in same block in header, but there i need just search.

Is there a way to have just 1 exposed filter in block and others on a view page.


texts: How can I group view results based on the week of the year using a date field?

texts:
I have a list of events (custom content type event) shown in a view.

There are several events each week.  Each event has a date field, date, that records the date that the event will be held.

I would like to group the events by the week of the year that they occur.  For example:

Next week
Two weeks from now
Three weeks from now
Four weeks from now

Is there a fancy way to compute the week using the date field and views grouping?


texts: Memory error when updating user field with Rules

texts:
I'm using the Rules module to update my user email signatures.
The rule get's triggered whenever an account is updated and performs a simple custom action.
This is the action, all it does is save a new value to the signature field (textfield, full_html).
<?php

namespace Drupal\frontview_general\Plugin\RulesAction;

use Drupal\rules\Core\RulesActionBase;
use Drupal\user\Entity\User;

/**
 * Change event date status to ( selected, open, closed )
 *
 * @RulesAction(
 *   id = "rules_update_signature",
 *   label = @Translation("Update User Signature"),
 *   category = @Translation("Custom"),
 *   context_definitions = {
 *     "uid" = @ContextDefinition("integer",
 *       label = @Translation("User id"),
 *       description = @Translation("Specifies the id of the user that needs to be updated.")
 *     )
 *   }
 * )
 */
class UpdateSignature extends RulesActionBase {

  /**
   * {@inheritdoc}
   */
  public function doExecute($uid) {

    $user = User::load($uid);

    $first_name = $user->get("field_first_name")->value;
    $last_name = $user->get("field_last_name")->value;

    $name = $first_name . " " . $last_name;

    $user->set("field_signature", $name);
    $user->field_signature->format = "full_html";

    $user->save();

  }
}

This all works fine until it hits the  $user->save(); part. That's where something goes wrong and I end up with this error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /Users/lennertslabbinck/Sites/Frontview/web/core/lib/Drupal/Core/Cache/DatabaseBackend.php on line 167

This works great in other actions with other content so it probably has something to do with this being users but I can't figure out what.


texts: I think I have deleted some .css theme files in my local directory by accident and when I delete All the theme's files to re-install and get the original files back, they still aren't there. Is there a way to reset the whole theme folder?


texts: I work at a non-profit, and the person in charge of the website has left.  I have taught myself how to edit the website online through our web log in, but can't figure out how to edit the theme.  All I need to do is add a logo to the theme (we use the Zen subtheme).  Is this something I can even do online, or do I need to set up a server shell or server test site on my desktop?


texts:
Using colorbox in views.

Can someone explain what the functionality of the "Content Image Style for first image" is?

At first glance, I would assume that it allows me to choose an image style for all of my gallery images, and then choose a different image style for the first image, allowing the first image in the gallery to be bigger or smaller, which would be very cool.

However, when I change the image style for the first image and save, all of my images in the gallery are changed to that style.

Am i missing the point here?


texts: How to call a drupal custom module function from a basic page?

texts:
* if i will click a input button in basic page a particular function should be called from my custom module. I have already enabled my
 module in my instance.*

<?php
$name = $_POST['name'];
$pwd = $_POST['pwd'];
homeFun($name,$pwd)
?>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">

Name
 <input type="text" name="name">

Password:
<input type="password" name="pwd">

<input type="submit"  value="Register">
</form>

i am using this code...and its working but the problem is while refreshing the page, function automatically gets called without clicking button...
I wrote this code in Basic Page...

  Please guys tell me the proper way to call the functioin from my basic
  page.

I just wanted to execute my cutome module function after clicking submit button...is there any simple way to do that...


texts: I can see the changes I made (as an administrator) but as an anonymous user, I can't

texts:
Have you had any problems like this before? I appreciate your help.

When I'm an admin and update a node (custom module), I can see the changes I made (as an administrator). However, when I'm an anonymous user, just to check the data, I can't see the changes I made. (note: I have flushed the site, it will work, but only when I run flush)

I thought it was something related with the permission, from a Custom module I created, but I'm not sure of that. I included a permission.yml file and gave full access. It didn't work.

find the attached images:

I had built the code in the Controller folder/file:
I have two public functions called retrieveArrayOne and retrieveArrayTwo. Each one has different data for me to query later (retrieving the data from these two functions).

public function mainviewlist() {
  $array1 = array($this->retrieveArrayTwo());
  $array2 = array($this->retrieveArrayOne());
  $retrieveData = array_merge($array1, $array2);
  $content = "

";
  foreach ($retrieveData as $key1 => $finalValues) {
    if ($key1 == 0) {
      foreach ($finalValues as $disCrop) {
        $content .= "";
        $content .= '' . $disCrop . '';
        $content .= "";
      }
    }
  }
  return array(
    '#type'     => 'markup',
    '#markup'   => $content,
    '#attached' => array(
      'library' => array(
        'modulename/modulename',

      ),
    ),
  );
}

Here is the function from the $array1 and array2. Both are similar.

$query = \Drupal::entityQuery('node');
$query->condition('status', 1);
$query->condition('type', 'content-type-name');
$query->sort('title', 'ASC');
$entity = $query->execute();
$options = array();

foreach ($entity as $n) {
  $node = \Drupal\node\Entity\Node::load($n);
  $options[$node->id()] = $node->getTitle();
  $elementA[] = [//
    'nid'        => $node->get('nid')->value,
    'title'      => $node->get('title')->value,
    'body'       => $node->get('body')->value,
    'field_crop' => $node->get('field_crop')->value,
  ];
}

return $elementA;


texts:
My homepage works perfectly fine on the live server but when I use any of the links they give me a 404 Page not Found.

I tried a couple things which was:

Made sure .htaccess was there
Tried a copy/paste of an .htaccess that someone provided
Tried setting $base_url
Tried setting Rewritebase /

Tried making sure this was in .htaccess

 Options +FollowSymLinks
 RewriteEngine on
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

I did go from an xampp local testing environment on Windows to a nginx setup on Ubuntu 14.04 so I figure it has something to do with that. I'm just not sure what to try next I've done most everything that googling brings me to.


texts: Trying to modify a menu with hook_menu_alter

texts: What is the best way to add a link to the user menu for a menu defined in my custom module?


texts:
We have an taxonomy with "news" and "articles" parent terms and structure with different child terms.

What we need, is simple navigation through this taxonomy without menus, but with pages: so at the "Article" page are presented child terms of "Article", once an term is selected user is redirected to the page with child terms of this term and list of items in current term + path to this term (like Articles > Child term 1 > Child term 2 etc for easier navigation).

Such navigation system is typical for many CMSs, but I couldn't find nothing like this in Drupal 7.

Is there a module or guide to implement such navigation?


texts: Should I stay with Poormanscron or is it worthwhile to set up an external cron?

texts:
In Drupal 7 Poormanscron has been made part of core and is the default.  I understand that for this to work at all, the site must get regular page requests in order to trigger Poormanscron - but that is not a concern with my site.

The Javascript it inserts in each page is insignificant and should not deteriorate overall performance much (if anything).  However, when the cron task actually runs, it will do so when someone requests a page, which is exactly the time you do not want your site to appear busy.  Is this a concern, or is this taken care of in some way (e.g. by running the cron task as a low priority subprocess)?

Poormanscron let you configure frequency, but not when to run.  I would prefer to have cron run at night, when the site see very little traffic.

So far, I've made do with Poormanscron.  The fact that it comes "built-in" can be viewed as some sort of recommendation.  However, I am concerned about performance. To me, it looks as if setting up an external cron job (with Gnu/Linux/Unix crontab) is a better solution for a production site.  Is this correct, or is there something I've overlooked?  Are there other things one should factor into this comparison?

PS.  I already know about the Elysia cron contributed module (basically a poor man's cron on steroids), and that it will let you set the time of day to run.  However, to keep this focused I will prefer answers that only look at the core Poormanscron vs. external cron. (Adding contributed modules also carries a performance penalty.)


texts: One Shipping method plugin or multiple Condition plugins?

texts:
What would be the best way to implement a shipping method that changes the rate amount depending on conditions that are not built in?
For example, when I have an order that has specific quantity of items of 1 category and another quantity of other items then the rate amount should be 20$, with another condition, rate amount would be 35$, with another it would be 50$.
As I see it, there are two options to resolve this problem, but not sure which is the best approach, or if there is another one.

Create 1 custom shipping method plugin, that changes the calculateRates() depending if-else cases
Create 3 custom condition plugins and separate each for an instance of the built-in FlatRate shipping method.


texts:
I dont know why the meta-tags is not working in Views.
I'm using the Meta-tag Version: 7.x-1.27
My views version: Version: 7.x-3.24

I try to change the views meta tag to any text, but it is still not working.  Nothing is change when I view that view.


texts: Stop exposed filters from rewriting url to begin with taxonomy/term/all

texts:
I have various views that show a limited range of nodes. For example going to collections/country-animals shows nodes with the taxonomy term 'country-animals'.

I have exposed filters enabled on these views, but unfortunately using an exposed filter rewrites the whole URL ignoring the fact that the user was viewing 'country-animals' and wishes to refine the current view by the terms selected. For example refining by 'gold' rewrites the URL to taxonomy/term/all?field_classification_metals_tid[]=89 and shows all nodes with the taxonomy term of 'gold' instead of nodes with the taxonomy term of 'gold' and 'country-animals'.

If I take the URL of the page I was on and combine it with the end of the URL that exposed filters creates (collections/country-animals?field_classification_metals_tid[]=89) I get exactly the view I want all the 'country animals' refined by 'gold'.

How do I make the exposed filters use the correct URL automatically instead of starting each URL with 'taxonomy/term/all'?

I get the same results with and without better exposed filters.

Here is the view settings page:

I am using Drupal 7 and Views 7.x-3.7


texts: How to pass extra information to search results page using hook node_api

texts:
I want to show some extra information on the search result page in Drupal. I want to implement it in a module (and not in the theme).

I am using this code in my custom module:

function custommodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op){
     case 'search result':
      return 'TEST';
      break;
    }

When I debug the statement, the line return 'Test' is executed.
I would expect this extra information to show up at: search-result.tpl.php in the variable $info.

However this extra information is not included. Has anyone got a clue how to pass this extra information so it shows up at the result page?


texts: For logged in user, let them view a list of content they have created (front-end user)

texts: I have a user called a creator who can create a 'skill' content type. When they are logged in, I want them to be able to view a list of the skills they have created. I am a beginner with drupal when it comes to users. What kind of settings would I need on my view so that the view showed only content by the logged in user. I know how to do this with custom code, but would be more convenient to do with views.


texts:
How can I properly render a field collection ? Is there any specific function for that ? I tried field_view_field but it does not output children fields.

My field collection is attached to a line item entity, and I want to display it in a Commerce checkout pane review.

function mymodule_pane_review($form, $form_state, $checkout_pane, $order) {
  //loading line item
  $line_item = commerce_line_item_load($order->commerce_line_items['und'][0]['line_item_id']);
  //loading field_collection from its id
  $paxsup = entity_load('field_collection_item', array($line_item->field_paxsup['und'][0]['value']));

  return drupal_render(field_attach_view('field_collection_item',$paxsup, 'full'));
}

but get an error EntityMalformedException: Missing bundle property on entity of type field_collection_item

EDIT : I got a step forward, with the use either of

$paxsups = entity_load('field_collection_item', array($line_item->field_paxsup['und'][0]['value']));
$paxsup = end($paxsups);
//or shortcut, as per Marcvangend
$paxsup = field_collection_field_get_entity($line_item->field_paxsup['und'][0]);

dsm($paxsup) now returns

So I can output a child field with

$view = field_view_field('field_collection_item', $paxsup, 'field_paxsup_civilite', $display);
return drupal_render($view);

EDIT 2: I ended chaining #markup

$display = array('label' => 'hidden');
$cv = field_view_field('field_collection_item', $paxsup, 'field_paxsup_civilite', $display);
$nom = field_view_field('field_collection_item', $paxsup, 'field_paxsup_nom', $display);
$prenom = field_view_field('field_collection_item', $paxsup, 'field_paxsup_prenom', $display);
$date = field_view_field('field_collection_item', $paxsup, 'field_paxsup_datenaiss', $display);
$view .= $cv[0]['#markup'] .' '. $nom[0]['#markup'] .' '. $prenom[0]['#markup'] .t(', né(e) le '). $date[0]['#markup'] ;

But I'm not happy with this "old style" solution, would have preferred to find a more elegant and Drupal way to output that field collection


texts:
which is the secure way of displaying the image_path in src ?

`a. <img src = "<?php print check_url($image_path) ?>" />`
b. <img src = "<?php print check_plain($image_path) ?>" />
c. <img src = “<?php print htmlspecialchars($image_path) ?>” />
d. <img src= “<?php print strip_tags($image_path)?>” />


texts: Can I create a block that shows custom node types but in a specific order?

texts:
For example, I have custom block made with Views that shows some block icons that are links to modules.

I would like to rearrange them.

For example, I would like to say "Put node 3 first, then node 5, then node 1".

Thanks!


texts:
I'm trying to edit default user login block.

I successfully changed it by creating custom block--user--login.tpl.php inside omega-starter/templates, but I don't want to write whole block code. I only want to change certain fields.

I tried to use this code in template.php :

function omega_starter_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] == 'user-login-form') {
    //dpm($form);
    $form['actions']['submit']['#value'] = t("Custom login button!");
  }
}

It doesn't make any changes. Please suggest a solution.


texts:
I'm trying to work with aggregation in Views and I just can not seem to understand how to get it to do what it is supposed to be doing. First off, a simple example. I create a view with "Show" set to a parent table. (a list of accounts in this case). Next I add a relationship to a child table (a list of account entries). I add one field, the account name.

Finally I turn on aggregation and set the account name to "group by". The SQL statement it provides has no group by clause! The View says it is:

SELECT ledger_account.name AS ledger_account_name
FROM
{ledger_account} ledger_account
INNER JOIN {ledger_account_entry} ledger_account_entry_ledger_account
    ON ledger_account.aid = ledger_account_entry_ledger_account.aid

Where I would have expected

SELECT ledger_account.name AS ledger_account_name
FROM
{ledger_account} ledger_account
INNER JOIN {ledger_account_entry} ledger_account_entry_ledger_account
    ON ledger_account.aid = ledger_account_entry_ledger_account.aid
GROUP BY ledger_account_name

I know this is a simple example, but it's a piece to a larger summation with a few joins. However, if views isn't smart enough to do this correctly, or if I just fail to understand how to do this properly, my query will never work.


texts: How to set up rules to email a pdf after creating it with fillPDF

texts:
I am using fillPDF and would like to set up a rule so that once the pdf is created it will create an email, attach the PDF and mail it to a designated recipient. I have looked on line on how to do this but the instructions are very vague saying it is possible and here is a list of modules you will need and no other instructions (link to instructions). I have tried putting together a rule but it is not working. I was wondering if anyone has accomplished this and what the steps are.

Thanks.


texts: Make Paypal checkout wait for checkbox state

texts:
I wrote a small module to display an "agree-to-the-terms"-checkbox in Drupal Commerce checkout pane, following the documentation HERE and tweaked it to my needs.
My PHP looks like this:
<?php

namespace Drupal\checkout_terms\Plugin\Commerce\CheckoutPane;

use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * AGB-Zustimmung für den Checkout.
 *
 * @CommerceCheckoutPane(
 *   id = "checkout_terms_agb_zustimmung",
 *   label = @Translation("AGB Zustimmung"),
 *   display_label = @Translation("AGB Zustimmung"),
 *   default_step = "_review",
 *   wrapper_element = "fieldset",
 * )
 */

class CheckoutTermsAccept extends CheckoutPaneBase {

  /**
   * {@inheritdoc}
   */
    public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
      $pane_form['accept_terms'] = [
        '#type' => 'checkbox',
        '#title' => 'Ich stimme den allgemeinen Geschäftsbedingungen zu',
        '#default_value' => 0,
        '#required' => TRUE
      ];
      return $pane_form;
    }

}

This works perfect for custom multi-step-checkouts. The checkbox is unchecked by default, but the checkout can't be finished without checking the box.
But when I choose the Commerce Paypal module to check out, I just ignores my checkbox and does the checkout anyway.
As I am pretty new to Drupal, I would be glad if someone could give me any advise on how to go from here. Is there any possibility to hook into the Paypal module from here and deactivate it as long as the checkbox is still unchecked? Or should I just do it in Javascript on that page?
Thank you very much in advance!


texts: How to get translated URL of node with Entity Translation

texts:
I've gone this similar question: How to get the path to the translated node?

But I'm using Entity Translation and it does not work.

I need this to send emails in Localized language in a cron job.$user_language referes to user's preferred language.

So currently I'm using this code:

$translated_path = ($user_language->language =='en' ?'' : $user_language->language . "/") .drupal_get_path_alias("node/$nid", $user_language->language);

What could be the right way to get translated URL?


texts:
I need to create urls aliases like this:

/mypath?foo=bar&foo2=bar2 (source) -> /foo/bar (alias)

via standard drupal alias url add (admin/config/search/path), but when I insert that link in the source path textfield I receive an error about not existent source path. But the path is correct (it works).

How can I resolve it? Only via direct db query?


texts: Custom Search Taxonomy Block shows Terms for all Languages

texts:
i have a vocabulary which has many terms . Some terms are for English and some are for arabic language . (vocabulary is translatable so each term can be translated)

I am displaying a "Custom Search Taxonomy Block" but it shows all terms from EN and AR in the dropdown ..

any idea how to restrict EN terms for EN site and AR for AR site ?

Thanks


texts: Dealing with installed modules/extensions in composer packages removed from composer.json

texts:
I had brought up a similar question on StackOverflow, but it hasn't gotten much traction because of a lack of understanding of Drupal, I think.

The issue we are experiencing happens when a developer removes an extension from Drupal then removes the composer package as well, and checks all these changes into git. Subsequently, all other developers are unable to run the typical sequence of composer install followed by drush cim in their development environments because doing so attempts to uninstall the extension, which can't be done because the composer package has been removed.  This also happens when switching back to master from a feature branch that includes a package and installed module.

What I was hoping for was a version of composer install that does not uninstall any packages removed from composer.json.  But such an option does not appear to exist.  My proposed resolution was to filter the composer install output for lines indicating a package was uninstalled, then re-install those packages, run drush cim, then run composer install once again.  Overall an ugly workflow.

It has been suggested to run drush cim followed by composer install, but that breaks on the addition of new modules.

Does anyone have a more elegant workflow that can handle the above situation and also handle cases where modules are added and/or other configuration changes are made?

It has been suggested that this is a duplicate of the related post Development with git branches/ gitflow and new modules which deals with the different issue of extension database tables getting installed twice when switching between branches, which is more of a drupal core issue than a composer issue. Granted, the unsatisfactory fix proposed for that issue (syncing to a database image) could work here, but it would be equally unsatisfactory and unnecessarily time consuming for large databases.


texts: Internal Server Error and Machine Readable Names

texts:
I have installed a new local site using Drupal 8.1.10 which takes a lot of time whenever I give any command (lets say create a text field) and then sometimes it gives a 'Internal Server Error' after which the 'machine readable name' of the text field which I was creating becomes unusable.

It then gives the error 'The machine-readable name is already in use. It must be unique.' whereas the field was not created and the 'machine readable name' is not actually in use.

This has happened multiple times. How do I resolve this?


texts: In drupal, Show own unpublished comments

texts: By default if comment is not approved it is not show to user. In my scenario I want to show own unpublished comment to user in light gray background if comment is not approved


texts:
Using Search_api, search_api_db and facet_api.

Ive created a view display using 'Facet Block'.

Ive set the facet field to the one I want to use. The facet configuration of this field has no listing limits.

ive set the view setting's 'pagination' to display all items.

When I look at the rendered block, it only shows 10 items.

Does anyone ever face this kind of problem ?

Is there an hard-coded limit ?


texts: Search snippet does not appear in Search API search page

texts:
I am using

Drupal 7.28
Apache Solr 4.4.0
Search API Solr 7.x-1.5
Search API attachment 7.x-1.3 and
Search API Page 7.x-1.1.

I have created 2 content types with
 - Title
 - ID
 - Document date (not the default node creation date)
 - Attachment

My index and preprocessing settings are the following:
Index Fields:
Processor settings:

In the search page I am searching all the fields and have set
View mode: Themed as search results

The searches work correctly only that when I search for a keyword appearing in the attachment text, the results return without the search snippet, whereas when I search in the title, the returned result is correctly highlighted

The funny thing is that when I submit the query directly to solr with e.g. q=tm_title:Spain?hl=on the <lst name="highlighting"> is empty.

Any ideas?


texts: How do I create a "platform" and "site" from CLI, using the drush extension provision

texts:
I'm trying to figure out how to use Provision to create new sites from the CLI.

I tried looking at what commands Aegir normally passes to Provision when setting up a new platform and then a new site on that platform, but I haven't succesfully made it work from CLI.


texts: Reset all votes on a content type every week

texts:
I am trying to build a website where people vote on individual nodes of a content type using the rate module. Is it possible to reset these votes say every 7 days or every 30 days, so that another round of voting can take place. How would I do this within drupal. I do not want to have to go through phpmyadmin to clear the voting api cache. I would prefer if this is done from within the website I'm building.

Is this possible?


texts: "Unable to send email" error shown to anonymous users in Workflow action

texts:
Using the Workflow module, I've got a content type that can be created by anonymous and authenticated users alike, then it goes into a review process. Upon creation, I want to email the user with a confirmation email. You may be asking, "do you want to email anonymous users too?", and that'd be a good question; the answer is "ideally, yes", but the important thing right now is authenticated users.

Ideally, we'd use the email field (field_email) as an address, but when I try to use [node:field_email] or [node:field-email] (the field itself is of type "Email", from the "email" module.), I get the error "Enter a valid email address, or use a token email address such as [node:author:mail]"

So, we decided to just use [node:author:mail], but, of course, anonymous users don't have an email and it follows that when they save the new node, they get the "Unable to send e-mail. Contact the site administrator if the site persists."

NOTE: This action is being created on the /admin/config/system/actions page, and added as a trigger; not on the "/admin/config/workflow/rules" page. For some reason, it seems like using the actual Rules module itself with workflow breaks; none of the rules we try to set up actually fire.


texts: log / capture all the queries executed in drupal

texts:
I want to log / capture all the queries executed by the drupal?
update, select, insert any query,
is there any hook or what will be the method to do this.


texts: how to stay on the same page on clicking a link

texts:
I need to know how to stay on the same page when a link is clicked. If l(), what can be passed as the second argument for the link to be for the page currently visualized?

I need to override l() for menu slot titles inside the megamenus module so that they don't redirect to a different page. Is there any token in Drupal 7 which stores the URL of the current page being displayed?


texts:
I have a Drupal 7 site where people might want to put code snippets in a comment.  I have the geshi module set up for syntax highlighting.

I have an article node set to the Full HTML text format, and some code snippets.  The article is displayed properly, the code is highlighted.

I have created a comment on the article with the text format also set to Full HTML, and some code snippets.  The comment displays the literal html code, as if the text format is plain text or something.  I have BUEditor and Ajax markup installed, and the preview they give me shows it highlighted.  But Drupal's preview is consistent with the real output.

I've tried googling for this problem, but between most people wanting the opposite and the term comment being on pretty much every webpage these days, I couldn't find anything.


texts: Add a new configurations block to admin/config

texts:
I'm trying to add a new configurations block to admin/config (just like "People", "Media" and "System").

I tried copying and modifying the relevant lines from modules/user/user.module but my block doesn't show and directly going to the link admin/config/mysite results in an access denied message.

The sub pages appear directly under the Administration > Configuration menu in the Administration module (but not in the page admin/config.)

Any idea how to fix this?

$items['admin/config/mysite'] = array(
  'title' => 'My Site',
  'description' => 'Configure My Site settings.',
  'position' => 'left',
  'weight' => -20,
  'page callback' => 'system_admin_menu_block_page',
  'access arguments' => array('access administration pages'),
  'file' => 'system.admin.inc',
  'file path' => drupal_get_path('module', 'system'),
);

$items['admin/config/mysite/page1'] = array(
  'title' => 'Sub page 1',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('mysite_admin_1'),
  'access arguments' => array('access administration pages'),
);

$items['admin/config/mysite/page2'] = array(
  'title' => 'Sub page 2',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('mysite_admin_2'),
  'access arguments' => array('access administration pages'),
);


texts: Webform Issue with Drop Down and Key not Equaling Value

texts:
I have written a custom handler in Drupal 8 D8 that grabs submitted data from a webform and reformats it and sends it to a JSON webservice. That is all working perfectly. My issue is that the submitted data from 2 of the dropdowns is an integer (the key of the dropdown), rather than the value of the drop down, like it was when in D7 I called:

$components = $node->webform['components'];

which gave me the value of the data from the dropdowns. Now I am calling:

$values = $webform_submission->getData();

Which gives me the submission data. However, what I need to do is translate the number to the value. For example:

for a component (or element) drop down called 'numbers' the options are:
1|One
2|Two
3|Three

When I grab the submission data I get "1" but I want to send the word "One".

How do I load the dropdown element to translate the value '1' to the word "One" in Drupal 8?

Thanks.


texts: Help with a D7 database query and update

texts:
I am not familiar with the Drupal 7 database API. I want to alphabetized a menu.
Can anyone help me write a database query to retrieve all the menu item links of a certain parent (plid = 228) and order ascending by title? Within that result set, can anyone help me write a database update method to update each menu item's weight sequentially (counter starts at 0 and increments)?


texts: views slideshow caption with absolut position

texts:
I have created a views slideshow with images which are not equal in width and height. Under my slideshow i placed a global PHP field With some informations (Autor name , filename, exif data from the images..)
The Problem is that i cant place this block in an absolute position . it jumpes up or down cause my images are different in size. How can i make the block staying. I tried it with CSS position:absolut but it dont helped..


texts: How can I migrate an Amazon S3 bucket to into Drupal?

texts:
SCENARIO

I currently have a bucket where all my images are hosted and stored. I currently display them by simply using URLs that link to the images (i.e https://[bucketName].s3.amazonaws.com/[imageName]).

I currently have over 22k photos in the bucket but I want migrate them over to the Drupal database.

PROBLEM

This was how I planned on resolving this:

I was thinking of trying to find an API that would get a list of all the objects in my bucket.
Then after getting the list off all the objects, use PHP's file_get_contents() function to get the image itself
Then programmatically create the Media type after each URL request, by following what I saw here, Programmatically create media file or possibly doing this Create file/media

QUESTION

Is this a proper approach? Or is there a better way for me to approach this?


texts: Change language for date cck field of a webform in drupal7?

texts:
Can we change language for date cck field of a webform in drupal7?
If I create a component of date type in webform then drupal provides a dropdown having month,day and year values in English e.g. Jan 1 2013 , I want a drop down for this component having options in different language say spanish (witout using any translation module, I am translating webform manually) Is it possible?


texts:
I have inherited an outdated Drupal 6 site with hacked modules. I did update core and all the modules that I could.

This php code is from a block for logging in. This redirects an authorized user to be directed to node-20.tpl.php.

<?php  global $user; ?>
<form action="<?php print "/{$base_path}user/login/?travelagents"?>" method="post" id="user-login">

CLIA number or Agent key:

      <input type="text" maxlength="60" name="name" id="edit-name" size="22" value="" tabindex="1" class="form-text required" />
      <input type="hidden" name="pass" size="20" value="password" />
      <input type="hidden" name="form_id" value="user_login" />

      <input type="submit" align="middle" name="op" class="form-submit" id="edit-submit" tabindex="2" value="Log in" src="/<?php print path_to_theme() ?>/images/login.gif" alt="Submit" />
</form>

My client asked me to override the login for users without authentication (ultimately allowing anonymous users to login and see what authorized users see). The other requirement is that authorized users with their unique ID must still be able to use the login box and get redirected appropriately.

I have been able to create a way to automatically login using 00407606 (a special functional generic ID) in the value=field and if I change the text field to hidden a user can click the submit button and be logged in automatically and redirected appropriately. But applying this removes the ability for registered users to input their unique ID and login normally.
This login is not the username-password of Drupal, it is a unique 8 digit number in a created table in the database.

Is there a php solution to do this? Is there some code in logintobbogan I could mimic/use? Am I looking for a javascript solution?


texts:
I have a couple of content types which I need to preprocess in different ways. So template.php in my theme foo currently looks like:

function foo_preprocess_node(&$variables) {
    if ('news' ==$variables['type']) _preprocess_news($variables);
    if ('event'==$variables['type']) _preprocess_event($variables);
    if ('alert'==$variables['type']) _preprocess_alert($variables);
    ...
}

function _preprocess_news(&$variables) {
    ...
}

function _preprocess_event(&$variables) {
    ...
}

function _preprocess_alert(&$variables) {
    ...
}

I'd like to be able to specify a Drupal specific preprocess function which would hook on the content type's machine name. I tried using foo_preprocess_news but it is never called.

Is there a better way?


texts: Default user image in user account menu!

texts:
I am trying to add a default image to render in the user account menu when the user does not have an image.

CODE:

function nestle_preprocess_menu(&$variables) {
  if($variables['menu_name'] == "account") {
    $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
    $name = $variables['user']->getUsername();
    $picture = file_create_url($file->getFileUri());
    $picture = $user->user_picture->view('large');
    $variables['items']['user.page']['title'] = $name;
    $variables['items']['user.page']['picture'] = $picture;
  }
}

What I did so far, is that I changed the "account" menu link to name of the logged in user and I added the picture of the user in the variables array so that I can render it using twig, The problem is I want to check when the $picture variable is empty ( ie: user has no photo ) it should render a default image from a URL.

PS: I am using Drupal 8, and this code is in the .theme file


texts:
I want to perform some admin configurations through drush using vset the way I've used it in the past, such as the following:

drush vset site_name Example;

drush vset site_offline 1;

drush vset preprocess_css;

If I wanted to turn off email varification on the following page, is there a variable I can use drush vset to set the variable to 0 or 1?

admin/config/people/accounts

If so, how would I find the variable names for admin configurations to know which ones can be set by drush?


texts: Drupal Commerce Kickstart 2 Mysql problem: "Table XYZ is marked as crashed and should be repaired"

texts:
My drupal kickstart 2 site occasionally cause Mysql errors. This is what Drupal Logs say:

"PDOException: SQLSTATE[HY000]: General error: 145 Table './MYSITE/field_revision_body' is marked as crashed and should be repaired: INSERT INTO {field_revision_body} (entity_type, entity_id, revision_id, bundle, delta, language, body_value, body_summary, body_format) 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, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 1953 [:db_insert_placeholder_2] => 1953 [:db_insert_placeholder_3] => breaking_news [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] =>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vehicula condimentum placerat. Curabitur vehicula pharetra felis, quis feugiat magna imperdiet non..
 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => formato_xxxxxx_calcio ) in field_sql_storage_field_storage_write() (linea 452 di /var/www/MYSITE.it/modules/field/modules/field_sql_storage/field_sql_storage.module)."

In this case general error was on table field_revision_body but sometimes it's another table. Hosting Service say that mysql are all ok. So what happend? This site has been online for several months, and only few days ago give me problem.

It seems that mysql dropped, then after a few minutes he recovers tables.
There are specific tools for debugging to see what makes me go down the site?

Pls someone help me.


texts: How do I deal with a lot of fields of different products in view modes of product display?

texts: Scenario is this: Let's say I have one product display for car parts and every car part have different attributes (or not necessarily attributes but some fields used for faceted search for example), so every view mode of my product display would end up full of different fields of all kind of products. It potentially can be A LOT of stuff. I don't think that creating many product displays ONLY to overcome this problem, would be a good idea if what I really need is only one. What I would be able to do with this mess of fields?


texts:
need to build a form which has fields of type array.
php normally would:

<input name="MyArray[0]" />
<input name="MyArray[test]" />
<input name="MyArray[1]" />

$array = $_POST['MyArray'];

already tried the following but is not input as an array:

$form["MyArray[1]"] = _d7_taxonomy_term_select($node_type->name, 2, $default_value);
$form["MyArray[2]"] = _d7_taxonomy_term_select($node_type->name, 2, $default_value);
$form["MyArray[3]"] = _d7_taxonomy_term_select($node_type->name, 2, $default_value);

someone help?


texts: How to Add Taxonomy Vocabulary in Rules when User Registers

texts:
Using the Drupal Rules module, I'm trying to create a rule whereby when a user registers, a taxonomy vocabulary is created.

So far, I've done the following:

EVENT: After saving a new user account

ACTIONS: Create a new Entity, value Taxonomy vocabulary. I enter a name using tokens but it doesn't seem to accept tokens for the machine name. The machine name obviously has to be unique to each vocabulary.

Just to give you a bit more info, each member registering is a Tutor (needs to be the taxonomy vocabulary) and each Tutor will create multiple Students (taxonomy terms).

Can anyone help me with this please? I'm using Drupal 7. Thank you :)


texts: how to programmatically set a group audience

texts:
I am trying to programmatically add the group audience widget to a custom form (without using OG field setting) and set it to a default value.

Would anyone know of a way to do so?

Well after one week of investigation i still haven t find an answer. I gotta say i am really dispointed by OG module, the documentation is so poor and the maintainer doesn't really help improving this. A real shame such a module isn't more documented


texts: Multiple exposed form blocks with different fields

texts:
Scenario:

View fields:

name
gender
age
especialty

exposed form block (1) fields:

name
especialty

exposed form block (2) fields:  (This is also I want to have but as a separate block)

 name
 age
 gender

I am looking for a way in which I can have two different exposed form blocks  but with different search fields.

I am using Drupal 8. Any help would be appreciated. Thanks!


texts: How to apply drupal_add_css by block_id in Drupal?

texts:
I am trying to apply css by block_id or block title.

if($template_name=="BOhhjI" && $block_name=="block1" ){
  drupal_add_css(drupal_get_path('module', 'MyModule') . '/css/grid.css', array('group' => CSS_DEFAULT, 'every_page' => FALSE));
 }
  else if($template_name=="calender" && $block_name =="block2"){
  drupal_add_css(drupal_get_path('module', 'MyModule') . '/css/carousal.css', array('group' => CSS_DEFAULT, 'every_page' => FALSE));
 }
 else{
  drupal_add_css(drupal_get_path('module', 'MyModule') . '/css/MyModule.css', array('group' => CSS_DEFAULT, 'every_page' => FALSE));
 }

But, drupal_add_css apply css to whole page. I have a single template and multiple css.I need to switch css on a given condition. Any way to achieve this?

Edited: Following solution from comments

function Module_Name_block_view($delta = '') {
    $blocks = array();
    $query = db_select('Table Name', 'n')
            ->fields('n')
            ->execute();
    $block_data = $query->fetchAll();
  foreach ($block_data as $block_query) {
  $macname = $block_query->title;
  if($block_query->options == 'BOI'&& $delta == $macname){

    $blocks['subject'] = t($block_query->title);
    $blocks['content'] => array
      (
        '#markup' => block_content($block_query->selected_type_list),
        '#attached' => array
        (
          'css' => array('/css/grid.css'),
        ),
      );
}
  }
  return $blocks;

}


texts: Why do I get 'access denied' when viewing nodes?

texts:
I'm testing my website and I have to cope with a strange problem. Although every role has the permission "View published content", only the administrator can access nodes: anonymous users and authenticated users can't. The same problem occurs with adding content. I've tried clearing caches, saving the permissions again and rebuilding the permissions, but nothing helps. I'm not using any modules that control node access either...

How can I solve this?


texts: disable date field (only update with datepicker)

texts:
I am using drupal 6, im my form I put the date field as

$form['myform']['from_date'] = array(
    '#type' => 'textfield',
    '#title' => t('From date'),
    '#size' => 8,
    '#default_value' => (arg(5) == null)? '0':arg(5),
    '#attributes' => array('onclick' => 'GetdatePicker(this);'),
);

i want that user can not edit this field without using date popup(populated from date picker).
any suggestion.


texts: How do I see *which user* last updated a node?

texts:
In admin/content, how might I override this display to list the User who last updated a piece of content. We can see the initial author and that's fine. But I'd like a running trail on who touched a node.

What I've tried

Revisions: However, some Content Types use a field by Jquery Tabs which lose their content when going back to a certain revision.


texts:
I have added a file field in views and when displaying it has some markup like this

 6783c11f-0b05-49e3-a494-ca68d2e6c23b-2060x1366.jpeg

Configure

  Edit

 Delete

While all I need is

How can I remove this markup. Can I use views-view-field-field_name.tpl.php. Only line this file contains is print $output. How can i use this file to remove markup. Or does any preprocess hook helps


texts: Can a form submit handler return results without using the $_GET array?

texts:
It looks like the default method for passing the result of handling a form submit is GET.

The following statement will redirect to form/result, where a page callback function will extract $content (the result form processing the form) from the query string (attached to the URL) using the $_GET array:

$form_state['redirect'] = array('form/result', array('query' => array('text' => $content)));

This works, but I do not want $content to be a query string (where it can be edited by the user).

Is there an alternative method (e.g. POST) for passing the value of $content to the page callback?


texts: Promoted to frontpage teasers in a block

texts:
General:

I am new with Drupal; so, I was trying to add new regions to Zen (sub)template, but got very confused why contents of my new-created region "content 2" appears on page above the original so called "promoted to front page teasers", which I considered to be a "content"...

Now, it seems "promoted teasers" are not in a block - and that's why they are not in a "content region"?

If so, How to put "promoted teasers" in a block?

Also confusing - what do "main page content" block? - It seems I cannot disable it and if I put "main page content" in a "content" region - my new "content 2" region appears above the "promoted teasers" ; if I put this "main page content" block in "content 2" - both content of "content 2" and "promoted teasers" appear next each other in the same row (?!)....

May be it depends somehow on CSS also?

I don't know, I just somehow assumed that "promoted teasers" are "content" region's content, but it's not - so, what should I do with it now?

Ingredients used:

Drupal 7.30

Zen 7.x.5.x

Display Suite

Views

few others...

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

      <?php print render($title_prefix); ?>
      <?php if ($title): ?>

<?php print $title; ?>

      <?php endif; ?>
      <?php print render($title_suffix); ?>
      <?php print $messages; ?>
      <?php print render($tabs); ?>
      <?php print render($page['help']); ?>
      <?php if ($action_links): ?>

<?php print render($action_links); ?>

      <?php endif; ?>
      <?php print render($page['content']); ?>
      <?php print $feed_icons; ?>

    <?php
    // content - 2 region , my own added
      print render($page['content2']); ?>
     <?php print render($page['content3']); ?>
     <?php print render($page['content4']); ?>
     <?php print render($page['content5']); ?>


texts:
How to hide Create new account and Request new password tabs in user login form? I use Drupal 7. I use custom theme. Maybe in template.php file some function?

You can see my page - http://broceni.garm.lv/


texts: Colorbox links not working on Ajax loaded content

texts:
I am using latest stable version of the Colorbox module

I have an image gallery with small thumbnails and a big one.

When I click on a small thumbnail it loads via Ajax a big image:

$commands[] = ajax_command_html(
    '.big-image', l(theme('image_style', array('style_name' => 'node-image', 'path' => 'public://' . $get_src)), file_create_url('public://' . $get_src), array('attributes' => array('class' => 'colorbox'), 'html' => TRUE))
  );

As you see i have added class .colorbox to a link, but it works only on the images that were loaded during the page load and it's not working on AJAX loaded images.

How can I re-initialize colorbox on Ajax images?


texts: drupal 7 views - access entire (!) views content after ajax refresh as json

texts:
im facing the following situation:

i have a view with exposed filters. after the user has altered the view using the filters, i need to access the view's entire data as json. therefore its not enough to simply hook into the ajax call using drupal's ajaxComplete() function, since it would only return the html of the current page - whereas i need the entire filtered data.

how can i achieve that? i dont need a detailed solution, just a workflow to get me to the right direction.

thanks in advance, great community!

bg
thomas

edit:

for now ive solved it as follows:

i created a json display without pagination using the views_datasource module. in the ajaxComplete() function i make an ajax call to the json view's page with the serialized exposed fitlers form as get parameters et voila.


texts: How to unset _none option inside field collection?

texts:
Normally, in a node form you'ld unset the _none option like so:

function MYMODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
    unset($form['field_name'][LANGUAGE_NONE]['#options']['_none']);
}

Why doesn't this work in a field collection? I tried:

function MYMODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
    $field_collection = $form['field_field_collection'][LANGUAGE_NONE];
    $delta = 0;
    $max_delta = $field_collection['#max_delta'];
    while ($delta <= $max_delta) {
        unset($field_collection[$delta]['field_name'][LANGUAGE_NONE]['#options']['_none']);
        $delta++;
    }
}

In dpm() the option is unset and doesn't appear anymore. But on the screen it's still there... What to do?


texts: How to create a rule to notify administrators of new comments by non-administrators?

texts:
I would like to use Rules to notify all administrator users of new comments that have been posted to the site.

I can get as far as getting the notifications working for all comments, but I would like to set it for notifications to just comments by non-administrators. Administrators will then not be notified for their own responses to comments.

Any hints?

Note: I want to do this so that I just have to specify the admin role only, as many new roles will be added that are non-admin roles. This way I do not have to update the rule every time a new role is added by site admins.


texts: Commerce + Paypal WPS : Run custom code on checkout: complete

texts:
I have read many posts about the problems of Paypal and checkout complete in Commerce, but I can't seem to get this simple thing to work.

When an order is completed I want to run a custom function. I have tried both hook_commerce_payment_order_paid_in_full and hook_commerce_checkout_complete - but neither seem to fire when paid through Paypal WPS. I am receiving IPN callback from Paypal fine, and it is updating the order status after adding in some custom rules as seen here: Is this normal to have Drupal Commerce stuck in PENDING status after a completed paypal payment?

I have also tried adding a custom action to be used in rules - but unsure how to get the corresponding order id in this case?

The only way I have got it to work is to use hook_preprocess_html which checks for the checkout/complete page, gets the order id from arg(1), and runs it all there, which is obviously very dirty.

Any help on this would be greatly appreciated.


texts: JavasScript from custom module not detected

texts:
I have created a custom module, which is working. Except the JavaScript, which is not being detected. I have been following the description at https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview and I have checked other modules.

What have I done to implement JavaScript? I have created a file with the following JavaScript content (location: MODULE-ROOT/js/info.js):

/**
 * @file
 * Info behaviors on node edit form.
 */

(function ($, window) {

  'use strict';

  Drupal.behaviors.nodeEditForm = {
    attach: function () {
      console.log('Hi there!');
    }
  };

})(jQuery, window);

Then I have added the following content into my MODULE-NAME.libraries.yml file:

nodeEditForm:
  version: 'VERSION'
  js:
    js/info.js: {}

I expect to see "Hi there!" in my webdeveloper tools inside Google Chrome browser, after I flush the entire Drupal 8 and browser cache. I do not get any output there.

Is it a "must" to attach the JavaScript to any existing behavior? If so: how can I learn which behavior is tied to an node edit form?

Thanks for your attention.


texts: Creating a fallback field to load conditionally

texts:
So if I have a node type of Article. I have two fields on it:

field_image
field_secondary

If field_secondary is being used, I'd like for that to be shown over field_image. Can anyone help point me in the right direction how I'd go about this?


texts:
I've added the page.tpl.php and the theme.api.php file to my bootstrap subtheme's template folder, refeshed and everything was fine.

I added
TEST
 to the page.tpl.php to check where it would show up. Moved it a bit until I was satisfied where it was.

However I changed my mind and deleted the files in the template folder and got the WSOD...

The two files are still in the original folder and adding them back to the templates folder does nothing.

Is there a way to fix this? Right now the whole site is blank and no errors show up.

Checking the watchdog table leads me to this function:

// Use a default value if $message is not set.
  if (empty($message)) {
    // The exception message is run through check_plain() by _drupal_decode_exception().
    $message = '%type: !message in %function (line %line of %file).';
  }


texts: How do I specify a parent domain in a multi-site install?

texts:
I'm not sure the best title for this question so sorry if it was confusing.

Setup

I have a multi-site install that I regularly add new sites to.

They are generally in the format:

example.com (default)
sub1.example.com
sub2.example.com
sub3.example.com
sub3.com

I also have a wildcard dns and vshost so I don't have to edit them every time I create a new site:

example.com my.ip.add.ress
*.example.com my.ip.add.ress
sub3.com my.ip.add.ress

<virtualhost *:80>
  Name example.com
  alias *.example.com
  alias sub3.com
</virtualhost>

Sites.php has a few entries like:

sites[sub3.com] = 'sub3.example.com'

All of this works great.

The problem.

Most of these sites are not publicly visible. being disabled with robots.txt and permission preventing users from see them. So I could care less about those. However some sites are public. In the example above the example.com and sub3.com are both public facing sites.

When a user visits rando.example.com the multi-site will send them to example.com but the url will appear as whatever they typed in. Also the sub3.com site will be visible as both sub3.com and sub3.example.com.

The question.

How do I, preferably using only Drupal, redirect the non-existent subdomains to the default. Not just show the default but actually do a 301 redirect to the url desired.

My attempts.

To my knowledge I can not solve this with:
-  redirect module as it does not let me specify a subdomain or a wildcard.
-  global redirect does not affect subdomains.
-  sites.php as it does not redirect but a sites[*.example.com] => example.com would be cool.

Qualifiers

I understand that I could fix this in the vhost by removing the wildcard name and just adding a new entry for each sub-domain. I do not want to have to edit my vhost every time their is a new sub-domain.
I understand I may be able to solve this with .htaccess files but I do not want to have to edit that file every time I create a new site either. And I don't really want it to be overridden from default. Plus I have my server pull the file only on reboot and I don't want to reboot apache just to add a site.
I understand that canonical urls would prevent bots from indexing unused sub-domains but that's not good enough I don't want users using a subdomain that doesn't exist.

My ideal solution would be a redirect that supports sub-domains or something similar. Changes to sites.php or database changes are the goal.


texts: How do I prevent the feed aggregator creates blank nodes when cron is run?

texts:
I've recently taken over the management and development of a Drupal 6 site and one of the problems plaguing this installation is that blank nodes authored by "Visitor" keep popping up.

I've narrowed the issue down to the RSS aggregator and it seems like the nodes are being created when this runs durring the cron job. Has anyone seen this before? If so how do I go about fixing this? If not, does anyone have an idea where to look in order to resolve this?


texts: View is duplicating content added by entity reference

texts:
I have two content types, Project and Resource,

I have a view displaying fields from Project, and also fields from Resources via an entity reference field.

The problem is, if I add more than one linked resource to a project via my entity reference field, the view duplicates that Project node, instead of adding another linked resource to that project.

Any help much appreciated!


texts:
Using rules and workbench moderation, i need to send email to the author when the moderation state on his new article is changed to published.

But emails are sent every time i change the moderation state for every single revision. can someone please help me solve it.


texts: Drupal can't create image styles for files located in theme directory

texts:
I have an image located in sites/all/themes/mytheme/images directory.
I'm displaying it programmatically with attached image style like:

  $style =  array(
    'style_name' => 'my_style',
    'path' => drupal_get_path('theme', 'mytheme') . '/images/' . $filename,
    'width' => 30,
    'height' => 30,
    'alt' => $alt,
    'title' => $title,
  );

  return theme('image_style', $style);

First error: 404:

  "NetworkError: 404 Not Found -
  http://j.dev/sites/default/files/styles/my_style/public/sites/all/themes/mytheme/images/img.png?itok=qsTbAc8I"

Log report:

  Source image at public://sites/all/themes/mytheme/images/img.png not
  found while trying to generate derivative image at
  public://styles/my_style/public/sites/all/themes/mytheme/images/img.png.

I'm sure that img.png exists in sites/all/themes/mytheme/images

File permissions:

sites/all/themes/mytheme/images: 777
sites/default/files/styles/my_style: 777


texts: How to prevent a field with thousands of files from loading on Edit operation?

texts:
I have a process running that renders a PDF to PNGs and attaches those PNGs to a file field.  There is one PDF's results per node, but  there we have a bunch of PDFs with 10,000+ pages.  We've found that this results in the operation of loading an edit form to eat quite a lot of memory (a node with 12,000 attached files ate up all 4GB of RAM on our server before Apache killed the process for taking up too much memory).

Does anyone have any ideas how we might prevent the field from loading?  It looks like I could hack file_field_load() to not perform its task given the user is on an edit page and the troubled field is expected but it would be cool if there was a solution that wasn't a hack.

The stack trace when the troubled field is set to not display is:

 1. {main}()  /index.php:0
 2. menu_execute_active_handler()  /index.php:18
 3. call_user_func_array()  /includes/menu.inc:348
 4. node_page_edit()  /includes/menu.inc:0
 5. drupal_get_form()  /modules/node/node.pages.inc:15
 6. drupal_process_form()  /includes/form.inc:121
 7. form_builder()  /includes/form.inc:406
 8. form_builder()  /includes/form.inc:930
 9. form_builder()  /includes/form.inc:930
10. _form_builder_handle_input_element()  /includes/form.inc:889
11. imagefield_widget_value()  /includes/form.inc:1020
12. filefield_widget_value()  /sites/all/modules/contrib/imagefield/imagefield_widget.inc:207
13. field_file_load()  /sites/all/modules/contrib/filefield/filefield_widget.inc:215
14. _field_file_cache()  /sites/all/modules/contrib/filefield/field_file.inc:51

And when the field is set to display:

1. {main}()    /index.php:0
2. menu_execute_active_handler()    /index.php:18
3. call_user_func_array()    /includes/menu.inc:348
4. node_page_edit()    /includes/menu.inc:0
5. drupal_get_form()    /modules/node/node.pages.inc:15
6. drupal_process_form()    /includes/form.inc:121
7. form_builder()    /includes/form.inc:406
8. form_builder()    /includes/form.inc:930
9. form_builder()    /includes/form.inc:930
10. form_builder()    /includes/form.inc:930
11. _form_builder_handle_input_element()    /includes/form.inc:889
12. process_weight()    /includes/form.inc:1063


texts: Is there a module that can record when and for how long each user logs in for? (Drupal 7)

texts:
I'm working on developing a website as part of an academic project that requires tracking individual user activity throughout a long period of time. We need to do the very minimum track when users log in and for how long (or until they timeout). I haven't been able to find a module that does this, except for Open Web Analytics which is breaking some of our pages.

I'm not completely closed to the idea of rolling my own solution but I'd like to do it through a tested module if possible.


texts: How to describe data for a custom views filter in the my_module.schema.yml file?

texts:
I encountered with a problem.

For creating a custom views filter in my own module I should also describe it in the my_module.schema.yml file.

Could you clarify me, how to do it?

For instance, there is a fragment of the views filter description from views.filter.schema.yml

views.filter.in_operator:
  type: views_filter
  label: 'IN operator'
  mapping:
    operator:
      type: string
      label: 'Operator'
    value:
      type: sequence
      label: 'Values'
      sequence:
        type: string
        label: 'Value'
    expose:
      type: mapping
      label: 'Expose'
      mapping:
        reduce:
          type: boolean
          label: 'Reduce'
    group_info:
      mapping:
        group_items:
          sequence:
            type: views.filter.group_item.in_operator
            label: 'Group item'

I would like to understand, what is this and where can I read the understandable documentation on how to create these descriptions for my own views filters?


texts:
I created a custom view with fields. I have a client file that pull data from the api, using an endpoint. On my code in the execute method of the view, I have this lines:

public function execute(ViewExecutable $view) {
    $index = 0;
    $data = array();
    $row['vat'] = $data['vat'];
    $row['name'] = $data['country'];
    $row['city'] = $data['name'];
    $row['index'] = $index++;
    $view->result[] = new ResultRow($row);
  }

This is a code for testing that responded to a success result:

$response = \Cvrapi\Cvrapi::get('12345678', 'dk', 'my project name');

I want that those values be mapped as $data[] and assign to corresponding $row[].

And in addition, not only I need to display the inputted values, but also to map other data from the api to my custom fields.

I did some logging from the method above and I get an empty array of fields.


texts: How do I override the username in forum views?

texts:
I have created a module that overrides the real user name with the string "Anonymous" when a node is displayed.  I use hook_node_view() to do this.  This works fine.

However, to keep the user truly anonymous, I need to override the display of the user name in other contexts as well, for instance in the views of last post in a forum, or in the forum topic list produced by the core forum module (Drupal 7).

The screenshot below illustrates the problem.  It shows a forum post by a user "bob" that is supposed to be Anonymous.  As shown, "bob" is not Anonymous in the first two views, only in the last view of the node itself.

What I am looking for is a hook (or something else if there is no explicit hook for this) that let me override the display of the user name in these views produced by the core forum module.


texts:
I tried to do something that I thought was fairly simple, but it's giving an error:

Notice: Array to string conversion in __TwigTemplate_dd3a187031be000574aa6b2149e8b2daacd4f1d086638752b5928811c46b8adf->doDisplay() (line 132 of vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code).

What caused it:
{% set support_url = url('<front>') ~ 'support' %}

So I tried something:
{{ url('<front>') }}

{% set support_url = url('<front>') %}
{{ support_url }}

{% set support_url = url('<front>') ~ 'support' %}
{{ support_url }}

The result of the above is:

http://www.example.com/
http://www.example.com/
Arraysupport

What is going on?


texts: Form framework doesn't render date type after ajax callback

texts:
I have an ajax callback which returns a date type input field.

The problem is any other input type other than date is generated, but date type is not rendered at all. The title, and description is all generated, but the input field is not. Desperately, i have used the suffix tag to generate a date type field the good old html way. But i'm still concerned with if this is a bug or if im doing something wrong.

Here's the code

This one wont generate any fields, but will generate the title and description

function raffle_start_date_now($form, &$form_state)
{
    if($form_state['values']['raf_start_now'] == 0)
    {
        return  $form['raf_start_date'] = array(
                "#title" => "When to start this raffle?",
                "#description" => "Doesn't generate date input, but generates all other input",
                "#prefix" => "
",
                "#suffix" => "
",
                "#required" => TRUE,
                "#type" => "date"
            );
    }
    else
    {
        return "

";
    }

}

And changing the #type to "textfield" will render a textfield.

Currently, this is my workaround

function raffle_start_date_now($form, &$form_state)
{
    if($form_state['values']['raf_start_now'] == 0)
    {
        return  $form['raf_start_date'] = array(
                "#title" => "When to starz this raffle?",
                "#description" => "Doesn't generate date input, but generates all other input",
                "#prefix" => "
",
                "#suffix" => "<input type='date' name='raf_start_date'/>

",
                "#required" => TRUE,
                "#type" => "date"
            );
    }
    else
    {
        return "

";
    }

}


texts:
I need to implement kind of a hit counter for the entire page (so how often the site was visited) in D7.

For D6 we got the Counter module, but is there any simple way to do it? Perhaps with a custom block and some PHP code?


texts: Translating the months in the archive view

texts: I need the months in views' default archive view to display in a different language, just changing the language in Drupal doesn't seem to be helping, string overrides in settings.php aren't doing the trick either. I also tried downloading and importing the views language file but that too has failed. Where can I make this change?


texts: How to choose between all the Views hooks

texts:
Reading the docs about Views hooks doesn't really help me to make the right choice between all the hooks. As per this comment, this is the Views hooks execution order:

hook_views_pre_view
hook_views_pre_build
hook_views_post_build
hook_views_pre_execute
hook_views_post_execute
hook_views_pre_render
hook_views_post_render

I'm currently trying to alter properly the output of a view field :

I tried with hook_views_post_execute(&$view) :

function MODULE_views_post_execute(&$view) {
  if ($view->name == 'foo' && $view->current_display == 'bar') {

    foreach ($view->result as $result) {

      if (isset($result->field_field_status)) {

        switch($result->field_field_status[0]['raw']['value'] ) {
          case 1:
            $text = 'ABC';
            break;
          case 2:
            $text = 'DEF';
            break;
          //and so on
        }
        $result->field_field_status[0]['rendered']['#markup'] = $text;
      }
    }
  }
}

This worked fine at first glance : returned string display nice,  but raw data were displayed again after a while. After clearing page cache the expected output turns back, but then disappeared again, and so on.

Then I tried with hook_views_pre_render(&$view) , with exactly the same code inside that other hook giving exactly the same result.

Question(s) :

What makes the hook be applied or not ? Wrong hook use maybe ?  Is there any logic to apply one or another of these hooks ? (After reading @Alexar comments : yes I'd explicitly like to know about views hooks, the example is just to illustrate my searches and misunderstandings.)

I really need to understand the logic behind all that for my "learning curve".

Edit :

Lastly, I used a views-view-field.tpl.php to change the output of my field, another possibility adding more confusion to my global understanding of the view construction background... Anybody for a bit of Drupal pedagogy ?


texts:
I created the event calendar using calendar view module. suppose If I click the particular event in calendar it will goes to particular event detail page but suddenly the left menu is disappear. How do I keep my left menu in all the event details pages?

Please assist me on this


texts: Drupal 6 does not like it when an image tag's absolute path contains “http:”

texts:
I'm using Drupal 6.28 and there's something i don't understand.

i have a page that contains an image tag pointing to an absolute path. e.g.

when the content is saved, drupal returns a "Page Not Found" error.

i found out that if i remove the "http:" at the start of the src attribute, there wouldn't be any problem. everything would be ok. i.e.

is there some setting that i may have messed up that causes this?

Thanks


texts: How can I share cache with multiple users and roles?

texts:
In my custom module, I define a custom block that performs an expensive operation:

/**
 * {@inheritdoc}
 */
public function build() {
  $data = get_expensive_data();
  $agent_number = get_agent_number_from_context();
  return [
    '#theme' => 'my_custom_module',
    '#cache' => [
      'keys' => ['my_block', 'full_version', $agent_number],
      'tags' => ['my_custom_module'],
      'max-age' => 86400,
    ],
  ];
}

The caching works except when another user views the block or a user with a different role view the page; it creates a new cache item. Is it possible to have cache only one time for multiple users/roles?

Edit

I tried the following (ended up using route context just to not add another variable to my problem):

/**
 * {@inheritdoc}
 */
public function build() {
  $data = get_expensive_data();
  return [
    '#theme' => 'my_custom_module',
    '#data' => $data,
    '#cache' => [
      'contexts' => ['route'],
      'tags' => ['my_module'],
      'max-age' => 86400,
    ],
  ];
}

Noticed when I had the block using Layout Builder via Page Manager, no item got added to the cache_render table (that might be a separate issue).  When I added the block on default Drupal Block Layout I noticed that it still created a new cache record for every user.  For example:

User 1 navigated to: /my-account/A123 and the following record got added to the cache_render table:

cid

entity_view:block:mycustomblock:[languages:language_interface]=en:[route]=entity.node.canonical7ccb4f15749b8c9e759f0016bfc863bd5e6bef88ea0a9dfe7b1cbe2687d30b32:[theme]=my_theme:[url.site]=http://mysite.test:[user]=1

tags

block_view config:block.block.mycustomblock config:user.role.administrator config:user.role.authenticated my_module rendered user:1

User 72 navigated to: /my-account/A123 and the following record got added to the cache_render table:

cid

entity_view:block:mycustomblock:[languages:language_interface]=en:[route]=entity.node.canonical7ccb4f15749b8c9e759f0016bfc863bd5e6bef88ea0a9dfe7b1cbe2687d30b32:[theme]=my_theme:[url.site]=http://mysite.test:[user]=79

tags

block_view config:block.block.mycustomblock config:user.role.agent config:user.role.authenticated my_module rendered user:79

With using contexts, I am still seeing it create a new record for every user.

Edit 3

I think my test form Edit 2 is invalid because I was trying to make the block work outside of page manager but I needed the context from page manager so it was using the logged-in users. Long story short, I need to figure out why context caching isn't working (although key caching is working) when using Page Manager or Layout Manager.


texts: In a Drupal 7 custom module, I am updating a record in the database using a form, and I am using the following code to update, but for some reason it is not updating. Who can help me out? When I replace the code $form_state['values']['res_name'] with Peter then the data will be updated.


texts:
I'm writing some custom modules (for a customer), but as expected their are showed in error in update dashboard (/admin/reports/updates): "No version available"

I was wondering if there's any way to tell Drupal that these module belong to another webservice to check for latest updates. So I can manage my module versioning and be aware quickly if some of my module are up to date or not.

I searched a lot about it but no result so far, if this is a duplicate feel free to point it out so I can check it out.


texts: Render image field with custom image style in custom block template

texts:
This is basically the same question as this, but I can't get the technique to work in a custom block type template: https://drupal.stackexchange.com/a/219052/71100

I have a custom block type called link_card.
I have an image field field_link_card_image.
I have a List(text) field to select an image style field_link_card_size
I have confirmed that field_link_card_size is outputting the key, which is the machine name of my image style.
My theme template is block--bundle-link-card.html.twig. It overrides block.html.twig. The template is working.
I want to render the image and use the image size selected.

Here is the first way I tried based on what worked in the answer for page.html.twig.

{% set image = {
  '#theme':      'image_style',
  '#style_name': content.field_link_card_image_size[0],
  '#uri':        file_url(content.field_link_card_image['#items'].entity.uri.value),
  '#alt':        content.field_link_card_image[0].alt,
 } %}

 {{ image }}

I get this white screen error:

  Error: Call to a member function transformDimensions() on null in
  template_preprocess_image_style() (line 303 of
  core/modules/image/image.module).

And this error in Report Log in the admin area:

  Warning: array_flip(): Can only flip STRING and INTEGER values!

If I replace the value for '#style_name: with the just the  machine name of one of my image styles (such as square) it almost kinda works.

The image renders but with the _incorrect image src: /D8_1318_LinkCard/web/files/styles/square/public//D8_1318_LinkCard/web/files/2019-06/unsplash_1500x500-4.jpg?itok=c16MdkOY (You can see it's sort of repeated itself.)
The alt text doesn't come in at all, so I probably have that wrong, too.

This leads me to believe that there are problems how I'm pulling in the field content from the block.

Here is the second way I tried:

{% set image = content.field_link_card_image[0] %}
{% set imagestyle = content.field_link_card_image_size[0] %}|
{% set image = setimage|merge({ '#image_style': imagestyle }) %}

{{ image }}

The errors are:

  Error: Call to a member function transformDimensions() on null in
  template_preprocess_image_style() (line 303 of
  core/modules/image/image.module).

  and

  Warning: array_flip(): Can only flip STRING and INTEGER values!

  and

  Error: Call to a member function transformDimensions() on null in template_preprocess_image_style()

This works if I do imagestyle = 'square'. But of course I'm trying to use the value of the field.

Here the problem seems to be an issue with getting in the field_image size to sneak into the variable imagestyle.

TLDR: How do I render an image field with a custom style in the custom block template.

Thanks!


texts: Is it possible the to view xml/json format data with url alias name instead of endpoint_path/node/1 or endpoint_path/node/2


texts: Recieving error: Fatal error: Class 'panels_renderer_standard' not found in

texts:
I recently migrated a site from a Drupal 6 install to a fresh Drupal 7 install.

I then installed panels 7.x-3.5.
Initially I had an older version of ctools installed, so I had to upgrade from 7.x-1.4 to ctools 7.x-1.6.

I then enabled panels the panels page is not showing up in "Structure". I checked permissions and all the correct permissions have been added.

I then try to flush my cache, and i get this error:

Fatal error: Class 'panels_renderer_standard' not found in C:\wamp\www\projects\elaw\sites\all\modules\panels\plugins\display_renderers\panels_renderer_editor.class.php on line 8

Here is a picture of the error with a full stack trace:

I can run cron just fine, but trying to clear the cache gives that error.
In the modules page "Panels" is enabled.

Before upgrading ctools, I had saved a files/database copy and then tried removing panels from "modules" and adding Panels 3.4 instead.  I got the same error.
I then restored my files and database and tried it again but with upgrading ctools instead as mentioned above.

There was also this error that briefly flashed up when I was enabling the module from the "modules" page, after the ctools upgrade.

********UPDATE*********

I was able to get the cache to clear by just hitting reload.  But, if after the cache clears I try to clear the cache I get the same error.
Now the "panels" shows up in Management->Structure, but it has a strange error on the top of the page:

Notice: Undefined index: rows in page_manager_panels_dashboard_blocks() (line 1251 of C:\wamp\www\projects\elaw\sites\all\modules\ctools\page_manager\page_manager.module).
Warning: Invalid argument supplied for foreach() in page_manager_panels_dashboard_blocks() (line 1251 of C:\wamp\www\projects\elaw\sites\all\modules\ctools\page_manager\page_manager.module).

Notice how none of the predefined panel pages are showing up?

I hit clear cache a couple more times (with it giving the "class panels_renderer_standard not found bug each time I cleared the cache initially and it clearing after I hit reload),
and now the panels page is showing the Predefined  Panel Pages, (user page, etc):

I tried creating a new panel page and got this bug:

I can't seem to create a new panel page.

****END UPDATE*****

************************S E C O N D   U P D A T E*****************

I had an idea that perhaps it was a contributed module that was causing the error.  I was going to just randomly start disabling contributed modules but I thought I would start with any contributed module that had ANYTHING to do with panels.
I found that disabling "Panels Translation" in the "Internationalization" section fixes the problem.

I'm not sure why this was causing the problem, but after disabling it I no longer get the " Fatal error: Class 'panels_renderer_standard' not found" error.
I am also able to get further in creating new panel pages.
I get all the way up to saving and it gives this error:

I have verified that that table is not in the database....

I am on a very tight deadline and would appreciate anyone's insight.
Thanks very much for any help.

Sincerely,

David


texts: How do I save a file with managed_file in a theme?

texts:
I'm developing a theme that it requires to have a header image on the front page, so I have this.

casper.theme

function casper_form_system_theme_settings_alter(&$form, &$form_state) {

$form['theme_extra']['front_page_background_image'] = array(
    '#type' => 'managed_file',
    '#title' => 'Front Page Background Image',
    '#description' => 'Add background image for the front page',
    '#required' => FALSE,
    '#weight' => -4,
    '#upload_location' => file_default_scheme() . '://theme/backgrounds/',
    '#default_value' => theme_get_setting('front_page_background_image' , 'casper'),
    '#upload_validators' => array(
        'file_validate_extensions' => array('gif png jpg jpeg'),
    ),
 );
}

However, after it, while the file been missing and after some reading, I find out that is because managed_file does not save your image permanent.

There are similar questions:

Is there a way to add managed_file field to theme-settings.php? is specified to Drupal 7.
Drupal 8 Theme Header Background Image Upload is using "file" type instead of managed_file. I already tried something similar to what the Mayo theme is doing, but I was not able to successfully figure it out.

How can I save my image permanently?


texts: How can I get the previous viewed page title? For example, I visited node/21 then, I navigate to node/22, then in node/22 I'd like to get the node/21's title. In node/22, there's a text field where the default value is the node/21's title. Is there any function I can use for this? Please help as I badly needed this. Thank you.


texts: In which cases should hook_process() and hook_process_HOOK() be used?

texts:
Considering that some modules implement hook_process() to alter the content of some variables and replace their content with themed content, in which cases should a module implement hook_process() instead of hook_preprocess() (or hook_preprocess_HOOK())?

function rdf_process(&$variables, $hook) {
  // Handles attributes needed for content not covered by title, content,
  // and field items. It does this by adjusting the variable sent to the
  // template so that the template doesn't have to worry about it. See
  // theme_rdf_template_variable_wrapper().
  if (!empty($variables['rdf_template_variable_attributes_array'])) {
    foreach ($variables['rdf_template_variable_attributes_array'] as $variable_name => $attributes) {
      $context = array(
        'hook' => $hook,
        'variable_name' => $variable_name,
        'variables' => $variables,
      );
      $variables[$variable_name] = theme('rdf_template_variable_wrapper', array('content' => $variables[$variable_name], 'attributes' => $attributes, 'context' => $context));
    }
  }
  // Handles additional attributes about a template entity that for RDF parsing
  // reasons, can't be placed into that template's $attributes variable. This
  // is "meta" information that is related to particular content, so render it
  // close to that content.
  if (!empty($variables['rdf_metadata_attributes_array'])) {
    if (!isset($variables['content']['#prefix'])) {
      $variables['content']['#prefix'] = '';
    }
    $variables['content']['#prefix'] = theme('rdf_metadata', array('metadata' => $variables['rdf_metadata_attributes_array'])) . $variables['content']['#prefix'];
  }
}


texts: Is alternative available in back end for drush migrate-import "ID"?

texts:
I have been migrating the contents using the migrating source csv, tools and plus modules

As followed the instruction, I have to use the drush command drush migrate-import 'ID' to complete the migration process.

Is there any option available in backend instead of using the drush command.


texts: How to restrict anonymous users to a single product and quantity 1 using Commerce and Rules?

texts:
I have a slightly unusual use case in that I want to allow authenticated users to order multiple products and use the shopping cart but I want to limit anonymous users to purchasing products individually (no changing quantities, no adding multiple products to the cart).

I am using Commerce and Rules on Drupal 7.  Because I do not want anonymous users to access the cart, I want to redirect them to the checkout page if they attempt to access the cart (I know this is not the most foolproof method, but it is sufficient for my purposes).

I tried creating a rule triggered on the event Content is viewed with the condition Path has URL alias of cart.  However, this rule is not triggered; when I add a Path redirect action and then visit the cart path, I am not redirected.  What event should I use in Rules to do the redirect?  Or is there some better way to do this?


texts: I don't understand module_load_include()

texts:
I believe it is meant to be used as follows, in loading a module include file into the calling scope:

function mymodule1_myfunction1(){
    ...
    module_load_include($type, $module, $name);
    ...
}

But looking at the code of module_load_include():

function module_load_include($type, $module, $name = NULL) {
  static $files = array();

  if (!isset($name)) {
    $name = $module;
  }

  $key = $type . ':' . $module . ':' . $name;
  if (isset($files[$key])) {
    return $files[$key];
  }

  if (function_exists('drupal_get_path')) {
    $file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
    if (is_file($file)) {
      require_once $file;
      $files[$key] = $file;
      return $file;
    }
    else {
      $files[$key] = FALSE;
    }
  }
  return FALSE;
}

We see that

require_once $file

is used to load $file into the scope of module_load_include(),  not  mymodule1_myfunction1() so $file is not available to mymodule1_myfunction1(). Is this not how module_load_include() is meant to be used?


texts: How do I redirect anonymous users to the login?

texts:
I'm using rules module with drupal 8 in order to redirect anonymous users to the login page after registration form submission, so I created a rule with react on event "After saving new user (rules_entity_insert:user)" because my account creation settings are : "Visitors, but administrator approval is required"

Events: After saving new user (rules_entity_insert:user)

Conditions:
User has role(s) - Parameter: User: @user.current_user_context:current_user, Roles: anonymous user

Actions: Page redirect - Parameter: URL: user/login

But its giving : WSOD with warning

Warning: Cannot use a scalar value as an array in Drupal\Core\Field\WidgetBase->extractFormValues() (line 366 of /var/www/html/D8/core/lib/Drupal/Core/Field/WidgetBase.php).

Any suggestion where i am missing something.


texts: I have a multi-site installation using domain access module and each sub-domain has its own theme. I have a javascript file which is common to all the themes. Right now I've placed the js file inside all the themes folder. Is there a way to place the js file in a common location so that all themes can share it ? Can I use Libraries API module for this purpose ?