texts:
In my store, i am allowing customers to create products like Courses using Drupal 7 Commerce module, Is there a way using views or whatever method to enable the sellers on my site to see orders placed for their products?
Example:  If Stanley is Selling  Product1 and Product2, he will be able to see orders for  product1 and product2, for now only admin can see the orders.
Your help will be highly appreciated.


texts: How can I update all content of a content type with a newly added field?

texts:
I have a content type with a set of fields.

Hundred(s) of pieces of content have been created from this content type.

I recently had to go back and add a new field to the content type.

In order for all content of that content type that I previously created to show the newly added field, I have so far been going into each piece of content and adding in the field. This is going to take forever.

Is there another tool or process I can use to update all previously created content with the new field added to the content type?


texts:
On the frontpage of my drupal site I have set up multiple blocks that display content from different views however, in the Content block region my news block is showing a pager that I am unable to remove.

In the news block I have configured the Pager settings to display a specified number of items
and to use a more link that says view all. But the settings will not work in the content block region.

I have also tried to configure the frontpage with similar Pager settings and still no luck.

System Information:

Theme: Bartik 7.12


texts: Access a page.html.twig template variable in another twig template using a preprocess function

texts:
Drupal core 8.8.3 Version

Using a preprocessor function as below

function subtheme_bs_preprocess_book_tree(&$variables) {
  $variables['page_id'] = code here to read the node.nid variable required;
}

I can see the node.nid value I need using the kint function on the page.html.twig file, but cannot fathom how to call the variable into my book_tree preprocess function.

I have tried many combinations, and have no idea how to do this.

Image of the 'nid' I would like to access.

For this current page, it's 115.


texts: A view where a user doesn't have a certain content type

texts:
I am trying to create a view where a user doest have a certain content type.

Say for instance I have content types A, B and C and I only want to return results to show users who don’t have content type A but could have B or C.

I have created a view for (users) and linked it to the content authored. I have played about a bit but haven’t managed to find the correct filters. Can anyone help??

Many thanks

David


texts: Using a Service to expose better getter methods for a Node instance

texts:
Currently we use a Service that takes an NodeInterface object as an argument and then gives back a value, i.e:

  public function iFullyBooked(NodeInterface $node) {
    $fully_booked_field = $node->get('field_fully_booked')->first();
    $value = $fully_booked_field->getValue();

    return $value['value'] === "1";
  }

This works, is testable, but is this a good approach to take? We don't want to put all these preprocess things in a hook, since that function would be ridiculous long and not very nice to work with.

Would this be considered bad practise, and if so, is there a better way?


texts: template associated with views style-plugin, and then customized for particular view: views does not find template

texts:
I have a style plugin, 'mystyle'. And I created a view, 'myview', with style set to 'mystyle'.

Here is the declaration of 'mystyle' in hook_view_plugins:

function mymodule_views_plugins() {
  $plugins = array(
    'module' => 'mymodule',
    'style' => array(
      'mystyle' => array(
        'title' => t('My Style'),
        'handler' => 'mymodule_views_plugin_mystyle',
        'theme' => 'mymodule_views_plugin_mystyle_template',
        'uses fields' => TRUE,
        'uses row plugin' => FALSE,
        'uses options' => TRUE,
        'uses grouping' => FALSE,
        'type' => 'normal',
        'even empty' => FALSE,
      ),
    )
  );
  return $plugins;
}

I have the following files in mymodule/views:

(handler)
mymodule_views_plugin_mystyle.inc

(template associated with this style)
mymodule-views-plugin-mystyle-template.tpl.php

(template associated with this style, and customized for the view 'myview')
mymodule-views-plugin-mystyle-template--myview.tpl.php

My problem:
Views is using the first, less specific, template (mymodule-views-plugin-mystyle-template.tpl.php) to display this view.

When I edit 'myview' and click on "theme information", I see both templates listed under "style output":

mymodule-views-plugin-mystyle-template.tpl.php
mymodule-views-plugin-mystyle-template--myview.tpl.php

The first, less specific, template is in bold. If I understand correctly, this means that views found the first template but did not find the second.

I have tried rescanning, but that does not help. I have also tried deleting the cache.

Should this work? What do I need to do to get views to find the more specific template?


texts: Update database with data from dev site?

texts:
I've made changes to 12 nodes on a site that already has about 4000 nodes.  I'd like to be able to push these changes to the database without affecting any other data (and without having to redo all the changes by hand).

Problem is, this is a live site, so if I try to simply import the updated database I'll lose some data.  What is the best method for doing a partial update?
-JB


texts:
I have a content type that is group content. There is a second field, "Other Groups Involved with Delivery," which is an entity reference for the Group content type. On the edit page, I can select "Core" which is a private group. But when the node is displayed, the field is missing. Devel shows it being loaded, but it is missing by the time to render it.

I do want the content in the group protected, but I don't want to deny the existence of the group.

What do I need to change?


texts: Add content type machine name as body class

texts:
Is there a way to insert a class to the body of the node page? It should be named like the current node type's machine name.

Maybe someone could extend this code below with a content type class:

function marienschule_preprocess_html(&$variables) {

  // Add node ID to the body class.
  $node = \Drupal::routeMatch()->getParameter('node');
  if ($node) {
    $variables['attributes']['class'][] = 'node-' . $node->id();
  }
}


texts: How to automatically generate a random url for a views rss feed?

texts: I have an administrative RSS feed generated by views in a feature that needs to generate a random/unique URL so that non-admins can't easily stumble upon it. I know that after installing the feature, the user can easily manually create the URL, but this will override the feature and put it in the DB, making updates troublesome. Thoughts?


texts: Can emails be sent asynchronously via rules? (Using Queue?)

texts:
I have some rules set up to send email notifications for forum messages, comments and articles. Sometimes the number of users that need to receive the email are quite large and the page doesn't refresh before the server has sent all the emails.
Can the sending be done in the background something? Isn't that what the core module "Queue" is there for?


texts: How to pass arguments from views to node.tpl.php

texts:
Is there a way to pass arguments from views to a node template other than via selecting build modes? I use node as row style.

I used display suite + node displays to set up a custom build mode. In my node-"content type".tpl.php I then can decide via

$node->build_mode

what to render.

But first I feels like way over the top to install display suite + node displays just to pass one argument and second I ran into problems with this configuration. Everything looks fine in view's preview but after saving the view I got a "merory size exhausted" error.

So when there's time I try to reproduce this with a clean install an file a bug but at the moment I would be happy to know if there's another way to pass parameters from views to my node templates.


texts: Cron job stops when another one is running

