texts:
I created a custom entity in my module and I can edit and save it just like any other entity in core. I also want to save revisions for this entity but I couldn't find any help so far. I tried this (from node module) but it doesn't work:

$entity = $this->getEntity();
$entity->new_revision = true;
$entity->save();

I have the revisions tables declared in @ContentEntityType annotation, I have the revision_id field declared in baseFieldDefinitions() but I don't know how to actually save a new revision.


texts:
locally my unit tests run just fine. On my online dev server, they fail and I don't get any error message despite "The test did not complete due to a fatal error." in the test messages and "An internal server error occurred. Please try again later." as return text of the batch process. No entry in the default error log, no error log file in the temporary simpletest public directory.

Is there any way to debug this and get the stack trace etc?

When I run the tests via Drush, they work just fine. This issue occurs only with the testing user interface and might be related to the PHP memory_limit as I run on a shared host.

The point where the test fails seems to be arbitrary: Sometimes it comes as far as 200 asserts before failing, sometimes the fatal error occurs after only 40 assertions. Also the test function from which the error is thrown differs, but they all belong to the same class.


texts:
I added an extra submit-function to my form:

$submit = array('_check_value_public_catalog');
$form['actions']['submit']['#submit'] = array_merge($submit, $form['actions']['submit']['#submit']);

So the form looks like:

array
  0 => string '_check_value_public_catalogue'
  1 => string 'node_form_submit'

But I would like to pass some arguments to my _check_value_public_catalog function. How do I do this?


texts: How do I specify in which database my schema should be created?

texts:
When using multiple databases in Drupal 7, how can I specify that a table is to be created in a different database on a different server?

By default, when you install a module, Drupal assumes that everything in hook_schema() should be installed in the default database. Is there a way to specify that a table should be created on a different database, or is there some kind of manual workaround I can use?


texts: How to Save a Node Object reached from another Server?

texts:
I'm implementing the Node Object passing one Site to another. I am now able to send the $node object across the sites. But the problem now again is i can NOT do node_save($node) simply.

I can NOT get the object as Drupal valid $node


texts:
Here is my code:

   $terms = array(

  \Drupal::service('entity_type.manager')
      ->getStorage("taxonomy_term")
      ->loadTree('faq', $parent = 0, $max_depth = 1, $load_entities = TRUE)

);

and when i'm using kint, i can see the first level of my vocabulary.

How can i render the field_question_tag in twig?


texts: If folders don't exist in URI path, file_save_data() fails

texts:
I am programmatically importing images and saving them via file_save_data();

$fileContentsPath = 'http://mypathtofile.com';
$uri = 'public://myfolder/mysecondfolder/filename.jpg';
$image = file_get_contents($fileContentsPath);
$file = file_save_data($image, $uri, FILE_EXISTS_REPLACE);

When I run this I get the following error: The specified file temporary://fileJ4LL4o could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

I am pretty sure my temporary directory is configured correctly and the files folder is assigned to the apache user.

If I go into the files directory and make the directories (myfolder/mysecondfolder) via command line and rerun it works correctly.

So the problem is that if the folders don't exist from the $uri path, it fails instead of creating the folders.


texts: How to alter a form element's properties before rendering?

texts:
Here's a simple task.

For accessibility reasons, from a custom module I need to perform alterations on textfield based form elements (such as email, textfield, etc ...) on custom forms displayed to front users.

These forms extends the Drupal\Core\Form\FormBase class.

The alterations I need to perform would be for exemple to automatically and programmatically copy the value of the field's placeholder text and put it in the field's title attribute (not the field's label, I'm talking about the HTML title attribute).

So the field's markup would look something like this :

<input type="email" placeholder="Email" title="Email" />

I want to check all custom forms for the entire website.

I tried different methods :

hook_field_widget_form_alter : doesn't fire for fields on custom
forms because they are not widgets.
hook_preprocess_form_element : It's too late to perform these changes. The values just won't take effect on the field.
hook_form_alter : Well it's just too general, I find it a bit dodgy to parse the entire Render Array, check for fields, etc ... but may be it is the only way..

I looked into the Form API, Render API, Plugins API, I looked into services, nothing seems to offer any solution, unless of course I missing something, and I probably do.

Has anyone any idea on how to achieve this in the best Drupal 8 way?


texts: How to apply Image Style with no effects and lazy load image?

texts:
We have two content types (Articles and Basic Page) that use the same Image (field_image) field. We are using the lazysizes js library where you need to add class="lazyload" and data-src="image-url.png" on the <img> tag.

For the Article Content type only we want to be able to lazyload the images, but we want to do in a way that does not impact the Image field on the Basic Page content type.

We initially thought that the best way to do this was to assign an Image Style with no effects and then use the mytheme_preprocess_image hook to do the following below.

Is this the correct way to modify the <img> element the way we need to? The goal is to be able to lazyload the original image without modifying it (no scalling, resizing, cropping, etc.).

