texts:
Im struggling from few days with amazon s3 s3fs cors module. My goal is to add custom form field for image upload in ajaxed form. Whenever user click on specific button ajax form will be invoked and this ajaxed form will be a fieldset with different fields involving as well s3 image field. One issue is that s3fs is looking for field instance.

$form['custom_field'] = array(
'#type' => 's3fs_cors_upload',

This is simply not working at all. Field is visible, user can select image but upload button is not active. If I pass some options to the array like value callback and process upload button becomes active but this only leads to more issues as module is checking field instance for file system reference, it should be s3:// but it doesnt find anything and so on.Any hints how to tackle this?


texts: What might be causing my problem to access user variables in Rules?

texts:
I use the module Rules link event to trigger a rule based on visited path. The problem I have that in condition I need to use user variables but get an error - variable user is not defined. If I try php condition and use global $user, I get Notice: Trying to get property of non-object in eval() and Warning: in_array() expects parameter 2 to be array, null given in eval()

What could be the problem here?


texts: Logged in users are automatically logged out when visiting some specific pages

texts:
I have a page view /all-authors where both (Anonymous & Authenticated) users have access to it; However, authenticated users can follow (flag) an author and Anonymous users cannot do that.
What I am facing:

An anonymous user visit /all-authors page as anonymous user.
User wants to follow authors so:
User Create a new account/Log in to the site.
User Visit again /all-authors page.
User will be automatically logged out and the anonymous look of
/all-authors view page will be shown to the user, also the entire site will look like the user is logged out:

Login link will be visible.
Create new Account Link will be visible.
Any block for anonymous user will also be visible.
...

However, if the user will click on Login link (/user/login), the user will be automatically logged in back to the site.
Also if the user click on Create new Account (/user/register), the user will be a prompted with Access Denied page.
So logically speaking, the user is not technically logged out but the user is served with anonymous pages while logged in (Correct me if I am wrong).
I believe that the main problem is due of caching, so below is my caching configurations:

Site settings is set to <no caching> at /admin/config/development/performance
Internal Dynamic Page Cache module which "Caches pages for any anonymous users "is uninstalled from the site.
The /all-authors view page setting for caching is set to: Tag based.
Site is connected through Cloudflare Firewall with Caching Level set to Standard.

I have tried the below:

Clear all Caches from the site side, but the problem persist.
Purge all caches from cloudflare side,  but the problem also persist.
Purge all caches from cPanel side (cPanel -> Cache Manager), then the problem gone and the site work as expected only for current user but after that if another user on another device logged in and visit /all-authors view page, she will be faced with same problem again until the caches from cPanel side is purged again

Is there anything I can do from Drupal side to fix this problem ? or it is generated from server side ?
Note: I have disabled Cloudflare cashing by turning on the Development Mode feature which will temporary bypass all caches allowing to see changes to your origin server in realtime... However, the problem remain the same with no changes !
Note 2: Support team for my VPS server replied with below information:

My senior tech tried manipulating the cache to work without the bypass
URLs but they weren't able to find a fix. It seems the cache manager
is interacting with your page in a way that's causing the session to
be killed. The bypass URL is the fix that would work here, but as you
mentioned that will hurt your performance. Outside of that, we're not
entirely sure what would be causing your site to respond that way with
the caching settings. Perhaps adjusting the sessions lifetime could
yield results.


texts:
In Drupal 7, how do I let the users with a specific role add new articles?

I logged in as administrator, set the permission for the role to allow creating and editing nodes that are articles.
When I login with a user with the role, for example, "NewRole," I do not see any control or dashboard that allows me to create new articles.

How do I start adding new articles as this new user?


texts: db_select returns empty array, BUT the raw query returns records...?

texts:
I've written a query to get records that start column is later than a given time. Take the following:

$q = db_select('timetable_slot', 's')
    ->fields('s')
    ->where('str_to_date(s.start, \'%H:%i\') >= \'15:24\' ');

    print_r($q->__toString());
    /* SELECT s.* FROM timetable_slot s WHERE (str_to_date(s.start, '%H:%i') >= '15:24' ) */

$result = $q->execute()
    ->fetchAll();

print_r($result); /* [] */

$result comes back as an empty array.
If I run the generated SQL manually I get the results I expect, any reason why drupal is returning an empty set?

I've also tried:

db_query("SELECT s.* FROM {timetable_slot} s WHERE (str_to_date(s.start, '%H:%i') > '15:24')")->fetchAll();

This also returns empty, even though the query works in a db client.

Thanks


texts: How to show taxonomy term image on node creation page drupal?

texts:
I have added an image field to my taxonomy terms. I upload images to each term. I just wanted to show term images on node creation page. Currently it showing term name only and showing image after node creation.
I want to show term image on node creation page.

Any help would be appreciated.


texts: How to add a percentage column to drupal views?

texts:
I use Views Aggregator Plus to calculate sum of a column.

items    data
A         20
B         40
C         10
____________
Total     70
Then I want to add additional column for percentage.

-----------------------------------------
Item        Data        Percentage
-----------------------------------------
A              20
B              30
C              50
-----------------------------------------
                100
----------------------

I know Global:Math expression. But I don't know how to get the sum, the sum field(Total) is not available. Only [value], [value_1] and [value_2] available for A, B and C respectively.

Is there a way to add a percentage column?
I have seen this question in another page with unclear answer.


texts: Use dropdown in views exposed filter on paragraph text field in paragraph view?

texts:
I have it working for nodes but i tried for paragraph view and it is not working
Here is the code:

function hook_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {

$storage = Drupal::getContainer()->get('entity_type.manager')->getStorage('paragraph');
$nids = $storage->getQuery();
$nids = $nids->condition('status', 1)
 ->execute();

if (!$nids) {
 return FALSE;
}

$options = [];
$nodes = $storage->loadMultiple($nids);

foreach ($nodes as $paragraph) {

    $value = $paragraph->field_pdf_title->value;
    $options[$value] = $value;

}

$form['field_pdf_title']['#type'] = 'select';
$form['field_pdf_title']['#options'] = $options;
$form['field_pdf_title']['#size'] = 1;
}


texts: Custom Entity - use taxonomy fields in views

texts:
I've created custom content entity, where one of fields defined in BaseFieldDefinitions() is

$fields['game_category'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Game category'))
    ->setDescription(t('Game category'))
    ->setSetting('target_type', 'taxonomy_term')
    ->setRevisionable(false)
    ->setCardinality(-1);
;

Now, I'm trying to create a list using Views, where one of displayed fields will be "Game category" term name. What I managed to achieve is to display that term's tid.

QUESTION: How to display term's name ?

I suppose I should add a relationship, so Views is able to make a JOIN with taxonomy table

My class exposing fields to Views looks like this:

class GameViewsData extends EntityViewsData implements EntityViewsDataInterface  {

public function getViewsTableForEntityType(EntityTypeInterface $entity_type) {
    return $entity_type->getDataTable() ? : $entity_type->getBaseTable();
}

public function getViewsData() {

$data = parent::getViewsData();

$data['game'] = array();
$data['game']['table']['group'] = t('Game Entity Table');
$data['game']['table']['provider'] = 'game_entity';

$data['game']['table']['base'] = array(
    'field' => 'id',
    'title' => t('Game Entity Table'),
    'help' => t('Game Entity Table'),
    'weight' => -10,
);

$data['game']['name'] = array(
    'title' => t('name'),
    'help' => t('name'),
    'field' => array(
        'id' => 'standard',
    ),
    'sort' => array(
        'id' => 'standard',
    ),
    'filter' => array(
        'id' => 'string',
    ),
    'argument' => array(
        'id' => 'string',
    ),
);

$data['game_entity_game__game_category'] = array();
$data['game_entity_game__game_category']['table']['group'] = t('Game Entity Table');
$data['game_entity_game__game_category']['table']['provider'] = 'game_entity';

$data['game_entity_game__game_category']['table']['join'] = array(
    'game' => array(
        'left_field' => 'id',
        'field' => 'entity_id',
    ),
);

$data['game_entity_game__game_category']['game_category_target_id'] = array(
    'title' => t('game_category_target_id'),
    'help' => t('game_category_target_id'),
    'field' => array(
        'id' => 'standard',
    ),
    'sort' => array(
        'id' => 'standard',
    ),
    'filter' => array(
        'id' => 'string',
    ),
    'argument' => array(
        'id' => 'string',
    ),
);

return $data;
}

}


texts: How do you cache a menu when loading it programmatically?

texts:
I am having the below code to load the main menu tree.

$tree = menu_tree_all_data('main-menu');
  $parentMenu = array();
  $index = 0;
  foreach($tree as $key => $value) {
    if (!empty($value['link']['hidden'])) {
      continue;
    }
    $submenu = array();
    foreach($value['below'] as $subMenu) {
      if (!empty($subMenu['link']['hidden'])) {
        continue;
      }
      $tid = explode('/', $subMenu['link']['link_path']);
      $submenu[]= array(
        'link_title' => $subMenu['link']['link_title'],
        'link_path' => drupal_get_path_alias($subMenu['link']['link_path']),
        'link_tid' => $tid,
      );
    }
    $parentMenu[$index]['link_title'] = $value['link']['link_title'];
    $parentMenu[$index]['link_path'] = drupal_get_path_alias($value['link']['link_path']);
    $tidSubmenus = explode('/', $value['link']['link_path']);
    $parentMenu[$index]['link_tid'] = $tidSubmenus[2];
    $parentMenu[$index]['sub_menu'] = $submenu;

    $index++;
  }
  $vars['parentMenu'] = $parentMenu;

Here, into the variable, $parentMenu I am storing the main menu tree. After that
i am printing the menu structure using below code in template.

 <?php if ($parentMenu): ?>
   //printing the html structure
   <?php foreach($parentMenu as $mainMenu) { ?>
     //printing the html structure
     <?php foreach($mainMenu['sub_menu'] as $k => $childMenu) { ?>
        <?php print $childMenu['link_title']; ?>
            <?php
              //printing the html structure
               $recent_content = views_embed_view('masala_taxonomy_section','block_10', $childMenu['link_tid'][2]);
                print $recent_content;
            ?>
<?php } ?>
<?php } ?>

This is taking too long to store the home page and other page... am I missing anything here... or is there need to optimize the code?


texts: can I call my entity checkCreateAccess function from custom code?

texts:
I have several custom entities in my projects.

To check access for certain links, I would like to utilize the checkAccess() and checkCreateAccess() functions in the MyEntityAccessControlHandler classes.

How do I call these from the Controller class or from the module file?


texts: File/function that is executed when I open node from view

texts: I have created view for displaying the nodes. I want to know which function/file is executed when I click on the node listed in the view table. I want to add some code to the file when the node information is loading. Can anyone suggest me the function/file where i'm supposed to do the changes?


texts:
I want to setup a forum using Drupal 7 with these features:

Manage user roles and give or revoke access to forums or topic per user.
Create moderators where they can add,edit, delete members and forums,topics,posts
Be able to get email notifications for every action made in the forums
Be able to upload photos,docs etc

Could you tell which modules I need to make a forum like this?

Thanks in advance


texts: Webform field options missing Entity Reference?

texts:
We're using Webform 3.27 in Drupal 7 (not my call, don't yell at me) and it looks like one of the field type options should be Entity Reference, but we don't have that option. Not sure what's going on there.

Ultimately what I'm trying to do is add an Entity Reference select field that, when an option is selected, will populate up to four other existing fields (like Entity Reference Autofill works in a Content Type). Is that even possible using Webform?


texts:
I am creating a module for searching a library of books.  I have created a set of tabs on the module display page.

Search
Results
Item

The title when the Search page is selected (or default) is as I would expect "Search" however when I go to either of the other tabs (via link or a click) the title of the page is shown as "Home".  While not a major issue it doesnt look good.

I have set the 'title' attribute of the render array for each page to 'Results' and 'Item Details' respectively.  How do I force this title rather than 'Home'.

I have noticed the same behaviour for pages using 'MENU_CALLBACK'.


texts: Trigger Drupal Rule Based on Taxonomy Term

texts: I have a rule built that sends an email to users of a specific role, when new, published content is created. What I want to do is be able to send this email only when the content matches a specific taxonomy term. Unfortunately, I'm struggling with this -- any help would be much appreciated!


texts: is installing a module on a live site ill advised?

texts:
I am trying to install Code Per Node on my website.

All i have to do is ad content types that would accept HTML5 webgames.

There would be theming involved.

Is this a no go?


texts:
I'm having a problem in my html.html.twig file where the styles and scripts variables are not printing anything, and when I debug with dump:

{{ dump(styles) }}
{{ dump(scripts) }}

Both variables are empty and 'NULL' is returned.

Any suggestions on how to debug this further?


texts: Uploading an image with JSON:API; getting "Access denied"

texts:
I'm attempting to upload an image with JSON:API.
I have added an Image field (not a media field) to the user entity.
In Postman, I get a session cookie for testing.
Then, in accordance with Flow 2 in the JSON:API upload file documentation, I configure my request:

I added image data as a binary to the request body.
However, when I send the request, I get the following error:
    "title": "Forbidden",
    "status": "403",
    "detail": "The current user is not permitted to upload a file for this field. The 'administer users' permission is required.",

I don't know why it is saying I need administer users permission.
When I log in as the same (authenticated, non-admin) user and then go to the user edit page, I can edit the image field (save a new image, remove the existing image) without any problem.  So why am I getting a permissions error in JSON:API?  I thought JSON:API permissions were supposed to be exactly the same as in the Drupal UI.


texts: how can control of number word show in article in frontpage

texts:
I would like to limit the amount of text that show in frontpage. Is there an easy way to do
this?

in general i do this :-

but in front page show me article as not good like this:-

its bad in style ,,, what can i do


texts: hierarcical select not apply parent restriction

texts:
i want to add a  "category" field in my custom content type.category type is "terme refrence" with hierarcical select wideget . in settings of it i restrict it with set parrent term for it

but in my form not resriction happend !!!

but in $form['field_category']['und']['#config'] have this

what is the problem and what is the correct way to restrict HS to pick up only sub term of optional term?(i have a vocabulary with a lot of term,i don't want split it to some vocaublary)


texts: Why are some of my teasers only show up inside the view preview and not on the page?

texts:
I've got a view that is displaying a couple different content types in teaser form. Everything looks fine in the view preview but when I look at the actual page, only one content type is displaying the teaser. I've tried comparing them and don't see any differences that would make any difference. Does anyone have an idea what the problem could be?

This is a screenshot of my view.


texts: How show core user mail if node author not anonymous using Computed field

texts:
I'am trying to set a computed field that:
1) show the core user email address if node author uid !=0;
2) and when the node author uid=0, no core user mail address can be find, so I show instead a node_email_field content that was filled by anonymous author during node creation

