texts: Views with ajax get current node in hook_views_query_alter

texts:
The view has on offset based on a value set in the Basic page node.

function domain_config_bu_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
    if($node = \Drupal::routeMatch()->getParameter('node')) {
      if(... // Node has certain field value set) {
        $view->setOffset(0);
      }
    }
}

On a page request i can get the current node object by routeMatch() functionality.
But views has ajax enabled, and on ajax callback routeMatch() does not return the node object. Wich is normal. But how can i get the current node object/ nid in an ajax callback so the offset is respected?


texts: Adding Pager to entity referenCED field display

texts:
I have two content types: Parent and Child

I have an entity reference field (called "Link") in parent content type referencing it to child content type.

I am using inline entity forms module for the entity reference field .

I want to know if there is a way to achieve the following:

Question 1:

I want to have a read more button on parent content type, which would open the first entity referenced child page.

Question 2:

I want to have a pager in the child page which would link to the other child pages of the same entity referenced parent content type.
(something similar to what books module provides for book child in child pages)

Any help would be highly appreciated. Thank You.


texts: Promotions not translated on cart and checkout page?

texts:
I have commerce site in 2 languages: English (default) and German.
I enabled translation of promotions so when I go to promotions admin page ( /admin/commerce/promotions ) for each promotion there is also "Translate" operation. I can enter German translation for each and it's saved well.
Problem is that when I'm on cart page or later on checkout page (German pages) promotions are displayed in English only. Other content, including subtotal, total, shipping costs are translated well, but promotions are always on English?!?
I searched but couldn't find that anybody reported that issue before, so most likely I overlooked something (hopefully), but just can't find out what it is.
Any idea why promotion titles are not displayed in page language, but always in English (default language)?


texts: Not able to upload file in content type form without filling all required fields

texts:
Uploading a file in node/add/mycontenttype is failing and displaying required field validation errors for fields that have not been filled out.

If I fill all required field then upload the file it works.
My drupal version is 7.28
Could any one who knows please help me sort out this issue?


texts: Login user programatically (Create user session)

texts: My question is based on this question: Programmatically User login not working i dont have this clear, to login an user (create an active session) only need use User::Load()? i'm triying make this on my custom module, due to i need an independent login and register form, but dont work. Someone can help me? i want create a user session and let the user navigate for all sections that your role have assigned, but without pass by "user/login" route. Thanks in advance. On resume i want emulate the login controller shipped with drupal 8.


texts: Authentication cookie in a load balanced environment

texts: Hopefully this is a basic question.  I'm going to be setting up a drupal website there there will be multiple servers in back of a load balancer.  The user will hit one web server where they will authenticate and the cookie will be added to the browser's session.  On subsequent requests if the user is sent to another server, will that server recognize the user as authenticated since the authentication cookie is present, or is the cookie somehow tied to the server that authenticated the user?


texts: Remove width and height from img tag in Drupal output (for certain content type)

texts:
I want to remove width and height properties from img tags in certain content type

Currently it show's like this

but I want


texts: I have created a Drupal page which consists of the main content of my page, text plus a photo, a nested box which is just a button and a views block which is the third element. What I want to do though is make the nested box go below the views block which is only possible if I add the views block to the content page class but I am not sure how to do it. Any ideas?


texts: How to select every date before now in timestamp?

texts:
my database feild type is timestamp here is my code I used it but It also gave me today date
I need every date before today

"SELECT * FROM {mytable} WHERE  date <".$now_timestamp."  "

please help me
Thank you


texts: How to add a view to content build with bricks module

texts:
I have installed the modules bricks and eck (entity construction kit). Then I tried to add a VIEW to content build with the bricks and eck modules, but without success. Can anybody help what's wrong or does anybody know wether it is in general possible to add a view or not?

This is my view:

The following images show what I have done.

Step 1:

Step 2:

I also tried to use a CONTENT-FIELD

Step 3:

Step 4:

Step 5:


texts: breadcrumbs not displaying correctly for views

texts:
I'm pretty new to the world of drupal so I'm hoping this will be a quick fix.

Anyhow here's the situation:
my breadcrumbs work correctly when hitting a node for example when i go to "contact" it prints out home > contact.  Now I have a view and when I go there things look ok. I go to events and it prints out home > events > view all. When I go to a subview like "tech events" however it spits out home > events > events > view all.

The code below is what is currently in place so I was wondering how to alter it to handle views or if anyone could point me to a good solution.

thank you

my code:

function custom_breadcrumb($variables) {
  $currentTitle = "";
  $trail = menu_get_active_trail();
  $currentNode = array_pop($trail);
  if( $currentNode ){
    $currentTitle = $currentNode['title'];
  }

  $breadcrumb = $variables['breadcrumb'];
  if (!empty($breadcrumb)) {

    $output = '

';
    $output .= implode('

', $breadcrumb);

    if( $currentTitle ){
      $output .= '

';
      $output .= $currentTitle;
    }
    $output .= '

';

    return $output;
  }
}

any help would be awesome guys. thank you.


texts: Change the product status after checkout_complete

texts:
I have one 'select' field in product page it has value 'Open', 'Closed'.I want to changed to 'Closed' after completing the first order of this product.

There is one issue which someone answered for Drupal 7 and it is done by using 'Rules' module.
How I can change the value of a commerce product field after Completion process?

How I can do that using Hooks and without Rules module?

EDIT:
I feel we can use below hooks. But how we can find the product and change the custom field value of the product?

function hook_commerce_checkout_complete($order) {
  if($order->status == 'completed') {
  }
}

hook_commerce_checkout_complete

EDIT 2:

Got the solution for Order Complete event - https://medium.com/@sumanthkumarc/writing-event-subscriber-for-order-complete-event-in-drupal-8-commerce-2-x-196292330b1c. Now question is How I can modify the product custom field value?

public function orderCompleteHandler(WorkflowTransitionEvent $event) {
  /** @var \Drupal\commerce_order\Entity\OrderInterface $order */
  $order = $event->getEntity();
  $items = $order->getItems();
}

How can i get the product id from the order items and change the custom field(field_prodstat) value


texts:
I have a view like as follows using exposed fliter fields in d6 , how can i recreate like that in d8 ?

Here the from date and to date is to be selected and result will come accordingly

for the date . Here the date field is exposed filter .

view page :

and in view

How can i recreate a form like this using view in D8 ?

For the same purpose in d8 i have only this option : Any help is appreciated .


texts: How do I hide the page title in Drupal 7?

texts: I'm a site administrator for my university and I'm using Drupal through their servers, but I can't figure out how to hide the page title from the screen. I can't install modules because I'm not on their lab computer (using my personal laptop and I don't have the permission to) and I don't see anything that I can uncheck that says "Automatically update Menu Title". Is there a way to work around this? Or does this mean I have to use my school's lab computers?


texts:
Created a custom form, which submit values to a table.
Fields on the form created on the go.
For example if we have 5 users, we will have 5 fields, if 6 then six fields

Say if it has 5 fields

Field 01
Field 02
Field 03
Field 04
Field 05

Just want to submit all values of all fields being created on the go.

when I dsm

dsm[$form_state[values]];

It shows me array with form fields and form info like

Field 01
Field 02
Field 03
Field 04
Field 05
form_build_id
form_token
...
..

So I can't just run loop to submit all fields because 'form_build_id' etc is also there.

How can I do this dynamically?


texts: After DB backup and restore: Call to undefined function user_access() in ...includes/menu.inc

texts:
This question pertains to a Drupal 7 multi-site install. As a test for some future backup/migrate bash scripting that I am doing for work, I made a backup/dump of my test site postgres DB. I then dropped the DB and recreated it with the same (old) name. I then restored the DB from my backup. I did not touch any files. I thought everything had worked out well, except I have an error that I cannot figure out:

  Call to undefined function user_access() in .../includes/menu.inc on line 634.

Things I've tried:

As a sanity check, I made sure that User module was in my core files and that user_access was defined in user.module
Checked out the restored database in pgAdmin, made sure that user 0 (anonymous user) was still there
Truncated any table starting with '_cache':

Truncate table prefix_cache;
Truncate table prefix_cache_block;
Truncate table prefix_cache_bootstrap;
Truncate table prefix_sessions;
Truncate table prefix_cache_field;
Truncate table prefix_cache_filter;
Truncate table prefix_cache_form;
Truncate table prefix_cache_image;
Truncate table prefix_cache_menu;
Truncate table prefix_cache_page;
Truncate table prefix_cache_path;