function mytheme_preprocess_image(&$vars) {
  $lazy_loading = [
    'lazy_load_image_style' // Machine name of Image Style.
  ];

  if(in_array($vars['style_name'], $lazy_loading) {
    // Copy src into data-src.
    $vars['attributes']['data-src'] = $vars['attributes']['src'];
    unset($vars['attributes']['src'];

   // Add css class.
   $variables['attributes']['class'] = 'lazyload';
}


texts:
I added quick edit to my site. Made sure all the correct libraries are in place and see the quick edit button in the gear next to the content, but am not getting any way to save the changes.

The screenshot shows what I see when I click in the content area.

I have CKEditor in place. Have tried CDN and Libraries version without success.

Is there a certain type of field or class I need to add to fields?


texts: Does Aegir 3 allow multiple SSL sites on the same IP Address?

texts:
On our server some sites use SSL, some don't, some are Drupal sites, some are not.
All the sites are served at the same IP address and the non-Drupal sites each use their own certificates (or none) per their Apache configuration.

With Aegir 2 it was only possible to have: one IP Address for non-SSL sites and one IP address per each SSL Drupal site which would exhaust our purchased IP addresses.

Does Aegir 3 allow multiple SSL sites / certificates on the same IP address?


texts: I'm designing a huge media site. It would need to have about 20 views on the homepage and should attract about 100,000 visitors daily. The site is hosted on a dedicated server. Other than setting up Drupal caching and Boot module, should I be doing anything else to optimize performance? Should I be worried about using Views?


texts: Display multiple values of a field in separated rows

texts:
I'm using drupal 7, and in my node views, I have a field named field_phone to display phone numbers. It is possible for a company to have more than a phone number, so I add some more rows in form edit to add more phone numbers. Instead of displaying all numbers in multiple rows, Drupal automatically puts them all inline inside a <span> tag. There are so many people on google trying to the opposite thing: make them display inline.

So I think that, by default, it displays multiple values in separated lines. How can I get over this stuff?

P.S.: I know I can edit the template file, and make it display the way I want, but it's not cool at all, when I have to edit all the field template files, as all my multiple-values-fields are displaying that way.


texts: Additional filter for (image)fields to filter node display

texts:
I need to display nodes on multiple places. For some fields I have multi values. On every place I'd like to display other values of the field. I'd like to have maybe some checkboxes as filter.

For example:

An multi value image field. 3 places to display these image on the site. For every place a checkbox (area1, area2, area3). When checkbox 1 and 3 are checked, this image is displayed only in area1 and area3. When checkbox 2 and 3 are checked for an image, the image is displayed in area2 and area3.

Does anyone knows a solution for that?


texts: How to display nodes of specific terms and expose only those terms to the user (out of many other terms)

texts:
I have created a view, where I display two content types. Both of them have field "Country". So in my view I want to display only nodes related to three particular countries, but additionally I want to add filter, so that the user is able to see content only for one country out of the three.

The problem is that when I specify in "Filter criteria" show nodes only for these three countries it works, but when I make this filter "exposed" the view renders absolutely all nodes.

At the same time I want my exposed filter to have only the 3 countries available available.


texts: Show Comment Form on its own Page or Popup

texts:
I am trying to figgure out how to show the comment form on its own page. So far I have been able to show it on a seperate page. All I had to do was to go to field comment setting and uncheck "Show reply form on the same page as comments"

So this allow the comments to show on a new page. The only issue is that the new page still shows body above. Is there any way to hide the body on the comment form page?

Ideally I would like to load the comment form on a popup or modal. Can this be done with bootstrap modal or Colorbox inline?


texts: no acces to /admin urls after site migration to local wamp server

texts:
After migration of my site , any url starting with /admin generate a wamp server 'reinitialization error'.
The migration has been done with drush-dump/archive-restore and is working fine when imported in a VM

what could be the cause and how can i debug it ?


texts: Taxonomy filters don't display results - Drupal 7

texts:
I've updated the taxonomy module to the last version, so after doing this I've noticed that clicking on one category or on one tag of my blocks inside the blog area will produce a page without results.

I've already checked if it was a pathauto fault, and it seems work fine and the settings inside there are right. The field in my blog content type concerning tags and categories are already there, and they are linked to the taxonomy vocabularies.

So at the moment I'm alone in the dark, does anyone knows how to help me in order to sort out this problem?

Many thanks.


texts: Controlling the height of a jQuery accordion in content page

texts:
I have managed to add a jQuery accordion content page to my Drupal7 site by following the instructions/code given here: http://www.chrisherberte.com/blog/drupal-7-and-jquery-ui-accordion.

However, the height on the drop down fields is not being calculated correctly. Some are too long with lots of white space, others are too short meaning a scroll bar is added to view all the text. It appears to be taking all the heights of each field and using that to calculate an average height which it then applies.

I have tried the default Bartik theme, as well as my custom theme, functionality is the same on both so not a css issue, but a problem with the jquery itself.

On top of this, using HTML list elements stops it working all together, and messes up the formatting completely.

I do not have any idea where or how to edit the Jquery to fix this problem and certainly don't really want to be hacking core.


texts: Devel query log not showing module enabling queries?

texts: I enabled "display query log" in Devel. However, I've noticed not all queries are logged, for instance when enabling/disabling a module there is no "update system set status = 1.." query shown. Why is that? Thanks.


texts: How do I find the mapping between profile fields and merge fields

texts:
I am using the Mailchimp module, version 7.x-3.6.

The client has asked for an extra merge field for Gender. At the moment, we just have First Name, Last Name, Username, and UID.

When I visit /admin/config/services/mailchimp/fields,
I see a field_profile_mailchimp field on my profile2 main bundle. This is just a checkbox field with a value indicating the user must be included on the mailchimp list or not.

Where is the mapping between the fields on the profile2 main bundle (field_profile_name is First Name, field_profile_last_name is Last Name) and the merge fields in Mailchimp?


texts:
I have no problems with using Ajax in every form element other then button. When I'm clicking this button

  '#type' => 'submit',
  '#ajax' => [
    'callback' => '::ajax_function',
    'wrapper' => 'my-button-wrapper',
  ],

it reloads the page ... well it does what would normal submit button do - calls submitForm(). And I don't need that. I need this button only to call ajax_function()


texts: Has anyone used ExtJS with Drupal? Is there any module for Drupal that supports Ext JS?  If so, what are steps to get it work? I'm wondering if there is any feasibility of creating an Ext based drupal theme.


texts: adding data attribute to option value in Drupal 6

texts:
I have a form, like this:

        $form['my_case_type_list']=array(
            '#type'=>'select',
            '#title' => 'Issue Type',
            '#options' => $my_list,
            '#multiple' => false,
            '#attributes'=>array('size'=>1),
            '#weight'=>2,
        );

where $my_list is an array, like this:

$array[0] = 'string 1'
$array[1] = 'string 2'
$array[2] = 'string 3'

This renders a dropdown list with the array key as the option value and the array value as the option text.  I want to use a multi-dimensional array to also provide each option with a data id.  An array like this:

$return_array[0] = array('name' =>'string 1', 'description'=>'description for string 1');
$return_array[1] = array('name' =>'string 2', 'description'=>'description for string 2');
$return_array[2] = array('name' =>'string 3', 'description'=>'description for string 3');

and have the description field be used, in the option value, as a data attribute.  So, it would be rendered like this:

<select name="my_case_type_list" size="1" class="form-select" id="edit-my-case-type-list">
    <option data-desc='description for string 1' value="0">String 1</option>
    <option data-desc='description for string 2'  value="1">String 2</option>
    <option data-desc='description for string 3'  value="2">String 3</option>
</select>

Is this even possible?  Can you assign a multi-dim array to a form?  When I do, it just create option groups and each dimension of the array becomes an option.

thanks
jason


texts:
I want to add CSS classes to flagged nodes in order to theme them.

Found the documentation How to add CSS classes to nodes, based on flags set, but this solution is for D6.

Can someone help me to figure out how to make it work with D7?


texts: Custom external read-only databases with Drupal, how to use views to communicate with the external database?

texts:
I have a pretty detailed relational database that I would like Drupal to communicate with (Read Only). Now, I know that I can create custom modules to output the data but I am not sure I will be leveraging Drupal's benefits using in that fashion (it seems like a hack). I do not plan on moving the data to Drupal either (too large in size and also more than 80 tables).

Is there a way that I could use views to get the data out from my external database without interfering with the Drupal core? I am sure that Drupal developers run into this issue many times, I would like to have a pointer as far as where to look. Is that possible? has anyone ever done this?

I have already used Google in an attempt to find a solution. I even tried the entity module, entity api, data module a few other API and modules without success.

Just need a workflow/pointer or simply a successful website that is using Drupal in that fashion.

I am using Drupal 7 and I will be willing to go to Drupal 8.


texts: How to approximate user location on IP&Geoloc maps

texts:
I'm using the combinaison of this modules :

Address field
Geofield
Ip&Geoloc
Leaflet

I need to approximate the location of user's markers on the map for privacy reason.

For exemple if somebody live at 123 addressstreet 10000 Washington I want the marker on leaflet map to point a random location in the area of this address and not the real geocoded location.

What's the best way to do that ?


texts: How do you turn off clean URLs in the database?

texts: How do I turn off clean URLs in Drupal 8 from the database? What table do I look in and what variable do I have to change?


texts:
First, I have tried for several hours to weed through the various search results of the keywords above. I've found several things that seem to answer this but they're for Drupal 7; one of those was posted on 2012 and I am pretty sure things are gosh darn different now.
I am not a programmer, nor a web dev professional; I am just someone trying to update a very old site that worked fine but that needs to be re-freshen. I have some experience as a content manager with Drupal 6, but I have never got into coding, building modules, or editing template files. I am not afraid to copy a file, open it in an editor, change this or that, cut or paste, but I don't see myself being able to build a module to do this.
Maybe there's no way to do this "easily."
I want to replicate a Google map with a custom search feature and some other tweaks. It works nicely in the existing site and it is basically 3 parts: a <script>code here</script> in <head>, some HTML and script in the body,  and the following markup for <body>.
<body onload="load(); curvycurvy()" onunload="GUnload()">

All I am hoping to do is properly add this code on my new Drupal 8 front page.  I've used the Asset Injector module to add the bulk of the script to <head> and used <front> to restrict it to the front page. I have chosen PHP for the content and it seems to retain the script.
Is there a way to add this code above into the body? Failing that, is there a way to provide similar functionality?
I was hoping that the Asset Injector has some tools like, "Add to the Body Tag" or such, that would have been exactly what I need.


texts: Drupal Sending Emails with Empty Body since change of Server

texts: Since we changed servers last week from Hostgator to UKFast, Drupal sends out automated php emails with a blank body. The only way we can get Drupal to send emails with the required body is by being logged in as an administrator and manually sending the emails. Does anyone know what could be the problem? This has only happened since we changed server.


texts: Ouput yes/no in commerce product table if product image available/not available

texts:
I am using Drupal 7 together with Drupal Commerce (not Kickstart). I am using a Bootstrap theme.

I have list of products displayed in a table that I created with Views. If you click on the Title, it goes to the product content page (display). Obviously, a product has an image if one is available. What I would want to do is to have a column in the table (Image), that would print out Yes or No, depending on if the image is uploaded (available) for the product.

Is this something that can be done in Drupal?


texts: Get the before and after values of a node field

texts:
I need to compare the before save/update value with the after save/update value of a node field.

Example: There is an already existing node with the title of "Hello". I then edit the node and change the title to "World".

I need to get the before value of "Hello".

function mymodule_node_presave($node){

    $before = $node->title;
    drupal_set_message($before, 'error');

}

function mymodule_node_update($node){

    $after = $node->title;
    drupal_set_message($after, 'warning');

}

But I always keep getting the same value...

Did I just discover a drupal bug? or what? Because I've used this method in the past with user hooks and it works as expected:

function mymodule_user_presave(&$edit, $account, $category) {

     $before = $account->field_custom['und'][0]['value'];
     drupal_set_message($before, 'error');

}

function mymodule_user_update(&$edit, $account, $category) {

     $after = $account->field_custom['und'][0]['value'];
     drupal_set_message($after, 'warning');

}


texts: Restrict editor user to only edit contents in one specific language

texts:
I'm trying to create a role for editors where one editor only has access to edit English contents and the other only has access to contents in another language.

I've been researching for quite a while, checked out Content Access too, but I haven't found any solution.

How can I make this happen?

Thank you!


texts:
Drupal 6. I try to add jquerry effect after pressing button

$(function(){
    $('.node-add-to-cart').click(function() {
      $(".prod-pic").effect("transfer", { to: $("#block-uc_cart-0") }, 1000);
    });
});

But I get error object# has no method 'effect'.
I created a custom js file with this code and put a link to the template.php using drupal_add_js.
According to status report Jquerry UI 1.6 is installed. However, when inspecting html code, among scripts there is no jquery.ui loaded. Should I call it from my custom js file?


texts: How to modify menu-block template with preprocessor in theming level

texts:
I am trying to modify menu block that locates in primary region with preprocessor in theme level but I don't think I will be able to accomplish without a lead or advice.

So this image is what I need to get, so "News","White Papers" and "Partners" are sub pages and sub menu items of /resource page. On "News" I just want to feed that news category(which taxonomy terms) and dates. (I am not worried about style of the block right now)

This is what I got so far:

I did this many times in Drupal 7 but I am pretty new to 8.


texts: image disappears which uploaded with managed_file type

texts:
I have implemented a configuration page which is at admin panel. It is something like this:

  $form["footer"]['xyz_cust_image'] = array(
    '#type' => 'managed_file',
    '#title' => t('Image title'),
    '#default_value' => variable_get('xyz_cust_image'),
    "#description" => t("Image description"),
    '#required' => TRUE,
    '#upload_location' => 'public://',
    '#upload_validators' => array(
      'file_validate_extensions' => array('gif png jpg jpeg')
    )
  );

but have a different situation. the thing is I successfully upload image and it is appearing when i upload it at the browser for that day. When the day passed, the image disappears. When I looked to variable table, the record exists; but the image not appears.


texts:
I am trying to use Feeds to import/update content types, but it appears that it's not recognizing my mapping as I keep getting the error Integrity constraint violation: 1048 Column 'title' cannot be null.
I have a test CSV header like this
O*NET-SOC Code,Delete,Title - Arabic,Title - English,Priority of Tasks,Task ID,Task - English,Task - Arabic,Task Type,Incumbents Responding,Date,Domain Source

We are using the Task ID (column 6) as our Title, so in the mapping I did the following:

The target Title is suppose to be mapped to the CSV header Task ID, but I get the title cannot be null error with this row whose Task ID is 1014:
11-3131.00,Delete,<arabic text>,Training and Development Managers,3,1014,"Plan, develop, and provide training and staff development programs, using knowledge of the effectiveness of methods such as classroom training, demonstrations, on-the-job training, meetings, conferences, and workshops.",<arabic text>.,Core,27,07/2017,Occupational Expert

However, this csv row, whose Task ID is 1009 uploads without that error. :
11-3131.00,Delete,<arabic text>,Training and Development Managers,2,1009,"Evaluate instructor performance and the effectiveness of training programs, providing recommendations for improvement.",<arabic text>,Core,27,07/2017,Occupational Expert

What could cause the row with Task ID 1014 fail but the row with Task ID 1009 work without error?
NOTE: The question editor told me Arabic text isn't allowed, so I changed the Arabic text with  in the CSV rows


texts: How to change fields to not be required before they are validated

texts:
In Drupal 7, How can I change certain fields to not be required using the form api, depending on which button they click to submit?
It seems the validation is occuring before the validate function.  Where can I change this before it gets there?


texts: FileField/ImageField error: "An unrecoverable error occurred. Form missing from server cache"

texts:
After creating about 20 nodes and uploading an image in each of them (using FileField/ImageField), I get this error when trying to create another node with an image: "An unrecoverable error occurred. Form missing from server cache". When this error shows up the image field disappears.

I've already tried:

Replacing if (isset($user->cache) && $user->cache > $cache->created)
{ with if (isset($user->cache) && $user->cache > $cache->expire) {
in includes/cache.inc;
Setting minimum cache lifetime to none;
Adding max_allowed_packet = 16M to the my.cnf file;
Repairing "cache_form" table;

I'm not using neither memcache nor cacherouter. Thoughts?


texts: People created by non-administrator role are not allowed to edit their content

texts:
I created a role called site manager. This role is allowed to create new users. The problem is that users created by this user are not allowed to edit their contents. The Access denied is reported. But people created by the Administrator or people who signup for the site, can edit their content.

This is the permissions of site manager (for Users and content type Image):

and this one

Do any of you know why this happens?

UPDATE

After installing devel node access module I see this for a node which its author is z jafari

This user is allowed to delete its content but unable to edit it.

I also tried content access module, gave appropriate permission but it didn't work again.


texts:
i am trying to get authenticated data after login with services module. ive a drupal services set up at openshift and the htmls are in my devices.

i managed to login, get authenticated, get the session name, id, token etc. but when i tried to fetch data for authenticated users, im getting the "403: Access denied for user anonymous" error. same on both firefox and chrome.

ive used postman in chrome and poster in firefox. im getting all the desired results. if i logged in drupal and open the url directly, im getting the right results too. that proves my services and everything are correctly configured.

i also tried examples with curl and php from my localhost, and they worked fine without any problem.

ive searched for solutions here and drupal forum. i did saw a few almost similar problems to mine in here, but they were not answered (like this one Post AJAX JSON with session id). after 5 days of failure, i think i should create a new post.

below are the codes. i hoped someone could get me to the right direction. thanks in advance.

$.post( "https://drupal-halmsx.rhcloud.com/services/auth/user/login.json",
    { "username": username, "password": password })
  .done(function(data) {
        console.log(data);

        var sessid = data.sessid;
        var session_name = data.session_name;
        var user = data.user;
        var token = data.token;

        $.cookie(session_name, sessid, {path: '/'}); // set session name and id
        //$.cookie("token", token);

        console.log($.cookie());
        console.log(user.uid);

        $.ajax({
            type: "GET",
            url: "https://drupal-halmsx.rhcloud.com/services/auth/user/10.json", // hardcode this for example.
            beforeSend: function(xhr) {
                xhr.setRequestHeader('X-CSRF-Token', token)
            },
            dataType: "json"
        });
    })
    .fail(function (data) {
        console.log(data);
    });


texts: Proper way to remove an item with custom widget?

texts:
So I've extended the core file widget, and when I go to edit a node with multiple files attached to a field, when I click Remove, it seems to go through all of the form build steps again.  I don't know when or where I'm supposed to be removing this file item.

I am using:

$elname = $form_state->getUserInput()['_triggering_element_name'];
 $elval  = $form_state->getUserInput()['_triggering_element_value'];

To figure out which element of which field I'm supposed to be removing, but no matter where I try to do this, it seems like html is being left behind after the ajax call has finished and the form build has finished.  After this, if I click the Remove button on another one of the files, I can see that even though the item for the previous file is now empty, it is still processing it as an item, though an empty one.  How am I supposed to get rid of the old item, and make the form remove all traces of it?

I've tried:

Waiting for the value callback to process the element that I don't want, and returning array(), or null

Using massageFormValues to remove the element that I don't want, and returning an array without it.

Writing an override for formMultipleElements and returning an array without the element I'm removing, and making sure the delta is one less than it would otherwise have been.

EDIT: I've read in some places that it seems like I'm supposed to unset the field from the form_state values and call a formRebuild with the form_state object, but what function would I be expected to do this in?  I have formElement, formMultipleElements, the value and process callbacks, massageFormValues, and no matter where I think of putting it, it seems wrong.  All of these functions are called multiple times during the build process of the form, so calling a rebuild before the form_state object is actually complete seems wrong.  I'll post if I figure anything out.


texts: Programmatically add the argument to a paragraph view

texts:
We're using paragraphs on a Drupal 8.8.5 with paragraphs 8.x-1.11.

To help relieve some data entry, I've created a module that auto-populate a custom content type, Student Page. This content type has a paragraphs field, and for this auto-generated content, we want to attach a custom paragraph type, Student Gallery, which has a views entity reference. The contextual argument to filter the view display is the student's email address, so I want to populate that field automatically in my module.

I can get the node to generate correctly with all of the fields, except I'm not sure how to populate the argument field of the view.

  $paragraph = Paragraph::create([
    'type' => 'gallery_student',
    'field_gallery_title' => $student . '\'s work',
  ]);
  $paragraph->save();

  $node = Node::create([
    'type'             => 'student_page',
    'field_paragraphs' => $paragraph,
  ]);

  $node->save();

The field on the paragraph is called field_gallery2_view_ref and its type is "Views Reference". The "View display plugins to allow" is only set to allow "Embed".

How do I programmatically set this argument?


texts: How to Add Multiple Values to Prefix for Currency field as a Drop Down

texts:
I have a custom Decimal field, Salary, for one of my custom content type. How do I add multiple prefixes that I can display as a drop down in the node add/edit form for users to select their respective currencies while updating the salary field?

I have tried the currency module, however, I didn't find any option in it to add a decimal/ integer value in it.

Also tried Field Collection Module, it does give the option for combining multiple fields, but, the result looks a bit crude. The Fields come one above the other rather than alongside each other.

Is there any option for me to add Multiple prefixes in the Field and display the same as Drop Down List in the Node Add/Edit form?

Please advice.

Thanks


texts: Setting the form value to an organic group gid from validation hook of custom field widget (Drupal 7)

texts:
I have a custom widget which can be used for a group audience field.  Instead of being a dropdown like the OG_AUDIENCE_WIDGET it is made up of three multiple select list, and the group which is actually selected is the one which is picked in the third select list.  I have the actual widget working but I am stuck on validation.  I have been trying to set the gid in a couple of different ways which have failed in a couple different manors.  First:

function multiselect_validate($element, &$form_state)
{
  if($form_state['submitted'])
  {
    $index = array_shift(array_values($element['wrapper']['dropdown_assignment']['#value']));
    $assignment_name = $element['wrapper']['dropdown_assignment']['#options'][$index];
    $query = new EntityFieldQuery();
    $result = $query
    ->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'assignment_group')
    ->propertyCondition('title',$assignment_name)
    ->execute();
    $node  = reset($result['node']);
    $assignment_gid = og_get_group("node", $node->nid)->gid;
    $value = $value[LANGUAGE_NONE][0]['gid'] = $assignment_gid;
    form_set_value($element,array('gid'=>198), $form_state);
  }
}

This kind of validation returns an error:

[11-Dec-2012 11:23:07] PHP Fatal error:  Cannot unset string offsets in /Applications/MAMP/htdocs/arcade/modules/field/field.default.inc on line 41

I also tried something like this for the final form_set_value:

form_set_value($element,array('gid'=>$assignment_gid), $form_state);

But when I do this and then look at the result nothing actually gets set into the field.

What is the proper way to set the gid for the field?


texts:
I'm newbie on Drupal and I try to set an validation and submit the custom user registry form but I try and validation not call.

function mymodule_theme(&$existing, $type, $theme, $path){

  $hooks = array();
   // Make user-register.tpl.php available
  $hooks['user_register_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'mymodule') . '/templates',
    'template' => 'user-register',
    'preprocess functions' => array('mymodule_preprocess_user_register_form'),
  );
  return $hooks;

}

function mymodule_preprocess_user_register_form(&$vars) {

  $vars['title'] = 'Registro de candidatas';
  $vars['message_welcome'] = '
Ingresar tu correo electrónico para iniciar este proceso. Asegúrate de tener abierto dicho correo para recibir las notificaciones y realizar de manera inmediata las indicaciones que recibas.
';

  //Shortens the form variable name for easier access
  $form = $vars['form'];

  $form['account']['mail']['#attributes'] = array(
    'placeholder' => 'Escribe tu correo electrónico',
    'class' => array(
      'mymodule-form-email-input'
    )
  );
  $form['account']['mail']['#title_display'] = 'invisible';
  $form['account']['mail']['#description'] = '';

  $form['account']['pass']['pass1']['#title_display'] = 'invisible';
  $form['account']['pass']['pass1']['#attributes'] = array(
    'placeholder' => 'Escribe una contraseña',
    'class' => array(
      'mymodule-form-email-input'
    )
  );

  $form['account']['pass']['pass2']['#title_display'] = 'invisible';
  $form['account']['pass']['pass2']['#attributes'] = array(
    'placeholder' => 'Vuelve a escribir contraseña',
    'class' => array(
      'mymodule-form-email-input'
    )
  );

  $vars['mail'] = render($form['account']['mail']);
  $vars['pass'] = render($form['account']['pass']);
  $vars['captcha'] = render($form['captcha']);

}

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

  $form['account']['mail']['#field_prefix'] = '';
  $form['#validate'][] = 'mymodule_user_register_form_validate';

}

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

  drupal_set_message(t('AN ERROR OCURED'));

  if ($form_state['values']['mail'] !== '') {
    form_set_error('mail', t('Escribe un correo electrónico'));
  } else {
    if(valid_email_address($form_state['values']['mail'])) {
      form_set_error('mail', t('Email invalido'));
    }
  }

  if ($form_state['values']['pass']['pass1'] !== '') {
    form_set_error('mail', t('Escribe una contraseña'));
  }

  if ($form_state['values']['pass']['pass2'] !== '') {
    form_set_error('mail', t('Confirma tu contraseña'));
  }

  if ($form_state['values']['pass']['pass1'] !== $form_state['values']['pass']['pass2']) {
    form_set_error('mail', t('La contraseñas no coinciden'));
  }

  if (!$form_state['values']['sendgift']) {
    form_set_error(NULL, '', TRUE);
    drupal_get_messages();
  }

}

Something I have wrong? I look on documentation and I found few details on registration. I read about hook_form_alter() and hook_preprocess_form() but it's confusing to me.

Thanks


texts: How to automatically uninstall a module before running a Nightwatch test?

texts:
I'm able to run Nightwatch without any problem but I would like to uninstall the Recaptcha module before running my test since the Recaptcha is preventing me from autosubmitting without passing the test.

I'm importing my DB in the phpunit.xml file in the core directory.

May be there are some hooks I could use?


texts: Rule to check if a date value is a specific day of the week

texts:
I want to set a rule which checks a date of format "2014-09-24 08:43:39" is a Monday using the data comparison rule. I have tried to manipulate the data selector for the date using the ":custom:N" format however data comparison wont accept it.
I'm trying to do it from within the rules module as my PHP is a bit limited.
Any ideas?
Thanks
Adrian


texts: MODULE_preprocess_block() get rendered region in drupal 8

texts:
So I am trying to port a Drupal 7 module to Drupal 8, and am struggling with how to translate a "NAME_preprocess_block" method. In the D7 code, it filters by the region a block is getting rendered

if ($vars['elements']['#block']->region == "my_region") {
   // Do stuff.
}

However, the "['#block']->region" object doesn't exist in drupal 8, and I can't seem to find an alternative. Is it still possible to do this?

Thanks!


texts: Media with WYSIWYG not converting media tags to markup

texts:
I just installed the Media module v 7.x-2.0-alpha3 along with WYSIWYG, CKEditor, and Image Resize Filter. (The site has many other modules active.)  The site also uses Display Suite, and its view modes are used for different types of images. My use case is for images embedded in the Filtered HTML text format, not as separate entities in a content type.

When an image is first embedded, its source code is like this:

[[{"fid":"161","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"f asdfasdf"},"type":"media","attributes":{"alt":"alt text","class":"media-element file-default"}}]]

From my reading, I found that checking "Convert Media tags to markup" at mysite/admin/config/content/formats/filtered_html is required. I have verified that is active.

Instructions at https://www.drupal.org/node/1599070 include "Image resize filter" is AFTER "Convert Media tags to markup" and my filters are in that order.

If I double-click an embedded image in the CKEditor and make it a captioned image, then the Media tags are converted to markup. If a caption isn't added, the Media tags do not get converted.

Based on my configuration, can anyone suggest why the conversion is not occurring?


texts: Drupal generating broken URLs containing "http" twice

texts:
My drupal site website started recently generating broken links/URLs within markup. It might have happened after I updated to version 7.41 or due to recent module update. I'm not sure.

Example:

<link rel="canonical" href="http://www.mydomain.nethttp:/" />
<link type="text/css" rel="stylesheet" href="http://www.mydomain.nethttp:/sites/default/files/css/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.css" media="all" />

Any idea what is going on? My drupal is hosted at the top of domain and not in a subdirectory. I was fine for years and didn't have to set $base_url in settings.php or anything.

My site uses clean urls and I double checked that rewrite apache module is on and working correctly.

I did try setting the $base_url in settings.php, this made the front page load correctly, however when I visit any node the apache returns 404, e.g. in access.log I see:
"GET /content/some-nice-article-i-had HTTP/1.1" 404

I'm using Apache/2.4.17 and PHP 5.6.14 on Archinux.

Any ideas?


texts:
I have this structure:

: '.$data->node_data_field_story_text_html_field_kampanya_adi_value.'

Ajans

: '.$data->node_data_field_story_text_html_field_ajans_value.'

Reklamveren

: '.$data->node_data_field_story_text_html_field_reklamveren_value.'

Ödül

: '.$data->node_data_field_story_text_html_field_odul_value.'

It's working.
And 4 other field:

field_one
field_two
field_three
field_four

When I change this field to other, not working. Like this:

: '.$data->node_data_field_story_text_html_field_one_value.'

And not working on my page.

How can I fix it?


texts: Drupal URL encoding breaks redirects/links

texts:
I added a link to my Toolbar Shortcuts list and the path is:

admin/content?title=&type=slides&author=&status=All&vid=All

But when you click it, Drupal redirects to:

admin/content%3Ftitle%3D%26type%3Dslides%26author%3D%26status%3DAll%26vid%3DAll

Which breaks the link and redirects to a wrong page.

How do I prevent Drupal from converting symbols and leave it as it is.


texts: Commerce: query products and product variations

texts:
I have a view with a custom template and I need to query my products using some conditions. I'm running a videogame store, so I have a Content Type and Production Variation called "Games", and those games have a plataform assigned (Content Type field). So now I'm creating a custom PS3 categorie view and I need to query only PS3 games.

This is what I have currently:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'commerce_product')
    ->propertyCondition('status', 1)
    ->propertyCondition('type', 'games')
    ->fieldOrderBy('commerce_price', 'amount', 'ASC');
$result = $query->execute();

That query returns a list of "games", but I need to filter them by plataform.

PS: I don't know if any one can share information about querying products in Commerce. I have to say that Commerce API is very poorly explained.


texts: How to let users mark ( like) other users?

texts:
In my project I'd like to let users to mark (kinda like) other users.

What solution should I use? Appreciate any feedback.


texts: Add file path to entity programmatically

texts:
I am creating an entity programatically, I want to set a file in entity, I have tried following method.

$file_path = '/sites/default/files/abc123.pdf';
$values = array(
      'type' => 'review',
      'uid' => $user->uid,
      'status' => 1,
      'comment' => 0,
      'promote' => 0,
    );
  $tenant_review_entity = entity_create('node', $values);
  $tenant_review = entity_metadata_wrapper('node', $tenant_review_entity);
  $tenant_review->title->set($_POST['field_tenant_review_ref']['und']['form']['title']);

  // adding file here
  $tenant_review->field_tenancy_document->file->set($file_path);

  $tenant_review->save();

If I am adding file path then getting following error

EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 737 of /var/www/html/rentspeak/sites/all/modules/entity/includes/entity.wrapper.inc).

If The file attaching code commented then entity is saving properly.
Please suggest me where is the mistake. Thanks.


texts: How to display (automatically in a field) all media that references this node?

texts:
I have a content type, "Fruit". Using that content type I have created a "Bananas" node. It contains text and link fields that constitute "banana information".

I have media type, "Fruit Image", with a field, "FruitShown". Using that media type I have numerous images of bananas and other fruit.

On my Fruit pages, how can I display automatically in a field all images of bananas (i.e. All images of media type "Fruit Image" that have "bananas" in the "FruitShown" field)?

CONTEXT:
I believe I am able to display the banana images in a block using a View with a contextual filter. However I prefer to display the images in a field so that I can wrap the images around a "banana information" CSS float, not just place them in a separate rectangular block (which leaves empty space in my theme).

WHAT I TRIED:
I am able to display the banana images in a field by using an entity reference field with an entity reference view reference method, but when adding the "Bananas" node, the images must be selected manually one-by-one. I prefer all of them to display automatically.


texts:
I think I need to use hook_cron() to cause my new module to be run each time cron runs, but in what file and directory do I place this code? Is it in my new module or some other place.

Logically, it would seem that it should go some place other than my module, but I don't know where even though I've looked at documentation from various web sources. It seems like the "chicken & the egg" problem. If I put hook_cron() in my module how does Drupal know to tell cron to run my module? Maybe it's magic?

I'm using Drupal 8.


texts: Remembering last checked parent category in Term Reference Tree

texts:
I have a lot of categories using Term Reference Tree that start minimized. I want it to remember the last category, subcategory, and term checked. Is this possible?

I think it needs JS code and a custom database table for every user's last addition that contains the last three checked terms. Please if you know how to solve this help me.


texts: List of nodes that have no taxonomy terms

texts:
I'm maintaining a D6 project, where the customer wants to see a list of nodes where no taxonomy terms were added.

I want to solve this with views. I already tried some Filter settings for that, but nothing worked so far.

I would know the solution in D7 with Views 3 but in this case I can't get rid of this problem.


texts: Displaying nodes and forms in a block for processing

texts:
I am trying to build a module that enables users to use Drupal as a front end for a BMP engine. Users will be able to use Drupal content in their Processes. For example filling out forms or approving nodes for publication. Filling out a form or approving something will be the completion of a step.

My idea is to display the Drupal content (node, form) in a block and display the step description above it and a button underneath it stating: "Complete Step".

The BMP engine tells Drupal what to display in the block through a node_id or a form_id. Adding a button to a form seems quite easy (even though a way that will always removing/replace the button that calles hook_form_submit is welcome). The Problem is displaying this same button under a node.

After trying a lot of things I am down to this (and it does not work yet but it should not be that big a problem...)

//get the node object
$node_object = node_load ($step['DrupalID']);

//get our node submision form
$form = drupal_get_form('pm_form_form');

$output = drupal_render($form);
$output .= drupal_render(node_view ($node_object, true));

Yet it feels like a hack... can anyone suggest a better idea?


texts: What is the difference between t() and l()?

texts: If I understand correctly, t() is the Drupal translations function, is l() simply calling the localization settings for translation specifics, or is there something more to it then that?


texts: Duplicated node pages are created with other language prefixes. How to fix it?

texts:
The content on our website is primarily created in English, however, we also have 3 other languages (fr, de, es) implemented. But not all the content is translated.

The problem is - in Google, we see a lot of duplicated pages with de/fr/es language prefix being as Node/id BUT the content is in English and the translation of the page doesn't exist. Basically de/es don't exist but they are somehow indexed by Google.

For example:
Original page path alias - en/blog/text (node id 134)
Duplicated page with English content path alias - de/node/134 - es/node/134

de/es duplicated nodes have also self-canonical and no correct hreflang because as mentioned above these pages don't exist as translations. This is harmful for SEO as Google sees these pages as duplicates.

Is there a way to avoid the creation of such pages? How it can be fixed?

Thank you!


texts: How to split up a View up amongst different Panels panes? Context display?

texts:
I know there's a way to take a view, and then put different slices into different panes in Panels or Page Manager. I've done it before, but not for a few years now.

I thought it was something that Views and Panels did 'out of the box', and I'm sure the Context module stopped being necessary a few years ago, but it's possible that's changed. I'm sure it involved a special type of views display (not blocks or pages, I think it was called a context display) then loading the view as a context in Panels/Page Manager. Then, each pane had appropriate options to choose the range of records e.g. 1-3 in one, then 4-6 in another, etc.

However, I have no such options in Views or Panels, and despite having a wealth of possible search terms here, I can't find the crucial step to enable this. It doesn't help that the word context is used in so many other contexts, I'm getting a wall of unrelated search results.

Did I remember this right, and if so, what do I need to do to access this "context display mode" in views that allows me to chop up the view in Panels?


texts: How to get list of templates for the active theme?

texts:
I am creating UI that will allow users to edit the active theme's template files(something like Wordpress does). For this I need to get the list of all templates from the system and to know which templates are already overridden by the front-end theme.

The list of templates can be retrieved via \Drupal::service('theme.registry')->get(). The problem is that this will return templates of the currently used theme therefore this will not return templates that are overridden by the front-end theme(since this is done on the back-end which has different theme).

The class \Drupal\Core\Theme\Registry has option to specify the theme in it's constructor but there is no option to set this via the service. Calling the class directly would require me to take care of DI and it's not what I'd want to do anyway(not very Drupal-way approach).

In the init() method there is logic that would rebuild the registry if there is no global theme key set or the theme name is different from theme information but I don' want to fiddle with global variables.

So what would be the proper way to do this?


texts: How to join the dots and reduce the dot size in scatter plot using Easychart?

texts:
I am using Easychart 7.x-3.7 with Drupal 7.51. I uploaded a CSV to display a scatter chart with x-axis (1st column) and y-axis (2nd column). The size of the dots are so big. Here is a screenprint of what I have so far:

How will I reduce the size of the dots and also how will I join the dots to show it like a line?


texts: hook_tokens_alter() not applying to [user:one-time-login-url] Token

texts:
I'm trying to alter the one time login token. I am implementing hook_tokens_alter to do this.

/**
 * Implements hook_tokens_alter
 * @param $replacements
 * @param $context
 */
function portalapi_tokens_alter(&$replacements,  $context){
  if(isset($context['data']['user'])){
    foreach($context['tokens'] as $name => $original){
      switch ($name) {
        case 'one-time-login-url':
          $timestamp = REQUEST_TIME;
          $token = user_pass_rehash($context['data']['user']->pass, $timestamp, $context['data']['user']->login, $context['data']['user']->uid);
          $resetpath = url(variable_get('portal_frontend_url').'/reset-password/'.$token.'-'.$timestamp);
          $replacements[$original] = $resetpath;
          break;
      }
    }
  }
}

Logging the $replacements array at the end of the function call shows the expected changes. However, the token output isn't altered when used (for example when sending password reset emails).

As a quick background here - We're implementing an entirely headless front end serviced by an API, we need to use a different domain in the one time login link and a different structure.

What am i missing?


texts: Display the results of a form submit on the same page just under the form

texts:
I have created a form and it takes in 3 values which are Brand, Item and Zipcode. The values are queried and the results are fetched the database table. I want the results to be shown in a table

function form_example_form_submit($form, &$form_state) {
$sql3 = /*my select query*/

$result = db_query($sql3);
$records = $result->fetchAll();

//code to display table

 echo "
";
   echo"
";
    echo"Retail Accounts	";
    echo"Address	";
    echo"City	";
    echo"State	";
   echo "
";
   foreach ($records as $record) {
    $record     = get_object_vars($record);
    echo "
";
      echo "";
        echo $record['Retail Accounts'];
      echo "	";
      echo "";
        echo $record['ADDR'];
      echo "	";
      echo "";
        echo $record['CITY'];
      echo "	";
      echo "";
        echo $record['STATE'];
      echo "	";
    echo"
";
}
echo "
";
}

The result is properly fetched but not displayed on the page.

I tried $form_state['rebuild'] = TRUE; but it displays the result on top of the page.

I want the result to be visible just below my form. How can I achieve that?

Any help is very much appreciated. Thanks in advance.


texts: Drupal 8: How to put a comma in addressfield display?

texts:
I'm using the address module with Drupal 8.x. I want a comma in the each line of the below address. Currently addresses display like:

John Peter
1181 Broadway
New York
SW1A 1AA
United Kingdom

I want it to display like:
John Peter,
1181 Broadway,
New York,
SW1A 1AA,
United Kingdom.


texts: privatemsg and services fully integration

texts: Does there exist any module even sandbox or starting point module (not ublished on drupal.org) to help achieve privatemsg crud operations over services module.


texts:
I've been trying to find an answer but any search for views embed display brings up a bunch of unrelated modules and questions.

There is a Views Display Type/Mode/Whatever called "Embed" that you select when creating different views in your view:

For what can I use this display type?


texts:
How can I output a custom field in Drupal 8 (Bootstrap theme)? Editing the field.html.twig file, if I have a custom field named field_title I thought

{{content.field_title}}

Would display it, but it doesn't. I've also tried:

{{item.content['#field_title']}}

To no avail.

The only thing that's worked for me is:

{{items[0]}}

But that picks up the custom field by its index number, instead of its associative name in the array.

What am I doing wrong?


texts:
I have used the format_date() in my template files to try and output the date created.

I followed this tutorial http://webwash.net/tutorials/handling-date-and-time-drupal-7

I created a date format 'd, j M y' and date type 'article' and called it through the code:

<?php print format_date($node->changed, 'article') ?>

however the date that it shows is the date it was updated not the date it was created.

How do I show the creation date of the node ?


texts: How to work with field collections in $build in hook_entity_view_alter?

texts:
I have a hook_entity_view_alter() function inside the .module file for a custom content entity type that I am working on. I want to be able to conditionally show or hide fields in the canonical view of the entity based on the value of that field.

Example for a checkbox field: show it in the canonical if it was checked in the form, hide it in the canonical completely if it was unchecked in the form.

I am using unset($build['field_id']) for fields that are not inside field collections, and this is working fine. However, I would also like to use unset() for some fields that are contained within field collections.

I feel like this is probably a pretty simple thing to do and I'm just completely missing it. I've been var_dumping $build for a while and can't figure out what to unset, or if this is even the way to do it.

edit: here is the code I am working on in {module}.module

function {module}_{entity}_view_alter(array &$build, Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display) {

  $notAllowed = stripos($entity->get('field_category')->getValue()[0]['value'], "Not Allowed");
  $allowedConditionally = $entity->get('field_maintenance_info')->first()->getFieldCollectionItem()->get('field_allowed_on_maintenance')->getValue();

  if ($notAllowed !== false) {
    if (!$allowedConditionally[0]['value']) {
        //the next 4 lines work with fields defined at the module settings level, not inside field collections - this works!
        unset($build['field_allowed_1']);
        unset($build['field_there_are_multiple_varieti']);
        unset($build['field_variations']);
        $build['title']['#prefix'] = "No ";
    }
  }

  $protein = stripos($entity->get('field_category')->getValue()[0]['value'], "Protein");

  //this is just a loop I had for exploring $build, this outputs string(2) "25" which I am pretty sure is the field collection ID
  //'field_allowed_1' and 'field_serving_settings' are both field collections, the latter nested inside the former
  if (!($protein && !$notAllowed) && !($notAllowed && $protein2 && $allowedOnMaintenance)) {
    var_dump($build['field_allowed_1'][0]['#field_collection_item']->field_serving_settings[0]->value);
  }
}


texts: Forms - Clone form with different url + theme

texts:
I have a content type which can be created by admins and regular authenticated users.
Now i would like to create a separate form url like /city/create for authenticated users instead of the standard admin url /node/add/city.

I try to achieve to have two urls for the same form with two different layouts.

Could you guys point me in the right direction?


texts: Which hook to use for updates of all nodes of a particular type

texts:
This question is about Drupal 7.
For a particular node type, let's take three examples:

a) book
b) article
c) customcontenttype