The following code is what I thought should be correct, but is not working. Thank you all for your support.

$uid = $entity-> uid;   // Grab the author of the node
if ($uid = 0) {   // Check if user is anonymous
$mail = $entity-> node_email_field [LANGUAGE_NONE][0]['email']; // Load email field content from node
}
else {
$user = user_load($uid);  // Load the user object, based on user id
$mail = $user-> mail;  // Load core user email
}
$entity_field[0]['value'] = $mail;


texts: Can there be content sent the a vanilla Drupal 8 sites' views that isn't a node?

texts: Is it possible to add content into views that is not searchable from google? I am trying to find out if the content sent to views has to be of a type node. (I think there are other modules for importing xml into views and such, but I am asking for just the vanilla views)


texts: How to use Rules to fetch domain Whois Data, parse the data and save it to fields?

texts:
For a domain management website I would like to import all Whois data to entity fields.
A domain is an (ECK) entity, with the fields corresponding with the Whois data.

There are public Whois api's available, such as http://bulkwhoisapi.com/ but I'm not sure which one would best serve the import method I want to use.

How can this be accomplished?

Note: My preference is to use Rules and not create a custom module.


texts: How to use a geolocation field from a flag to calculate proximity

texts:
I'm using the Flag module for the notifications system on my site. One of the notifications is supposed to be "Notify me when a new node is created near my location".