texts:
I have two cron jobs in my site (I'm using Elysia Cron).
They are set in my own module. One runs every minute and one every hour. Code below:

function mymodule_cronapi($op, $job = NULL) {
    $items['Import J Data'] = array(
        'description' => 'Import J Data',
        'rule' => '* * * * *',
        'callback' => 'mymodule_import_j_data_cron',
    );
    $items['Import Q Data'] = array(
        'description' => 'Import Q Data',
        'rule' => '0 * * * *',
        'callback' => 'mymodule_import_q_data_cron',
    );
    return $items;
}

function mymodule_import_j_data_cron($what) {
    mymodule_j_save_f_data();
    mymodule_j_save_c_data();
}

function mymodule_import_q_data_cron($what) {
    mymodule_q_save_data();
}

In my server (centOS), i have the following line in my crontab (with correct MYKEY and url):

* * * * * root wget -O - -q -t 1 http://.../cron.php?cron_key=[MYKEY] >/dev/null 2>&1

When the second job runs (the one set to run every hour), the other one stops and I get the following error in my site log:

  Attempting to re-run cron while it is already running.

The firs job runs for about 15-20 minute. After it ends, the other one starts again.

My question is, it's not possible to have both cron jobs running at the same time? Am I missing some settings in elysia cron?


texts: How to schedule an action to reliably be performed once every 5 minutes?

texts:
I have a need for a function to run every N minutes (it doesn't need to be EXACTLY every N minutes, but it should still occur within a reasonable amount of time, maybe N+/- 5 minutes)

I've been bouncing around between the DrupalQueue class, job_scheduler, rules, actions, etc., and each time it seems like I run into a wall.

My current set up is that I use job_scheduler_trigger. I seem to have it setup correctly (using a basic UI created action of "Send email"), and I have it set to go every 5 minutes, but it NEVER fires. The "Next" run time just keeps incrementing itself properly,  but the "Last" run time is always "Never". I have no idea what I'm doing wrong, or even if this is the best way to go about it.


texts: How do you disable Cron on a staging / dev server?

texts: I have a staging and dev setup, but I wonder if I can disable cron on these as I don't want cron firing. It's mainly because I have backup migrate module scheduled to backup my site everyday, but I don't want this executing every time.


texts: How to create a responsive theme with Omega?

texts:
How can I create a responsive theme with Omega?

So far when I wanted to theme, I unchecked the reponsive design because I don't know how to theme responsive in Omega!

Any suggestions about how to achieve this?


texts: Adding group members to eck entity with og

texts:
I hope i didn't duplicate an issue i didn't see anything like this... Im trying to create an entity with eck and then make it a group. That I can do. But as og is seemingly designed to work with nodes not entities... the functionality of adding group members to an entity seems to be missing in entity i made..

i cant figure out how to add a member to a group from the ui with an eck entity as a group


texts:
I have three CSS versions (default CSS, black on white and white on black for visually impaired users) of my drupal-7 website to be selected by users if they need to.

And I just have no idea how to do this with drupal... I would like to add a drop-down list in the footer to change the CSS used. Then, I imagine I would have to store it in a session variable or a cookie and change the CSS according to this value.


texts: Batch operation for consuming data from API via drupal_http_request

texts:
I am consuming data from an API which provides a URL similar to:
http://data.something.com/api/records?pageIndex=0&pageSize=25

The API will return XML which I will then use to create nodes.
There are many thousands of records, so I will need to do this via batch. I have used batch before but never for drupal_http_request. What would be the best approach for this? Is batch API the best solution, or would another method be preferable?

Thanks


texts: Extra sorting criterium in case of ex aequo with Views

texts:
My articles have a 'Ranking' field, which contains an integer. I have a view that sorts articles depending on this value: the article with the highest score is a the top. Now, when two articles have the same amount of points, I'd like the most recently posted article to get the highest ranking.

For example. Let's say I have 3 articles:

'Article A' (5 points - posted on 30/12)
'Article B' (5 points - posted on 21/12)
'Article C' (6 points - posted on 20/12).

The ranking should be:

'Article C'
'Article A'
'Article B'

How can I do this?


texts: I am working with WEBFORM module, and I provided only one text area for the user to enter his choice but I want a "ADD MORE" button in my form element so that my user can enter his second choice also. I want to know what I can do to achieve described action?


texts: How to add text over Slideshow/carousel?

texts:
I've been able to create a simple slideshow using field slideshow, jcarousel and libraries.

But how would I go about add text in the rhs of the images? I would like the text to change depending on the slideshow image.


texts: Custom form adding a commerce price field

texts: I am creating a custom form using the form api. I'd like to reuse the price field used by commerce, but I don't know how to include their form type in my own form.


texts:
I hope it's okay to ask a why question here. I've got a profile named Expert Information and a Skills field in that profile. I've got 9 users with the Expert role. Now my problem is: When I make a user type of view and make a relationship to profile, I get all 9 users but nothing shows under Skills; however when I make a profile type of view and make a relationship to user, I get results under Skills but this time I get 4 users. Why is that happening and what is the correct way to fulfill both?

Thanks,

K.


texts:
I need to add a user role when the workflow value is set to "approved". This role is setup already. Use case: An authenticated user fills out a webform, I have a custom module to add an entity for approval, then an admin user approves/denies based on values in the webform.
I've tried to add a reaction rule using the Rules module /admin/config/workflow/rules . When I get to the data selector I get lost.
My steps for the rule should be:

the event is when an instance of "myworkflow" is set to "approved"
get the user from the workflow object
add the "approved" role to the user

I've tried looking at the documentation here: https://www.drupal.org/node/1300042  I'm stuck at step one (how to get the rule to fire). I think the problem is confusion about how the data selector is supposed to work.  Specifically, I can't put the correct value in the "Data Selector" on this page /admin/config/workflow/rules/reactions/edit/saveworkflowtransition/add/rules_condition

I'm also confused about the messages about Rules module not supported in Drupal 9. We are on 8.8.8. Should I be implementing this as a custom module instead?


texts: view results not show for unadministrator users

texts:
There is a views that it access set to permission:view published contents ,every thing seems ok but I meet strange things, The views result not show for non-administrator user,
first I think the views result node are unpublished but they are not ,another idea was check the permission view published contents but It check for all roles.
any idea about where is the problem and how can I solve it ?
    thank you


texts:
I cannot find information on how translate database field values. On my site I use Support Ticketing System module. If I'm trying translate interface to German (for example) everithing is ok except Status field (Status field is reffering to support ticket status - new, in progress, closed). I can see in the database all these values (new, in progress, closed) in certain table. But how to translate them?
The built-in Drupal interface translation does not recognize these values.

Can you advise the correct way for translation of these field values?


texts: How to make group visible, but content hidden?

texts:
Using Organic Groups, I'd like to have three visibility states:

Group and group content is visible to all, including anonymous users.
Authenticated users can see the group, but not the content.

This would be the same thing as if everyone marked all the content as "private", but the group node was marked as "public."

Only members of the group can see the group and the group content.

I tried OG Visibility, but it is no longer maintained and did not work. Or at least I couldn't figure out how to get it to work.

Any suggestions?

This is on Drupal 7.


texts: How to filter types of Webforms with Views

texts:
I am trying to create a simple View of webforms to display a list of currently available jobs.

This is what I am trying to accomplish:

Webform1
description description description description...
[Read more]

Webform2
description description description description...
[Read more]

Webform3
description description description description...
[Read more]

I thought webforms would be a decent solution considering I can add/remove them once the job listing is expired. It is also very easy to go through submissions.

Only issue I am having is that the contact form I have is also a webform.

So I am getting some unwanted items in my view query. I am having a difficult time figuring out a simple yet robust solution to filter the different types of webforms.

The only filter criteria available for a view of webforms are Webform: Node & Webform: Status and I believe neither will help me accomplish what I need.

Anybody got any ideas of what I could do to differentiate between webforms for views filtering?


texts: How to only allow alphabets and spaces in the middle in Profile2 field

texts:
I'd like to only allow alphabets in and spaces in the middle of a my Profile2 "real_Name" field. I have found what I think I need: profile2_form_validate_handler but I don't know how to get it to work.

I think it should be similar to user_validate_name, especially for

  if (!$name) {
  if (substr($name, 0, 1) == ' ')
  if (substr($name, -1) == ' ')
  if (strpos($name, '  ') !== FALSE)

and I should use

preg_match('/[^A-Za-z ]/'

I only have a rough idea but I don't know how to make it work and I'd appreciate your help.


texts: Complex View Involving Separate Entities / Taxonomy Vocabulary / Content - Distinct

texts:
Given the following Content Type: Smartphone

Taxonomy Vocabulary: OS: Android / iOS / Windows / Blackberry

Taxonomy Vocabulary: Color: Red / Blue / White / Black / Yellow

OS and Color is a Taxonomy Vocabulary which is term referenced in the content type smartphone.

Now the question is:

How do you setup a view to display only the COLORS that are available for the Android OS? I do not care about what phone it is. Example of this contextual path would be: example.com/android-colors

That in effect would just give me a list of all available colors that androids are in. Since OS and color has no direct relation, you would have to create a view of smartphones then GROUP THEM BY color while the contextual filter grabs the %android% arguement via the path.

The problem with this is that there will be thousands of records since each result is unique since your querying the smartphone table. Distinct setting in the query dialog box does not apply since each result is technically not distinct.


texts: Webform Computed Data Display Grade and Text based on result

texts:
I am building a quiz using webforms and the computed data twig and have a question if something is possible and if there is documentation on how to build this.
The quiz is 20 questions and each answer has a value of 1-5, I have all of the computed data working and it is able to show the final score properly, but was wonder if I could assign a grade and give short text feedback based on the score.
For example:
A user scores less than 70 they would receive a grade of "Below Average", 70-80 Average and 81-100 "Above Average" and then some text giving them feedback on their score depending on this range they scored in. Is this possible to do in webforms?


texts: Modifying superfish menus to gives extra block of data

texts: I am using superfish menus and it works fine and i want to add extra column in superfish menu which will display some stand alone data. how do i alter superfish menu to do this. I have shown in image what i need to do.


texts: user_load() and EntityFieldQuery not found when running script via Drush

texts:
I'm trying to run a php script from the command line via Drush. When I tried to use EntityFieldQuery...

$query = new EntityFieldQuery;

I got the error:

PHP Fatal error:  Class 'EntityFieldQuery' not found in /path/to/my/script.php on line 43

So, I tried to make it even simpler, and just used this script:

<?php

print "inside script\n\n";
$user = user_load(1);
print "name: ".$user->name;

?>

But I get the error:

PHP Fatal error:  Call to undefined function user_load() in /path/to/my/script.php on line 17

It doesn't appear that drush is bootstrapping properly. Am I missing something? What do I need to do for drush to be able to use the drupal apis?

I read through Drush php-script | Drupal functions such as node_load() are not being found, but I've got mysql client libraries already installed so that isn't a solution for me.


texts: "drush up" is changing my selinux context

texts:
Disclaimer: I have found a way to fix this problem short-term, but I'm curious if anyone can explain to me why it's happening, or if someone has found a better fix than what I'm doing.  If it exists already, Google has not revealed it to me.

Problem: (on a LAMP Server) When I use 'drush up' to update a module, or even core, the selinux context on the files is changed.  This is new behavior as far as I can tell. I have used 'drush up' to update core and modules in the past with no problems.  The changed selinux context results in a WSOD.  To fix this, I run restorecon -R on the drupal root, which results in a series of

  unconfined_u:object_r:user_tmp_t:s0->unconfined_u:object_r:httpd_sys_content_t:s0

and then things work again, until the next 'drush up'.  If I have multiple modules to update I either update and restorecon repetitively, or take my chances and drush up -y, restorecon, and then hope for the best (not ideal obviously).

Drush 7 and Drush 8 both behave this way.  Oddly enough, when I 'drush dl' a module, it's brought in to the modules folder with the appropriate selinux context. Based on an ll -Z of files in the temp folder, I'm guessing (emphasis on guessing) that the files are getting moved from there rather than copied during an update, but I do not know enough about the inner workings of drush to be able to trouble shoot.  Any insight would be welcome.  Thank you.


texts: Create node template only for default view-mode

texts: I created a node template for my content type which I only want to use for my default view mode and keep the standard view of the teaser. My file is named like node--customnode.tpl.php. As I read I can create a template file for the teaser by adding node--customnode--teaser.tpl.php but it does not work for default in the same way. Does anybody have an idea?


texts: How do I change page callback for a particular menu?

texts: There is already a menu defined in core module. I need to alter the page callback of this menu in another module. Similar to using hook_menu_alter() in Drupal 7, but since there is no hook_menu_alter() in Drupal 8, how do I define another page callback?


texts: What approach for Commerce products, attributes and product displays?

texts:
I am building a site, based on Commerce Kickstart. At this moment the site will not have a store, but it's on the horizon and I am trying to prepare the site beforehand for a store launch with as little developer hassle as possible.

My concern is now to wisely design the products and their attributes.

First off, I have two taxonomies. One is obviously a Product tree. A Commerce Product will have only one term reference value possible.
Then I have a Usage tree (or call it Applications), which describes how and where a product can be used. A Product Display will have multiple possible term references from that tree.

Now let's say, I have a brand of nails in different sizes: 1,2,3,4. The sizes 1 thru 3 would be tagged as "Home Use" and the size #4 - only as "Construction Use". All sizes would share some fields, such as main description, PDF attachments, images. And these could be fields on the Product level.

For sizes 1 thru 3, I would basically need one product display, speaking in terms of the page contents. And the Add to Cart button would have a list of models next to it: 1 thru 3. I would expect the button to add to cart SKUs mapped for each size.

For model #4 I would like to have perhaps additional set of images and a slightly different description, and the Add to Cart button would not need any select.

This is one possible approach. Another that comes to mind would be to treat all sizes as separate 4 product displays. Then, the Add to Cart buttons would have no attribute selector. This scenario could seem quite simple and obvious - a typical one-to-one relationship. However I am allergic to solutions that are not scalable, I hate cloning data as a slightest text correction would later require N edits on each product display.

So, which way would you go based on your experience? I don't know Commerce well enough but still want to be prepared for it beforehand.

I assume that SKU is something crucial for a successful and non-ambiguous order. But maybe my assumption is wrong.

I'm open for your insights.


texts: Views Rewrite Results Shows "Delete Comment" shows as text to anonymous users

texts:
I'm using a views to show my comments.
I've  Rewrite Results and add a delete comment field.

When users login they can click on the link
and delete the comment

But when a user is logout
any user can see [delete_comment] token

How do I hide the [delete_comment]token from anonymous users please?


texts: How to run jquery codes before and after ajax call?

texts:
I want to create a loading code while the ajax call is not yet complete, AND enable my jquery code after calling the ajax of drupal form. The ajax I'm referring to is the "Add new field/Add more" of unlimited field. I don't have a custom module for that. I'm just using what drupal already has.

This is the code that triggers the Ajax of the form:

$('input[name="field_collection_add_more"]').mousedown();

I can't use the $(document).ajaxComplete(function(){}); nor ajaxStart
function of the jquery because I only want my functions to run on that specific ajax call for that specific field.

How can I use the beforeSend: and success: when the ajax add new field is running?

Thank you in advance for the help!


texts: Programmatically added taxonomy terms not being indexed

texts:
I'm assigning taxonomy terms to an entity (user) like this:

$drupalUser->taxonomy_vocabulary_6 = array('und' => array(0 => array('tid' => _findorcreate_tid($eecid, $arrUser[12]))));

_findorcreate_tid finds, or creates a new tid, within the supplied vocabulary.  This function is working correctly. $eecid is the vocabulary ID. $arrUser is some user data imported from a CSV.

When viewing the user object, the correct term name and ID is displayed, but viewing the term's "contents" (at a URL like http://localhost/taxonomy/term/1061), I'm told there is no content.

My very amateur poking around leads me to believe that the taxonomy_index table is not getting populated when I assign the terms in this manner.

I have tried to call
taxonomy_build_node_index($drupalUser);
after the user object is saved, but this has yielded no change (and I'm a bit unclear if that function only applies to nodes, or any entity).

Is there a better way of assigning taxonomy terms to a user entity that would fix this?


texts: Keep randomly getting /index.php/ in link Urls with Pantheon (nginx)

texts:
I have a live D8 pantheon site and keep randomly getting index.php in the menu link urls. It's now happened  four or five times. We've set a base url for the sitemap, so it has prevented the sitemap from including index.php (which it did the first time). And we've also redirected from /index.php to / in settings.php, which works fine.

But still, today, on the live site, we found that a bunch of menu links randomly had /index.php/ in the paths (it was all the links referencing a node). And if we clear the cache or just wait 20 minutes, it magically fixes itself.

I haven't had enough time with the problem persisting to successfully debug it. This is similar to the following link, but the solution here is for apache, whereas pantheon uses nginx. https://www.drupal.org/forum/support/post-installation/2016-09-19/how-to-remove-indexphp-from-urls

Anyone ever run into this or have an idea where to start prodding next? Any help or debugging suggestions are greatly appreciated! Thanks.

Drupal 8.5.3
nginx/1.8.1


texts: How to hide taxonomy menu items on specific pages?

texts:
My situation on D7:

I have 6 different menus displayed on the left side region of a Omega theme using with Delta + Context. Each menu is a taxonomy vocabulary created using taxonomy_menu and taxonomy_menu_trails module.

These menu items are displayed in a tree format, and one item from every menu should be hidden on few specific pages only.

Let's say 'Menu 1' has 5 items:

-Term-1

--Term-2

---Term-3

---Term-4

---Term-5

where item Term-1 is linked to url: 'xyz' and when user clicks on 'A' and enters the 'xyz' page the menu item 'Term-1' should be hidden.

The link of menu item 'A' is manually updated.


texts: Render a region e.g page.sidebar_first in views-view.html.twig

texts: Is it possible to render a region e.g sidebar_first in a views twig-file views-view.html.twig?


texts:
This is going to sound really weird, but I just upgraded from 8.3.7 to 8.4.5 and now whenever I make a template change and rebuild cache, whatever that element was, disappears.

I edited a page template and rebuilt cache and the page is completely blank now. When turning on Twig debug, it shows that the template is being rendered, but there is no output.

I know that 8.3.x => 8.4.x has a Symfony upgrade from 2.8 to 3.2. I assume the issue is being caused by this. I also noticed that Twig went from 1.25 to 1.35.

As a side note, even reverting the template back to the original state and rebuilding cache, the elements/pages do not come back either.

Has anyone else come across this issue? Any suggestions? Greatly appreciated.


texts: How to use Drupal Captcha in Custom form?

texts:
Creating nodes can take a long time. That is why for one specific part of my site, I have created my own custom form. The problem is, I want to use the captcha plugin so I don't have to get another separate module for that.

How can I use the Captcha module PROGRAMATICALLY so that I don't need a separate libary?


texts:
I created a new content type called 'Newsletters' and created an image, text and link field.

I then created a view-block and when I try to insert my custom fields they do not show up in the fields list.  I checked my permissions of the modules and my folders so that should not be the problem and there are no errors in my logs.

It's a bit confusing.
Drupal 7.41
PHP 5.4.45
views 7.x-3.13

Any insight to why I can't insert my custom fields would be helpful.


texts:
Doe's anybody know how to add metatags such as fb:admins or fb:app_id into drupal 7 ?
I use meta tags module for D7 but for some reason theese tags are not included.
Thank you for answers.


texts:
I have a page and a view. I have placed the view as a block on the page and there is a contextual filter defined as shown in the image

Basically when i print the arg(1) in header and see i get like 42 which is like the node id on which the view is placed. Can you please tell me what its is trying to do when its placed in the contextual filters as it was was done earlier by another person. I mean to ask how does it filter out the data based on the node id ?


texts:
I'm using Faceted Search module and i was trying to change a display of search result with Panels.

I've enabled search-node page in admin/build/pages and added a variant with URL selection rule set to search/results/* but it looks like nothing happens.
I'm still seeing default results page instead the one which uses Panels.

Am i doing something wrong? Does anyone have any tips?
Thanks in advance


texts: A good way to import tweets, blogpost, flickr photos, slideshare,

texts:
I'm building a "social corner" on my website and I need to import quite a lot.

I've got these accounts:

Twitter
2 blog
Slideshare
Flickr
YouTube channel

I'm using the feeds-module at this moment, but for some reason, it got overwritten.

I tried with the Media module, but I got an error every time I tried to activate the modues, so that's not an option either.

There is a pretty good module for catching and showing tweets, but there seems none like it for YouTube posts, Slideshare, Blogs, Flickr,...

What is, in your opinion, the best way to import this kind of social media every 30 minutes or so. Because I can't think of any anymore.


texts: How do I display the latest post related to another?

texts: I'm on d7. I have 12 nodes that I use as groups with the entity relations module. When a user submits a post, they choose one of the groups to put it into. I want to make a views list of all 12 groups that displays the title of the latest post that has been submitted into each of them. Any suggestions? Thanks.


texts: How to display billing information associated with with stored Auth.net payment information?

texts:
I am newish to Drupal and have been trying to print out the billing address data from the saved payment method information labels in drupal commerce checkout. The payment processor is Auth.net, using Drupal 8.6.14 and Commerce 8.x-2.13. I have tried getting $billing_profile to show with no luck.

$pane_form['payment_method'] = [
      '#type' => 'radios',
      '#title' => $this->t('Payment method'),
      '#markup' => '
Please choose from a previously saved credit card or pay with a new card.
',
      '#options' => $billing_profile,
      '#default_value' => $default_option->getId(),
      '#ajax' => [
        'callback' => [get_class($this), 'ajaxRefresh'],
        'wrapper' => $pane_form['#wrapper_id'],
      ],
      '#access' => count($options) > 1,
    ];

    // Add a class to each individual radio, to help themers.
    foreach ($options as $option) {
      $class_name = $option->getPaymentMethodId() ? 'stored' : 'new';
      $pane_form['payment_method'][$option->getId()]['#attributes']['class'][] = "payment-method--$class_name";
      $store = $this->order->getStore();
      $billing_profile = $this->order->getBillingProfile();
      if (!$billing_profile) {
        $billing_profile = $this->entityTypeManager->getStorage('profile')->create([
          'uid' => $this->order->getCustomerId(),
          'type' => 'customer',
        ]);
      }

    }


texts: The meta tags module sets default meta tags that are rendering. However, I have a page with a panel and I am trying to override the default meta tags. I went into the panel and replaced the default meta tag tokens with custom text, but nothing changes. Any thoughts on why this might be happening? I'm using Drupal 7, and I'm hoping that we can do this through the admin UI.


texts:
I need to customize the access to details like 'Publishing options', 'menusettings', 'authoring information' etc while the user is editing the node.

These options should be shown only if the admin has allowed the users to view those. I Have searched for this, but unfortunately found no answers for Drupal 8.


texts: update the group audience field using rules

texts:
Is it possible to update a group's audience field using rules or actions ? I would like to add nodes/remove currently selected nodes from the list in groups audience.

Would anyone know of a way to do so?


texts: How do I install Drupal Console to my project with Composer?

texts: I am running my Drupal 8 project under Acquia Dev Desktop 2 and just got Composer installed. How can I add the Drupal Console to my project?


texts: Change from address of user registration email

texts:
How can I update the from address of the email sent when a user successfully registers to the website. Currently the from address is same as the site administrator email id. Instead I would like to set it some custom email id like do-not-reply@example.com.

I looked at the Mail editor module and from the documentation I understand that it can be used only for updating the subject and body of the email and not the from address.

Any thoughts??


texts: Disable some category In-Place Editor (IPE)

texts:
I'm working with a Lightning distribution of Drupal 8. I need to show to the editor, for example, only the Create contenttab under Manage content tab in panelizer. I'm not finding anything to do this. I tried with the permissions or looking at the panelizer settings, but nothing worked.
So, I need to remove all the Chaos Tools, Devel, Forms etc tabs.


texts:
Well look I have a multisite.

The main site that uses the sites/all folder for its modules and libreries
and another subdomain that uses sites/subdomain for its modules, themes, etc...

they are in separate databases but share the same drupal instance

In the main site I have an inventory app for a local store they manage their inventory and their invoices there.

In the subdomain I did a ecommerce store so they will sell their products through that subdomain, I need that when an user buys a product in the ecommerce store ten automatically I need that purchase to be registered in the inventory that is in the other site.

How to do this connection betweed the 2 sites in a multisite config?

Thanks for your help


texts: How can I detect a "page's" content type?

texts:
I have begun work on a Drupal website and unfortunately I did not have an opportunity to have them walk me through the website as is.

I'm now trying to replicate content from a development site to a live site, but there is a page which I cannot identify as a particular content type, though I know it is content, because it says on the page "Clone Content."

How can I figure out this page's content type so that I can replicate it? Is this the right question to be asking?

I apologize if this is an ambiguous question, I will clarify any detail needed.

As a side note: Is there any way to clone content between Drupal websites? Like exporting and importing? Perhaps a tutorial I should check out?

Thanks so much in advance.


texts: View for latest articles - but able to override at page level

texts:
I have a requirement to create a view which will return the latest 4 articles added to the site to be displayed in a block on multiple pages.

This in itself is easily done - however the client has requested the ability to override the articles shown in this block on certain pages. Again this would be easy if all 4 latest articles were to be swapped for these 4 statically selected articles - but the request is to allow any number between 1-4 static choices to be made when creating content.

If a user chooses just one article manually - the other 3 in the "related" block should be the latest 3 articles from the site.
Similary if 2 were manually selected, 2 latest articles should follow them. And so on.

I think I may be overcomplicating this - but having played with Views all morning trying to achieve this I'm struggling - can anyone give me some pointers?


texts:
I have a problem when i want to see a file uploaded.I created a managed_file like this :

$form['document']['footer_file'] = array(
    '#name' => 'footer_picture',
    '#title' => t('Footer file'),
    '#type' => 'managed_file',
    '#description' => t('Put here a "PNG" picture.'),
    '#default_value' => variable_get('footer_file'),
    '#upload_location' => 'private://mydoc/header-footer/',
    '#upload_validators' => array(
         'file_validate_extensions' => array('png'),
    ),
);

I log into my drupal website with a normal user, next i upload a file with the field created highter and the file is uploaded in the right folder. After that i go to my page where the picture is displayed and i can see her. Next i change my user and log with another user, when i go to the page where the picture is displayed i can't see her. when i inspect HTML code, there is the same link :

<img src="https://mydomain/system/files/mydoc/header-footer/image1.png">

When i click on this link with first user, i see the picture. And when i click on the link with second user, i'm redirected to https://mydomain/user/login

So, my question is : When i create programmatically a managed_file, there is permission on this file ? just the person who uploaded the file can see the picture ? Because i need to display the picture uploaded for all users.

Thanks


texts: How get language switcher working when using facet api pretty paths?

texts:
I have a multilingual website where i use facet api pretty paths to get nice urls for the facets.
This looks like
www.example.com/search/color/red
when i filter my search results for the color red.
The working url for this in german would be
www.example.com/de/search/color/rot
(i know, search and color is not translated but this is another problem)
So the problem now is that when i switch the language from english to german the language switcher uses the following url
www.example.com/de/search/color/red
which will not work.
As a workaround i could use the option from facet api pretty paths to use the tid in the urls which would look like this
www.example.com/search/color/red-123
The problem with this solution is that this will lead in multiple working urls for the same content (duplicated content) because he will only use 123 for filtering.

So anyone an idea how to get this working?


texts: A user field's text format defaults to "- Select -", how do I force it to an allowed option?

texts:
I have added a field, "Bio" to the user profile. All user roles have permissions for "Filtered Text", and the field text format settings are limited to "Filtered Text" only, with override default order on. I've set it to default to "Filtered Text" in the Default Value field as well.

When I edit my profile as an authenticated user (who only has permissions for "Filtered Text"), the selector refuses to default to "Filtered Text", as demonstrated in the screenshot:

How can I force this to default to Filtered Text, or moreover why is it not defaulting?

I have tried altering the field's text format in hook_form_alter, with the line:

$form['field_bio']['und'][0]['format'] = 'filtered_html';

but it still defaults to "- Select -"!

Is there another way to force, on the form, a default value in a hook?


texts: A way to share content structure across several panel pages

texts:
I develop a site which presents content along with multiple blocks of information on side bars. They're context related by nature, so I decided to use panels instead of block module.

That approach worked great for some time and was flexible enough. I created multiple view panes and passed the arguments through panel contexts.

But soon I realized there is a problem. I have a bunch of pages on a site which usually implemented using views pages. But they must more or less share the same side bars. So they must be panel pages too.

But there is a dozen or so of panes on a panel, so copying panel content (say, by using export and import) creates an awful mess and redundancy which greatly hampers maintenance and subsequent changes.

I'm thinking about creating all the pages in code by customizing one rough part created through gui. But I'm hesitating whether it's a good way. Any ideas?


texts: Views switches to another view on apply or any change

texts:
When I'm working on a block display in Views on Drupal 7, and hit the "Apply" button, I'm taken to the master (or first view), instead of staying on the block display that I'm working on.

How do I fix this behaviour and remain on the correct display when applying settings?


texts:
I have a vocabulary "holiday_types" with taxonomy terms "ski" and "beach". I have a custom field on these taxonomy terms "field_activityid" which relates to a legacy system.

I want to load all these terms so that as I loop through a list of regions I can add the taxonomy_term ID to an entity reference field, and I need to get the legacy activityid to query an external API.

I'm having issues with entityQuery not recognising 'holiday_types' as a bundle of taxonomy term, I tried 'type' too. I'm also not getting entityQueryAggregate working either so thought I'd pose the question here to see if there's a 'proper' way of querying custom fields on taxonomy terms.

Adding example here which produces "QueryException: 'bundle' not found"

$holidayTypesQuery = \Drupal::entityQueryAggregate('taxonomy_term');
$holidayTypesQuery->conditionAggregate('bundle', 'holiday_types');
$ids = $holidayTypesQuery->execute();
$storage = \Drupal::entityManager()->getStorage('taxonomy_term');
$entities = $storage->loadMultiple($ids);

If I change 'bundle' to 'vid' it errors with the following:

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]:
Syntax error or access violation: 1305 FUNCTION purkidev.holiday_types does not exist:
SELECT holiday_types(taxonomy_term_field_data.vid)
AS vid_holiday_types
FROM {taxonomy_term_data} base_table
LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data
ON taxonomy_term_field_data.tid = base_table.tid
INNER JOIN {taxonomy_term_field_data} taxonomy_term_field_data_2
ON taxonomy_term_field_data_2.tid = base_table.tid
HAVING (holiday_types(taxonomy_term_field_data_2.vid) = :db_placeholder_0); Array ( [:db_placeholder_0] => )
in Drupal\purkitest\Controller\PurkitestController->simple() (line 89 of /Users/steve/Sites/purkidev/modules/purkitest/src/Controller/PurkitestController.php).

Trying without Aggregate:

$holidayTypesTIDs = \Drupal::entityQuery('taxonomy_term')
  ->condition('vid', 'holiday_types')->execute();
$taxonomyTermStorage = \Drupal::entityManager()->getStorage('taxonomy_term');
$holidayTypes = $taxonomyTermStorage->loadMultiple($holidayTypesTIDs);
foreach ($holidayTypes as $holidayType) {
  dpm($holidayType);
}

This works but when I dpm($holidayTypes) I don't get anything in the fields:

[fields:protected] => Array
    (
    )

...hence why I was trying aggregate as I thought it brought together the fields.

So, can I access the value of my field_activityid from here and if so how? Have tried various random things like

dpm($holidayType->field_activityid->value())

which produces

Call to undefined method Drupal\Core\Field\FieldItemList::value()

Following berdir's comments here's the latest whole function... which now works - thanks all for helping my syntax!

public function simple() {

$holidayTypesTIDs = \Drupal::entityQuery('taxonomy_term')
  ->condition('vid', 'holiday_types')->execute();
$taxonomyTermStorage = \Drupal::entityManager()->getStorage('taxonomy_term');
$holidayTypes = $taxonomyTermStorage->loadMultiple($holidayTypesTIDs);

$markup = '';
foreach ($holidayTypes as $holidayType) {
  $markup .= "
Holiday Type: ";
  $markup .= $holidayType->getName();
  $markup .= "

TID: ";
  $markup .= $holidayType->id();
  $markup .= "

ActivityID: ";
  $markup .= $holidayType->field_activityid->value;
  $markup .= "

";
}

return array(
  '#markup' => $markup,
);

}


texts: Site is redirecting to old domain on button submission, files are linking to old domain

texts:
I have a D7 site at www.example.com, an old one, not updated since 2012 (Drupal version 7.34). I made a clone copy with separate clone database under dev.example.com

All files like CSS are still linking to www.example.com (while they are available at dev.example.com).

And most important, on /admin/ backend when under dev.example.com if you click any Submit button in any page, it redirects to the www.example.com website. So if I submitted any operation at dev.example.com/admin/* it redirects to same page at www.example.com/admin/*

I've cloned websites million times, I never had this behavior. How do I prevent redirects for files and on submissions?

update: I found in settings.php I have $base_url = www.example.com enabled, can somebody confirm this is the reason?


texts: Remove an item from list of taxonomy terms prior to rendering

texts:
What is the correct way to remove an item from a list within hook_entity_view or hook_preprocess_node?

I am trying to remove a taxonomy term from a list of terms EntityReferenceFieldItemList. I calculate two boolean values, if both are true then the item should be removed from the list.

I've tried removing the second item in the list. That works, but removing the first item results in all the items being removed. Is this because the list keys are no longer sequential?

function mymodule_node_view(&$variables) {
  # calculate $field_hide_term and $node_in_past

  foreach($build['field_terms']['#items'] as $key => $term) {
    if ($field_hide_term && $node_in_past) {
      unset($build['field_terms'][$key]); # This also removes other items in the list if key is 0.
    }
  }
}


texts: How to scedule a reminder mail for nodes with date field in an oganic group?

texts:
I would like to enable all members of an organic group to subscribe to a reminder, that sends an e-mail depending on a date field.
To be more specific: The group has a group content with a date field. Now I would like a mail being sent a specific time before this date becomes actual.
Would would the best way to do this?


texts:
How do I set the title of the tab from a controller in Drupal 8? This is the code I am using:

Controller

class myController extends ControllerBase {

    public function node($nId) {
        $nodeObj = Node::load($nId);
        $elements = getRequiredDetails($nodeObj);

        return [
            '#theme'    => 'my_mod',
            '#title'    => 'This is the Tab Title'
            '#contents' => $elements,
            '#attached' => [
                'library'=> [
                    'my_mod/my_mod',
                ],
            ],
        ];
    }

    /**
    * Returns a page title.
    */
    public function getTitle() {
        $route = \Drupal::routeMatch()->getCurrentRouteMatch()->getRouteObject();

        return $route->getDefaults('#title');
    }
}

Route

my_mod.node:
 path: '/node/{nId}'
 defaults:
   _controller: 'Drupal\my_mod\Controller\myController::node'
   _title_callback: 'Drupal\my_mod\Controller\myController::getTitle'
requirements:
   _permission: 'access content'

But the '#title' in my controller sets the title in the page, not in the tab.  Is there anything I am doing wrong?

If I put something like die('Title Here'); in getTitle(), it will show in the tab. I need to call that method from the route.


texts: I would like to alter/change structure of main menu links (programmatically!) for logged in users. What is the simplest way to do this?


texts:
I am new to Drupal 8. I had a understanding that, Drupal by default provides you a Title and Body field for content type.

I have an ongoing project, and I realized that one of the content types is missing the body field. How can I restore it?


texts:
After moving my sites to the new server, and some updates in the mean time. I have found one of the sites displaying the

"The following module is missing from the file system: block_user bootstrap.inc:276"

warring.

Have search the DB and it seems the only "block_user" string is located inside the key_value table, it's raw definition looks like that:

INSERT INTO `key_value` (`collection`, `name`) VALUES ('system.schema','block_user')

It has one more binary column as well.

To test the issues have changed the field value to "block_user_1234", it changed the warring message so it's the point for sure.

Should I remove the row ??


texts: Outputting different class other than default for status messages

texts:
I'm trying to theme status messages, I want to change the HTML of the message.

Drupal default is

message!

What I want to achieve is

message!

I have used theme_status_messages to modify 'messages' but how can I modify the type (e.g. 'status'/'warning', etc)?

This is current code

function theme_status_messages($variables) {
  $display = $variables['display'];
  $output = '';

  $status_heading = array(
    'status' => t('Status message'),
    'error' => t('Error message'),
    'warning' => t('Warning message'),
  );
  foreach (drupal_get_messages($display) as $type => $messages) {
    $output .= "
\n";
    if (!empty($status_heading[$type])) {
      $output .= '
' . $status_heading[$type] . "
\n";
    }
    if (count($messages) > 1) {
      $output .= "
\n";
      foreach ($messages as $message) {
        $output .= '
' . $message . "
\n";
      }
      $output .= "
\n";
    }
    else {
      $output .= $messages[0];
    }
    $output .= "
\n";
  }
  return $output;
}

I've changed this line

$output .= "
\n";

to

$output .= "
\n";

as you can see in my code above, but how can I change the options for $type?? I want my types to be alert-success, alert-error, alert-warning, rather than status, error, warning.

Anyone got an idea?

thanks!


texts:
I have a problem with form. I would like to create checkboxes dynamically, based on the value from select type field.  I have created AJAX callback function and in this function, I create a list and then return it to form.

my_ajax_callback($form, $form_state) {
  $form['fieldset3']['service']["#title"] = 'new title';
  $form['fieldset3']['service']["#options"] = array('test1','test2');
  return $form['fieldset3']['service']["#options"];
}

This function sets the new title but doesn't create new options in that field.
If I change the type to 'select' it works fine.

What am I missing here?


texts:
I just migrate my Drupal 6 website to Drupal 7 successfully, using migrate_d2d module. Is there an easy way to migrate Drupal 6 xml sitemap to Drupal 7 too?

Should I just install the XML sitemap module in Drupal 7 and it'll create its own?


texts: Rewrite Results -> Output as Link: How do I get this to work?

texts:
Ok, so I have a table in my database that I am outputting by using a combination of the data module to bring in a table from my database and the views module so it can be displayed.  The page with the view can be seen at http://apollo.tbc.iit.edu/~spaceweather/?q=distribute-data.

I want to enable the column fileSymlink to output as a link.

Below is an example of what the table looks like.

In order to try to enable the links in the last column:

Go to edit view
Click on the column in the fields section that corresponds to that column (i.e., fileSymlink)
Open the drop down "Rewrite Results"
Check to enable "Output this field as a link"

There is then a text form I need to fill out and I'm unsure what to put there. The text in the column is the link. For example if someone clicked on the text in the column DownloadData/cases/grid108/297/txt/channel_dataout_2013_297_0100.log, it would take them to
apollo.tbc.iit.edu/~spaceweather/DownloadData/cases/grid108/297/txt/channel_dataout_2013_297_0100.log.

Am I doing this correctly, or should I be actually storing the HTML in the columns and having views render HTML instead?

I'm not set on one way of doing this, if there is any better way. Any suggestion is very appreciated.


texts:
My Website name is Subham Soni.

I want to add two more lines below it.

One as "Developer" and then in another line a quote along with the author.

How do I do it?


texts: What does the 'export' key mean in a schema definition?

texts:
The code below is from the message module.  What does the 'export' section mean?

function message_schema() {
  $schema['message_type'] = array(
    'description' => 'Storage for user-defined message templates.',
    'export' => array(
      'key' => 'name',
      'identifier' => 'message_type',
      'default hook' => 'message_default_message_type',  // Function hook name.
      'primary key' => 'name',
      'api' => array(
        'owner' => 'message',
        'api' => 'message',  // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
      'load callback' => 'message_type_load',
      'save callback' => 'message_type_save',
    ),
    'fields' => array(
      // Although the "name" should be enough as the primary key, the numeric ID
      // is required for the internal use of entity API.
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Numeric message type ID.',
      ),
      'name' => array(
        'description' => 'The unified identifier for a message type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'Description for this message.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array('id'),
    'unique keys' => array(
      'name' => array('name'),
    ),
  );


texts: How to create access permissions system similar to Organic Groups access, using Eck entities

texts:
There currently still is not a working version for Organic Groups access control, compatible with ECK entities.

My current site contains entity type project and entity type project content.
The project content references the project through an entityreference field.

I would like to use an access control system that grants access to specific projects, and when that access is granted, the user has also access to specific project content entity types.

I know that Organic groups uses a relationship approach in which the group membership is an entity, and there is a two level deep relationship between group content (or group member) and the group.

In my case I prefer the simple direct entityreference (one level relation) between content and project. This would serve simplicity and performance. If you would advise against that, please let me kow.

I would like to receive guidance on how to set up such permission system, and possibly your suggestions and recomendations based on your experience with a similar setup. Thank you.


texts: View node public OR only to verified/role by choice user

texts:
It's possible to set the permission to view for a Content type. But how can i let the choice to view to public OR only verified users/role to the user?

Making 2 different Content types would be an easy solution, but is not convenient.
Also, Node Access is to difficult for users (too many choices). Need just a button or check box to hide or view the node public. If it's hidden for public, it should be visible to registered users.


texts: "Parameter expected to be reference, value given" error in menu page callback

texts:
I have a custom module that adds a couple action links via menu items:

function monographs_menu() {
  $items['node/%node/clone_comment'] = array(
    'access callback' => 'clone_access_cloning',
    'access arguments' => array(1),
    'page callback' => 'monographs_node_check',
    'page arguments' => array(1, 2),
    'title' => 'Create For Comment version',
    'type' => MENU_LOCAL_ACTION,
  );

  $items['node/%node/clone_authorized'] = array(
    'access callback' => 'clone_access_cloning',
    'access arguments' => array(1),
    'page callback' => 'monographs_node_check',
    'page arguments' => array(1, 2),
    'title' => 'Create Final Authorized version',
    'type' => MENU_LOCAL_ACTION,
  );

  return $items;
}

and the function signature for the page callback is

function monographs_node_check(&$node, $type)

On my local machine and my dev server, this all works just peachy.  However, on the client's server, with a clone of my db and the repo, whenever this link is clicked on, they get a WSOD and this error in watchdog:

  Warning: Parameter 1 to monographs_node_check() expected to be a reference, value given in menu_execute_active_handler() (line 517 of ...\public_html\includes\menu.inc).

Since it's on a remote server that I don't have access to, I can't debug it, but the fact that it works without error on my own local machine and dev server makes it even weirder.

What could be different in the other environment that would cause this error?

Thanks.


texts: Why are there so many attempts by an anonymous user to access /wp-login.php?

texts:
I looked at /admin/reports/dblog today. There were five request in two minutes by an anonymous user to view /wp-login.php. These requests have been happening for an hour at least and continue 2-3 times per minute.

What are the possible explanations for this strange behavior?
What can/should I do about it, if anything?


texts: Leveraging field_get_items variable in a custom field template

texts:
I can use a template preprocess function for node to simply get the alt tag of an image field image using the venerable field_get_items as such:

function MYTHEME_preprocess_node(&$vars, $hook) {
// Global node.
  $node = $vars['node'];

 $field_image_items = field_get_items('node', $node, 'field_image');
  // Load individual data from 'field_image'.
    $vars['alt_caption'] = $field_image_items[0]['alt'];
}

Then in node.tpl.php, I can render the alt tag of the image from the variable we created above as:

<?php print $alt_caption; ?>

... and that works great.

However, I'd like to customize the template for the image itself so when I create a field--field_image.tpl.php template, sure enough the image renders fine but if I add the $alt_caption variable, that does not render. I'm guessing this will simply not work or there is an extra step I need to do for the variable to render in this new template.


texts: How to hide a field from anonymous users?

texts: I've been searching for this for quite some time, but so far I haven't been able to find a good way to hide a field on my custom content type from anonymous users. I want some fields to be visible only to logged-in users. Any idea how I can do this?


texts: Facebook Comment Social Plugin - Get Comment Count on Nodes and Views

texts: I used a module 'Facebook Comment Social Plugin' to display comments on nodes, which it successfully did, however i like to know, is there a way to display comment count for the comments coming from the facebook plugin in nodes and views.


texts: Using Ctools, how do I render a managed_file from system form?

texts:
I'm adding some fields to Drupals site-information form. Textfields and managed_file fields. Images are uploaded there and not in my panel panes edit form.

Now I want to make the additional fields I've added, or just the whole form be rendered in a custom panel content_type. I have no issue getting the textfields themselves using

$block->content .= filter_xss_admin(variable_get('phonenumber', ''));

however I also need to render my managed_file. How would I go about doing so?


texts: Disabling Page Cache for Redirect Response

texts:
I've implemented a conditional redirect on my site via an event subscriber and returning a redirect response. It's working but, I believe due to the page_cache module is getting cached for anonymous users.

This is basically what I'm using to set the redirect response:

public function checkRedirectStatus(GetResponseEvent $event) {
    if(shouldIRedirect()) {
        $response = new RedirectResponse('/redirect/path');
        $event->setResponse($response);
     }
}

The above gets cached whether or not it returns true unless I add \Drupal::service('page_cache_kill_switch')->trigger();.

As this is a fairly high-traffic page I'm concerned about bypassing cache for anonymous users. Are there other options I'm not aware of?

If this is on the REQUEST kernel event, how far-reaching is page_cache_kill_switch?

Thanks for your help!


texts:
Planning is like that:-

  We are going to manage multisites & each site having 3 cron jobs daily
  basis.

so my question is how can I analyze server performance there for multisites ?

Current scenario :

  10 sites having 3 cron jobs in each 10 minutes & each cron is updating
  contents in each sites(Number of updating contents maximum 3000 in
  each site with each cron job) but as I am seeing here cpu utilization
  & mysql is 100% occupied by first 5 sites.

I don't know resource is enough or not ?

Is this related to resource OR how can I improve performance there with cron jobs?

Right now I am using Elysia cron with each site.

Thanks in advance!


texts: I would like to be able to use some tokens like %post[key]used in webform, in my custum module how to call these up in my custum module

texts: I am creating a custom module webform3rdparty integration to icontact .Using my module create an extra field in weform field to add icontact field(mapping purpose).I want to use token replacement patterns in my field.How to call these replacepatterns in my custom module.


texts:
Is there a hook I can use to alter the way comments are rendered? Not for altering the comments form, but the listed comments themselves. Obviously, I can target with CSS, but I was wondering if I can hook into core and change the way they are displayed from there?

Thanks


texts: Understanding theme hooks and template preprocessors

texts:
In hook_theme for the poll module in drupal 7 the following is defined:

function poll_theme() {
  $theme_hooks = array(
    'poll_vote' => array(
      'template' => 'poll-vote',
      'render element' => 'form',
    ),
    'poll_choices' => array(
      'render element' => 'form',
    ),
    'poll_results' => array(
      'template' => 'poll-results',
      'variables' => array('raw_title' => NULL, 'results' => NULL, 'votes' => NULL, 'raw_links' => NULL, 'block' => NULL, 'nid' => NULL, 'vote' => NULL),
    ),
    'poll_bar' => array(
      'template' => 'poll-bar',
      'variables' => array('title' => NULL, 'votes' => NULL, 'total_votes' => NULL, 'vote' => NULL, 'block' => NULL),
    ),
  );
  // The theme system automatically discovers the theme's functions and
  // templates that implement more targeted "suggestions" of generic theme
  // hooks. But suggestions implemented by a module must be explicitly
  // registered.
  $theme_hooks += array(
    'poll_results__block' => array(
      'template' => 'poll-results--block',
      'variables' => $theme_hooks['poll_results']['variables'],
    ),
    'poll_bar__block' => array(
      'template' => 'poll-bar--block',
      'variables' => $theme_hooks['poll_bar']['variables'],
    ),
  );
  return $theme_hooks;
}

In function poll_view_voting($form, &$form_state, $node, $block = FALSE) { there is $form['#theme'] = 'poll_vote';

How does this work and what does this to?

Also there is this function:

function template_preprocess_poll_vote(&$variables) {
  $form = $variables['form'];
  $variables['choice'] = drupal_render($form['choice']);
  $variables['title'] = check_plain($form['#node']->title);
  $variables['vote'] = drupal_render($form['vote']);
  $variables['rest'] = drupal_render_children($form);
  $variables['block'] = $form['#block'];
  if ($variables['block']) {
    $variables['theme_hook_suggestions'][] = 'poll_vote__block';
  }
}

I was able to create a function theme_preprocess_poll_vote(&$variables) which I was able to change the output. Is their a document that explains how this all works?


texts: How do I create a block in a module that can be referenced via an entity reference field?

texts:
I'd like to be able to reference my programmed block as a field in a paragraphs.
I've

Generated a module with drupal console - drupal generate:module
Used the template for a block from the example module. Only has Plugin/Block/MyBlock.php

I create a new field in my paragraph

Field type Reference
choose other

How do I get the block to be able to be embedded in this way?


texts:
I have a module with a bunch of menu-items. Is it somehow possible to show the MENU_LOCAL_TASK's when a MENU_CALLBACK is called?
The structure basically is like this:

A normal menuitem in the user-menu
Some local tasks
'test/%user_uid_optional/test2' in this example would be an overview-Page with several links as defined in in the last item.

This all works great, except I want the local tasks to be visible when the user clicks on 'test/%user_uid_optional/test2/%test'. Since I don't have breadcrumbs that's the only easy way for the user to get back to the overview page.
Any idea?

function test_menu(){
  $items = array();
  $items['test/%user_uid_optional'] = array(
    'title' => 'test',
    'page callback' => 'test_whatever',
    'page arguments' => array(1),
    'access callback' => 'user_view_access',
    'access arguments' => array(1),
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'user-menu',
  );

  $items['test/%user_uid_optional/test1'] = array(
    'title' => '...',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -20,
  );
  $items['test/%user_uid_optional/test2'] = array(
    'title' => 'test2',
    'page callback' => 'test_whatever_b',
    'page arguments' => array(1),
    'access callback' => 'user_view_access',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
    'weight' => -15,
  );
  $items['test/%user_uid_optional/test2/%test'] = array(
    'title' => '...',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('test_whatever_d', 1, 3),
    'access callback' => 'user_view_access',
    'access arguments' => array(1),
    'type' => MENU_CALLBACK,
  );
  return $items;
}


texts: Views block doesn't show up at the user profile page

texts:
I created a views block and try to make it appear on the user profile page. I did the following steps, but it doesn't show up:

Block layout -> Place block
Tab Pages: Select "Show for the listed pages and specify path: /user/*
Region: Footer

I tried different regions but can't make this block appear on profile page.

Additional info:

I made a Page view with the exact same configuration and the same user can visualize it correctly. So it doesn't seem to be an issue with permissions.
Other blocks do show up in the footer region, so it doesn't seem to be an issue with the template.


texts:
I created groups using Group module.

One group is a job poster(Group-A) and the other is a business owner(Group-B).

Group-B business is all about plumbing.

When Group-A posted a job about plumbing, Group-B should be able to get notified about the post as this is related to his business.

So, I use message stack as a method, but I still didn't get in the right way.

There is a message_notify module example that displays details in a page about a certain actions.

So what I need is that a group should get a notification message whenever a related job post is created.

Thanks!


texts:
How to get booking records from booking table? How to get GROUP BY function WITH ROLLUP?

Here is my SQL query:

SELECT * FROM booking
GROUP BY startBooking WITH ROLLUP;

How to convert above query in Drupal 7?

     $queryPrice = db_select('booking', 'b');
     $queryPrice->fields('b');
     $queryPrice->groupBy('b.startBooking');
     $resultPrice = $queryPrice->execute();

How to roll up use in above query in Drupal 7?


texts: How can I find out whether my Drupal 7 site using persistent connection or not? And it's possible to turn it on if it's not?


texts: Programmatically alter views exposed form option value

texts:
I have a view with an exposed form, i need to programmatically change the value of the 'autosubmit' option in code but cant find out how to access it/change it.

The field is defined in the ::options_form method of the views_plugin_exposed_form class, i would like to alter this setting in a hook_views_pre_view() hook or similar but cant find a way to do it currently.


texts: node_save() not working with LANGUAGE_NONE

texts:
My question is exactly similar to the one posted here
https://www.drupal.org/node/2324047.

The answer posted here is not complete and I'm looking for a solution. I'm using the below code to save a node.

function api_add_getabstract($node_values, $api_endpoint) {
  //initialise node object
  $ex_node = new stdClass();
  $ex_node->type = 'getabstract';
  $ex_node->language = 'en';
  node_object_prepare($ex_node);
  dpm($node_values,'node values');

  //add field values
  $ex_node->title = $node_values['bookinfo']['title'];
  $ex_node->body['en'][0]['value'] = $node_values['recommendation'];
  $ex_node->body['en'][0]['format'] = 'full_html';
  $ex_node->field_authors['en'][0]['value'] = $node_values['bookinfo']['authors'];
  $ex_node->field_sub_title['en'][0]['value'] = $node_values['bookinfo']['subtitle'];
  $ex_node->field_publisher['en'][0]['value'] = $node_values['bookinfo']['publisher'];
  $ex_node->field_ex_cover_image['en'][0]['value'] = $node_values['bookinfo']['bookcoverOriginal'];
  $ex_node->field_ex_deep_link['en'][0]['value'] = $node_values['publicURL'];
  $ex_node->field_api_info['en'][0]['value'] = $api_endpoint;
  node_save($ex_node);
}

I tried by changing the value 'en' to 'und' and LANGUAGE_NONE, but none seem to save the node completely. Using 'en' at least creates the node with only Title field, but for the other 2 values, node is not even getting created.


texts: Drupal's built-in xss filters vs. HTML purifier module

texts:
Does the  htmlpurifier module for Drupal provide better security against xss (and possibly other vulnerabilities) than Drupal's built in functionality such as filter_xss?

Looking for some guidance on why I should use htmlpurifier module for Drupal if I'm purely concerned with security (NOT concerned with preserving inline styles).


texts:
After pressing the delete button the following message appeared:

  The website encountered an unexpected error. Please try again later.

How can I solve this problem?

when deleting field The system log says:

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '[name].field_deleted_data_5' doesn't exist: SELECT field_deleted_data_50.entity_type AS entity_type, field_deleted_data_50.entity_id AS entity_id, field_deleted_data_50.revision_id AS revision_id, field_deleted_data_50.bundle AS bundle FROM {field_deleted_data_5} field_deleted_data_50 WHERE (field_deleted_data_50.deleted = :db_condition_placeholder_0) AND (field_deleted_data_50.bundle = :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => patient_info ) in field_sql_storage_field_storage_query() (line 577 of C:\xampp\htdocs[name]\modules\field\modules\field_sql_storage\field_sql_storage.module


texts: Site falls over on loss of single "key" memcached instance in distributed cluster

texts:
I have a Drupal 7 site sitting behind HAProxy that is load balancing across 4 web servers.

Each of these web servers is also running a memcached instance. All the Drupal applications have been identically configured to distribute their cache across all these memcached instances using consistent hashing.

I'm seeing a problem when testing failover; Basically one of the memcached instances seems to be randomly designated as being special, stopping this memcached instance will take the site off line.

Any of the other three non-key instances can be stopped and the site will continue to run; however if the key memcached is stopped the site performance across all web servers suddenly becomes terrible; greater than 10sec for a single authenticated page response. Because the health check configuration in HAProxy then times out the entire site is then taken offline until the key memcached instance is restored.

Some other observations:

Stopping and then starting all the drupal instances will change which instance is the key memcached; it is not one particular server.
We have observed this behaviour with both the memcache and memcache-storage modules in Drupal.
It remains the same whether I have locking (and sessions in the case of memcache-storage) in memcached or not.

Our config is roughly as below (MEMCACHED_HOSTS is a comma delimited environment variable of <hostname>:<port>:

/**
 * Memcached setup for Drupal
 */
$conf['memcache_servers'] = array();
foreach(explode(',',getenv('MEMCACHED_HOSTS')) as $mc_host) {
  $conf['memcache_servers'][$mc_host] = 'default';
}

$conf['memcache_extension'] = 'Memcached';

$conf['cache_backends'] = array(
  'sites/all/modules/contrib/memcache/memcache.inc',
  'sites/all/modules/contrib/cache_consistent/cache_consistent.inc',
);

// Set default cache backend to use Cache Consistent.
$conf['cache_default_class'] = 'ConsistentCache';

$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['cache_class_cache_update'] = 'DrupalDatabaseCache';

// Set Cache Consistent's default backend to memcache.
$conf['consistent_cache_default_class'] = 'MemCacheDrupal';

// Don't skip cache_set() operations during transactions.
// When using the isolation level REPEATABLE-READ, safe mode should be set to
// TRUE. When using READ-COMMITTED, it should be FALSE.
// What safe mode does, is that it discards cache writes during transactions, to
// avoid storing stale data into the cache. This is due to transaction snapshots
// and MVCC.
$conf['consistent_cache_default_safe'] = FALSE;

// Set cache consistent's buffer mechanism to ConsistentCacheBuffer. (default)
// There's currently only one buffer mechanism bundled with Cache Consistent.
$conf['consistent_cache_buffer_mechanism'] = 'ConsistentCacheBuffer';

// Don't do strict expire checking on each item for all bins. (default)
$conf['consistent_cache_default_strict'] = FALSE;

// Strict expire checking on each item for cache_bootstrap.
$conf['consistent_cache_strict_cache_bootstrap'] = TRUE;

$conf['memcache_options'] = array(
  Memcached::OPT_COMPRESSION => FALSE,
  Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
  Memcached::OPT_BINARY_PROTOCOL => TRUE,
  Memcached::OPT_TCP_NODELAY => TRUE,
);

$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

/**
 * Moving the locking machanism to memcache to avoid DB cluster issues
 */
$conf['memcache_stampede_protection'] = TRUE;
$conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc';

I am going to test to see whether this is a memcached vs memcache PCEL issue next and will update this if anything changes, but at this point any suggestions are welcome.

Thanks in advance for any help.

Update 1
I've tried now with both memcached and memcache PCEL extensions, the issue occurs with both.

Also, I should confirm that I am seeing all memcached instances being used, so it's not a case of just a single instance being used.


texts: how do I configure a view to make two fields be inline

texts: what format should I use in order to make two fields out of three be inline in a drupal 7 view, and how do I configure this?


texts: Displaying URL taxonomy term as page title

texts:
How can I display a taxonomy term in the url [example.com/taxonomy/% (% being the term)] of a page as title for that page - no view involved?

I assume it will require a block with some PHP or some hacking of a template.

In either case, what's the PHP and where do I put it?

I use D7 and Bartik.

Thanks. :)


texts: Using a View in a tooltip for an image map hover link

texts:
I have a imagemap with various  tags, it works well in my Drupal instance, I can click on the various areas to get to my pages.

Now I want to hover one area and display a tooltip with information inside (example: if I hover France, I will have a tooltip showing little information on Paris, with a picture). I will find myself how to do it by the way if you can't help with it - that's just my final goal.

Following various sites tutorials, I made a View with contextual filters in order to display the city content by passing an argument to the view. It works like a charm. I also rewrote the output to use tokens for display

I have actually no idea how to display my View in a tooltip - and searching didn't help me either ...

Modules I am using :

Views
Tipsy (or qTip or else, I don't have any preferences, as long as it works)


texts: How to theme views fields template to display a gallery?

texts:
My question is generic because the solution will allow me to use various jquery gallery as bxslider, galleria or flexslider.
My need is about creating a gallery with thumbnail nav, for that I need to create a views display that provide this kind of code (ex from bxlsider):

The list creation is easy for mu but I don't find a way to produce the thumbnail part..the views PHP module seem to be the path (to add data attributes and create the thumbnail "list") but I don't find the right way.

If someone can help me.All of this come from that actually using Drupal 6. :/

Thanks

EDIT: use case with data from $row views object.I don't know how to print field data settings in my view as in the template to override the output.
Here I would to add the "data-thumb" attribute dynamically, provided by views data.

No difficulty to build the list in views.

EDIT2: back on my second example, I improve my code and I'm near the goal.In a views field tpl I put actually:

<?php

    $imgurl = file_create_url($field->uri);
    $img_filepath = $fields['filepath']->content;
    $img_slide_size = $fields['field_galerie_image_vdl_fid']->content;
    $img_caption = $fields['field_galerie_image_vdl_data']->content;
    print '
'
            . '
'.$img_caption.'
'
            . '
';

?>

Naturally when it'll be ok, a foreach loop will needed.But I need to clean the provided views code, because actually I put off all HTML things via the Views UI but I think it's possible to that by PHP code.

EDIT 3: my new base code to continue looking for theming my views output from unformatted content.

<?php foreach ($fields as $id => $field): ?>
  <?php if (!empty($field->separator)): ?>
    <?php print $field->separator; ?>
  <?php endif; ?>

  <?php print $field->wrapper_prefix; ?>
    <?php print $field->label_html; ?>

<?php
//création des variables utiles pour la mise en forme de la sortie de la vue
  $imgurl = file_create_url($field->uri);

    $img_thumb_filepath = strip_tags($fields['field_galerie_image_vdl_fid_1_value']->content);
    $img_slide_size = strip_tags($fields['field_galerie_image_vdl_fid_value']->content);
    $img_caption = strip_tags($fields['field_galerie_image_vdl_data_value']->content);
    $img_delta = strip_tags($fields['delta']->content);
    ?>

 <?php
               foreach ($fields as $key => $lien) {

                    print '
'.$img_slide_size.'
';
               }
      ?>

  <?php print $field->wrapper_suffix; ?>
<?php endforeach; ?>

actually my variables doesn't return the right content, but I don't know how to find the right syntax.


texts: How to send a message notification based on a flagged node being linked via entity reference?

texts:
I'm trying to figure out how to make the following work: Sending notification based on flagged node being linked via entity reference.

I have a 'News' content type and a 'Band' content type, that has a flag called 'fan'. When somebody becomes a fan, I want them to receive a notification via the Message module whenever I link the band to the content type 'News' with the News article I just created.

The content-type setup is as follows:

Node type 'News' has field:
Entity reference to content type 'Band'
The Band content type has a flag called 'fan'
The Message type is called "user notification center" and has a field named field_mnc_recipients, which is an reference to a user(unlimited values)

How I want it to work:

when a user flags the 'band' and a new article is referenced to the band, I want to notify them with the Message module,
to make it work, I need to get the user from the flag for that band and insert it into the message field  field_mnc_recipients.

I created a Rules Component as follows:

{ "rules_message_tes3" : {
"LABEL" : "message tes3",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : {
  "referencing_node" : { "label" : "referencing_node", "type" : "node" },
  "referenced_node" : { "label" : "referenced_node", "type" : "message" }
},
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "referencing-node" ],
      "type" : { "value" : { "bands" : "bands" } }
    }
  },
  { "entity_is_of_type" : { "entity" : [ "referenced-node" ], "type" : "message" } },
  { "entity_has_field" : { "entity" : [ "referenced-node" ], "field" : "field_mnc_recipients" } }
],
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "referencing-node:flag-fan-user" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "data_set" : {
            "data" : [ "referenced-node:field-mnc-recipients" ],
            "value" : [ "referencing-node:flag-fan-user" ]
          }
        },
        { "entity_create" : {
            "USING" : {
              "type" : "message",
              "param_type" : "user_notification_center",
              "param_user" : [ "site:current-user" ]
            },
            "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
          }
        }
      ]
    }
  }
]

}
}