I would like to be able to capture the moment of an update of an existing node of this type.

I would like to know if there is a way to target only that node type directly from the hook and not to have the hook triggered for all nodes and then checking the node type.

I've seen some internet articles talking about

mymodule_node_update - for me this is a general hook for all
nodes
mymodule_book_update or mymodule_article_update or
mymodule_customcontentype_update
mymodule_form_book_node_form_alter or
mymodule_form_article_node_form_alter or
mymodule_form_customcontenttype_node_form_alter

Which one of the three above hooks should I use? all of them? if none of them are good then which hook to use?

Many thanks


texts: Where does the query table "taxonomy_term_data_node" come from?

texts:
I'm troubleshooting a Views' query which uses taxonomy_term_data_node.weight, but  there is no table of this name. Actually, the table name is taxonomy_term_data as you well know. So how is this table reference made? I do not see that alias in the query.

SELECT node.title AS node_title, node.nid AS nid,
  taxonomy_term_data_node_1.weight AS taxonomy_term_data_node_1_weight,
  taxonomy_term_data_node.weight AS taxonomy_term_data_node_weight,
  'node' AS field_data_field_category_child_node_entity_type,
  'node' AS field_data_field_category_parent_node_entity_type
FROM {node} node

LEFT JOIN (
  SELECT td.*, tn.nid AS nid
    FROM {taxonomy_term_data} td
    LEFT JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
    LEFT JOIN {taxonomy_index} tn ON tn.tid = td.tid
    WHERE  (tv.machine_name IN ('category_child')
  )
) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid

INNER JOIN (
  SELECT td.*, tn.nid AS nid
  FROM {taxonomy_term_data} td
  INNER JOIN {taxonomy_vocabulary} tv ON td.vid = tv.vid
  INNER JOIN {taxonomy_index} tn ON tn.tid = td.tid
  WHERE (tv.machine_name IN  ('category_parent'))
) taxonomy_term_data_node_1 ON node.nid = taxonomy_term_data_node_1.nid

WHERE (((node.status = '1') AND (node.type IN ('group_by_test'))))
ORDER BY taxonomy_term_data_node_1_weight ASC, taxonomy_term_data_node_weight ASC
LIMIT 1000
OFFSET 0


texts: How to correctly use cookies? (Twig and cache context)

texts:
In my current project I need to alter node templates depending on previously visited landing page. My idea is that, when a visitor visits one of these landing pages, a cookie will be set, and subsequent node templates will be altered depending on that cookie.

I've got three view pages serving as entry points for my visitors:
myproject.com/tv
myproject.com/mobile
myproject.com/infopoint

In theme preprocess I'm checking/setting a cookie and assigning a template variable. The Twig templates do minor modifications depending on that variable:

function MYTHEME_preprocess(array &$variables, $hook) {
  $router = \Drupal::routeMatch();

  if ($route = $router->getRouteObject()) {
    $view_id = $route->getDefault('view_id');
    $display_id = $route->getDefault('display_id');
    $view_display_plugin = $route->getOption('_view_display_plugin_id');

    if ($view_id && $view_display_plugin === 'page') {
      if ($view_id == 'slide') {
        user_cookie_save(['device' => 'tv']);
        $variables['MYTHEME']['device'] = 'tv';
      }
      elseif ($view_id == 'tile' && $display_id == 'mobile') {
        user_cookie_save(['device' => 'mobile']);
        $variables['MYTHEME']['device'] = 'mobile';
      }
      elseif ($view_id == 'tile' && $display_id == 'infopoint') {
        user_cookie_save(['device' => 'infopoint']);
        $variables['MYTHEME']['device'] = 'infopoint';
      }
    }
  }

  // user_cookie_save prefixes all cookie names with 'Drupal.visitor.'
  if (isset($_COOKIE['Drupal.visitor.device']) &&
    in_array($_COOKIE['Drupal.visitor.device'], ['tv', 'mobile', 'infopoint'])) {
         // I'm doing design modifications in my Twig templates depending on this variable
        $variables['MYTHEME']['device'] = $_COOKIE['Drupal.visitor.device'];
    }
  }
}