I added two fields to a flag: a geolocation field, provided by the Geolocation module, and an integer field (the radius from the user's location which the user enters).

My idea is to use the geodata from every new node that gets created (I store it in WKT format), the users' location and radius from the flag and send off notifications after calculating proximity. Ideally with Rules, but it hasn't worked so far (Rules doesn't seem to recognize flag fields).


texts: Date module year submission form - remove drop down menu

texts: I was wondering if there was a way to change the format in which the year is input in the date module. By default, it is set as a drop down. I would like the user to input by key stroke. Alternatively, I could set up an integer field as I only need a four digit year.


texts: Send email grouped on a commerce line items field

texts:
I use commerce a little different than most as I schedule trips as custom line items.

A trip is scheduled by someone else and they can schedule as many trips as they want for however many users they want.

I am trying to send an email to the user that had a trip scheduled.

My problem is that a user can have multiple legs (line items) on a single order.  So when I try to loop through the line items, it sends out an email per line item (which it should) but to the user it is a duplicate.

I want to use rules to send an email out once.

Is there a way to group the line items on the user as a result and then just send one email out?


texts: Updates for custom module not showing in update.php list

texts:
I've created a custom module for my Drupal 7 website, under sites/all/modules/custom/tm_general which has the following updates in the tm_general.install (please see image attached).

The site is being installed from scratch, meaning the DB is empty when installing. After installation, I have enabled the custom module through the UI.

The problem I'm encountering is that when visiting mysite.local/update.php the updates won't show up. It says No pending updates.

What am I missing?

Thanks a lot in advanced!


texts: How to embed a Rules Link in a View in order to trigger a Rules link to run?

texts:
What is the general process to embed a Rules Link in a View in order to trigger a Rules link to run?

I have used the Rules Link module to create a Rules Link embedded in a View (it's a View that combines all the details of a User).

I want the Rules Link to trigger a Rule which (when the reading user clicks " More Content From Author") will trigger the Rule to show a list of their latest postings in a HTML format.The paths work alright, it just doesn't seem to trigger the Rules Link to run the View.

If I add say a generic link in the Rewrite Result link path (say http://www.google.com), it works fine and finds the target. But my Rules Link URL "More-Content-by-Author" throws a 404 even though the link is set correctly.

I've got most things working, checked all the Permissions and set the "Execute Rules Link" permission in the said View, but still get a 404 error.

I have not added any variables (do I need to?).

After 6 hours, and I'm stumped now. Any suggestions?

Note: All my other Rules links work fine.


texts: How can additional tags be added for a term reference field while listing previously added vocabulary terms?

texts: I am trying to modify a content type which has a term reference field to list all the terms in a vocabulary (like a select) while still allowing multiple tags and the addition of new tags.  It seems like it's something that should be pretty standard, however the Select list widget does not allow multiple tags, nor does it allow the addition of tags.  I have looked at about every module out there as far as I can tell and have been unable to find a solution.  The closest module to what I want is Autocomplete Deluxe, but it has so many bugs so as to render it virtually useless.  Does anyone know of a solution to this problem?


texts: How to attach variables to drupalSettings with ajax?

texts:
With the page attachments function, I can easily attach a library or some variables to drupalSettings.
Now however, I want to replace some HTML code with ajax AND attach some variables to drupalSettings. While the ajax call does work in replacing HTML, it does not work in attaching or passing along the variables to drupal Settings.
Is there a way I can do both? Here is my code.
public static function AddAJAXResponseCommands(AjaxResponse $response = NULL, array $params = []) {

  $modalSettings = [
    'id' => 1,
    'status' => true,
  ];

  $sample = [
    '#type' => "html_tag",
    '#tag' => "div",
    '#attributes' => ['class' => ['context-menu']],
    '#value' => "Dashboard",
  ];

  $sample['#attached']['library'][] = 'mylibrary/dashboard-js';
  $sample['#attached']['drupalSettings']['dashboard']['myVariables'] = $modalSettings;

  $response->addCommand(new ReplaceCommand('.context-menu', $sample));
  return $response;
}

When I attempt to access drupalSettings.dashboard.myVariables which I confirmed already works when I use the page attachment function, it does not work when using ajax calls. Instead I get myVariables is undefined.
I console logged drupalSettings and sure enough, my variables are no where to be found in there. How can I get it added? Is page attachment the only way to do this?


texts: How do you Drush reset an administrator password?

texts: How do you Drush reset an administrator password after forgetting the pass and losing its email?


texts: what is the advance poll tpl file name and where should it locate at?

texts:
I need to theme the advance poll, but not sure what the tpl file name and where should it located...
I had tried poll-vote.tpl.php inside mytheme templates file
I had tried poll-vote.tpl.php inside adv poll modules templates file
I also had tried advpoll-vote.tpl.php
but not working
(or this only work for poll modules but not adv poll?)
Anyone Please help!


texts: How to get the administrator role id to assign new permissions?

texts:
In my module I'm creating new permissions that I want by default also assigned to the Drupal admin user.

I know how to assign new permissions to a role, but I don't know how to get the Drupal administrator role id. In the database the rid for administrator is 3, but can I rely on that being always the case? I'm using Drupal 7.


texts:
Trying to make a field with Drush, i get the following error

First, the version

root@homer:/usr/share/nginx/html/8/sites/default# drush version
 Drush Version   :  8.0.1

Try to make a field 'voorvoegsel' (dutch) with field-create in Content-type contact

root@homer:/usr/share/nginx/html/8/sites/default# drush field-create contact voorvoegsel,text
PHP Fatal error:  Call to undefined function field_info_field() in phar:///usr/local/bin/drush/commands/core/field.drush.inc on line 175
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Call to undefined function field_info_field() in phar:///usr/local/bin/drush/commands/core/field.drush.inc, line 175

Googling gives me no clue, so i post this here. Can't find a (good) solution.


texts: How to filter views block depending on field value?

texts:
I have two content types "Company" and "Contact". The content type "Contact" have a Entity reference field referencing "Company", it also has a text field called field_country.

Company1--->Contact1 (UK)

Company1--->Contact2 (UK)

Company1--->Contact3 (USA)

Contact1,2,3 are different nodes of type "Contact" referencing a
"Company".
UK, USA is value of field (field_country) in type
"Contact" of different nodes.

Currently I have a views block showing on type "Contact", listing all the nodes referencing the parent "Company". Now i want to filter the view based on the field value of field_country. In other words i want a list of nodes referencing the parent node from the same country as the current node.

i.e on Contact1 and Contact2 views block i want to show:

Contacts1 (UK)
Contacts2 (UK)

on Contacts3 views block:

Contacts3 (USA)

So how to accomplish it using Drupal 7 and views 3?


texts: User List of user roles in List field af a content type

texts: I would like to add a new field type in my content type. The field is of the type List(Text) and the possible values should be the list of user roles in the system. Is there a way to do it without creating a custom field type?


texts: How to translate a node in a custom block?

texts:
I know that the question has been asked several time but I didn't find how to get the translation of a node entity.

Here is the code :

    $countries = \Drupal::entityTypeManager()
        ->getStorage('node')
        ->loadByProperties($properties);

    return [
      '#theme' => 'country_selector_block',
      '#langcode' => $lang->getId(),
      '#countries' => $countries,
    ];

And in the twig template I put :

{% for country in countries %}
    <option value="{{ country.field_code.value }}">{{ country.title.value|t }}</option>
{% endfor %}

=> but it return the country name in the default language

Can you explain how to handle that ?


texts: Get access to node titles and nid's only

texts:
there are two content types on my site: Projects and Employees. Employees has a user reference field, Projects have several node reference fields to Employees (according to different project roles). I grant rights to users with Node access user reference and Node access node reference modules so they can view and edit only the nodes they are referenced to (either directly or indirectly).
Certain referenced users (project managers) should be able to add other Employees in Project nodes but in the same time they must not see their personal data. Therefore they haven't got any referencable Employee nodes.
Would it be possible to grant access to the node titles (and nid's for referencing) only and hide other fields?


texts: How can I update a field on a user profile with Drush

texts:
I'm creating users with user-create but I have added extra fields to the user like membership number.

Is there a way to update that field with a number when I create the user?


texts: Flags, Entity reference, users and content upload

texts:
I am using the entity reference module and flags to achieve a certain use case. Let me elaborate. In my site, there are nodes of type "TASK". They have a flag on them "Take Task". Now a logged in user can click the flag and he or she has undertaken the task. Now to show that he or she has completed that task, they upload a blog about it. There is a field in the blog "TASK NAME" which is a entity reference field linking to the different nodes of type TASK. The user can select a task from the drop down so that it can be indicated which task has the user completed and blogging about and then in the blog they can upload details about it. Now i want that in that drop down provided by the entity reference only those nodes which have been flagged by the user appear. How can i achieve this?

Regards


texts: How to find "next day date" (xx/xx/xx 00:00:00) from a given date & time value in Rules?

texts:
I'm trying to figure out how to find the next day date (xx/xx/xx 00:00:00) from the given date&time value in rules without the use of PHP filter module. Played with offset already - couldn't get the needed result.

The idea is to set up scheduled task in Rules that will take the date & time value from a node field#1 and change the field#2 on that node at midnight of the next day.

EDITED: To simplify: if my date field = 07/30/15 05:00:00 how do I schedule task at 07/31/15 00:00:00 without the use of PHP filter.

Any ideas are greatly appreciated.


texts: PHPUnitTest is missing the file_managed table?

texts:
My PHPUnit test is throwing an error saying that my file_managed test database table does not exist. What module do I need to include for that test table to get created? I would think it should be the file module, but I've already got that listed in my $modules array.

This is a Kernel test and I've been trying to fill up the modules array with everything I can think of that might actually get that table created.

  public static $modules = [
    'system',
    'path',
    'user',
    'file',
    'file_test',
    'node',
    'field',
    'media_entity',
    'entity',
    'image',
    'graphql',
    'graphql_core',
    'custom_graphql_file_upload',
    'custom_graphql_field'
  ];

Here's the error:

Invalid GraphQL query. Errors: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'contenta.test87607590file_managed' doesn't exist: INSERT INTO {file_managed} (uuid, langcode, uid, filename, uri, filemime, filesize, status, created, changed) 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, :db_insert_placeholder_9); Array

I'm trying to test a graphql file upload to make sure the file entity gets created as expected. I have a lot more tests I want to write and lot more that needs to be solved with multi-part/form data, etc, but I need to figure this out first I think.

Here's the full test
https://github.com/justinlevi/graphql_custom_file_upload/blob/feature/PHPUnitTest_WIP/tests/src/Kernel/MutationFileUploadTest.php

All other code posted as well on the WIP branch.


texts: Commerce - access denied on checkout page

texts:
When I tried to access the checkout page I get "Access denied"; this happens with every role, all of which have permission to view the cart/make orders/view orders.

This happens even with a complete fresh install of Commerce Kickstart.  There must be something going on with the server configuration?  All other admin and user functions work without any issue.  I am using HHVM instead of standard PHP, but surely I am not the first one to attempt to run Drupal Commerce on HHVM.  I can find no trace of this issue elsewhere except someone with the same question 6 months ago that was unresolved.

Any idea what's going on here?


texts: Include email attachment in new content Rule

texts:
I'm trying to send an attachment within a rule I've set up for new content notification.  I have the requisite modules installed: Mail System, Mime Mail, etc.  I've set the rule up to send HTML mail to users of a role, specified the body content, and the attachment in the following manner...

I've tried various incantations of the attachments value by changing the token.  The file I'm trying to attach is an Excel file attached to an article.  The email notification does get delivered, and, appears to have an icon indicating an attachment.  However, when I open the email, the body text is correct, but, there's no attachment.  From the research I've done, I've found that attachments seem to be an enigma.  Some posts I've read imply that I need to do some coding to get this to work.  Seems like I shouldn't have to.  Can anyone shed some light on how to attach a file correctly?


texts: Unpublish commerce product display when stock is '0' with rules

texts:
Does anyone have an idea of how to do this?

I tried it with the reaction after saving commerce product but I wasn't able to access the node.

I also tried accessing the node by looping through product_reference field and used set a data value and selected list-item:status and then unpublished, but I got this message:

  Unable to modify data "list-item:status": Entity property
  field_product_reference_node doesn't support writing.

and

  Unable to evaluate action data_set.

in the error logs.


texts:
I need a way to load Fivestar via AJAX for a onepage.

Currently I load every section async but need to init the votes afterwards. Otherwise I only see the dropdown menu and the rate button. When I try to select something in the dropdown menu it'll get reset.

Does anyone know a solution? Thanks


texts: I cannot find Profile module in the core in drupal7, I want to create a registration page with multiple textboxes. Kindly tell how can I find the profile module.


texts: Extending Entityreference Field Class to contain additional input fields

texts:
I am currently trying to build a custom field consisting of an EntityReference Input Field (Autocomplete Widget) and two textfields to add additional information in Drupal 8beta11.

I used the code from the example module and the EntityReference field type. I copied it into my custom module. Everything worked.

But then I remembered the 'new' OOP approach of Drupal 8. Why copy, when I can extend? Extending the EntityReferenceItem Class worked without any problems. The table was correctly created.

Then I tried to extend the autocomplete widget class EntityReferenceAutocompleteWidget to show my additional two textfields. Here it somehow doesn't work. The Error I get:

Fatal error: Call to undefined method Drupal\Core\Field\FieldItemList::referencedEntities() in ...\core\lib\Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget.php on line 95

I know it means more or less, that somehow the $items, which are put into the parent::formElement method doesn't have the function referencedEntities implemented. But how can I fix this?

I tried to look into other modules and even found Drupal\Core\Field\Plugin\Field\FieldWidget\AutocompleteTagsWidget to extend the EntityReferenceAutocompleteWidget, but I don't find the difference.

This is my CompoundReferenceWidget. I am grateful for any advice or hint to get it working. Or to get the information, that it can't be done the way I tried it.

/**
 * @file
 * Contains \Drupal\compound_reference\Plugin\field\widget\CompoundReferenceWidget.
 */

namespace Drupal\compound_reference\Plugin\Field\FieldWidget;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget;
/**
 * Plugin implementation of the 'compound_reference_widget' widget.
 *
 * @FieldWidget(
 *   id = "compound_reference_widget",
 *   module = "compound_reference",
 *   label = @Translation("Modeling a reference with additional fields."),
 *   field_types = {
 *     "compound_reference"
 *   }
 * )
 */
class CompoundReferenceWidget extends EntityReferenceAutocompleteWidget {

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element = parent::formElement($items, $delta, $element, $form, $form_state);

    $element['description'] = array(
    //$element += array(
      '#type' => 'textfield',
      '#title' => t('Description of the reference.'),
      '#default_value' => isset($items[$delta]->description) ? $items[$delta]->description : NULL,
      //'#min' => 1,
      //'#required' => TRUE,
    );
    $element['start'] = array(
      '#type' => 'textfield',
      '#title' => t('Start Date'),
      '#default_value' => isset($items[$delta]->start) ? $items[$delta]->start : NULL,
      '#description' => t('Start'),
    );

    return $element;
  }
}


texts:
I am using the Webform and displaying it using the Views module.

Unfortunately, I couldn't get the submitted data of the webform in views.

Any suggeestions?


texts:
I'm working on this web site which I need to make changes to the heading part and I need to know which template or file is generating it so that I can add a slogan. My first attempt was using theme developer. However, it crashed the site so I had to disable it. Is there any other way I can track down the responsible template?

Drupal 7.0


texts:
I'm about to start a Drupal project for a client who has a large site currently set up on Drupal. The project will be a mini-site on a subdomain and will be totally different from the main website.

The mini-site will probably be a one-page website and the client wants to be able to easily edit the test on there. The one-page website will be fairly long and will need custom HTML.

My initial thought was to just code the HTML directly into a new page via Drupal and enable 'Full HTML' as the content type - my only worry is that I don't want the client to see/edit the HTML code, I only want them to be able to edit the text content.

So my question is quite simple - what would be the best way to go about doing this?


texts: Starts with a larger ubercart order number

texts: Ubercart order number start at 1. How can I set the order number to start with a larger number, e.g. 100001?


texts: Is there any way to dynamically add a CSS class selector to a view with submitted exposed filters?

texts: I need to add some different styling to a view based on whether the exposed filters have been applied or not. Eg add the class "filtered" once a person has submitted their info in the exposed filter?


texts: Add a twig variable to a certain href url menu item when it is being created

texts:
I have a Drupal 8 install that I am trying to add a variable to a href  URL when it equals #blog but I can't get it to work. Can anyone see what I am doing wrong?

This is my menu template file:

{{item.url}}
{% if item.url == '#blog'  %}
    {{ item.title }}  /Tksksks iss
{% else %}
    {{ link(item.title, item.url) }}
{% endif %}


texts:
I have a triggered rule, when a content is Published the author receives email.
I want to show my logo in the email but so far I could not find how to do that.
Any help appreciated?

I wrote this in email message body, but instead of an image, I see only HTML text.

<img src="http://www.vragenenislam.com/misc/logomuz.png" alt="Vragen en Islam" />


texts:
I have problems with rendering twig templates inside my block theme.
Is it possible to display default template for a field that I've fetched with entity manage query?

I've got a custom carousel slider module which uses 'Banner' node type. It has a banner image, link URI fields.
Everything works fine, but I would like to display the responsive image template instead of building my own HTML.

Here's how I do it right now.

        <span class="glide__arrow prev" data-glide-dir="<">&lt;
        ">&gt;

            {% for item in baners %}

                        {% if item.field_url.uri %}

                                    {% if (item.field_description.value) %}
                                        {{ item.field_description.value }}
                                    {% endif %}
                                    {% if (item.field_url.title) %}

{{ item.field_url.title }} &gt;
                                    {% endif %}

                        {% endif %}

            {% endfor %}

I am fetching banners this way.

$storage = \Drupal::entityManager()->getStorage('node');
$nids = $storage->getQuery()
    ->condition('type', 'baner')
    ->condition('status', 1)
    ->execute();
return $storage->loadMultiple($nids);

What I would like is to find a way to display a responsive image, such as in the following way.

{{ responsive_image(item.field_baner) }}

Or render them in module class so I could display them in my template.

$banerBuildParams = [
      '#theme' => 'responsive_image',
      '#width' => $variables['width'],
      '#height' => $variables['height'],
      '#responsive_image_style_id' => $variables['responsive_image_style_id'],
      '#uri' => $variables['uri'],
  ];
  //render template
  $template = $this->getTemplate($banerBuildParams);

[edit]

I think I've found a solution to render all the view I can use this code to pretender nodes (not sure it's the best approach to the problem):

node_view($baner, 'teaser');

The problem I've still got is that I use external jquery library which requires some specific html formatting which not comply with the default generated tags. Maybe somebody more experienced with Drupal could suggest something?
I know I can create my own plugin for field type. It seems a lot trouble for just one not reusable element.
What if I need to group two fields in specific DIV and some others in different one?
Using node_view I am loosing the way my code looks like:/


texts: Taxonomy terms from multiple vocabs on a single line

texts:
I migrated from Drupal 6 to Drupal 7 and used the same theme, now the "post tags" (taxonomy terms from multiple vocabularies) aren't displayed on the same line as shown below.

How to get these into a single line.


texts: Leaflet library not avaliable even though it's in sites/all/libraries

texts:
I've seen people talking about hook_library() etc., but I'm not creating a custom module, I'm trying to use Leaflet. In the browser I get the error message:

L is not defined

From leaflet.drupal.js in my sites/all/modules folder. I've got the Leaflet and Libraries modules installed and enabled, and the Leaflet files are extracted under sites/all/libraries/leaflet.

Anyone have any idea what I'm doing wrong?


texts: How do I manipulate a variable's property in Twig?

texts:
I want to add classes to a link render element that's a property of the {{content}} variable in my template.

I can do this:

{% set link = content.my_link %}
{% set link = link|merge({ '#attributes': { 'class': [ 'my-class', 'other-class', 'third-class' ] } }) %}
{{ link }}

But I don't seem to be able to manipulate content.my_link directly. Why can't I do this:

{% content.my_link|merge({ '#attributes': { 'class': [ 'my-class', 'other-class', 'third-class' ] } }) %}
{{ content.my_link }}


texts:
I am using flat rate shipping service and I want to add a value to shipping service price, I know drupal commerce  has a rule for this job, Add an amount to the unit price , but when I want to complete it  I don't know what is should enter in  Line item section ?

I try below one by one

commerce-order:commerce-line-items:0
commerce-order:commerce-line-items:1
commerce-order:commerce-line-items:2
commerce-order:commerce-line-items:3
commerce-order:commerce-line-items:4

but no one work. exactly what this mean, I want add value to only line item that is shipping type, I search google but didn't get any example or something similar this.

appreciate any lead an suggestion about what I should enter in line item ?


texts:
I'm using the Multi-Step Registration module to have a wizard in my user registration. The wizard works fine. You can also select a wizard trail to see in which step you are.

As you can see it displays that you can customize it by theming ctools_wizard_trail__step. Now the html code of the wizard is like this:

    Register »
    Geslacht »
    Politiek actief
    .......

This is what I've done so far in the function:

function mytheme_ctools_wizard_trail__step($html) {
    $wizard = $html['trail'];
    $steps = ['', 'geslacht', 'politiek_actief', 'beroep', 'vakgebied', 'berichten_ontvangen', 'nicknames', 'other'];
    for($i = 0; $i < count($steps); $i++)
    {
        $step_name = (string)$steps[$i];
        $wizard_html = (string)$wizard[$i];
        $wizard[$i] = "" . $wizard_html . "";
    }
    $html['trail'] = $wizard;
}

When I dump the $html variable on the first line of the function (before any operations) I get this result:

array (size=1)
    'trail' =>
       array (size=8)
          0 => string 'Register' (length=51)
          1 => string 'Geslacht' (length=51)
          2 => string 'Politiek actief' (length=58)
          3 => string 'Beroep' (length=49)
          4 => string 'Vakgebied' (length=52)
          5 => string 'Berichten ontvangen' (length=61)
          6 => string 'Nicknames' (length=48)
          7 => string 'Other' (length=44)

When I dump the $html variable on my last rule of the function I get this:

array (size=1)
   'trail' =>
      array (size=8)
         0 => string 'Register' (length=81)
         1 => string 'Geslacht' (length=89)
         2 => string 'Politiek actief' (length=103)
         3 => string 'Beroep' (length=85)
         4 => string 'Vakgebied' (length=91)
         5 => string 'Berichten ontvangen' (length=110)
         6 => string 'Nicknames' (length=87)
         7 => string 'Other' (length=79)

It looks the same but my wizard is gone ... . It's not added to my html.. .
What could be the problem of this?


texts: How to associate User data with custom module?

texts:
I'm thinking about a custom module where I need to save additional data (like user logs from other software, customer data, etc.) that'd go into a custom module user table.
How would I associate that with the user? Just the user ID?
Or is there anything else that I might want to save for uses that I might not yet know (Views, Domain Acess, Panels, Context, ...) or can I get all required data just be joining the UserID everywhere?


texts: Correct way to disable /node in Drupal 7?

texts:
I find going to /node as being very useful to pinpoint exactly what content non-authorized users can see. But for two reasons I don't want anyone to access "/node".

I don't want that to end up in Google Search Results.
I don't want prying eyes to go through each and every content in case something should accidentally not have been made public.

So my question is: what is the most correct way to block /node? Or should I keep it open and rather let robots.txt avoid that path?

UPDATE

To make matters worse, it seems I have set everywhere in my permissions that certain content types must not be viewable by certain roles. However, those pages are still showing up under /node ?


texts: Error occurs every time I try to log in after updating

texts:
I cloned a site locally, imported the database and run: "composer update --with-dependencies",

Got the following:

  [RuntimeException]
  Could not scan for classes inside
  "/home/www/sites/site/web/vendor/drexarj/disqus-php/disqusapi/" which
  does not appear to be      a file nor a folder

then I run "drush updb -y".

There were a couple warnings:

  The following module is missing from the file system: aspambot
  bootstrap.inc:268
  The following module is missing from the file system: phpmailer
  bootstrap.inc:268

Then I uninstalled recaptcha by typing:

"drush pm-uninstall recaptcha"

Tried to log in, but got the following unexpected error:

  The website encountered an unexpected error. Please try again later.
  Error: Call to undefined function Drupal\commerce_price\bcmul() in
  Drupal\commerce_price\Calculator::multiply() (line 75 of
  modules/contrib/commerce/modules/price/src/Calculator.php).
  Drupal\commerce_price\Calculator::multiply('107.000000', '1.00')
  (Line: 140) Drupal\commerce_price\Price->multiply('1.00') (Line: 259)
  Drupal\commerce_order\Entity\OrderItem->recalculateTotalPrice() (Line:
  133) Drupal\commerce_order\Entity\OrderItem->setUnitPrice(Object)
  (Line: 144) Drupal\commerce_order\OrderRefresh->refresh(Object) (Line:
  92) Drupal\commerce_order\OrderStorage->doPreSave(Object) (Line: 389)
  Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 820)
  Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line:
  391) Drupal\Core\Entity\Entity->save() (Line: 114)
  Drupal\commerce_order\OrderStorage->postLoad(Array) (Line: 249)
  Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 231)
  Drupal\commerce_cart\CartProvider->loadCartData(Object) (Line: 184)
  Drupal\commerce_cart\CartProvider->getCartIds(NULL) (Line: 172)
  Drupal\commerce_cart\CartProvider->getCarts() (Line: 221)
  Drupal\commerce_cart\Plugin\Block\CartBlock->getCacheTags() (Line: 86)
  Drupal\block\BlockViewBuilder->viewMultiple(Array, 'full', NULL)
  (Line: 71) Drupal\block\BlockViewBuilder->view(Object) (Line: 151)
  Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line:
  259) Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array,
  Object, Object) (Line: 117)
  Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array,
  Object, Object) (Line: 90)
  Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object,
  'kernel.view', Object) call_user_func(Array, Object, 'kernel.view',
  Object) (Line: 111)
  Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view',
  Object) (Line: 156)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line:
  68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
  (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
  (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object,
  1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line:
  78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
  (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1,
  1) (Line: 52)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1,
  1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line:
  666) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

My question is: what can I do about this? I've repeated the process two times and got the same error.


texts:
I am trying to create Drupal entity instances from an external script that is not part of Drupal or a Drupal module.

For Drupal 7 there was drupal_bootstrap to load the required Drupal dependencies. However, after a long search all I found for Drupal 8 was a note that drupal_bootstrap is deprecated for Drupal 8.

And indeed, I get a

  Call to undefined function drupal_bootstrap()

when I try to call it after including as in

define('DRUPAL_ROOT', __DIR__ .'/../drupal');
require_once DRUPAL_ROOT . '/core/vendor/autoload.php';
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

So how can I use the Drupal 8 API from an outside script?!


texts: corresponding textbox for each user reference item

texts:
I have a special node type [I call it members] that includes a user reference field. The amount of user references that can be added to each members is unlimited.

But I need to add an extra information for each user that is added to each members node.

I am searching for a solution to put a text box input beside the node reference auto complete input.
I mean each auto complete user reference field has a corresponding text box input.

Even when the manager click on add another button and new auto complete line is appeared at the end of rows, the new corresponding text box input must be located beside it.

Please help me

How can I do this.


texts:
Good Day All, I need some guidance please.

I have a page.tpl.php file in sites/all/themes/mysubtheme/templates but it is not reading that file (override), it is still looking at the default page.tpl.php in sites/all/themes/bootstrap-less-master/templates.

Any way how I can change this or what can be done to fix this?


texts:
I want to change the order of a webform component. This creation of a webform component:

$component = array(
      'name' => key($question_name),
      'form_key' => $key,
      'type' => $form_type,
      'mandatory' => 0,
      'weight' => $weight,
      'pid' => 0,
      'extra' => array(
          "items" => "1|1\n2|2\n3|3\n4|4",
          "multiple " => FALSE,
          "aslist" => FALSE,
          "description" => $question['description'],
        ),
);

Gives me the following display result:

Name of component
1 - 4 radiobuttons
Descriptiontext

But I want to move the description text over the radiobuttons:

Name of component
Descriptiontext
1 - 4 radiobuttons

How can I change the order of the output?


texts: Using oauth_common in a module to authenticate with a web service?

texts:
I'm wanting to use my Drupal 7 site to communicate with an external API that must be authenticated via 3-legged OAuth.

It seems there's a lot of documentation around about using Drupal as the OAuth provider (Via the OAuth project), but very little about using its API to do things like authenticate a Drupal site with an external web service. There's an old complete tutorial, but this doesn't list any of the functions that oauth_common provides, nor even really any code with how to build an OAuth session with the module.

Any help? Moreover, is there a "Drupal Way" of creating OAuth sessions?

(If it helps, I'm doing stuff with Magento and using the examples here as a base.)


texts: Linking to #targets when promoting to homepage

texts:
On a Drupal 6 site, I want my article to start with a bullet list of section headings, linked to in-page targets; and I want to include this list in the teaser text which is promoted to the homepage.

But the links don't work from the homepage, because Drupal doesn't work out that the on-page target in an article is an off-page target or the teaser, so it doesn't include the node reference.

Is there some way for content authors to achieve this easily?  Maybe there's a module which handles it?


texts: How to transform select options from views exposed filters to clickable link areas?

texts:
I have asked more generally in stack overflow

https://stackoverflow.com/questions/49491094/how-to-transform-select-options-to-clickables-link-areas?noredirect=1#comment85985442_49491094

How can I make my exposed filters look like this?

<select data-drupal-selector="edit-field-video-theme-target-id" id="edit-field-video-theme-target-id" name="field_video_theme_target_id" class="form-select"><option value="All" selected="selected">- Tout -</option><option value="9">A*midex</option><option value="11">Bibliothèque</option><option value="10">Relation entreprise</option><option value="8">Université</option></select>

Is it possible to transform select/options to ul/li?

Is it possible to override the template views-exposed-form--videos.html.twig?


texts: Add Brightcove field through form in custom module

texts:
I'm using Brightcove Video Connect 7.x-6.0-beta2 module and I want to add field in my custom module.

I was tried with brightcove, brightcove_video and brightcove_field types and it is not working.

Example of my try:

  $form['something_page_settings']['something_media']['my_module_bri_file'] = array(
    '#title' => t("Brightcove"),
    '#type' => 'brightcove_field',
    '#default_value' => variable_get('my_module_bri_file'),
  );

Can someone help me to add this field?


texts:
I measure time of my batch node creation and it's fairly acceptable at the beginning with, let's say 200 nodes, and totally disappointing at 1700 nodes. After some measurements I found out that the culprit is the node_submit / node_save part. For loop of 20 nodes creation it takes 5-6 seconds for each node to happen.

Where should I look for optimization? Is it some heavy module ruining my performance? Maybe it's some devel function that slows it down.

On almost empty base my call runs for 8 secs. When there's about 1600 nodes in the base I have to wait 120 secs! (loop of 20-21 nodes 5 secs each).


texts:
I updated Drupal to 8.6.16 version and after that Revisions Tab is disappeared.
Actually, all revisions are saved fine and I can see them because I have access to the page "xxx/revisions", but I don't have "Revisions" in the list of tabs.
Do you have some idea what is the problem?


texts:
I'm on Drupal 7.43 and are using Nice Menus 7.x-2.5. I just noticed a problem but can't say it is connected to Nice Menu.

When I under admin/structure/menus manually creates menu links, not all links produces class="active". After a while I found a pattern:

All nodes created by a Content type, like node/53, works just fine,
there are class="active" in the menus
Just some of the Pages made manually under admin/structure/pages
produces class="active"
Pages with a functioning class="active" has a link with a Path name
like "anypage"
Pages not producing class="active" has a link with a Path name like
"/anypage". The difference is the /.

So why do I not write the Path without / ? Because it is impossible for some Pages. On some I can write without / and class="active" will appear, but on others when I try to write the Path without / I will have the message "The path 'anypage' is either invalid or you do not have access to it." When I add / in the beginning, I can create the link but there will be no class="active"

As far I can see there is no difference at all in the settings between the different pages.

Can anyone give me a lead what this is all about. Please, I really want the active class in the menu.


texts: Unable to contact the Apache Solr server

texts:
I followed README.txt and installed these :
apache solr 1.4.1 (Out side WWW Directory)
Apache Solr Drupal modules
SolrPHPClient r22 (placed inside module)
I copied over xml files(as mentioned in readme) to example folder
And after starting up SOLR as java -jar start.jar I am able to access localhost:8983/solr/admin,
But still i get

Apache Solr: Your site was unable to contact the Apache Solr server.

I am using windows :(


texts: Get image url with https instead of http

texts:
When I use file_create_url it return url with http instead of https.

Code Snippet:

$desimg = file_create_url($node->field_image->entity->getFileUri());

Due to which i m getting warning like below

Mixed Content: The page at 'https://www.example.com/' was loaded over HTTPS, but requested an insecure image 'http://www.example.com/sites/default/files/test/test_M_01.jpg'. This content should also be served over HTTPS.

I'm missing something?


texts: adding yet another domain to multi-site but this time symlink not working

texts:
Have no idea what's going on here. I'm trying to add another new domain to my multi-site but keeps directing to apache test page - not install.php.

Have many subdomains installed now and one new domain added to root one but this next one is giving me problems for some reason. Everything has been done same way. Set up in server to point to IP; separate database created; name of domain in sites folder created with default.settings.php copied to it as settings.php and chmod 644 then a symlink from the /var/www/html folder to the sites one but as I say just keep getting apache test page. Not found if try going to install.php. This is happened to me before but don't have a thorough understanding why...i am suspecting has something to do with database- not sure.


texts:
I set the cron to run every day.

I want to prevent the cron from deleting some of the watchdog table content.

But i didn't find a way to do it, i still want the cron to run for the search index.

How can i prevent the cron from deleting dblog (watchdog) informations only ?


texts: How can I replace the Forum's vocabulary 'Forums' with my existing vocabulary 'tags'?

texts:
I use a "tags" taxonomy for most content on my site. The "Forum" (core) module insists on using its own vocabulary ("Forums") and also seems to have automatically created a vocabulary for itself.

Is there a way to have the forum module use my existing "tags" vocabulary? I'd imagine forum topics tags with a tagged term to be listed in a teaser kind of preview when browsing that tags' vocabulary's matching term (alongside other content with that tag).

Edit: See below screenshot where I try to change the vocabulary in the forum content type field. The vocabulary choice is disabled.


texts: Custom breadcrumbs from a breadcrumb builder disappear until I clear Varnish cache

texts:
Unrelated to this question, which is about how to properly inject breadcrumbs as a renderable item into a node template.. I have a custom breadcrumb builder for certain node types with the same sort of cache clearing issue.

After I deploy code to production, and clear the Drupal cache, about 50% of the time anonymous users stop seeing breadcrumbs on these 3 node types. I find that I have to clear cache again, then clear the Varnish cache on the server, and then they appear again for anonymous users. Am I missing something in the build method?

<?php

declare(strict_types = 1);

namespace Drupal\harlib_breadcrumbs;

use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Link;
use Drupal\Core\Routing\AdminContext;
use Drupal\node\NodeInterface;
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Url;

/**
 * Class ContentTypeBasedBreadcrumbBuilder.
 *
 * @package Drupal\harlib_breadcrumbs
 */
class ContentTypeBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {

  use StringTranslationTrait;

  /**
   * The AdminContext service.
   *
   * @var \Drupal\Core\Routing\AdminContext
   */
  protected $adminContext;

  /**
   * The AliasManager service.
   *
   * @var \Drupal\Core\Path\AliasManagerInterface
   */
  protected $aliasManager;

  /**
   * The EntityTypeManager service.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * {@inheritdoc}
   */
  public function __construct(
    AdminContext $admin_context,
    AliasManagerInterface $alias_manager,
    EntityTypeManagerInterface $entity_type_manager
  ) {
    $this->adminContext = $admin_context;
    $this->aliasManager = $alias_manager;
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function applies(RouteMatchInterface $route_match) : bool {
    if (!$this->adminContext->isAdminRoute()) {
      $parameters = $route_match->getParameters()->all();

      if (isset($parameters['node']) && $parameters['node'] instanceof NodeInterface) {
        $types = ['story', 'press_release', 'news_mention'];
        $type = $parameters['node']->getType();
        return in_array($type, $types);
      }
    }

    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function build(RouteMatchInterface $route_match) : Breadcrumb {
    $node = $route_match->getParameter('node');
    $breadcrumb = new Breadcrumb();
    $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));

    if ($url = $this->getNodeUrlByAlias('/about')) {
      $breadcrumb->addLink(Link::fromTextAndUrl($this->t('About'), $url));
    }

    if ($url = $this->getNodeUrlByAlias('/about/news')) {
      $breadcrumb->addLink(Link::fromTextAndUrl($this->t('News'), $url));
    }

    $breadcrumb->addCacheContexts(['url.path']);
    $breadcrumb->addCacheTags(["node:{$node->nid->value}"]);
    return $breadcrumb;
  }

  /**
   * Create a Url object if the alias matches a node object path.
   *
   * @param string $alias
   *   The node alias.
   *
   * @return bool|\Drupal\Core\Url
   *   A Url object, or FALSE if no result found.
   */
  protected function getNodeUrlByAlias(string $alias) {
    $path = $this->aliasManager->getPathByAlias($alias);

    if (preg_match('/node\/(\d+)/', $path, $matches)) {
      $id = $matches[1];
      return Url::fromRoute('entity.node.canonical', ['node' => $id]);
    }

    return FALSE;
  }

}


texts:
How I can add itemprop="url" for each link () in main menu?
So, I need to get from
Test

to
Test

Is it possible to do it in preprocess? I would like not to use any module for this.


texts:
I have a page which uses the form api. When I go to that page via hook_menu I want to run a batch script.

I have looked at the batch example module and have come up with the following:

My page code

...

batch_set(my_batch());
die(); // removing this has no affect

...

Rest of the code

function my_batch() {
  $max = 10000;
  $increment = 1000;

  drupal_set_message(t('Creating batch'));

  $operations = array();

  for ($i = 0; $i < $max; $i = $i + $increment) {
    $operations[] = array(
      'batch_example_op_1',
      array(
        $i,
        $increment
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'batch_example_finished',
  );
  return $batch;
}

/**
 * Batch operation for batch 1: load a node.
 *
 * This is the function that is called on each operation in batch 1.
 */
function batch_example_op_1($count, $increment) {
  drupal_set_message('Count is : ' . $count);
  $context['results'][] = time();
}

function batch_example_finished($success, $results, $operations) {
  if ($success) {
    drupal_set_message('All done');
  }
  else {
    drupal_set_message('Error');
  }
}

Currently the $operations array is being created and is being passed to batch_set() then nothing else is happening.


texts: Get just the first item from a multiple valued field using field_view_field()

texts:
I'm using field_view_field() to get the render array for a image field that has multiple values. I then use drupal_render() on that resulting array to print out the markup.

I only want the first image to be returned in the markup for that field. Is there a way to either manipulate the rendered array to remove the other fields or a setting when call field_view_field() to say only return first row?


texts:
I need to add IN clause while implementing hook_views_pre_execute

But it's not the regular IN added like the next line

  {table1}.col1 IN (val1, val2)

$query->condition('author', array($user->uid), 'IN');

Wanted to add reverse

  {val} IN ({table1}.col1, {table2}.col2)

$query->condition($user->uid, array(pm_message.author, pm_index.recipient), 'IN');

But the query takes the fields as values not column names

Is it possible to be added in drupal

Simply I need to get messages where the user is the author or the reciever in privatemsg


texts: 503 Service Unavailable error in all pages except added to my route file

texts:
I have a D8 web with some views and pages. If I log in with administrator user, all works good. If I log in with a normal user, I get 503 service unavailable error after some seconds of load. It happens with all pages (view pages, public pages, etc.), and I can only open pages (routes) that were defined in my module. Anonymous user can navigate to public pages but normal users can't navigate to those pages after log in.
It looks like a problem with permissions, but I have rebuild it with success. Some suggestion?

EDITED:

As requested I added my route file. But thouse paths work good. The problem is with other paths. The most weird are public pages that get error when you are logged in, but not if you are anonymous user. Except for administrator.

licencias_pesca.copiarmodalidades:
  path: '/copiarmodalidades'
  defaults:
    _form: '\Drupal\licencias_pesca\Form\CopiarModalidadesForm'
    _title: 'Copiar modalidades por categorias'
  requirements:
    _role: 'gestion+administrator'

licencias_pesca.crearliquidacionprevia:
  path: '/crearliquidacionprevia'
  defaults:
    _form: '\Drupal\licencias_pesca\Form\CrearLiquidacionPreviaForm'
    _title: 'Formulario previo para crear una liquidacion'
  requirements:
    _role: 'club+gestion+administrator'


texts: Which library is better for image processing, GD2 or ImageMagick?

texts:
Is ImageMagick is supported by Drupal 7? If the answer is positive, which is better for image processing, between GD2 and ImageMagick?

Are any other alternatives for Drupal 7?


texts: Using field_create_field and field_create_instance to add a checkbox to a content type

texts:
I've written the following update hook to add a field to a content type. In an ideal world I'd like that field to be a single on/off checkbox. However, the code I've written outputs three radio buttons - with options for Yes and No, as you'd expect - but one for NA, too. I don't really want my users to have an NA option. Any idea how to achieve this? I'm guessing it's either the widget or display attributes, but I don't know where to find a list of what options are available to me.

Update:

Marcel's suggestion worked just fine - it doesn't provide a checkbox, but it removes the NA option, and that's good enough for me. Adapted code is below - I've also made some changes to the rest of it that ensure the title and summary text are displayed properly in the editor UI:

$field = array(
  'field_name' => 'field_maxy8',
  'type' => 'list_boolean',
  'settings' => array(
    'text_processing' => 0,
  ),
  'widget' => array('type' => 'options_onoff'),
  'settings' => array(
    'allowed_values' => array(
      '0' => 'No',
      '1' => 'Yes',
    ),
  )
);

$field = field_create_field($field);

$instance = array(
  'field_name' => 'field_maxy8',
  'required' => 'true',
  'label' => 'Maxy 8',
  'description' => st('Maxy 8'),
  'entity_type' => 'node',
  'bundle' => 'article',
  'display' => array(
    'teaser' => array(
      'label' => 'hidden',
      'type' => 'hidden',
    ),
    'default' => array(
      'label' => 'hidden',
      'type' => 'hidden',
    ),
  ),
);

field_create_instance($instance);

In order to use this you'll need to:

1) Put it in a <modulename>.install file

2) Put it in a hook_update_n function

3) Save it, and run UPDB through Drush


texts:
I'm using the contact form, smtp module and secureserver as the mail server. When I run tests via the smtp settings page. Everything works as it should. When I use the contact form, SOMETIMES I get an error other times I don't. After reviewing the drupal log as to what the issue might be. I get the 2 following error for the ones that don't mail out.
I get this smtp error;

Error sending e-mail from *@something.com to *@something.com : The following From address failed: *@something.com

SMTP server error: Sorry, your envelope sender is in my badmailfrom list.

and another error which simply states it couldn't send the email. After running some tests and reviewing the mail headers of the emails that did go through. It seems as thou it sends FROM the email address the user is inputting. This to me like the server would deny it because this essentially is a 'spoof'. On the site information email, we are using "info@ourdomain.com". On the smtp settings, we are using a "donotreply@ourdomain.com". I tried a test by changing the dnr email to the info and it still has the intermittent fails.

Update: I've narrowed down the problem to a Godaddy issue. We don't use the 'web' hosting server as our email server. We use their "Email" server which is the "secureserver" most people have problems with in the threads I've read. We ended up switching over to gmail and everything works as it.

@Citricguy: Naw, we aren't blacklisted. It's just that they have several configuration issues with those email servers. To the point that their own techs don't know what they are talking about half the time..


texts: Replace/alter/rename form labels in theme

texts:
I installed this Simplenews module, and it gives default field to enter your email to subscribe for newsletter and the fields title is just 'Email:' and I need to change it to something else.

It looks like it's hardcoded and I could just dig through modules files and edit, but I know this is not recommended.

I was hoping maybe I could just paste in some preprocess function to theme's template.php file and replace 'Email:' with e.g. 'Join Our Mailing List:'.

Path to label is form.simplenews-subscribe div div label.


texts: How do I return the output from a callback function unthemed?

texts:
I have a custom module with a hook_menu() "page callback" function, a custom theme function and a hook_theme() implementation. This module is working fine and the final output of the module is passed to the template of my site.

However, what I would like to do is to have the output of the module to be displayed on its very own - nothing else. That is:

what it does now:

hook_menu --> page callback function --> custom theme function --> hook_theme implementation --> .tpl.php template file

what I would like it to do:

hook_menu --> page callback function --> return a <div> to be displayed on its own

Can anyone help?


texts: How to create content type programmatically with fields and vertical tabs

texts:
I'm creating a module using Drupal7.26 and want to create content type with different type of fields like radio/checkboxes/drupdown and textfields.
I'm following the last comment by Jason Gray in THIS thread and is working pretty well except it is not creating Fieldset, Vertical Tab Group and Vertical Tab when the module is installed.

What I did is:
I have created a custom module to create new Content Type by following SITEPOINT tutorial.
And take the fields array by exporting of the node which I created manually using CCK with all fields that I want.
Now all the fields are showing in my newly created node by installing module, except (Fieldset, Vertical Tab Group and Vertical Tab) which I created by enabling Field group module.

NOTE:
When I export the content type using feature as (test) it gives me 3 files as bellow:
1 - test.features.field_base.inc (I take fields array from here)
2 - test.features.field_instance.inc (I take instances array from here)
3 - test.field_group.inc (it give me the bellow hook) which I'm not sure where/how to use it.I place it in both MYMODULE.install and MYMODULE.module files both didn't work.

    function test_field_group_info() {

    }

Any ideas would be appreciated.


texts: How do I bulk switch specific content from one content type to another?

texts: So I get a fair amount of spam on my site that gets a good amount of traffic. But the spam content doesn't fit what my main audience is looking for. So I created a content section called spam and downloaded the Node_Convert module, which has worked out well. I can easy change content from one type to another individually. But I want to bulk switch specific content from on type to another. I know I can bulk switch a content type using this module, but I don't want to switch a whole content type, just specific articles in one content type to the Spam content type all at once. It would make sense to to this from the admin content dashboard.


texts: jquery get or post methods for drupal block module

texts:
Is it possible to use jquery get or post methods to fetch data dynamic in a a drupal7.x block module. I am a newbie to drupal.

Here is my event_calendar.module file

      function event_calendar_help($path, $arg)
      {
          switch ($path)
          {
          case "admin/help#event_calendar":
          return '
'.  t("A block module that creates events and lists them in a event calendar") .'
';
      break;
          }
    }
     /**
    * Implements hook_block_info().
    */
    function event_calendar_block_info() {
      $blocks['event_calendar'] = array(
        'info' => t('Event calendar'),
        'cache' => DRUPAL_CACHE_PER_ROLE, //Default
      );
      return $blocks;
    }

    /**
    * Implements hook_block_view().
    *
    * Prepares the contents of the block.
    */
    function event_calendar_block_view($delta = '')
    {
      switch($delta)
      {
        case 'event_calendar':
          $block['subject'] = NULL;
          if(user_access('access content'))
           {
            $items = array();
            $basepath = drupal_get_path('module', 'event_calendar');
            $markup = '

                        Week :

                             -

Lane 1

Lane 2

Lane 3

Lane 4

';
      $block['content'] = array(
        '#markup'   => $markup,
        '#attached' => array
            (
            'css' => array($basepath . '/css/event_calendar.css',$basepath . '/css/smoothness/jquery-ui-1.8.16.custom.css'),
            'js'  => array($basepath . '/javascript/event_calendar.js',$basepath . '/javascript//jquery-ui-1.8.16.custom.min.js'),
            ),
        );

          }
return $block;
      }

    }

I want to know how to write functions inside above .module file to access some content dynamically through jquery get or post method?

Or should I use something like 'hook_menu' other than block?


texts: Views Slideshow, items per slide based on screen resolution

texts:
I have a Views Slideshow slider with 4 items per slide (see below). I am looking for a way to make it change the items per slide number dynamically when the screen width hits a certain breakpoint -for example 3 items per slide when tablet screen and 2 items per slide when mobile screen. Been trying for few days but without success.

Any ideas are welcome.


texts: Can't print any field using entity_metadata_wrapper

texts:
I'm cloned an existing D7 site onto a new computer that I've worked on many times before, but I have a problem I've never seen before - I can't print ANY field using entity_metadata_wrapper.
The fields exist in the backend and the backend works fine.
Printing $wrap->raw() shows all the fields as expected but $wrap->field->value() doesn't.

Our templates use this heavily, and as the site is live there is nothing wrong with the code, but my environment.
But what could it be? I've tried all types of PHP version (on MAMP) to avail.

Any help appreciated!

<?php $wrap = entity_metadata_wrapper('node', 123) ?>
<?php print $wrap->field_any_field->value(); ?>

  EntityMetadataWrapperException: Unknown data property field_any_field. in EntityStructureWrapper->getPropertyInfo() (line 354 of


texts: How to add only unrefered node of a content type in an entity reference field of another content type

texts:
There are 2(two) Node types

A
B

A has a node reference field to node type B.

If a node x of A type used a node y of B type as a node-reference then next time node z of A type will not use the node y of B type as a node-reference because x is already used as node-reference.


texts:
Currently I am using the following query to select the data from database

$result = db_query("select data from {config} where name like '%IPPOOL_POOL%' ");
while ($row = $result->fetchObject()) {
  $ips=$row->value;
}

But this generated an error like

  Undefined property: stdClass::$value

Please help me to implement same in Drupal 8.


texts: Having some conceptual trouble creating a View to list users that have nodes containing entity references

texts:
Users on my site can create content by adding a new node of content type 'project'.

Projects are assigned to exhibitions through a drop down 'exhibition' field which is an entity reference to another content type named 'exhibition'.

Exhibitions are created by admins and each exhibition has a location field (one of three distinct values).

I would like to create a view that displays all users that have created projects for two or more locations. So that could be (for example) 5 projects for 2 exhibitions in location X and 2 projects for 1 exhibition in location Y.

Having some conceptual trouble putting the view together, any help much appreciated.

Danny.


texts: Pathauto insert taxonomy term custom url

texts:
I have change the url of an taxonomy term. Now when i use a field with taxonomy term the url is showing like this:

[node:field-taxonomy:parents:join-path]/[node:field-taxonomy:name]/[node:title]

auto/safety-tools/audi

The taxonomy term has name Safety Tools but i have change the url to just tools.

like auto/tools/audi

How i can load to my node the custom term url path.

I tried [node:field-taxonomy:url],[node:field-taxonomy:url:absolute],[node:field-taxonomy:url:relative] without success


texts: How to get Taxonomy Menu working properly with Contextual Filters in Views?

texts:
I can't get taxonomy menu links working properly with contextual arguments in Views.

This is what I have done:

0) I create a menu called: Catalog menu

1) I create a Vocabulary called: Catalog terms and in the Taxonomy menu area I set Catalog menu for the Menu location (I have Taxonomy menu module enabled which allow me to do this)

2) I the Catalog vocabulary I added 2 terms: Cars and Phones