And now I got stuck, I based the component on "Sending a message to users of a flagged node when it is referenced" which is close to what I want.


texts:
I'm using Drupal 7 and different content types.

I've got 'News' content type and want this be like a blog. So, provide News content type to menu link.

Click Content Type and after menu settings, selected parent item main menu but not seen on frontpage.

How can i provide News content type to menu link?


texts: How do I add reCaptcha to a custom form?

texts: I need to add a reCaptcha to my form; creating the form then adding the form ID to the reCaptcha settings did nothing.


texts:
I need to change translation links attributes, which have been defined in translation_node_view function in these lines:

$node->content['links']['translation'] = array(
  '#theme' => 'links__node__translation',
  '#links' => $links,
  '#attributes' => array('class' => array('links', 'inline')),
);

I'd like to override these attributes in my custom module.

Any help would be appreciated.


texts: How can my Drupal module expose custom URLs?

texts:
I'm writing a custom drupal module and have just starter out working with Drupal.

I need to expose a custom URL from my module so that some JavaScript files can request this URL for XML data. How can I do this? I'm not referring to the hook menu. Thanks


texts: select image from existing folder without programming

texts:
I uploaded a folder of images to my drupal7 server using WinSCP. I know the path name to these folders as shown below.

I have a field image0 defined for a image for each node.