In services.yml I've activated the cookies cache context

parameters:
  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions', 'url.site', 'cookies:Drupal.visitor.device']

In my Twig templates I've got multiple code pieces like this:

{% if MYTHEME.device == 'tv' %}
   <!-- code here -->
{% else %}
   <!-- other design here -->
{% endif %}

Sadly the code doesn't really work. On the entry pages, the device theme variable is always correct, but the cookie is not updated (seems as if only first uncached hit sets the cookie. I even have the weird situation that cookie and twig variable aren't equal.). On node templates the theme variable isn't set correctly at all.

Any ideas how to get the code above working?

PS: Due slow views with geo-distance calculations disabling cache is not an option, I need to provide cached pages also for anonymous users.


texts:
I've got my drupal site set up so that all newly uploaded files are automatically stored on my CDN (Rackspace Cloud Files).

The only thing I need moved over is drupal's core css and js (along with the css and js for all of the installed modules).

I've been reading over the CDN module and the FileConveyor daemon, but it seems like a lot of overkill. I don't need a daemon that watches for new files and transports them over to CloudFiles. I really just need a one-time deal.

Is there an easier way?


texts: How to strip html from Elasticsearch and search API index?

texts:
I'm also using the search API autocomplete module. When I start typing, the autocomplete shows fields with html code.