3) In admin/config/search/path/patterns I set Pattern for all Catálogo taxonomy paths to catalog/[term:name]

4) In admin/structure/block I enable the Catalog menu block to the First sidebar

So far so good. I have a menu in my first sidebar with the links: cars and phones.

5) I have a content type called Products with a field of the type Term reference called: field_catalog

6) Now I create a new view called: Catalog view where I need to show Products which has an specific term in the url. The path of this view is catalog

7) I added a RELATIONSHIP called: Content (field_catalog)

8) I added a CONTEXTUAL FILTERS called Taxonomy term: Name using the previous relationship

Now if I enter "cars" in the Auto preview Preview with contextual filters: area it works fine. It only shows products that has cars term.

So the Catalog Menus is fine and the view is fine.

But if I go to the url www.mysite.com/en/catalog/cars it takes me to the list of content that has the temr cars. Here I need to show the Catalog view passing cars as an argument and not that list.


texts: Filter a view result by matching a view field to a URL term

texts:
I have a content type called "Post" which contains two fields:

1) title
2) username

I created a View which creates a block that gathers all Posts. The block will reside on a user's account page, wherein the URL will always be:
www.mysite.com/user/username

How can I filter that block to only show the results where the username field matches the second term in the URL?

Thanks!


texts: How to get all the field and value of node as an array?