The only option I have for defining what image is assigned to the field is to upload a new file from my computer. I don't see any way to select an existing file I already have on my server. The way I would like to do this is to display a list of files for a ceratin path on my server, like File Explorer on Windows. How do I point the field to the path sites/default/files/images/plants/Plant001/photo01.jpg?


texts: Flexi access : create a view of content allowed

texts:
I'm using Flexi Access in my project to allowed some users to see nodes with the ACL. But can we use Views with flexi access to create a view who regroup all nodes allowed to this user ?

If we can't, there is a solution to show the nodes allowed on normal view ? For example : The users with role 'admin' and 'project' can see every node of entity contact in view 'contact_view' because they have access to entity contact. And my role 'External' can just see the contacts allowed to him in this view but he doesn't access to entity contact.

Edit : Example with image

Here my view saw by role 'admin' and 'Project'

Here the same view saw by role 'external' : Nothing because he hasn't access to the entity shown in this view, but he has acces to the view.

I allowed my user with flexi access to see the node with id : 6166. In my view, i just want to see the row with line 6166 like this :

I hope you understand.

Thanks


texts: Anonymous user can´t see views button which is added in template

texts:
I want to have back button in views page..

The button is added at the bottom of this code.. As Administrator I can see it normally.. But when I log out, it´s gone.. Any ideas ?