What settings do I need to set to get the index to store correctly?


texts: Theme inheritance : blocks placement not inherited

texts:
I have a "Father" theme, and a "Child" theme that inherits from Father.

Css and templates are well inherited, it's ok, but blocks placement (Structure > Blocks) won't inherit.

Is it supposed to ? If it is, do you have any idea for this to work ?

Note : I have the same custom regions defined in each .info file.

Many thanks.


texts:
I have written a migration script that is working but After migrate data I need a method/way to store recent inserted id with some other relevant data in another custom database table.

Can I do with help of any hook or use any plugin.
 This is my yml file.

id: order_billing_address
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: default
label: 'User profile for billing information'
source:
  plugin: csv
  path: pathtocsv/order_billing_address.csv
  header_row_count: 1
  keys:
    - profile_id
process:
  type:
    plugin: default_value
    default_value: 'customer'
  uid: uid
  profile_id: profile_id
  address/country_code: country
  address/administrative_area: state
  address/locality: locality
  address/dependent_locality: locality
  address/postal_code: postal_code
  address/sorting_code: ''
  address/address_line1: street
  address/address_line2: street2
  address/organization: company_name
  address/given_name: first_name
  address/family_name: last_name
destination:
  plugin: 'entity:profile'
migration_dependencies: {  }


texts: How do I add an anchor attribute to a route?

texts:
I've created a route:

regions.taxonomy_term.edit_form_header:
  path: '/taxonomy/term/{taxonomy_term}/edit'
  defaults:
    _entity_form: 'taxonomy_term.default'
    _title: 'Edit term'
  options:
    _admin_route: TRUE
  requirements:
    _entity_access: 'taxonomy_term.update'
    taxonomy_term: \d+

But now I can't add to path anchor attribute.

For example:

path: '/taxonomy/term/{taxonomy_term}/edit#header'


texts:
I need to tag keywords through the body which will display as links.

Let's say in the middle of the text I want to tag job listing. When the page is displayed, it would look like http://urlprefix&keyword1+keyword2&urlappendix, where urlprefix and urlappendix is hardcoded in the module.

How do I build a custom shortcode for the Shortcode module?


texts:
Using Drupal 7 and WebForm Module (version 7.x-4.2). How would I go about adding images, next to text, in a dropdown listbox?

Is this even possible?

I have a dropdown with a list of products and I'd like to add an image next to the name.


texts: How to find a Data Selector in a rule condition?

texts:
Update 3: I just need to know how to find a Data Selector in a rule condition

In a Commerce Kickstart distribution:

To reproduce:

1) I added a billing field called: "VAT NUMBER" at: "admin/commerce/customer-profiles/types/billing/fields"?

2) I created a Sale Tax at: admin/commerce/config/taxes

3) For this new Sale Tax I clicked at "configure component" to edit the "rule component" for the tax.

4) Now inside the rule: in Conditions I need to check if the field: "VAT NUMBER" is empty

Here is my problem: I don't know which is the Data Selector to get the field: "VAT NUMBER" and make the comparation.

I found this screencast which shows how to create a conditional tax based in the address field: http://www.drupalcommerce.org/videos/tutorials/drupal-commerce-condition...

I need to do the same that is shown in the video with the only difference that the condition for the video is based in the address field and in my case I need to base the condition to the value of "VAT NUMBER"

UPDATE: This post is no the solution that I need, but it might help to put it in the right direction: http://www.drupalcommerce.org/faq/rules-field-data-selection

UPADE 2 I tried to use the condition "Entity has field" but I can't find which is the right Entity to select to get the condition to TRUE


texts:
I am using "answers module".

The voting does not appear on the screen even I've enabled "rate module".
I changed the settings of Rate Widget and disabled the rate module and re-enabled it, but nothing changed.


texts: I want to create a newsletter in drupal. What i want is the ability to subscribe the users that are not registered to the site. I can use the third party or any contrib modules available . Any help ..?


texts: Install new site from existing config plus data migration

texts:
I need to install a new site on drupal 8 from existing config plus data like content, users.

I used config installer to install a new site from existing config.

How to make it import content after complete configuration import.

New ideas and other solutions are welcomed.


texts: I have added a product in commerce. Each products have a price and sale price. In product listing page the price is cutout and sale price is displayed. When a product is added to the cart, sale price is not calculated in checkout. Instead original price is calculated. Since i'm new in drupal, I have no idea to solve this problem.


texts: What is the difference in State API and Config API?

texts:
It is a bit confusing to understand the difference in State API and Config API in Drupal 8. I went through the documentation of both on drupal.org but it is not clear to me yet.

Do we define both State config and Config variables in config/install directory?
And How are they both distinguished?


texts: How to throw error message if profile image size exceeds? D6

texts:
I have enabled picture support and given the maximum size of an image as 30KB.

But if i upload profile image larger than the maximum size the the image is being uploaded and no error messages is thrown.

My case is:

  If the size of an image is larger than the maximum size given in
  user/settings -> Picture Support it should throw an error message.

What should i need to do?

Thanks in advance..


texts: How to pull the value of a taxonomy term into the html.tpl.php files

texts:
How does one  pull the value of a taxonomy term into the html.tpl.php file?

I know this needs to be done in the template.php file, no?


texts:
I'm migrating a drupal 7 site from one hosting provider to another.  I've hit some snags along the way.  The main one comes from page.tpl.php.

On the screen I see various messages such as:

Notice: Undefined index: highlighted in include() (line 126 of /public_html/cconn/modules/system/page.tpl.php).

Notice: Undefined index: sidebar_first in include() (line 138 of /public_html/cconn/modules/system/page.tpl.php).

Notice: Undefined index: sidebar_second in include() (line 144 of /public_html/cconn/modules/system/page.tpl.php).

In page.tpl.php the missing sections are defined as such:

    <?php if ($page['highlighted']): ?>
<?php print render($page['highlighted']); ?>
<?php endif; ?>

Does anyone have any thoughts on what's going on and how to remedy it?  The site itself does come up, but as mentioned with these large chunks missing.


texts: How to set Views to show field-collection entries with not duplicated other fileds?

texts:
I have two fields in content type. One is "link", other is "file&text"(field collection; number of values: unlimited) with two fields: "file" and "text".
Relationships:
Content: "file&text"

Problem is: Every "file&text" entry duplicate "link" field for that entry.

I tried query settings/distinct but that not make any progress.

Any tips?


texts: How to specify in a form field's #ajax setting that the entire form should be rebuilt

texts:
I have a form with 3 sequential selects at the top, each populated as a result of the selection in the one prior.

After the third select is choice is made, a large number of fields segregated into two vertical tabs should be populated.

In the form, I set the default value of each of the fields to an associative array element, which is empty when the form is first built.
When the third select choice is made, its callback
a. obtains an associative array of the values needed for the form
b. stores them in $form_state['storage']['mykey']
c. sets $form['rebuild'] to true (for good measure)
d. returns $form
In the form function, prior to the field definitions, I set the associative array used for the default values to $form_state['storage']['mykey']

I can see in xdebug that $form_state has the data in the correct place prior to returning, but when execution returns to the form function, $form_state no longer has a ['storage'] key.

AJAX CALLBACK

function my_ajax_callback($form, &$form_state) {
  $form_state['storage']['draft'] = my_mysql_get($form_state['values']['id']);
  return $form;
}

FIRST LINE OF FORM FUNCTION (most fields use $r for default_value)

  $r =  !isset($form_state['storage']['draft']) ?  array() : $form_state['storage']['draft'];

A breakpoint at the callback reveals that it is reached, and that $form_state['storage']['draft'] is populated at the point of returning.