texts: I am trying to render all field and value of a node as an array dynamically. How can i achieve that?


texts: Accessing taxonomy custom field values (Drupal 7)?

texts:
I've added a new vocabulary to Taxonomy, and then proceeded to add several custom fields to that new vocabulary. In the taxonomy_term_data table, I see the values for the tid, vid, name, description, format, and weight fields. It also looks like there are now a couple of new tables in the database that are related to the new custom fields that I created for the new vocabulary (i.e. field_data_field_taxonomy_cip_code). The values in the new table are entity_type, bundle, deleted, entity_id, revision_id, language, delta, field_taxonomy_cip_code_value, and field_taxonomy_cip_code_format. There's nothing that I can see on the surface that would allow me to relate the two tables together.

How would I go about pulling the additional custom field values along with the new vocabulary values?


texts:
I have a site and I'd like to customize the login page. I'm using a customized version of the Stark Theme and I'd like to know if there is any way to change the actual file behind the login form so it looks a bit more uniform with the rest of the site. So without creating a new file and redirecting.

Any help?


texts: How to send data like NAME[]=value via POST request and simultaneously redirect user to 3rd party server?

texts:
I'm writing a custom module which needs to send data string like this: "CODES[]=xxx&NAMES[]=xxx" via POST to 3rdparty payment gateway AND redirect user there.