texts: Display success message after submitting form

texts:
I am try to display an success message after submitting my form and redirect to next page. The code I am using is the following.

public function submitForm(array &$form, FormStateInterface $form_state) {
  drupal_set_message(t('Form Submitted Successfully'), 'status', TRUE);
}

It doesn't work for me.

Is there any alternate way to do it? What code should I use to display a success message?


texts: Show node field as a carousel using jCarousel module programmatically?

texts:
I have a content type with a fiel called: fotos-carousel (image type) which I want to show as a carousel. I can't use views to do this.

I installed the jcarousel module and read the documentation to add a carousel programmatically.

Then I create a tpl file to change the output of this field: field--field-fotos-carousel.tpl.php

and add this code:

<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php foreach ($items as $delta => $item) : ?>
  <?php
    $items_carousel[]='';
  ?>
<?php endforeach; ?>
<?php
            $options = array ('visible' => 1,'scroll' => 1,);
            print theme('jcarousel', array('items' => $items_carousel, 'options' => $options));
            jcarousel_add('.jcarousel-id-1', array('vertical' => TRUE));
        ?>

The output (ul, li, images) is fine but the carousel is not loaded (jquery)

Anyone has done this before? What am I missing?


texts: setting checkbox Checked in user_registration_form

texts:
Array
(
[account]
   [notify] => Array
                (
                    [#type] => checkbox
                    [#title] => Notify user of new account
                    [#access] => 1
                )

)

I want to checkbox on user_registration_form must be checked by default.
I did $form['account']['notify']['#default_value'] = array(1); but it does't work.Suggest something.


texts: JSON:API How to get node data from menu item

texts:
I have a menu which contains links to nodes.
I can get the JSON:API data for the menu links with the jsonapi_menu_items module.
From there, I want to retrieve the JSON:API data for the nodes themselves.
I don't see a direct path in the data that connects the dots.
I see an indirect path:
The menu link data contains the nid. I could query the JSON:API for all of the node content types (page, article, etc) filtered by nid until I get a hit on the node, but that's inefficient.
I'd want to retrieve the node data from the API more directly.
Menu link JSON
Here's the JSON for the menu item.
// 20210212195003
// https://example.com/jsonapi/menu_link_content/menu_link_content/df30c6df-2c19-413c-b247-affd12127738

{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": {
    "type": "menu_link_content--menu_link_content",
    "id": "df30c6df-2c19-413c-b247-affd12127738",
    "links": {
      "self": {
        "href": "https://example.com/jsonapi/menu_link_content/menu_link_content/df30c6df-2c19-413c-b247-affd12127738"
      }
    },
    "attributes": {
      "drupal_internal__id": 1,
      "drupal_internal__revision_id": 1,
      "langcode": "en",
      "bundle": "menu_link_content",
      "revision_created": null,
      "revision_log_message": null,
      "enabled": true,
      "title": "About",
      "description": null,
      "menu_name": "main",
      "link": {
        "uri": "entity:node/1",
        "title": null,
        "options": [

        ]
      },
      "external": false,
      "rediscover": false,
      "weight": 0,
      "expanded": false,
      "parent": null,
      "changed": 1449285432,
      "default_langcode": true,
      "revision_translation_affected": true
    },
    "relationships": {
      "revision_user": {
        "data": null,
        "links": {
          "related": {
            "href": "https://example.com/jsonapi/menu_link_content/menu_link_content/df30c6df-2c19-413c-b247-affd12127738/revision_user"
          },
          "self": {
            "href": "https://example.com/jsonapi/menu_link_content/menu_link_content/df30c6df-2c19-413c-b247-affd12127738/relationships/revision_user"
          }
        }
      }
    }
  },
  "links": {
    "self": {
      "href": "https://example.com/jsonapi/menu_link_content/menu_link_content/df30c6df-2c19-413c-b247-affd12127738"
    }
  }
}


texts: How to create a view with group by node title and no grouping on nid

texts:
I want to create a view that shows nodes with duplicate titles. I am using Views 7.x-3.7 and Drupal 7.24

To do this I created a view with 2 fields: nid and title.

I turned on Use aggregation and for the node title field set it to group results together, and for the nid field selected count.

The query generated was:

SELECT node.title AS node_title, node.nid AS nid, COUNT(node.nid) AS nid_1
FROM
{node} node
GROUP BY node_title, nid
LIMIT 10 OFFSET 0

Clearly this won't work - we can't count nids if we are grouping by the nid.

How would I change my view so the query outputted was:

SELECT node.title AS node_title, COUNT(node.nid) AS nid_count
FROM
{node} node
GROUP BY node_title
LIMIT 10 OFFSET 0

Is this even possible? And if not why not? I would ideally like to achieve this without hook_query_alter if possible.

Exported view:

$view = new view();
$view->name = 'duplicated_page_titles';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Duplicated Page Titles';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Duplicated Page Titles';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['group_by'] = TRUE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
/* Field: COUNT(Content: Nid) */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['group_type'] = 'count';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'page' => 'page',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'duplicated-page-titles';


texts: Port/Automate the process of theme development to modules development

texts:
Thank you for taking time to give me guidance and advice for this ^^.

So we have a Drupal starter theme using: scss, es6, webpack, grunt, linting, .editorconfig, bower and so one.

All of this allows the team to understand the code of each other and keep everything organised.

I was wondering if there was a possibility to do the same for modules (it is possible actually). My question is how we can manage all of this stuff.

If we place these files inside each custom module we have, it will be hard to maintain. Is there an approach to create for example a grunt file for each module that inherit another configuration (core one - only one), and let's imagine having one core module which compile everything when needed - keeping in mind that we may need for each page to load a specific/different js/css.

Can we achieve something like that ?


texts: How do I change the created date when I create a node?

texts:
When i do POST request for create node i get error:

{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Property created cannot be set.",
  "status": 400,
  "detail": "Bad Request",
  "instance": ""
}

My restful resource provide this field:

protected function publicFields() {
  $public_fields = parent::publicFields();

  // Another fields ...

  $public_fields['created'] = [
    'property' => 'created',
  ];
}

I use restful module.


texts:
I installed commerce 2.x and all seemed well. I have recently noticed there's no sign of any settings to configure taxes. When first setting up a store the taxes section (see image) wasn't visible as an option.  My "vendor/commerceguys" folder contains zone, intl, enum and addressing.

Do I have to run the composer command "composer require "drupal/tax"" or something? To install commerce in the first place I ran "composer create-project drupalcommerce/project-base mystore --stability dev" as instructed on the drupal commerce site so puzzled no tax setting are available? Also where does composer manager come into it, is this something I need to proceed?

Thanks for any help