A breakpoint at the equate reveals that ['storage'] is no longer in $form_state, but this is only reached (in the form function) if I return only a field from the callback, not the entire form. I really need the entire form, because 17 of 20 fields on the form need to be rebuilt at that point, to get the default value into them.

FORM FIELD WITH AJAX CALLBACK

  $form['info'] = array(
    '#type' => 'select',
    '#title' => 'Player',
    '#prefix' => '
',
    '#suffix' => '
',
    '#options' => info_options($form_state['values']['key1'], $form_state['values']['key2']),

    // ajax to bind this select to the players select
    '#ajax' => array(
      'event' => 'change',
      'callback' => 'my_ajax_callback',
      'wrapper' => 'my_form_id',
    ),


texts: How can i get prepared for DRUPAL-PSA-2016-001?

texts:
The PSA for tomorrow left me a bit uncomfortable. Quote:

  The Drupal Security Team urges you to reserve time for module updates
  at that time because exploits are expected to be developed within
  hours/days.

Does it make sense to put all sites in maintenance mode or take them offline precautionary?
Maybe creating database backups before the announcement takes place isn't a bad idea?

Is there a Drupal way of responding such a pending threat? Or should we just sit and wait what's coming?


texts: Is there a way to autopost images that are inside nodes from Drupal to Pinterest?


texts: Drupal core error when moving a Drupal site from a server to a farm

texts:
I have a site in temporary production server. Now I got the "final" production environment with two front-ends and a database/file-server.

I had a simple idea how to move the site from one server to another: copy the database to the farm database server, copy the drupal directory to front-end (one to start with), change settings.php to point to the database in database server, copy the Nginx conf-file and just run it.

Now when trying to run for example "drush cr" I get:

 PHP Fatal error: Class name must be a valid object or a string in /srv/site-d8/core/modules/field/src/FieldStorageConfigStorage.php on line 155

  Fatal error: Class name must be a valid object or a string in /srv/site-d8/core/modules/field/src/FieldStorageConfigStorage.php on line 155
  Drush command terminated abnormally due to an unrecoverable error. [error]
  Error: Class name must be a valid object or a string in
  /srv/site-d8/core/modules/field/src/FieldStorageConfigStorage.php, line 155

The same error comes when I try open the site itself by browser. I have been fighting with this for whole the day and getting really frustrated. I found some instructions on the google, but though I changed the drupal core code ( the no-no, I know) to check the existence of the class, but then the error just seems to propagate somewhere else.

The environments should be fully similar except for the farm architecture, Nginx as the web server

The problem is that the site should be running there next Monday plus also another site I haven't even been trying to move.

Any help, anyone?

---- more information

This is to add the question which I accidentally wrote as an answer (yeas it was me all the time).

So now I add the answer to the comment editing it here...

Ok, I checked and it says that the record structure when $class is empty is

Array
(
    [uuid] => dacacd09-c5fe-44b1-8035-566b102731dd
    [langcode] => en
    [status] => 1
    [dependencies] => Array
        (
            [module] => Array
                (
                    [0] => entity_reference_revisions
                    [1] => node
                    [2] => paragraphs
                )

        )

    [id] => node.field_paragraphs
    [field_name] => field_paragraphs
    [entity_type] => node
    [type] => entity_reference_revisions
    [settings] => Array
        (
            [target_type] => paragraph
        )

    [module] => entity_reference_revisions
    [locked] =>
    [cardinality] => -1
    [translatable] => 1
    [indexes] => Array
        (
        )

    [persist_with_no_fields] =>
    [custom_storage] =>
)

I also checked that the module for entity_reference_revisions exists in /modules directory. So, how can I resolve the problem itself as the module itself seems not to be missing. Also the paragraphs and node modules exist (paragraphs is sites/{sitename]/modules and node of course in core/modules.

hank, grateful but still (maybe more) confused

p.s. mods could delete the erroneous answer at their will


texts: Theme setting to change block position (region)

texts:
i want to create a theme setting to change blocks position(region) for ex.

  option_1 block_branding-> region_top block_main_menu-> region_menu

  option_2 block_branding-> region_branding block_main_menu->
  region_header_first

I think that should do something like:

Create a file with a function to change the region of the blocks according to option.
Call this function when the form is submitted.

But I don't how to get block info to change its position.


texts: Run DB query and fetch fields in block--block--ID.tpl.php

texts:
I need to run Database query and fetch the fields in my block named block--block--45.tpl.php.

How can I get subdomain table field values to my block tpl(block--block--45.tpl.php) file?

I tried this code in my block tpl file and its not working : $subdomain = db_query("select subdomain from {subdomain} where sid = :sid limit 0, 1", array(":sid" => $node->uid))->fetchField();

So anyone suggest an easy way to get subdomain table field values to my block tpl file.


texts: How to migrate from Commerce Kickstart to Drupal Commerce?

texts: What’s the recommended way to migrate users, orders, products including products variation... simply everything to Drupal Commerce 7?


texts: Attach user created content (in this case a gallery view) to a Profile 2, per user

texts:
I have created Galleries by following the tutorial here:

http://www.dailymotion.com/video/xnqe4c_creating-a-drupal-7-image-gallery-using-content-types-nodes_tech?start=0#.UOS4IRwujTN

I managed to do it fine and have the galleries working.

Now what I would like to do, is to be able to attach that view to the Profile2 for each user.

I tried different ways, but I probably don't have the concept right and time is pressing. I would really appreciate if anyone could give me a pointer.

Just by changing the EVA parameters from Content: Album to Profile: Name of Profile. I assumed the view was going to get attached to Profile. Well it does!

But How do I filter the content in order to just get the attached images uploaded by the profile owner?

Also, I have the following issue, the profile author is always the administrator, since users cannot create profiles. They are able to edit them after the profile is created by the admin.

I thank anyone who can give me a tip on how to solve this issue.

Further info: Using Drupal7, Profile2, Views3, Eva

FOUND OUT YET ANOTHER ISSUE : The "Add more images" link as per the reference node is public. If you set this field as private, it only affects the display of the Title(link) in the image node, but the "Add more images" link shows and can be used by anyone. How can this be solved?


texts: How can I execute one Drush 10 installation from any of my different sites (NOT multi-site)?

texts:
What is the proper way to install Drush 10 if I have a domain and several independently installed subdomains like described below? I want to avoid multiple drush installs.
On my shared hosting account, here is my directory structure for subdomains that are Drupal 8.7 and 9.0 sites. Originally, I was trying to install drush in the directory as shown below and set an alias in .bashrc alias drush='~/drush/vendor/bin/drush' so that I could run drush in any of the Drupal installs. Drush 10  isn't working that way. I haven't tried Drush 9 yet.
/home/account
   |
   |---drush
   |
   |----public_html <-- this is primary domain (currently just an index.html, but future Drupal)
          |
          |-------d87_site1 <---site1.domain.com
          |          |----vendor
          |          |----web
          |
          |-------d87_site2 <---site2.domain.com
          |          |----vendor
          |          |----web
          |
          |-------d9_site3 <---site3.domain.com
                     |----vendor
                     |----web

UPDATE: I seem to be successful incorporating your feedback, plus adding this added research to the solution:

I installed drupal at the web root (hosted primary domain), but had to add this to my .htaccess file in the web root:

# https://www.inmotionhosting.com/support/domain-names/how-to-redirect-your-primary-domain-to-a-subdirectory/

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain_name.com$
RewriteCond %{REQUEST_URI} !^/subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain_name.com$
RewriteRule ^(/)?$ subdir/index.html [L]

# end of how-to-redirect-your-primary-domain-to-a-subdirectory

I was able to add alias drush='vendor/bin/drush' to .bashrc, so that I could run the each project-installed drush from each site root. I will try drush-launcher later.


texts: Add-only widget for entity reference field

texts:
Is there any widget for Entity Reference field, which would allow users to only add new values, without possibility to see existing values? I know, I could probably achieve it by using CSS, but I wonder, if there is any cleaner solution to this problem.

I know, I probably could use info in Entity reference - hide some references in multiple-reference field edit widget, but that would also need to be adjusted.


texts:
i am using drupal 7.

I want to add forums in OG groups so that forums added in OG groups can only be accessible by members of the OG groups.

Is there any other option to grant access restriction on forms except using Form Access, because it will not integrate groups with forums?


texts: Hook for the "Welcome (awaiting approval)" email

texts:
I need to modify the email for "Welcome (Awaiting Approval)."

I know I can use hook_mail_alter(), but I don't know what the ID is for "Welcome (Awaiting Approval)," nor do I know how I can directly access a user's profile2 fields.

I assume I have to do something like:

function module_mail_alter(&$message) {
  if ($message['id'] == 'welcome_waiting_approval') {
    global $user;
    $fid = $user['firm']['firm_id'];
    $message['body'][] = "Your Firm's ID is: $fid";
  }
}


texts: REST Services documentation for end client

texts:
After creating a REST services using Services module there is always somebody who develops a client for you endpoint. And this developer must know which services we have, which parameters to pass, which method to use etc.

Is there any automatically generated documentation for Services that are created?
(E.g. something like to WSDL document for SOAP.)


texts: How to assign a section to a specific node with Workbench?

texts:
I'm creating nodes using a custom modules

$node = new stdClass();
$node->type = $link['content_type'];

node_object_prepare($node);

$node->uid = $user->uid;
$node->name = $user->name;

$node->title = $html['title'];
$node->language = LANGUAGE_NONE;
$node->body[$node->language][0]['value'] = $html['html'];
$node->body[$node->language][0]['summary'] = $html['summary'];
$node->body[$node->language][0]['format'] = 'filtered_html';

$node->menu['enabled'] = 0; // 1 to enable providing a link in main menu
$node->menu['link_title'] = urlencode($html['title']);
$node->menu['description'] = urlencode($html['summary']);
$node->menu['parent'] = 'main-menu:0';

$node->menu['weight'] = 5;
$node->path['alias'] = urlencode($html['title']) . time();
$node->comment = 1;

$node->status = 1;        // 1 means published
$node->promote = 0;
$node->revision = 0;

$node->changed = $_SERVER['REQUEST_TIME'];
$node->created = $_SERVER['REQUEST_TIME'];

node_submit($node);
@node_save($node);

$node->path['alias'] .= '+' . $node->nid;

node_submit($node);
@node_save($node);

db_update('node_revision')
    ->fields(array('uid' => $node->uid))
    ->condition('vid', $node->vid)
    ->execute();

But now I need to assign each node a I create a workbench section, so I tried doing this:

$node->workbench_access = array('66');

node_submit($node);
@node_save($node);

$node->path['alias'] .= '+' . $node->nid;

node_submit($node);
@node_save($node);

db_update('node_revision')
    ->fields(array('uid' => $node->uid))
    ->condition('vid', $node->vid)
    ->execute();

This add the workbench access id temporarily, but when the page is refreshed it doesn't apply it. Is there a way to assign a node to a workbench section using php?


texts: Adding translations for taxonomy term via REST API

texts:
Need to add taxonomy term with translation via REST API
Steps to Reproduce

Drupal install
Enabled Language,Interface Translation,Content Translation,Configuration Translation modules
Created Custom Vocabulary and enabled  following option
Show language selector on create and edit pages
Enable translation
Given Permission as follows
Create/Edit Translations
Translate  taxonomy term
REST API
For creating a term I will be doing a POST operation first and then execute another PATCH operation with translation langcode.

POST Reqeust JSON
{"langcode":[{"value":"en"}],"vid":[{"target_id":"<custom vocabulary machine name>"}],"name":[{"value":"test taxonomy"}]}

PATCH Reqeust JSON
{"langcode":[{"value":"ar "}],"vid":[{"target_id":"<custom vocabulary machine name>"}],"name":[{"value":"test taxonomy ar"}]}

Even both these API return success,The original language value changes to the translation value based on langcode in the request.
How can I prevent that from happening?


texts: How to sort userlist on the basis of number of likes or age?

texts:
How to sort userlist on the basis of number of likes(eg:by flag module) or age(taxonomy term) having each user.

For this i have created a view of users, i want to show sort by likes and age the result page should sort on the basis of assending and desending order .

How to acheive this functionality?


texts: Feeds import by http always imports even after deleting the source

texts:
I'm using Feeds to import an xml file. I'm using cron to do this every minute. I noticed that if I delete the source file, the import still succeds! It seems Feeds caches the data somewhere and there is no setting to disable this as far as I know.

This would not be a problem because I don't allow to have duplicate content but I need to have a different file with the same name to get different data but Feeds, recognizing a file with the same name, ignores it and imports the cached data.

Does anyone knows a good solution to prevent this from happening?

Thanks.

EDIT: I can't find any temp file in the system but in the db there is a 'cache_feeds_http' table that has in fact the data from the file. I tried truncate the table and delete the source file but the behaviour is still the same. What's going on here?!?! Where is the data being pulled?


texts: What to do when Drupal views module doesn't output what you want?

texts:
When a user search for a word the view should output its translation and any other vocabs that might be similar to it ( using Taxonomy terms ).

This works as the following:

The similar vocabs are actually another view that I pass ( Taxonomy ids ) to its URL as a contextual filter and it outputs all words that has the same Taxonomy term or terms. This view a lone by it self works fine when you pass Taxonomy terms manually. It doesn't produce any duplicates since I handled that by choosing 'Query settings: DISTINCT' and using aggregation.

However when I combine it with the other view and pass the Taxonomy terms using the Views UI it produce duplicates.

What should I do? Is there a way to write the view code manually or something like that?


texts: Automatically create hyperlink based on span class

texts:
Does anyone have any idea how I can do this? I want my content writer to be able to add span classes to certain numerical amounts that then automatically hyperlink to a pre-defined URL. Example:

  And the price at John's hardware shop is$2.35

I am fully aware there is a module called Word Link Which does a fantastic job of hyperlinking specific keywords but as numerical amounts are not specific to anything this is a tad more challenging. What I mean by this is in Word Link you can say:

"coca cola" - link automatically to www.cocacola.com
"Nike" - link automatically to www.nike.com

"$5.67" is just a number so a span class would be approriate.

Grateful for any help.


texts: When a user login fails, is it possible to say "Password incorrect" or "Username does not exist" instead of the default message?

texts:
When a user types an incorrect user name or password, by default Drupal gives this message: "Sorry, unrecognized username or password."

To help my sometimes clueless users (and my clueless self), I'd like to provide more helpful messages to specify exactly what is wrong.

In other words:

Incorrect password= "The password you provided is incorrect."
Account does not exist= "No account is registered for USERNAME."

How could I go about doing this?


texts:
I love to work with features! I often work with several colleges on the same feature and I'ld like to add a signature to the features. So we can see who worked last on the feature (without having to dig in Bitbucket).

It must be possible since the example Features do so:

But all I get are Unavailable signatures :(

Any one know this magic?


texts: How to use the Rules and Group modules to send a privatemsg to users of a role in a group?

texts:
I am using the module Rules with Group (not Organic groups) as well as the Privatemsg module.

I want to send an email to all users of a role that are in a group. I am able to send an email to all users of a role, but I need a Rules condition that sends it to members of a certain group.

Any Suggestions?


texts: not show any picture in full html ,filtered html mode

texts: when i upload or post a link image in article post or basic post not show anything but when i use the img tag and address show image!enter image description here


texts: Limiting node access to certain users based on an entity reference field. Which hook to use for when node is viewed?

texts:
Scenario:

"Teams" content type has user entity reference field.

"Manager" role can add teams to nodes they have created and the teams will change often.

Members of the team can only view the nodes (and nodes that reference that node through another entity reference field) whenever their team is assigned to them.

For these content types, performance isn't an issue. What I want to do is use a series of views_get_view_result when the node is viewed and redirect away from the node if necessary. That part is easy.

What is the best hook to use for when the node is viewed and I can run my views to find out if the user should view it?

Thanks


texts: Adding users to entity reference field by custom field

texts: I have added some custom fields to my D8 site's user profiles. Would it be possible to add users to a entity reference field on a node using one of these? For example phone number, as that is one of the fields. Or am I stuck referring to only the users username?


texts:
For example, there is a view.

The view has been executed and has results.

How can I alter these results. For example, I need to change the letter "a" to the letter "b" in result of some field.

How can I do it ?

I'm looking into hook_views_pre_render and hook_views_post_render, but can't understand how to get results and how to change them.

Could you share your experience how to do it ? Or could you share useful links ?


texts:
I have come to an impasse in the development.

MY GOAL:
Setup department pages on the site, giving editing access to specific LDAP roles
Creating workflow for the data(draft,review,publish).
Creating private content for department users.

My Solution(SO FAR):

I have the LDAP module install on our D7 site.  I am mapping LDAP fields to the profiles and roles, Using LDAP queries with a view to display a "staff" page.

I have tinkered around with OG, Workbench, Workflow, TAC and TAC_lite. SO FAR NONE really meet the control and goals we have set out to obtain.

I am hoping that there is someone out here that has conquered a similar setup and could impart some of their wisdom on me.

All constructive thoughts will be appreciated


texts: I need to hide some blocks from priviledged user so he won't be able to attach them to regions via the Block layout. What is the proper way of doing this?


texts: I have a content type that I want to have certain fields show up for different users. For instance, for admin, I'd like the users to see all of the fields available, however, for non admins, I'd like to have one certain fields displayed. Is this possible?


texts: What is the best way to upload a PDF attachment, that can be attached to multiple nodes?

texts:
I want multiple nodes to all have a download link on each node to one, shared PDF file.

What is the best way to upload the PDF file one time, but add it as an attachment to each of the multiple nodes?

This is easy to do for one node:one pdf attachment using the File Upload module, but I'm not sure of the best way to associate one single PDF with multiple nodes.


texts:
Just wondering whether I can use exposed filters to re-order a list of nodes rather than eliminating ones that don't fit the desired criteria.

E.g. If I filter for 'Monday' and have a list of nodes [Sunday, Saturday, Friday, Thursday, Wednesday, Tuesday, Monday], then I would like the list of nodes to return as Monday, Sunday, Saturday, Friday, Thursday, Wednesday, Tuesday.

At the moment my result when I filter for the term 'Monday', is just 'Monday'.

Any thoughts?

Cheers!


texts: Results of GET Request inside block are being cached and not updating when GET request values are changed

texts:
I have a block plugin that contains a form that performs a get request and reloads the current page. Currently it's set to allow a user to submit a state from a drop down box to be used as a filter.

This issue I'm having is the results from the get request are cached. It works after clearing the cache but right after, once I submit again with a new value for the dropdown the results do not update on the page, even though I can clearly see that the get request has changed. Below is the code I currently have

public function build() {
    $request = \Drupal::request();
    /* GET Variables */
    $state = (empty($request->get('state')))?'':$request->get('state');

    $render = '
    <form method="GET" class="relief-network-form">

    State:

    <select class="state" name="state">
        <option value="">Pick One</option>
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
    </select>

    <input type="submit" value="Filter">
    </form>';
    return array(
        'test'    => [
            '#type'  => 'html_tag',
            '#tag'   => 'p',
            '#value' => 'State:'.$state.'-',
        ],
        'form'       => [
            '#type'     => 'inline_template',
            '#template' => $render,
        ],
    );
}

When submitting this form after the cache is cleared it displays the proper state in the p tag above the form, but afterwards it never changes. I have a feeling it has to do with using cache tags after reading the documentation here https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays
but to be honest I'm having trouble making sense of it, and I'm not sure how I would apply the examples to the current situation.
Is there a way to prevent the results of a GET request inside a block plugin from being cached?


texts: Multisite - Commerce reference between sites

texts:
Setup

Main website: www.example.com
LMS website: lms.example.com

The Main website is public facing for visitors to browse the courses.
The LMS website is for the users/commerce to be managed and the actual Course material to be used/viewed.
Drupal Commerce manages the payments and Access modules manage the users access once purchased.

The 2 websites are setup as Drupal multi-sites:

On the same server
Separate databases
All modules/theme files are under the sites/all folder.

Question

How do I create a 'Buy' button on the main website that will take the visitor to the LMS website with that particular course added in their cart?

Note: there is only a hand full of courses so the link on the main website can be manually added for each course.


texts:
I want a form to display an error if someone is not 18 years old, or display the next form item if they are.

After exhausting a lot of time searching for a way to do it, I believe AJAX does not work directly on "date_select" fields. I was thinking there might be some kind of use for "#states" here.