I've written a form to gather data from customer, but I can't use [] in form fields names, Drupal reports an error (an array instead of string) and quits.

I can post all data manually via drupal_http_request, but it doesn't redirects browser to needed URL. If I use drupal_goto after drupal_http_request, the data is lost and payment service doesn't recognize the user. If I include $request(my drupal_http_request)->result in a page, I get redirected to 404 page of my site with a non-existent URL (/order/checkout.php which has to be appended to payment server root and instead glues to my server root URL).

If I use $form['#redirect'] or $form['#action'] it posts fields names without "[]".

Question is, how can I append these square brackets after request is formed, but before it is sent?

Or how can I send data along with redirecting?

Will be very grateful for help, this problem is driving me nuts for a week now.

UPD My code:

    //a form
function mymodule_ask(&$form_state) {

 $form = array();

$form['#action'] = 'https://3rdpartysite.url/script.php';
$form['#method'] = 'post';

 $form['ORDER_PRICE[]'] = array(
   '#type' => 'textfield',
   '#title' => t('Amount'),
   '#size' => 10,
   '#required' => TRUE
 );

 $form['ORDER_PNAME[]'] = array (
   '#type' => 'radios',
   '#title' => t('Name'),
   '#options' => array('Avia' => 'Avia tickets', 'Other' => 'Other'),
   '#required' => TRUE
 );

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

return $form;
}