Checked the system table and disabled, checked and re-enabled various modules including user module via the 'status integer' value/col. (I'm not sure if this is the way to enable and re-enable modules in the DB).
Tried to install Drush on my server but file permissions are very restrictive. It seems that Drush has limited abilities. Drush can only clear its own cache even after I setup an alias for the site in question.
Created a 'modules' directory inside of the site's multi-site directory and copied the user module out of core and put it there.
Tried the export using utf8 as the encoding of the DB and re-importing (no change in error)


texts: Get submitted values of webform in hook_alter function

texts:
how can i get the submitted field values of webform in hook_alter function.
One more question is how can i call to submit function from hook_alter function.


texts: Event Subscriber for User fields event not working as intended

texts:
I am trying to auto approve users who have a certain domain in their email who signup with Google Login (Social Auth Google) by creating an Event subscriber using the User Fields Event.

The code works but surprisingly the user is approved only after they try to login. Not sure if its a bug in the Social auth or in my code. Is there any other event that needs to be used or is there something missing in the code below.

public function onSocialAuthUserFieldEvent(UserFieldsEvent $event) {
    $user = $event->getUserFields();
    $user_email = $user['mail'];

    // Checking if the user has email id as abcode.com and setting
    // status to 1 If user has another email domain we do nothing and
    // leave it to the admins.
    if (preg_match('/.*@abcd\\.com$/i', $user_email) > 0) {

      // Setting the user account status to be active by default.
      $user['status'] = 1;
      $event->setUserFields($user);
      $this->loggerFactory->notice('Auto approved Abcd user with mail id:  %user_email ', ['%user_email' => $user_email]);
    }


texts:
(I have posted this on Stack Exchange as well)

I have a Drupal 7 page on which I need to remove text bracketed by "Keywords:" and "Description:", there are a number of text blocks all with the class .feedDesc

Page is here: http://www.cafe.gen.nz/node/236/feed-items

I have this working on a plain html page with this Jquery below but can not for the life of me make it work in the Drupal setup:

  $('p.feedDesc').html( function (index,text) {
    var regex = /Keywords(.*)Description/;
    return text.replace(regex,"");
  });

On the site the below does work indicating the whole stack is good.

  $('p.feedDesc').html( function (index,text) {
    return text.replace("Keywords","Foobar");
  });

Help !

Any ideas?

Update:

This works to do the find/replace:

    $('p.feedDesc').html( function (index,text) {
      text = text.replace(/Keywords:([^"]*)Description:/gi,"");
      return text;
    });

However I also need to trim whitespace and $.trim does not work:

    $('p.feedDesc').html( function (index,text) {
      text = text.replace(/Keywords:([^"]*)Description:/gi,"");
      text = $.trim(text);
      return text;
    });


texts: Incorrect branch when adding modules with composer

texts:
Edit: Gist of my complete composer.json

I'm seeing some confusing behaviour with Drupal branch names when adding modules using composer - specifically I seem to be getting the 7.x version of the module rather than 8.x.

This is a composer based setup, running 8.3.0-rc1 - composer.json includes:

"drupal/core": "8.3.0-rc1"

My understanding has always been that for modules, whenever you specify the branch in composer, you remove the 7.x- or 8.x from the start.

e.g. I wanted the tagclouds module 8.x-1.x branch, so I did:

composer require drupal/tagclouds:1.x

Yet what it actually installs is 7.x-1.9+30-dev

Composer output:

 - Installing drupal/tagclouds (dev-1.x 54086ae) Cloning 54086ae717

I also ran drush ups and got:

  Project was not packaged by drupal.org but obtained from git. You need
  to enable git_deploy module

So I add and enable git_deploy the same way.

composer.json:

"drupal/git_deploy": "2.x"

again it installs a 7.x release (7.x-2.2+10-dev)

Any obvious mistakes?

Other things I've tried:

Explicility listing the stability in the version constraints, e.g. 2.x-dev instead of 2.x, and 1.x-dev not `1.x'. (The documentation suggests composer adds this by default though.)
Using composer update nothing to regenerate the composer.lock file


texts:
I have installed Multistep module and it worked well for forms (e.g. save node, edit node). But when I switched to "Manage Display" tab and add "Multistep Form" group, it didn't work. No multistep form block appeared in Structure->Block for displaying a node.

I have also tried "Div" for displaying field group, but it's just a collapsible box.

Is it possible to display node as multi-step?


texts: view to list already added referenced nodes to all content types by user

texts:
I have a content type of DELIVERY, and another content type of BOOK. Now each user has 3 DELIVERY content types that they are the author of. What i do is then edit a users DELIVERY content and add a BOOK to it (i have added a entity reference, referencing BOOK in DELIVERY).

All works fine, what i want to do is create a View, so that when i edit a users DELIVERY it lists the BOOKS i have already assigned to all the other DELIVERY's from that user. is this possible? been playing around with it but cant figure it out.


texts: jquery slide toggle - affects all on the page

texts:
I have a view with a list of a content type and using drupal behaviors and jquery toggle, I trying to toggle some content when the user clicks a div. The only problem is that it's affecting all the divs and they're all toggling open, I'd just like the one they clicked to open.

Here is my code:

(function ($) {
 Drupal.behaviors.myToggle = {
  attach: function(context, settings) {
  $('.views-row').find('.views-field-field-mp3').hide();

    $('.mp3-toggle', context).click(function() {
     $('.views-field-field-mp3').slideToggle();
    });
  }
 };
})(jQuery);

I've tried return false and a couple of other things, though none seem to work.

Any help would be much appreciated.


texts: Insert bank detail in email if the user choose to pay with bank transfer

texts:
I want to add a to order checkout emails the bank account details managed by commerce_bank_transfer module.
I create a rule for the order with the bank transfer payment method but I'm not undertanding how to add in the mail my site's bank account infos.

I tryed to add this code to the email

<?php
   $payment_method = commerce_payment_method_load('bank_transfer');
   echo commerce_bank_transfer_bank_details($commerce_order->order_id, $payment_method);
?>

I did some test and in the mail there is nothing where I was expecting my bank info.

Reading commerce_bank_transfer module I saw that commerce_bank_transfer_bank_details function request a 'setting' key in the $payment_method array but if I retry the payment method by

commerce_payment_method_load('bank_transfer');

I have no 'setting' key.

How can I retry the setting from a payment method?


texts:
I have a view which contains the relationship "OG membership: OG Roles from membership", and the only thing I need is to translate the retrieved values from this relationship.

What is your recommendation?


texts:
I would like to add some extra html/text to one of delivery address fields - phone number. Wha twould be the best way of doing that? Would this code be of a help?http://api.ubercart.me/api/drupal/ubercart!uc_cart!uc_cart_checkout_pane.inc/function/theme_address_pane/6

Thank you.


texts: SORT CRITERIA by GROUP BY datepart in Views

texts:
In views I have my items being sorted by date and then relevancy .  Although unless the items are posted at exactly the same time this means that the relevancy score is made redundant.

I can’t seem to add a date boost to the relevancy but have figured if I could Sort the date in blocks of time ( i.e. a day ) this would give me the results that I’m looking for.  Then items to be sorted by the day they are posted; and then by relevancy.

I understand that in SQL I can use ‘ GROUP BY datepart’ to do this.  Has anyone done anything like this in Views.


texts: Ubercart review order button redirects to cart page, does not allow checkout

texts:
I am using Ubercart 3.3, Secure Pages latest dev, and Drupal 7.18.

When I go to the site, login, and add a product to my cart all goes well.  I then go to the cart page which shows correctly and I click checkout.  It then redirects me to the checkout page where I fill in my information and choose paypal as my payment of choice.  When I'm all done I click review order at the bottom of the form and it redirects me back to the cart page instead of the review order page.

To make matters worse, after that happens I can no longer get back to the checkout page, every time I click checkout it just redirects me back to the cart page.

Some things i've checked:

User 0 is in the database
Clearing cache
Truncating the cache tables
Try a different product
Applied patches Secure Pages requires
Adding $conf['https'] = TRUE; at the bottom of my settings.php file


texts: How do I load several feeds sequentially and in order?

texts: I have a site which loads its content nodes using Feeds module. I load several nested taxonomies, and, as indicated in the docs, I use several different feeds. These are called sequentially by hand. How could I configure a cron so the feeds are called in exactly the same order as I would define? I have read the documentation and cannot find it how. Must I configure something here?


texts: How can I remove the "This translation is published" checkbox?

texts:
In my custom entity module I have already defined a status checkbox to determine the entities status. What I noticed is when I enable show_revisions_ui in the annotation and have the entity setup to support multiple languages there are two check boxes at the bottom of the page.

One of them is to publish this entities language copy and as a result the published checkbox I created is being ignored. How can I disable the multilingual published checkbox?


texts: Form submit is not working in custom module

texts:
I’ve build several custom modules which connect to webservices.

They  works fine except one where i need to validate a form.

If i execute the function inside controller (without the need to validate the form), the datas are sent so i can say the php is ok.

My problem is the form button is not working.

<input type="submit" class="btn btn-success">

or

<button type="submit" class="btn btn-default">Valider</button>

doesn’t submit the form in front-end (and doesn’t reload the page).

I’ve read topics on this and solution seem to do something like :

public function buildForm(array $form, FormStateInterface $form_state) {

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

return $form;
}

But i don’t how to do since the "controler class return" is :

output = array();

        $output['dc'] = array(
            '#markup' => $tableau,
            '#allowed_tags' => ['table', 'caption', 'thead', 'tbody', 'input', 'thead', 'tr', 'td', 'th', 'label', 'p', 'h2', 'button', 'radio', 'div'],
            '#attached' => array(
                'library' => array(
                    'webservices_xxx/bootstrap.bootstrap-datepicker'
                ),
            ),
        );
        return $output;

ps : i know, allowed_tags is a bit uggly here but i don’t know for now how to use #type or #theme, that would be an other question.

Actually, i use  '#markup' => $tableau, because i have a form but also somes tables.


texts:
My Drupal 7 site is working nice and most of my static files are served via CDN. I use CDN module with Origin Pull however CDN didn't pull the files from my misc folder where there are small png icons (came with vanilla drupal installation).

In CSS, I have used url('sites/all/themes/mytheme/img/bg.png') for background and I can see the background, and it is served via CDN. In the same CSS I have url('misc/configure.png') but this one is not working. I see 404 for configure.png while checking from Developer Tool.

So, I added the path in CDN module's whitelist like misc/*.png and did all those flushing and cron for CDN to recognize the file. Still CDN didn't pull the file. I have set the file permissions to 775 too, but nothing changed. Any help would be appreciated.

Edit: the 404 is only for the picture, I checked it via chrome's Developer tool. It shows the path https://myCDN/misc/configure.png (which is missing), whereas for background it shows https://myCDN/mysite/sites/all/themes/mytheme/img/bg.png.

However, the notable difference is in configure.png the name of my site is not present in CDN path. If I change the path via Chrome Developer Tool like https://myCDN/mysite/misc/configure.png It works, the image shows. It also works if I use absolute url in CSS like url('https://mysite/misc/configure.png')


texts: Display 3 items by default in a multivalue field?

texts:
I have a field collection which is a multivalue field with unlimited values.

when I opens the form, the field collection has a set of fields with "add another item" button. When I click the button, it adds one more set and so on.

Is it possible to have 3 sets by default and when the "add another item" button clicked, one more set is being added and so on?


texts: Drupal Feed importers: Update Node values without needing to include all values in Feed

texts:
Currently when I try to import data through a feed, importer, if any field from the mappings is missing then the data for that field gets overwritten. This is despite of selecting

  Update existing nodes

or

  Replace existing nodes

Thus how can I ensure the data does not get overwritten with blank even though those mappings are provided but the column is not included in the csv.

Thanks.


texts: Jump Menu Style Dropdown To External Links

texts:
I'm attempting to create a jump menu of links to external websites, and I would like to be able to order the links within this menu differently depending on the organic group of the current user attempting to access it. So far I've tried to accomplish this using views with nodequeue, and have come somewhat close, but its beginning to feel like a dead end..
 Does any module(or combination of modules exist) which would allow me to accomplish this without having to write my own?
Ideally each will be able to reorder the links according to their personal preference and override the default ordering of links. but that is not essential at this point


texts: How to populate File Description Field programmatically?

texts:
Hello I'm migrating data to my website and will like to populate File Description programatically so files display the same names on the previous website.

Many thanks.


texts:
I have created a Vocabulary (categories) with terms (term1, term2, term3..etc). After that I created a content type (Product) with fields title, description, image. Also, created field called "product type" which is a term reference (categories). Furthermore, I am displaying  all terms list in page like term1 term2 term3 with link.

When I click on term1 I want to display related products name, description, image with full details link. I am currently displaying only term related product title with read more link only.
[![enter image description here][1]][1]
Please Advice.


texts: How to pull commerce_customer_address into the invoices view?

texts:
I'm using Drupal Commerce for a hotel booking site so it's not following the typical Commerce use case. It works very well except for an issue I'm having where the Billing Info is not being automatically populated with the Account Info. This works in Commerce but not the way I'm using it. I spoke to some Commerce peeps and they confirmed this. As a work around and since I'm not using the Billing Info fields anyways, I thought why not just use the Account Info fields?

Well the problem is that I can't seem to call on commerce_customer_address in the invoices view. I don't see it in the relationships section. Does anyone know how I can do this? As a proof of concept, I added an entity reference field to orders and was able to manually pull the address from Account Info. I'd like to automatically pull this info.

Thanks.


texts:
I have been trying out the Message module. I am using it to send notifications to users' profiles whenever a node of a certain content type is added (a simple hook_node_insert() in combination with Message::create()). These notifications are displayed in a view block on the user's profile page (this block is an alteration of the base Message View. Let's say these are nodes whose content type is Event, and each of these nodes has a taxonomy term reference field called Event type (e.g. Sports, Conference, Concert, etc.).

Let's say that a user only wants to be notified about events for which the value of the Event type field is Concert. In the user form, I have provided a field which contains checkboxes for all of the different event types (its a list of all of the terms that come from the Event type vocabulary). Whenever a user visits their profile page, they should only see notifications for the event types they've selected.

I haven't been able to find a solution for how to implement this either at message creation or through some sort of view block hook. I am now trying to do it through Views filters/relationships.

To make the long story short, my view block contains a list of Message type entities, each with an event_type field that references a single taxonomy term. Every user entity on the page has a event_notification_preferences field which is basically an array of taxonomy terms selected by the user.

What I would like to do can be explained through an example. Let's say the view contains three messages, each with a different event_type field (Sports, Conference, Concert). The currently logged in user's event_notification_preferences array contains only one reference (to the Concert term).

How can I filter the view to display only those messages whose event_type field is relevant (i.e., it has a corresponding match in the event_notification_preferences array, in this case Concert)? Is this possible?


texts: Delete button not working in Checkout page

texts:
I created a Rule on event 'After adding to cart' to action 'Page redirect' to redirect straight to Checkout page (at /checkout) so it skips the Cart page.
The cart page by default has the Line Item: Delete button and its title is 'Remove' and it works.
I decided I wanted same in the Checkout page and it is easy to add, just edit the view and add the 'Line Item: Delete button'.
But it does not work. Also for some reason its title is 'Delete', not 'Remove'.
When clicking Delete it refreshes the page giving errors 'There are errors on the page. Please correct them and resubmit the form.' under 'Shopping cart contents' and another error under 'Billing information' which simply says to fill in the form details:

Address field is required.
Postal code field is required.
City field is required.
Full name field is required.

Which makes no sense, I'm just trying to update the cart contents inside the checkout page.

Even better. If I do fill the forms and click to delete the product from cart, it redirects straight to Review page. But I didn't even click the 'Continue to next step' button.

?


texts:
I am looking how I can change the location that drush deals with when updating modules.
I want to set it to /sites/all/modules/contrib.

I have suceeded in changing the download (drush dl) location with  $command_specific['dl'] = array('destination' => 'sites/all/modules/contrib'); in drushrc.php

How can I set this for updates. I guess something needs to be rebuilt?

I have seen something about using drush-remake with --contrib-destination set, but then im told i need to specify an "installation profile", is this really the proper way to set this?

Update: When I run pm-list in sites/ it sees the modules but says they are not installed.


texts:
I have a web service with the Services module that works perfectly, with an URL like myweb.com\api\my_conent\124 I obtain the information of my_content that has the 124 id.

Now with the URL myweb.com\api\my_content I want to obtain all the contents of my_content, but it doesn't return anything, a blank page. I have the 'optional' => TRUE, for the arguments.

How can I use the web service with one or none arguments?


texts:
What would be the best way to update file uploads (updating the content of the file, not the target_id) using REST in Drupal 8?

We have a bunch of files in GIT that we will create entities for (custom entity type) and upload the files (using core or JSON API) etc using the existing POST method.

What I am not clear on is how we can update these files - we can't just create a new file_upload as that will change the file name and create a new file entity, however we need to overwrite those files not file rename exists.

So questions are:
1. Is there an existing way to do this?
2. Should we build a custom PATCH method to achieve this?

Any advice or pointers much appreciated.


texts: Alter Multiple Field Values by Testing "Field Type"

texts:
Drupal 8.x

I would like to alter the value of all/any ckeditor/text fields on a node.

Currently working with HOOK_node_presave().

Ideally, I'd like an agnostic approach that doesn't mind where the field is coming from, e.g. paragraph, node, taxonomy, etc.

How can I loop through all fields, check the field type, get and replace the value?

MYMODULE.module

Working with the below code gets me close I think:

use Drupal\Core\Entity\EntityInterface;

function MYMODULE_node_presave(EntityInterface $entity) {
  $fieldsArray = \Drupal::service('entity_field.manager')->getFieldMapByFieldType('text_long');

  foreach($fieldsArray as $longTextName=>$key) {

    kpr($key); // This returns an array of the values I need.
    if ($entity->hasField($key)) {
      $entity->get($result)->value = preg_replace(
        $toReplace,
        $replaceWith,
        $entity->get($result)->value
      );
    }
  }

}

Try #2;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;

function MYMODULE_presave(EntityInterface $entity) {
  // Get form config.
  // Get config Node field names.
  // Get config Paragraph names.
  // Get config Paraghraph field names.

  // Loop through our Node field names.
  foreach($nodeFieldNames as $fieldName) {
    // Check if the entity has field.
    if ($entity->hasField($fieldName)) {
      // Get the field.
      $entity->get($fieldName)->value = $newValue;
    }
  }

  // Loop through our Paragraph names.
  foreach($paragraphNames as $paragraphName) {
  // Check if the entity has field.
  if ($entity->hasField($paragraphName)) {
    $paragraphs = $entity->$paragraphName->getValue();
    foreach ($paragraphs as $paragraphItem) {
      $p = \Drupal\paragraphs\Entity\Paragraph::load( $paragraphItem['target_id'] );
      foreach($paragraphFieldNames as $paragraphFieldNamesitem) {
        if ($p->get($paragraphFieldNamesitem)->value) {
          // kpr($p->get($paragraphFieldNamesitem)->value);
          $p->get($paragraphFieldNamesitem)->value = $newvalue;
          // kpr($p->get($paragraphFieldNamesitem)->value);
          // This does alter the value, just does not get saved.
        }
      }
    }
  }
}


texts:
My requirement is to convert a views page into a PDF. I have created the views page with table formatting and a PDF plugin attached to the header that allows one to download the views page as PDF. I created an entity-print.html twig template and an HTML structure copied from the answer in this post How to customize entity print pdf and created a twig variable 'footer' in THEME_preprocess_page function in the theme's .theme file but the calls {{ footer }} to that variable in the template returns nothing.
In other to at least test CSS formatting, I placed these in the respective files:
ENTITY-PRINT.HTML.TWIG

    <meta charset="utf-8">
    <title>{{ title }}</title>
    {{ entity_print_css }}

{# The footer is repeated on all pages and must be printed first. #}

    {{  footer  }}

{%  if cover_page  %}

    {{ cover_page }}

{%  endif  %}
{# The header is repeated after the cover page for all pages. #}

    {{  header  }}

    {{ content }}

THEMENAME.THEME
function THEMENAME_preprocess_page(&$variables) {
  $variables['footer'] = "HERE IS YOUR FOOTER";
  $variables['header'] = "HERE IS YOUR HEADER";
}

IN .INFO.YML
entity_print:
 views:
   views_page_machine_name: 'theme_name/result-pdf'

IN .LIBRARIES.YML
result-pdf:
  css:
    theme:
      styles/result-pdf.css: {}

IN CSS FILE (i.e. result-pdf.css)
* {
    color: red;
}

div {
    background: blue;
}

and then created result-pdf.css but the styles did not change anything in the generated pdf.
One of the answers in another post Entity print get variable in twig template pointed to creating an entity specific template for layout of the PDF  with HTML as required. For example, for the article content type you have node--article--pdf.html.twig. What is the template suggestion for a views as described in my case?
The question is how do I achieve:

create a HTML layout format that is fed all the fields from the views page
rightly set the footer/header variable for output in the entity-print.html template mentioned above
turn bullet into A pdf (so that the download link on the views page generates the formatted html as pdf).

Perhaps bullet 1-3 is irrelevant, a step by step direction on how to have a views page formatted as required and converted to PDF using the entity print module will be appreciated.


texts: How to hide a content type on the node add page?

texts:
I need a way to hide a content type on the node add page, or better yet, make two separated node add pages that separate my content types. I'm on Drupal 7 and have four different content types. I would like three of them to be on the default node add page and the fourth to be separate. How would I do this?
Thanks


texts: Redirecting a user to a different home page

texts:
I am trying to create a site where any logged-in user is redirected to a page that is specific for that user, when the user logs in.

Suppose that U1, U2, U3 are three users on that site. U1's home page should be http://www.example.com/u1; if U1 created any link, the link should be displayed on http://www.example.com/u1, not on http://www.example.com/u2, or http://www.example.com/u3.

I also want different admin panel for each user logging in.


texts: Creating a new variable by combining 2 field values

texts:
In my theme’s preprocess node function i’m trying to create a new variable by combining 2 existing fields, both of which are text strings.
pseudo code is this:

$teachers_name = $firstname + $lastname;

When looking at a print out of the Teacher object using Devel, i see the field first name is an array, structured like this…

field_first_name
    und
        0
            safe_value ‘Lisa’

but so far it’s not working at all. i’m not accessing the variables correctly.

function myTheme_preprocess_node(&$variables){
    if($variables['type']=='teacher') {
        $variables['teachers_name'] = $variables['field_first_name’][‘und’][0]    [‘safe_value’];
    }

how can i access the text string of field 'first name'? thanks!


texts: Superfish themable hooks not getting called

texts:
According to superfish.module these following theme hooks are available.

 function theme_superfish($variables) {

    function theme_superfish_build($variables) {

    function theme_superfish_menu_item($variables) {

    function theme_superfish_menu_item_link($variables) {

but for some reason using these in my template.php only theme_superfish is getting called.

function nph_superfish($variables){
 dpm("nph_superfish");

        dpm($variables);

  return "HTML";
}

works

function nph_superfish_menu_item_link($variables) {
dpm("theme_superfish_menu_item_link");
      $menu_item = $variables['menu_item'];
      $link_options = $variables['link_options'];
      return l($menu_item['link']['title'], $menu_item['link']['href'], $link_options);
    }

doesn't work

This post is probably the most comprehensive to answer the question for what I am trying to achieve (I want to add classes to menu items based on the title).  Any ideas what might be happening?

UPDATE:

I just noticed a setting on the settings page, not mentioned in any of the answers I found around the web....

UPDATE: I've  just noticed it says Default:enabled ..., so by checking it I'm disabling it...


texts: Use an Address Field with 3 lines for the street

texts:
I'm working on an Entity where I created a field containing Address informations (like country, city and street).

The default Address Type in Drupal 8 supports only 2 lines for the street information. Is there a way to add an extra line?


texts: I want to run some maintenance scripts against a Drupal 7 system. These scripts will call the Drupal API to use things like EntityFieldQuery, node->save and so on. I could create a module called maintenance_scripts which has a forms interface to launch the scripts with and to display their output, but I'd rather just run a script from the command line. Is this possible?


texts: "Undefined index: und" Error fetching array in node form

texts:
I am facing this error in node form when I going to be print title of the body field.
Error:

  Notice: Undefined index: und in include() (line 4 of C:\wamp\www\drupalapi\themes\bartik\article-node-form.tpl.php).

I need to print the title of the body field, and my code looks like:

print $form['und']['#title'];

And shortly, the array is:

Array
(
[#type] => container
[#attributes] => Array
    (
        [class] => Array
            (
                [0] => field-type-text-with-summary
                [1] => field-name-body
                [2] => field-widget-text-textarea-with-summary
            )

    )

[#weight] => -4
[#tree] => 1
[#language] => und
[und] => Array
    (
        [#theme] => field_multiple_value_form
        [#field_name] => body
        [#cardinality] => 1
        [#title] => Body
        [#required] => 0
        [#description] =>
        [#prefix] =>
[#suffix] =>

        [#max_delta] => 0
        [#after_build] => Array
            (
                [0] => field_form_element_after_build
            )

        [#language] => und
        [#field_parents] => Array
            (
            )

What i am missing in my code to print the title of the body field. Thanks


texts:
I like to add a "help tips" link next to the search button. I made some changes on the "search-block-form.tpl.php" (see below) but it does not show on the search result page.

Some documentation on the web suggests using function hook_form_alter to make the changes. Thank you in advance

  <?php if (empty($variables['form']['#block']->subject)): ?>

<?php print t('Search form'); ?>

  <?php endif; ?>
  <?php print $search_form; ?>
  help_tips


texts: Webforms: Is it possible to set a delete field button?

texts:
As far as I understand there is not possible do delete the field value of file upload fields but rather replacing the field with an empty one.

Is it possible to add this button using JS and thus delete the text path inside the field without refreshing the page (PLAIN SIMPLE)? Otherwise I am afraid i need to use a php solution with page refresh.
If not is it possible for 'Delete' to emulate the 'Browse' button? I mean when hitting 'Delete' to actually browse for another file?

ps. I know webforms are using their own implementation but I am force to find another solution


texts: Using compass in Aegir limited shell (user o1.ftp)

texts:
I installed the latest BOA-stable and after it RVM with Compass and SASS. According to the changelogs of BOA-2.0.4, I should be able to use Compass commands:

  Fixes:

  Allow all standard compass/sass commands in limited shell.

As root, I am able to execute 'compass watch', but I am not with the limited shell (as user o1.ftp). It says:

sh: 1: compass: not found


texts:
CKEditor was initially working correctly. Now it's removing all the line breaks and the font size and color changes in my text.

The source code still shows , , , and  tags (with closing tags), but even the list does not begin on a new line. When I format a line as a headline, it gets smashed together with all the other text.

I followed all the steps posted by
sємsєм
201112 at Drupal CKEditor module remove line breaks, but the problem was not solved.

I know html well, but I'm not skilled with css or php. Can I solve this by inserting css styles into the source code? Since the editor worked correctly earlier, I think I must be missing something.
Thanks.


texts:
I'm using Drupal 7 and Clean theme. And i want remove only submitted by admin, dont remove date info.

Looked node.tpl.php and node.module files but not seen this fields. How can i remove this info?


texts: How to debug 404 on user/login user/register user/logout?

texts:
I have a Drupal 8 site on 8.4.2.  When I upgrade it to 8.5.1, after running the database updates, the paths /user/register, /user/login, and /user/logout return a 404.

I can log in with Drush (drush uli myuser), so it is possible to actually log in, but the log in page is not displayed.
I tried uninstalling my custom modules, but the problem persists.
I looked at /admin/reports/dblog, but it just says "page not found" as the error for /user/login.

This question about a similar problem was closed as off topic because it was too specific; my question is about "how can I debug this?" not "what is the cause of my problem?"


texts: Creating Custom Drupal 7 Registration Form

texts:
I am trying to create a custom registration form on D7.
According to this article

The steps should be (theme name is icompany)

Modify template.php to override the registration form

function icompany_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','icompany'),
    'template' => 'user-register',
    'preprocess functions' => array('icompany_preprocess_user_register_form'),
  );
  return $hooks;
}

Create a second function which builds the form

function icompany_preprocess_user_register_form(&$vars) {
  $args = func_get_args();
  array_shift($args);
  $form_state['build_info']['args'] = $args;
  $vars['form'] = drupal_build_form('user_register_form', $form_state['build_info']['args']);
}

Create user-register.tpl.php with the newly styled form

My problem is this does not work.  My custom form does not seem to be called.

The alternative approach is to create page--user--register.tpl.php.  This sort of works, any text I put on the page appears but the form fields do not using the syntax

<?php
print render($form['account']['name']);
print render($form['account']['mail']);

?>


texts: Forbidden 403 when trying to update modules

texts: I just updated drupal core to 7.36. Next I needed to update some of my modules. I get through the auto download process, but when I proceed to the update I get a 403 error when trying to access authorize.php. Has anyone else had this occur, and what can I do to fix it?


texts: how to call a JQuery function inside an ajax callback function

texts:
I have a custom module, this module has a form with an ajax submit callback

$form['submit'] = array(
'#type' => 'submit',
'#ajax' => array(
    'callback' => 'mymodule_submit_driven_callback',
    'wrapper' => 'box',
),
'#value' => t('Submit'),
);

I into the callback function I need to call a JQuery function:

function mymodule_submit_driven_callback($form, $form_state) {
//call JQuery function here
}

How can I do this? Thanks.


texts: javasript invoking custom module to update user response

texts:
I have created Multiple choice questions in drupal . One node (page ) has one mcq . The answers are displayed by simple radio buttons and javascript .
Now  I am planing to give some dynamic behavior to users . When a user click the wrong option , I want to capture the response in a custom table in drupal , having userid , nodeid .
can I invoke a custom module by the present javascript  which gets the userid and nid and update the table . I did some  research , and found that form hook is the way to do such things ,But i have hard time understanding this. Can someone please give me right direction .

Thanks a ton !


texts: Drupal 8 - Variables - Template Twig - Cache

texts:
In the HOOK of my project XXX_preprocess I am defining a variable based on a cookie.

My Hook function

function XXXXXX_preprocess(array &$variables) {
if (isset($_COOKIE[personsSearchCookie]) && !empty($_COOKIE[personsSearchCookie])) {
    $personsFilter = explode("-", $_COOKIE[personsSearchCookie]);
    $variables["personsFilter"] = array (
        "filterType" => $personsFilter[0],
        "filterId" => $personsFilter[1]
    );
}

But in the Twig template, it always gives me the initial value of that variable, it never changes.
My Twig code:

Filtering results by [{{ personsFilter.filterType }}]

{% if personsFilter is defined and personsFilter.filterType is defined and personsFilter.filterType is not empty %}
    {% if personsFilter.filterType == "area" %}
        Filtering by Area

    {% endif %}

    {% if personsFilter.filterType == "office" %}
        Filtering by Office

    {% endif %}
{% else %}
    No filtering
{% endif %}

This should be a cache theme, right?

How can I make so that when my cookie changes, the variable is modified and since twig can access the new value?

In the prepreocess function in all re-loads, the variable change correctly, but, in twig, the variable have bad value.

Thank you!


texts: Getting Currency Multiplication Factor defined in rules in template.php or other block etc

texts:
I have a rule setup for converting INR to USD using IP to Country module as follows.

{ "rules_convert_to_usd" : {
    "LABEL" : "Convert to USD",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "ip2country", "commerce_line_item", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "ip2country_user_country" : { "countries" : { "value" : { "US" : "US" } } } }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_multiply" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : "0.025",
          "component_name" : "base_price",
          "round_mode" : "1"
        }
      },
      { "commerce_line_item_unit_price_currency_code" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "currency_code" : "USD"
        }
      }
    ]
  }
}

Now I want to get that multiplication factor(.025 in this case) in some custom template view pages, Is that possible?


texts:
I'm using the Calendar, and Date modules to create an agenda on a website. However, when I create an event with a start and end date, it also shows the event on the next day. While this is useful for true multiple day events, it is not for party that start late and end late, as I want them to only show once (at the start date).

Is it possible to fix this?

For clarification: I'm using the Date (ISO format) field.


texts: Trying to get a property of a non-object in 'mymodule_node_access()'

texts:
In a custom module, I try to make this code work :

function mymodule_node_access($node, $op, $account) {
  if ($node->type = 'devis' and $op = 'view') {
    $field_language = field_language('node', $node, 'field_project');
    $project_node = node_load($node->fields->field_project[$field_language][0]['value']);
    if ($project_node->uid == $account->uid) {
      return NODE_ACCESS_IGNORE;
    }
    else {
      return NODE_ACCESS_DENIED;
    }
  }
}

I get the following notice:

  Trying to get a property of a non-object in mymodule_node_access()

I don't know where the problem is.


texts: Display views result from a certain entry on

texts:
I have a ranking list on my Drupal site (Database output sorted by points, and I assign a rank via the field "Global: View result counter"). Now, displaying the entire ranking list is no problem. But I would also like to add a view where a user can find himself in this ranking list and see the list from his position on (i.e. himself and then all users with lower points). Any idea how I could do this? Filters are not suitable, as they retrieve only a selection of the original ranking list from the database, hence the rank does not match anymore...

Thanks for your help!

Tobias


texts: View output add a class to first and last rows

texts:
I'm trying to output views and i'm using 960gs as well.

It possible to enable views processing so views knows if it this is the last one of the row and that way i can add a class "alpha" to the first view out put and "omega" to the 4th item and last item?

Update: Looking for primarly a php solution; not a jquery one; as it's not best practice to utilize javascript to manipulate layouts (IMHO).


texts: Statistics module doesn't show the "Enable access log" checkbox

texts:
Drupal 8 Statistics Configuration http://curiosidad-racional.tk/drupal8statistics.png

I dont know what to do to show "Enable access log" option.

I activated logging all messages and checked all statistics permissions.

Thanks.


texts: How to send comma separated taxonomy term (as link to taxonomy term url ) from preprocess to twig file as single variable?

texts:
According to my requirements I have to use views preprocess and views-view.html.twig

function MYTHEME_preprocess_views_view(array &$variables) {

  $aliasManager = \Drupal::service('path.alias_manager');

    if (isset($variables['rows'][0]['#rows'])) {
      $nodeValues = [];
      foreach ($variables['rows'][0]['#rows'] as $value) {

        $nodeValue['created'] = $value['#row']->_entity->created->value;
        $nodeValue['external_url'] = $value['#row']->_entity->field_url->uri;
        $nodeValue['title'] = $title = $value['#row']->_entity->title->value;
        $nodeValue['nid'] = $title = $value['#row']->_entity->nid->value;
        $nodeValue['tid'] = $value['#row']->_entity->field_topic->entity->tid->value;

        // section referenced to node
        $nodeValue['section'] = $value['#row']->_entity->field_topic->entity->name->value;

        $topics = "";
        foreach($value['#row']->_entity->field_topic2 as $val){
          $topics != "" && $topics .= ", ";
          $topics .= $val->entity->name->value;
        }

        $nodeValue['topics'] = $topics;

        $nodeValues[] = $nodeValue;

      }

      $variables['node_values'] = $nodeValues;
    }

 }

In twig file :

{% for value in node_values %}

 {{ value.title }}

            {% if logged_in %}
                {% if 'premium' in user.getroles %}

{{ value.created|date(format='y-m-d H:i') }}

{{ value.topics }}

                {% endif %}
            {% endif %}

    {% endfor %}

Out put is like below :

Everything is working fine but I need to create Links of terms in above screenshot. And in code its TOPICS in preprocess function.

I have tried various ways to create it as link but that does not work as it just print a tags as html but not links. Please suggest.

Thanks!


texts: Separating User Picture from Submitted by date in Node

texts:
on my node pages (drupal 7) the user picture is displayed along with the submitted by date. I'd like to separate them somehow so I can style them separately.

Anyone know a great way to do this?


texts:
On each article page I have an annoying 'recent content' part underneath the articles written, along with an extra title (see screenshot). Is there a way to not show the recent content? (I've just started out so if the answer could not involve code that would be great) I've had this issue from the start, as far as I remember, and I've changed themes a few times, which didn't help. Display Suite doesn't do anything to hide / change position either.

That extra title by the way, also appears on the basic pages--only then it's the only title and it's still on the bottom of the page.

I'd be ever so happy if someone could help me out. Thanks in advance! :)

http://img560.imageshack.us/img560/5093/recentcontent.png


texts: How to customize a link with a custom module?

texts:
I installed the "Private Message" module on Drupal 8.

There is a link to send a message that I want to transform into a Bootstrap button.

How to customize a link on Drupal 8 ?

Here is the HTML code of the link :

Envoyer un message

The developer of "Private Message" gave me this code, but I do not know what to do with it.

I need to create a custom module or put it in my_theme.info.yml ?

function HOOK_node_view_alter(&$build) {
  $build['private_message_link']['#title'] = t('Click me. Click me now!');
}

The developer of the module wrote in a comment :

You can implement hook_ENTITY_TYPE_view_alter(). For example, if you are altering the link on the user profile you would implement hook_user_view_alter(). If you are altering the link on nodes, you would implement hook_node_view_alter(). If you are altering the link on comments, you would implement hook_ENTITY_TYPE_view_alter().

In this function, you can change the output of the link by altering $build['private_message_link'] as you see fit.

I created a custom module:

private_message_contact_button.module :

<?php

/**
 * @file
 * Hook implementations of private_message_contact_button module.
 */

use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;

function private_message_contact_button_node_view_alter(&$build) {
  $build['private_message_link']['class'] = array('button button--primary', 'btn');
}

The code works, but the button is not applied.

I want to add class btn btn-success

And I want to add an icon make awesome in front of the text

I have to put what as code ?


texts: How to add Search form/Advanced search form view to advanced forum pages?

texts:
I found two things in Advanced forum.

1. Advanced forum provides the views, one of which is advanced forum search as shown in the following image, which provide the specific search on the forum.

2. But it is a separate link, and totally separate page, if it will be under the title of the advanced forum topic and on every forum discussion page, it will be very suitable for visitors. As shown in this image.

Now, how to add that advanced forum box and advanced option selection box provided in views under the forum title? I mean all on all the pages of forum except the first main page. Very Thanks.


texts: I have a smart doc page on a drupal based website which has a submit button. From where to edit the submit button?


texts: How to make Shipping services available in Rules tokens (data selectors)?

texts:
I am using D7 and Drupal commerce, with a flat rate shipping service. In my country the VAT for both products and shipping costs must be included in the total VAT amount. But the only line items available in Rules are product line items. So in order for the VAT post to include the VAT for the shipping cost, I need the token:

commerce_line_item

... to also include the shipping service selected in the order. I have spent days trying to figure this out, with no luck. I have read this answer, but those suggestions does not work either. If I remove the filter that only shows product line items in the order summary view, the shipping shows in the table together with the products, which I do not want. And also the tokens still only reflected the product lines.

This is how I need it to look:

Product line item 1
Product line item 2
Product line item 3
   Net amount excl. VAT
   Shipping service
   VAT (including vat on products and on the shipping service)
   Total amount

Any help?


texts: How can I display reviews related to a profile?

texts:
I have tried everything I can think of but can not solve this. I would sooo much appreciate any help with the following:
I am using Drupal 7., latest Version. For displaying user details, I am using Profile2. In order to allow other users to give feedback about a member, I have installed the Reply Module, set up a reply bundle, and a reply type called Recommend. Recommend itself has two fields. I guess it is a form. I have embedded this in the profile page and it nicely displays on the View page of each member's profile. Reply has a reply-entity_id which is the same as the profile_id of the profile from which a reply has been created. Lets say a member submits a reply on the view page of another members profile with the profile_id 7. The reply will get the reply-entity_id 7.

I am trying to display the replies each member received from other members using Views (content panes).

However, I cannot separate the replies a member has created from the replies he has received. For days I am trying to make a relationship between UID and reply entity id or pass arguments from the URL to pick up the entity id. I have tried using EVA, content panes, entity references. Could anyone please let me know how I can achieve that the view displays only reply entity id created on a specific profile (both IDs are the same as explained above). Hope this makes sense. Many thanks in advance.


texts: Can some one please tell how it is possible to add the shipping prices from Add Product Page. Actually I want to add the field on product page where the store admin can define the rates for each specific product type.


texts:
I'm building a website that needs the following functionality -

So two different content types - work type profile and job type.

So work type profile contains a field 'Skillset A' and a 'Skillset B' so I can create this content type and select the different skills the type has.

Job type has lots of different detail about the job, like salary etc.

I want a user to be able to select their work type as stage one, and then select the salary level they require for the the second stage filter.

Then I want a list of jobs to appear that they can do based on the skills within their salary range (so the jobs that match their skillset profile)

And I want the jobs to then be further filterable by the skillset. So they can see all the jobs that match the skillset.

How would I configure something like this with views?

Thanks for your help!


texts: Migrate d2d – Problem with duplication of thumbnails

texts:
In order to be able to copy all files to certain specific subfolders in site/default/files during my migration från D6 to D7 I use the file class MigrateFileUri (as far as I understand MigrateFileFid does not care about destination directories). So, in prepareRow() I fetch the filepath from the legacy db for the main image and likewise for the thumbnail of that same product.

The problem occurs when there is only a main image and no thumbnail in a product node. What happens is that the thumbnail field gets the previuos thumbnail path used. This is my prepareRow():

public function prepareRow($row){
    // Always include this fragment at the beginning of every prepareRow()
    // implementation, so parent classes can ignore rows.
    if (parent::prepareRow($row) === FALSE) {
        return FALSE;
    }

    $fid = (isset($row->field_sensorimage) && !empty($row->field_sensorimage[0])) ? $row->field_sensorimage[0]: FALSE;

    if($fid != FALSE){
        $filepath = Database::getConnection('default', 'legacy')->query('SELECT f.filepath FROM {files} f WHERE f.fid = :fid',array(':fid' => $fid))->fetchAssoc();
        $this->addFieldMapping('field_sensorimage_newsite')->defaultValue($filepath);
    }

    $fid2 = (isset($row->field_thumbnail) && !empty($row->field_thumbnail[0])) ? $row->field_thumbnail[0]: FALSE;

    if($fid2 != FALSE){
        $filepath = Database::getConnection('default', 'legacy')->query('SELECT f.filepath FROM {files} f WHERE f.fid = :fid',array(':fid' => $fid2))->fetchAssoc();
        $this->addFieldMapping('field_thumbnail_newsite')->defaultValue($filepath);

        dsm($fid2);
        dsm($filepath);
    }

    return TRUE;
    }

This happens: if let's say the 100 first nodes has no thumbnail, it works as expected. No thumbnails are copied to the destination directory. But after the first node with a thumbnail all the following nodes that did not have a thumbnail in the D6 legacy site, gets the previous nodes' thumbnail all the same in the new D7 site.

Thanks to the 2 dsm() near the end of the snippet above I can confirm that no thumbnails gets duplicated within that if statement. There are about 50 thumbnails mapped. But the end result is that several hundred nodes gets duplicate thumbnails from other nodes.

So once the first thumbnail is migrated, that thumbnail path is inherited by all the following nodes and renamed with a number extension *_1.jog, *_2.jpg .... *_30.jpg as long as there is no thumbnail in the legacy field.

Now, where does this happen and how can I stop it from happening? I have rewritten the prepareRow() many times, but always with this same result. I am really stuck... Please help :-(


texts: View does not display attached file without Display field checked

texts:
I've got a view that exposes a list of nodes with fields: Title, Publishing date, Attached files.

If an attached file has checked the "Display" flag it is visible on the view result, but if the "Display" field is not checked the file is not visible.

Is it possible to show all attached files?

There are three files attached to node, but only two with "Display" checked, I'll want to show all files attached to node.


texts:
I am using Drupal-7 and I have installed login redirect module to redirect my page after login.

I read that this module allows redirect towards non-Drupal location.
So, does the Login redirect module is only for to redirect non-Drupal location? Can we redirect to the internal path thru login redirect module?

If this module allows internal path redirection as well, then what to write in Parameter Name?

For example, if we want to redirect it to google after login, then we have to write in parameter name like this:
user/login?destination=http://www.google.com

But, I am not sure about internal path. Can any one please guide me on that?

Thank You!


texts: How to use Drupal.behaviors in Drupal 7?

texts:
I have these codes in my druapl 7 theme js file (js/test.js):

 (function($) {
    alert("Hi");
    Drupal.behaviors.mythemename = {
      attach: function(context, settings) {
        alert("Bye");
      }
    };

 })(jQuery);

then I call this file using :

 drupal_add_js(drupal_get_path('theme', 'mythemename'). '/js/test.js');

in page--front.tpl.php file inside the theme folder.

But only the first alert is shown.
Why is it so? where is my problem ?


texts: How to add active class to a specific menu only, while ignoring other menus?

texts:
I have 2 conflicting menus I need to solve by adding an active class to a targeted menu only, they are a user menu and a profile and account settings menu which have overlapping links.

User Menu (in the header section of every page):

[username] (links to Profile2 page)

Account Settings  (i.e. change password, etc.)
Log out

Profile and Account Settings menu (appears in the sidebar of the profile2 and account pages):

View Profile (links to Profile2 page also)
Edit Profile
Account Settings (same link destination as "Account Settings" of User Menu)
Order History

Since I'd like to convey to my users that whenever they are in any page linked by the Profile and Account Settings menu (eg. Edit Profile)I tried using Context to set an .active class for "User Menu>Profile", which worked.

However, now that "User Menu>Profile" is active when I'm in "Edit Profile", since "View Profile" shares the same link destination as "User Menu>Profile", both "View Profile" and "Edit profile" are have an .active class, which is very undesirable.

Hence, I would like to know, if there is a way to use Context or any hooks to set an .active class for the User Menu only when I'm in the "Edit Profile" page?


texts:
I have a view /widgets with a couple of optional contextual filters of type "Has taxonomy term converted to ID", so the url can look like this:

/widgets/blue
/widgets/big
/widgets/small/green

And so on.

But there should also be a "current" contextual filter on the date field defined as such:

Currently, we used exposed date filters as such:

But for "current" widgets, my urls look like this:

/widgets/blue/small?field_date_value_op=<%3D&field_date_value%5Bvalue%5D%5Bdate%5D=2013-05-17&field_date_value2_op=>%3D&field_date_value2%5Bvalue%5D%5Bdate%5D=2013-05-17

How to make:

/widgets/blue/small/current do a filtering like field_date_value<=today && field_date_value2>=today ?
/widgets/past do a filtering like field_date_value2<today
/widgets/future to field_date_value>today


texts: How to navigate the URL after booking page

texts:
I have node content type for booking and created booking page in drupal 7 and same page is displaying error, confirmation and booking page. I am trying to split into three different pages(nodes) using same node--booking.tpl.php content type. I have custom booking.class.php that manages the booking process using two steps function prebooking and postbooking

After booking, I would like to redirect to xyz.com/booking-confirm if it's successfully booking and if it's error xyz.com/booking-error and currently, using xyz.com/booking for all actions.

What should I do? I am not sure, which option works. I have found this using some articles and stuck at this point.

Should I use header to redirect it?

header('Location: /booking-confirm');
header('Location: /booking-error');

Should I hook them in template.php?

function MYMODULE_user_register_form($form, &$form_state) {
    $form_state['redirect'] = 'path/to/somewhere';
}
Should I use drupal_goto to redirect it? it's in booking.class.php class?
Should I use hook_init? It's in template.php or booking.class.php ?

I am not sure, which is correct option to figure it out. I would like to split the URL using same content type. Any approach to solve the issue.


texts: Internal Server Error - Downloading attachments

texts:
I've recently migrated a Drupal 6.22 site from my local host (Xampp 2.5) to a remote, shared server - Fasthosts hosting services.

After uploading the files through ftp and importing the database, I couldn't access the site at all - it would return a 500 Internal Server Error. Trawling the Drupal forums and searching online, I found out that this was down to the .htaccess file, which I subsquently removed.

This allowed the site to load, but only the homepage. I then found a .htaccess file in the Drupal forum which someone had edited and I uploaded that, which gave me full access to the site - good times! However, after performing a walk-through of the site, I've found that I cannot download any of the attachments I've uploaded to some of the pages.

Is this a .htaccess issue? I've trawled many forums and posted several questions around the place, but no one has given a response yet. My mate highly recommended StackOverFlow, so I hope someone can help!

I've checked the server logs and it's states the error is that the file is not found! But I've deleted and re-uploaded then several times now.

Can anyone advise?


texts: Looking for a way to trigger an event for testing custom event subscriber

texts:
I am looking for ways to trigger an event in my local dev to check out a custom event subscriber. The actual event is triggered by Google social auth and I don't think it is possible to do that locally.

Is it possible to trigger events using devel


texts:
Hello it is possible to order the output of the paragraphs for example
Type of content Blog
I create a blog details field that calls the type of paragraphs and there I select image and description
In my content it goes in this order

1 Image
2 Description

In the view I call that field
blog details
and they appear to me
but based on the order of the node
But I don't want it to look like this

1 description
2 image

and always look in that order


texts:
I'm running Drupal 7.54 and for some strange reason my admin menu on top disappears. This happens sporadically, no telling what's going to happen next. I've done some searching and found

$conf['admin_menu_cache_client'] = FALSE;

I added this line of code to the settings.php file and that didn't help.

I was wondering if anyone else had experienced the same problem and tried any solutions.

below is the javascript error

GET https://www.nokidhungry.org/modules/comment/comment.css?otg3j2
smiah:18 Uncaught TypeError: Cannot read property 'prototype' of undefined
    at HTMLDocument.<anonymous> (js_lfuW81Xw_ijrPfg5E_XWjUDemAzqGwWRZunpwj_BL20.js:1032)
    at c (jquery.min.js:4)
    at Object.fireWith [as resolveWith] (jquery.min.js:4)
    at Function.ready (jquery.min.js:4)
    at HTMLDocument.q (jquery.min.js:4)
    at HTMLDocument.nrWrapper (smiah:18)
(anonymous) @ js_lfuW81Xw_ijrPfg5E_XWjUDemAzqGwWRZunpwj_BL20.js:1032
c @ jquery.min.js:4
fireWith @ jquery.min.js:4
ready @ jquery.min.js:4
q @ jquery.min.js:4
nrWrapper @ smiah:18

I think the error below is causing the issue and I don't know how to get rid of it.


texts: I would like to add a body id to a view page in Drupal 6 - would I modify template.php? I'm trying to figure out where to make the correct modification


texts: How to find formatter names for field_view_field?

texts:
I have to display field with field_view_field
I know I can use formatter name ('text_summary_or_trimmed' as example):

print render(field_view_field('node', $node, 'body', array(
'type' => 'text_summary_or_trimmed',
)));

But how can I find these all possible formatter names for the field?


texts:
Drupal doesn't call the theme function for my form in my module (error log: Theme hook wc_challenge_actions not found.). I found similar posts on stack exchange, but none of the solutions works for me.

Form declaration

    function wc_challenge_actions($form, &$form_state, weACT_Challenge $challenge) {
      $form['action_groups']['#tree'] = TRUE;
      $form['action_groups']['#type'] = 'fieldset';
      $form['action_groups']['#title'] = t('Action groups');
      $form['action_groups']['#theme'] = 'wc_challenge_actions';

      // rest of form definition, works correctly

      return $form;
    }

Theme function

    function theme_wc_challenge_actions($variables) {
      drupal_set_message('The theme worked!');

      // rest
    }

Drupal never calls this function... Any ideas?


texts: Continue to show the preview page after submission, adding the confirmation message

texts:
The preview page showing submitted values (rather than the empty form) is the ideal thing to show the confirmation message (and to adapt to better summarize what was submitted, as we have already done for the preview page).
Unfortunately, "Inline (reloads the current page and replaces the webform with the confirmation message)" and "Message (reloads the current page/form and displays the confirmation message at the top of the page)" both seem to reload to show the empty form, not the preview page.
Is there a way to change this, and show the preview page?
This is similar to the question show the preview page on confirmation instead, but this is for Drupal 8.  And if redirecting to submission results were recommended, i'd expect that as a pre-set option?


texts: Adding class attributes to a form prevents 'hasdatepicker' inheritance

texts:
I have a form to which I’ve added an input element of type ‘date’.  When I add a attribute-class property the date-picker behavior stops working. This is the code for the element:

$form['stop_date'] = array(
  '#type' => 'date',
  '#title' => t('Stop Date'),
  '#default_value' => date("Y-m-d"),
  '#id' => 'stop_date',
  '#attributes' => array('class' => array('dateSel-Fld')), // ADD CLASS TO FORM ELEMENT
  '#required' => true,
);

This is the HTML output:

<input id="stop_date" class="dateSel-Fld form-date required"
type="date" aria-required="true" required="required"
value="2016-03-11" name="stop_date" data-drupal-selector="stop-date">

When I remove #attribute, the HTML is the following:

<input id="stop_date" class="form-date required hasDatepicker"
type="date" aria-required="true" required="required"
value="2016-03-11" name="stop_date" data-drupal-date-format="Y-m-d"
data-drupal-selector="stop-date">

So, adding the attribute property prevents the default behavior of adding the 'datepicker' class to the element.

What am I doing wrong?

NewProtocol.php:

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements an example form.
 */
class NewProtocol extends FormBase
{
    /**
     * {@inheritdoc}
     */
    public function getFormId()
    {
        return 'NewProtocol_Form';
    }

    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state)
    {
        $form['#attached']['library'][] = 'GenoForm/GenoForm'; // attach css and js libs

        $form['stop_date'] = array(
          '#type' => 'date',
          '#title' => t('Stop Date'),
          '#default_value' => date("Y-m-d"), // default to today
          '#id' => 'stop_date', // ADD ID TO FORM ELEMENT
          '#attributes' => array('class' => array('dateSel-Fld')), // ADD CLASS TO FORM ELEMENT
          '#required' => true,
        );
        return $form;
    }

    /**
     * {@inheritdoc}
     */
    public function validateForm(array &$form, FormStateInterface $form_state)
    {
        $a = 1;
    }

    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state)
    {
        $a = 1;
    }
}

GenoForm.js:

/**
 * @file
 * Contains js for the GenoForm module.
 */

// attaches a keyup funcion to form element by id
// - needed to alter value in $form_state[values]
//(function($) {
//    $(function() {
//        $('#genotype_3_id').keyup(function() {
//            this.value = this.value.toUpperCase();
//        });
//    })
//})(jQuery);

GenoForm.css:

/*
    Created on : Feb 27, 2016, 2:19:35 PM
    Author     : michael.sullivan
*/
.dateSel-Fld {
    background-color: lightblue;
}

GenoForm.libraries.yml

GenoForm:
  version: 1.x
  css:
    theme:
      css/GenoForm.css: {}

  js:
    js/GenoForm.js: {}
  dependencies:
    - core/jquery


texts: How to get current path for user profile field?

texts:
On the user profile page, I want to add link field which will link to a view page.

For example,
if the current path is:

sitename/user/1 (profile page of user-1)

The link should be:

sitename/user/1/view-page

It should take the user-id from the current-path. It should redirect to sitename/user/1/view-page, in general sitename/user/%/view-page, which is my contextual view path.

How can build this link field for the profile page?


texts:
I have a form with a submit button :

$form['my-custom-submit'.$i] = array(
    '#name' => $nid,
    '#type' => 'submit',
    '#value' => 'Delete Node',
    '#submit' => array('::deleteNode'),
);

This submit button calls this function :

public function deleteNode(array &$form, FormStateInterface $form_state, $nid)
{
    // My Delete function($nid)
    drupal_set_message('Delete : '.$nid, 'status');
    $form_state->setRedirect('my-route');
}

How can I pass the $nid parameter to my deleteNode function ?
Or if there is a way to get the '#name' in my function, it could be perfect too.
I cannot pass it through a $form_state->getValue('abc') because it is a list of incremented ids : $form['my-custom-submit'.$i].

I have searched google for 4 hours without finding, but I'm pretty sure that there is a simple way to accomplish this (newbie).

Thanks in advance.

Edit :
I found that the '#name' and value of the submit are passed to my function, I can get it like this :

public function deleteNode(array &$form, FormStateInterface $form_state)
{
    $last_nid = '';

    foreach ($form_state->getValues() as $key => $value) {
      $last_nid = $key;
    }
    // My Delete function($last_nid)
    drupal_set_message('Delete : '.$last_nid, 'status');
    $form_state->setRedirect('my-route');
}

Which isn't really elegant but does the job.
Is there a better way to get it ?


texts: Change the default value of a checkbox element

texts:
I have created 7 checkboxes using webform. I want the checkbox to be checked by default. For this I have used hook_form_alter() to change the checkbox as ticked by default. I have used the following code.

 function module_form_webform_client_form_31_after_build($element, &$form_state) {dpm($element);
     $element['submitted']['checkbox7'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox6'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox5'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox4'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox3'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox2'][1]['#checked'] = TRUE;
     $element['submitted']['checkbox1'][1]['#checked'] = TRUE;

     return $element;
  }

this code works fine for me. If I add another checkbox, I have to add another line of code. Is there a way to change the default value of all the checkboxes without to add a new line for every added checkbox?


texts:
An error kept showing after installing Search API for solr and after creating a server on drupal. (Solr 5.x)

You are using an incompatible schema.xml configuration file. Please follow the instructions in the handbook for setting up Solr.

Already copied alll configuration files from drupal module into:
/opt/solr/server/solr/my-core/conf

what else to check?


texts:
I have Drupal 7 site.
somehow - every time I make any change in the site- the caches flushed (all the anonymous users can see the changes).

I want that the anonymous users will be able to see the changes only after flushing the caches manually (by clicking on the "Flush all caches" button in the Performance module).

I tried a lot of thing but with no success. for example:

Use CacheExclude module
Disable it in Devel module
Use Cleaner module (disable the option in settings)

here is my performance settings:

Please try to help me with that!


texts: Using clientside_validation project, default validation plugin message not being overridden for states dependent field

texts:
I am currently using clientside_validation with clientside_validation_states to validate conditionally required fields.

The issue I am experiencing is when the conditionally required element is invalid (empty), it is showing the generic "This field is required" (from jQuery.validation defaults) instead of using a message that is typically seen (and shows on all other, non-conditionally required fields) - for example, "First Name field is required".

I am using a custom errorPlacement method, but I'm not sure that it matters:

    // custom error placement
    Drupal.clientsideValidation.prototype.replaceLabel = function (error, element)  {
      var label, origLabel;
      var wrapperClass = 'formReplacedLabel';
      var WrapperEl = 'span';
      label = element.siblings('label');
      if (label.find('.form-replaced-label').length === 0) {
        label.wrapInner("");
      }
      label.addClass('labelError');
      label.prepend(error);
    };

So, the error being passed (for the states dependent control) to the custom errorPlacement method is just the default $.validator.messages.required instead of what is passed for the other controls.  I can't just change .messages.required to something that is for this field specifically either, as I have several forms with state dependent fields.

I have attached an animated gif that I think can explain the issue better than I do.


texts:
Is there a way to allow the creation of nodes only via services and not via node/add?
I want that nodes are created by the users of a mobile application, and not using the web interface.

Is this possible?


texts:
I'm using Drupal commerce and I was wondering if there is a way to do partial search? Current the search engine is only searching the exact word. E.g. Candy or Battery I'm looking to search with only term 'Can' or 'Bat'. Please advise.
Thank you


texts: How to make exposed filter show results on another page?

texts:
Possible Duplicate:
  Expose Views filters both in a block but in the actual view also

I have a Views-based page (Page A) with exposed autocomplete filter. I want that filter form to appear in a block on Page B, but the search results should be displayed on Page A.

Unfortunately I have to search open value fields (node title), which eliminates Better Exposed Filters from play.

Does anyone know of a ready module that could work for me?


texts: How can I add variables from a preprocessor function to be used in an unformatted view template?

texts:
The variables I'm adding in my preprocessor function are not visible in the template for the unformatted view I've written. This seems to work fine if the template is formatted (the default).

That is, in template.php I set some variable $foo in the preprocessor…

function themename_preprocess_views_view(&$vars) {
  // Do view-specific preprocessing in here because of http://drupal.org/node/939462
  if ( $vars['view']->name === "viewname" ) {
    $vars['foo'] = 'bar'; // set $foo to be used in viewname templates
  }
}

…such that I can use it in views-view--viewname.tpl.php, <?php echo $foo; ?>. This works just fine.

However, $foo is undefined in views-view-unformatted--viewname.tpl.php.

Why is this? How can I store the results of my preprocessing in a variable I can then use in the template for my unformatted view?

Doing the preprocessing in a function specific to the unformatted view doesn't work because

such a function, themename_preprocess_views_view_unformatted__viewname(), will not be called due to a bug, and
working around the bug by defining its behaviour in, or calling it from, themename_preprocess_views_view() doesn't work

as above, where I seem to make changes to $vars that should be accessible in all viewname view templates,
nor can it be repeated specifically for the unformatted view templates because there's nothing in $vars that can be used to discriminate the unformatted from the default view.

Any help?


texts: multiple views want single search field is it possible in drupal?

texts:
I have developed Multiple views with multiple nodes.like(View1 , View2,View 3).

In these three views Name field is same.
so is that based on Name filed search feature is possible or not.
I have tried with views default search criteria,but its working for only particular views only.

any suggestions please?


texts:
I have already a theme using for my Paragraph, its view based so im doing this to print the fields:

{{content.field_title}}

{{content.field_description}}

<button class="main">{{content.field_link}}</button>

Everything is working as spected but i need to break on 2nd item and add a diferent class, how can i detect the 2nd item and change the class here? Im on a twig file.


texts: How to know when the language has changed?

texts:
I need to know when the language change in the site, because I need to performs some actions in this moment, I searched in the docs for a hook to perform this action (in my case this is the best option or at least this is what I think) but I can't find any hook related.

The language can be changed with the language switcher links or not and this need to be trigger for roles with some defined permissions.

I need this for Drupal 7 and Drupal 8.


texts: Add an image to a line item in drupal commerce

texts:
my client ask a site to sell printed canvas so I need to allow site users to add at least one image to every drupal commerce line item.

There is easier to start from a drupal kickstarter installation or a clean installation od drupal + commerce module?
There is some module to achieve this with drupal commerce?

Thank you


texts: Error during import (The header record must be an empty or a flat array with unique string values)

texts:
I want to import some content into my site from a CSV file (bellow) [the file is originally an .xlsx and I use a online CSV converter to get the CSV file)
format,type,name,address,id,ttx
open,semi-transparent,Thomas Chao,,rk39k3as22,coming soon

And here's my migration file:
id: migrate_content
label: 'Import content from CSV to CMS'
migration_group: migration
source:
  plugin: csv
  # Full path to the file.
  path: '/var/www/html/myproject/web/sites/default/files/migrations/test_1.csv'
  header_offset: 1
  ids: [id]
  keys:
    - id
  constants:
    status: 1
process:
  title:
    plugin: create_title
  field_format: format
  field_type: type
  field_name: name
# field_address: address
  field_ttx: ttx
  status: constants/status
destination:
  plugin: 'entity:node'
  default_bundle: granularity_type
migration_dependencies:
  required: {  }
  optional: {  }

When I run drush migration:import migrate_content, I get this error.

The header record must be an empty or a flat array with unique string values.


texts: Migration Group Not showing in Drupal 8 UI

texts:
I have created custom migration module and created two files in config/install folder with the following names

migrate_plus.migration_group.unp_taxonomy_terms.yml

migrate_plus.migration.industry.yml

After installing the module, I can not see the migration group in the UI
Can anyone please tell me how to solve the issue.


texts: Is there a way to set block visibility programmatically without using the PHP Filter module?

texts:
By enabling the core PHP Filter module, I can use PHP code to set the visibility of a block in the block configure page.

But I don't want to enable the PHP filter module for security measure. So is there a way to do it in custom module? I can't find a hook doing so. And a close hook hook_block_view_alter can only change the block content.


texts:
I'm using Pricing Attributes module, but i don't know how to show its in line item view, in shopping cart view and in shopping cart form view.

How do it?

Thanks


texts: Caching problem: Why does the pager of my pages module not work?

texts:
I am using the pages module in combination with the view module on the front page of my website.
This worked until recently, when my pager started to behave strangely.
The pager does not work anymore and always shows the same items for all the different pages according to the first page that is accessed after clearing internal drupal cache.

Examples: If internal drupal cache is cleared and the next session on my website starts on ?page=6, the correct items are displayed for page 6. However if any other user then visits the front page/page 1 or any user clicks on any page, it will always be displayed like page 6 as well regardless of page number.

If I clear drupal cache and start on ?page=2, I also have items from page 2 on all the other pages.

This seems to be a caching issue. It is true I have tried to optimize cachinge quite a bit and e. g. set browser caching for pages. However I disabled that again as well as caching of views and still the error occures. Somehow I feel like this might even be a bug and my reverse to not caching pages anymore does not work?

Of course I cleared internal drupal cache after each change.
Also the described paging error does not occure in the preview function of that module in the backend section. There the paging works just fine.

Additional information that could be an issue: Another module I have tried is "Boost" but I have disabled this module now.
Same goes for AdvAgg, in this case, however, I am pretty sure AdvAgg is not the problem because I have used it for a long time and did not have the issue.

Can you help me in this?


texts:
In a bundle of content types, I placed fields on many vertical tabs of the field group.
In order to switch display / non-display of the field, I moved and saved it without going well for each tab.
Movement of many fields and field groups at one time was not very easy.
t was saved with tab items and fields that do not belong to parent tab.
After that, even when tabs and fields were moved and saved, there was no change.

I think that the View mode is broken.
I also copied the broken view mode to default.
Therefore, all the view modes are deleted, the newly created view mode is copied from the broken default and remains broken.

Is there a way to restore the default view mode for a particular bundle?

Environment:
Drupal 8.5.6,
Field group module 8.x-3.0-beta1,
Display Suite 8.x-3.1


texts: In Activity Stream, how is the 'active group' determined when a node has multiple organic groups assigned to it?

texts:
I created new blog node in Drupal commons and assigned it to two organic groups. While it appears under both groups' Blog tab (view group_tab_blogs), it only appears under one group's Home tab but not the other.

On exploring the activity_log_stream view which is essentially the query for this tab, I noticed that it filters on the stream owner and does not search any other table.

My question is then, would I have to duplicate the row in this table or is there a way to have "multiple stream owners"?

Update:
After a bit more digging, I started playing with the rules area. Here I see that this rule fires after the creation of a Node. But, again, how is the 'active group' determined when a node has multiple organic groups assigned to it?

Update 2:
On Drupal.org, a bit more asking and digging lead to this bug report http://drupal.org/node/1294794 and even http://drupal.org/node/1256754.

Update 3
The above patch failed...


texts: Can't find migration when running drush migration:status

texts:
I'm trying a tutorial to migrate users data from a CSV file.
From here: https://u.group/thinking/drupal-8-csv-migration/
I've created a module as suggested. Here is the code:
/config/install/migrate_plus.migration.demo_user_migration.yml
id: demo_user_migration
langcode: en
dependencies:
  enforced:
    module:
      - user_migrate
label: 'User migration from CSV'
source:
  plugin: csv
  track_changes: true
  path: /config/users.csv
  header_row_count: 1
  ids:
    - Uid
destination:
  plugin: entity:user
process:
  name: Name
  mail: E-mail
  field_last_name: First Name
  field_first_name: Last Name
  status: Active status
migration_dependencies:
  required: {  }
  optional: {  }

user_migrate.info.yml
name: User Migrate
type: module
description: Custom Migrate of Users using a CSV file
core: 8.x
package: Migration
dependencies:
    - migrate_source_csv
    - migrate_plus
    - migrate_tools

user_migrate.module
<?php

/**
 * @file
 * Contains teacher_migrate.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function user_migrate_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the custom_user_migrate module.
    case 'help.page.user_migrate':
      $output = '';
      $output .= '
' . t('About') . '
';
      $output .= '
' . t('User Migrate') . '
';
      return $output;

  }
}

/**
 * Implements hook_migration_plugins_alter().
 */
function teacher_migrate_migration_plugins_alter(&$definitions) {
  $definitions['demo_user_migration']['source']['path'] =
    drupal_get_path('module', 'user_migrate') . $definitions['demo_user_migration']['source']['path'];
}

I've enabled the module from the Extend page.
However, when I run drush migration:status the migration I've created is not found. This confirmed by executing drush migrate:import demo_user_migration
Do you know where the problem can be?


texts: How can I Hide in Drupal 7 the bottom blocks in Add and Edit button for my content

texts:
I made a new content type in Drupal 7 without problems, but now I want to hide the bottom block in the content Add and Edit fonctions
This block as some url's parameters, comments parameters ...I don(t want to show to the users or registered users

I cant't find where and how I mask this blocks,
Thanks for your help


texts: Configuring views to display book pages as teasers, in the correct order

texts:
I am trying to display book pages as teasers, on the book cover node.

I created a Views block and display it under the parent node.

Book relationship is added, and a contextual filter as well.
Correct book pages are displayed in the block, but the problem is in the ORDER (weight).

None of the following criteria options work:

(Book parent) Book: Weight (asc)
(Book parent) Book: Hierarchy (asc)
The two above combined

Book pages are always displayed in the same order, which is not the same as order of pages in that book.

What am I missing? Any ideas?

Thanks!


texts: How to display command output programatically Drupal 8

texts:
Based on the input from this post I am running a command. Basically I need to run phpmetrics from backend, so administrator(or user has access) can run the latest custom module dependency status.

I created a config form, and on "submitForm" I an running the command with:

$process->run()

I need help to diaply the output of the command:

php ../vendor/bin/phpmetrics.phar --report-html=sites/default/files/metrics-report ./modules

It shows in console as:

Lines of code                               115
    Logical lines of code                       67
    Comment lines of code                       48....


texts: How to correctly add meta tags to custom menu items?

texts:
I want to be able to use the meta tag module for everything my site, but currently I have no idea how to add meta tags to custom pages. For example, I have this page:

function mymodule_menu()
{
    $items = array();
    $items['home'] = array(
      'title' => 'Home',
      'page callback' => 'mymodule_home_page',
      'access callback' => TRUE,
    );
    return $items;
}

function mymodule()
{
    $o = '';
    $o .= 'hello world';
    return $o;
}

Such a page doesn't get meta tags as it is a custom page. What is the best way to get meta tags on the page in this case? Or what is wrong with my strategy?


texts:
I am integrating code that implements its own extension of PHP's PDO class, in the same way that Drupal's DatabaseConnection does. So this code (which is various data models) needs to use this non-drupal PDO object.

This code needs DSN, username and password to access the default drupal database. I noted that $databases, defined in settings.php is not available: global $databases does not work to give me access to that data.

Is there a way to ask Drupal for this info or extract it from the default connection object?


texts: Is it possible to use Apache Solr to search across multiple sites?

texts:
I'm completely new to Solr and roughly understand the basic principles of setting up a search engine but not (yet) the specifics.

I'm beginning work on a site which will display search results from the content in the site (Articles), however, we also want to allow visitors to use the same search form to return - in the same page - results from both our own site, and from other external sites which could be indexed in Solr but are not Drupal sites.

Is this even possible or am I wasting my time? Many thanks for any insights.


texts:
I backuped my website with Backup and Migrate.
I made some tests and restored a few times successfully.

Then I created some fields (one of them is named field_date), and made some tests; I was not satisfied so I restored again.

Then I wanted to create a field named field_date, which should not be in the database after restore to previous state, but I got the following error message:

DatabaseSchemaObjectExistsException: Table field_data_field_date already exists in DatabaseSchema->createTable() (line 630 of /var/www/includes/database/schema.inc).

How is this possible? None of my backups works to turn the site to the initial state. Is this bug in the module I used for the backup, or is this feature and I should use more reliable backup utility?


texts: Preview template for node with custom template?

texts:
I have a custom content type, 'Article with Header' for which I have a custom twig template, 'page--article-with-header.html.twig', which manages the layout for this content type. When I preview the node before publishing, the template used is page.html.twig. I would like to have the same layout for previewing as for when the node is published, but I don't see any options for doing this. The template suggestions that come up in preview mode (page--node--preview.html, for example) would affect every content type.

Is there a naming convention for preview mode twig templates for custom content types that I'm missing? Is there a preprocessing function I can implement that will force the preview mode for this content type to use the correct template?