function mymodule_ask_submit {
    //in form submit function retrieving data from form values
    $requestar['ORDER_PNAME[]'] = $form_state['values']['ORDER_PNAME'];
    $requestar['ORDER_PRICE[]'] = $form_state['values']['ORDER_PRICE'] * 1.02;
    //forming an array to post
    $onestr = '';
    foreach ($requestar as $key => $value) {
    $onestr .= $key."=".$value."&";
    }
    $resstr = chop($onestr, '&');
    // and then I tried different ways

    //either creating and auto-submitting a form with needed values
    create_form($requestar); //separate function creating this form
    drupal_execute('payu_addform', $form_state);
    // but it doesn't pass drupal evaluation because of "ORDER_PRICE[]" element name

     //or via http_request
    $result = drupal_http_request('https://PAYMENT_SERVER_URL/script.php',  array('Content-Type' => 'application/x-www-form-urlencoded'), 'POST', $resstr);
    drupal_set_message($result->request);

    // but it takes me to MY_SERVER_URL/order/checkout.php?CART_ID=442bc42170616cd36dfd2246434d4210, while I need it to make to PAYMENT_SERVER_URL/order/checkout.php?bla-bla-bla
    //may be I can use $result->request in some other way? Just printing within this submit function gives nothing... But how can I pass it to make drupal take me out?

}


texts: Logout user programmatically without redirect

texts:
I need to logout the current user in my code.
For now I use : user_logout(); but this function seems to have a redirect at the end.

How can I logout a user without any redirect ?

It need to be for a single case, not a hook to every logout.

Thanks.


texts: Is there a way to set two separate views with exposed filters in a panel page?

texts:
I have been attempting to create a panel page with two columns, one to display view1 and the other view2. The intent is to have the user choose a content type in each column using exposed filters and have the list of content displayed by the view in the panel page.  This has turned out to be more complicated to execute than I first thought.

The problem is with the URL. I can have a URL to invoke the panel page, eg.relate/relate, and it will display the same list of all content in each column by default.  However, when I change the content type in one of the columns, the URL is changed in response and only the changed view is displayed (the panel is not longer activated.

So I am trying to find a way to manage two views from the same page panel that either does not change the URL request or that the panel can manage correctly.

I have tried passing both content type names in the URL eg. relate/%type1/%type2 and have each view read one of the URL positions using contextual filters.  This has approach has several problems

I am not sure how to tell the view contextual filters how to react to only the relevant wildcard in a two wildcard URL relate/%/%.
How do I set up a contextual filter to read the value in the path segment and interpret it as a filter for a content type?  The contextual filter can be set up to read the raw URL path segment (in the section re: what to do when the filter fails), but there does not appear to be a way to set up the validation to determine a content type.

Has anyone ever achieved this or can you suggest an approach that might work?

ADDITIONAL INFO

I found that I can prevent the URL from changing by setting a n option in the view content pane to use the Panel URL.  This keeps the display as two columns (from the panel), but does not unlink the two similar view content panes. They still both change when I set the exposed filter for either.  Apparently the exposed filter is only created once , but displayed twice and sends its setting to both panes.  I found this to be true even if I create two distinct View definitions.  If the settings for the filters are the same they appear to both run if either exposed filter is changed.


texts: How do I show the number of nodes using a taxonomy term?

texts:
Somebody asked Views and node count for taxonomy terms. I am trying to do the same, but with Drupal 8.

I follow the steps reported in that question, and I get a count of the taxonomy term (say "fruit"), but when I click on it there is a page that lists "fruit" multiple times, instead of listing the pages themselves.

If I do not do a count. then when I click on the taxonomy term I get the correct listing page (e.g. apple, orange, pear).

Can anyone help me with this?


texts: Will Drupal & Drupal Commerce run under php-cgi?

texts:
For some specific reasons (experimental setup - not Apache nor nginx) want run Drupal  under php-cgi (not fast-cgi). The site should serve an very-small e-commerce site - probably Drupal Commerce.

Based on my googling Drupal can run under php-cgi, but the found links are pretty old (2009 and such),  so looking for some answers for both of current main versions - for the v7 and for the upcoming v8.

The questions are:

Will Drupal (v7 and/or v8) run under php-cgi?
Will run Drupal Commerce under php-cgi?
are here some major limitations (other than speed!) caused using Drupal (and Drupal Commerce) with php-cgi?


texts: How to get plugin configuration through plugin manager?

texts: I have defined plugin manager and I have installed two plugins, I am getting plugins name and id by $plugins = $this->pluginManager->getDefinitions(); but I need to access its configurations and display whether this property is enabled or not with an edit button. How to do it?


texts: Should i use field.tpl.php or Display suite to add my own classes to fields?

texts: I want to get rid of the default classes and add my own to the fields. I was always using field.tpl.php but i've read some tutorials where people are doing this with Display Suite. So should i do this via field.tpl.php or Display suite?


texts: Autocomplete several fields with values based on the selected value of an user reference field

texts:
UPDATE: the code is now cleaner and shorter. An autocomplete field triggers the ajax callback which reloads a field. The whole thing works for one field but not so well for multiple fields.

function my_module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'form_id_form') {
$form['triggering_field_id'][LANGUAGE_NONE][0]['value'] += array(
    '#autocomplete_path' => 'my_auto_path',
    '#ajax' => array(
        'callback' => 'my_ajax_callback',
            'wrapper' => 'my_ajax_wrapper',
            'method' => 'replace',
            'effect' => 'fade',
        ),
    );

    $form['dependant_field1'] += array(
        '#prefix' => '
',
    );
    $form['dependant_field2'] += array(
        '#suffix' => '
',
    );
  }
}

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

    $items['my_auto_path'] = array(
        'title' => '',
        'page callback' => '_my_auto_path',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}

function _my_auto_path($string) {
  $string = array(':s' => $string . '%');

  if ($string) {
    $results = db_query("SELECT name FROM {users} WHERE name LIKE :s", $string);

    $items = array();
    foreach ($results as $result) {
        $items[$result->name] = $result->name;
    }
    print drupal_json_encode($items);
  }
}

function my_ajax_callback(&$form, &$form_state) {
    if (user_load_by_name($form_state['values']['triggering_field_id'][LANGUAGE_NONE][0]['value']) != FALSE) {
        $user_obj = user_load_by_name($form_state['values']['triggering_field_id'][LANGUAGE_NONE][0]['value']);
        $user_id = $user_obj->uid;
        //let's get another field from user's object:
        //$user_whatever_userfield = $user_obj->whatever;

        $form['dependant_field1'][LANGUAGE_NONE][0]['value']['#value'] = $user_id;
        //Do the same for the 2nd field but need to return both fields at the same time...
        //$form['dependant_field2'][LANGUAGE_NONE][0]['value']['#value'] = $user_whatever_userfield;
        return $form['dependant_field1'];

        //another way, with ajax commands:
        //but I can only replace the whole <input> instead of just the val() of each field.
        //$commands = array();
        //$commands[] = ajax_command_replace("#dependant_field1_id", $user_id);
        //$commands[] = ajax_command_replace("#dependant_field2_id", $user_whatever_userfield);
        //return array('#type' => 'ajax', '#commands' => $commands);
    }
}


texts: Embed some user profile fields in a block form

texts:
I've added some fields to user profile.
None of these fields are displayed on registration form, but I want user can edit them quickly when he is logged.
I want to embed some fields in a static content and display them to the user: how can I manage this? Can I create a php page or is it better using hook_form?


texts: Update node multi value field programatically

texts:
I am trying to update a node with a standard multi value text field programatically with the following:

$node = customfunctionreturnsnode();
$node->field_scores['und'][$dayof]['value'] = $total;
node_save($node);

More info: $dayof is a custom variable, that can be from 1 - 28. $total is numerical value that is determined elsewhere in the code.

Eventually the field will have 28 values, but they might not get entered in the 'correct' order. So I would like to be able to have my code above select which delta to add it to.  Also, the values could get updated, so this will allow me to update the correct value.

It seems to work, and the db shows the right delta. But when I add a new value the previous delta resets to 0.  The new delta has the correct value, but when I add another one the second value's delta goes to 1... and so on.

I checked, and the delta field is not an auto-increment table... but I'm not really sure where to look from here. I couldn't find anyone else that has this issue. Am I doing something wrong?

Thank you for you time.


texts: drush sql-sync: "The external command could not be executed due to an application error."

texts:
When I execute drush sql-sync @production @local -d to get a database from the server to local, I get the following error after login with ssh:

The external command could not be executed due to an application error.

Here is the debug after the ssh login:

Backend invoke: php
C:/Users/x/drupal-root/vendor/drush/drush/drush.php --backend=2 --verbose --debug --uri=mysite.localhost --root=/C/Users/x/drupal-root/web  sql-conf --all 2>&1
php C:/Users/x/drupal-root/vendor/drush/drush/drush.php --backend=2 --verbose --debug --uri=mysite.localhost --root=/C/Users/x/drupal-root/web  sql-conf --all 2>&1
The external command could not be executed due to an application error.
Error: no database record could be found for target @local
Returned from hook drush_sqlsync_sql_sync_validate
Command dispatch complete

Drupal version: 8.2.7

Drush version: 8.1.8

This is my local alias:

$aliases['local'] = array(
    'uri' => 'mysite.localhost',
    'root' => '/C/Users/x/drupal-root/web',
    'path-aliases' => array(
      '%drush' => '/C/Users/x/drupal-root/vendor/drush/drush',
      '%dump-dir' => '/C/Users/x/.drush',
      '%files' => '/C/Users/x/drupal-root/web/sites/default/files',
     ),
  );

Here is the output of drush @local status:

PHP configuration      :  C:\x\xampp\php\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:/Users/x/drupal-root/vendor/drush/drush/dr
                           ush.php
 Drush version          :  8.1.8
 Drush temp directory   :  C:\Users\x\AppData\Local\Temp
 Drush configuration    :  C:\Users\x\.drush\drushrc.php
 Drush alias files      :  C:/Users/x/.drush/example.aliases.drushrc.php

Does anyone have an idea? I'm at my wits' end.