texts: How can I prevent Drupal to add extra  tags to body field?

texts:
I have a content type with body field. I have created few nodes of this content type. When I edit them, I see that there are extra <p> tags have been added to the text of body field. I checked in the field_data_body table in databse and found that HTML tags were there as well in the body_value column for each entry.

I google for it and found out two probable causes:

Using an MCE adds extra HTML tags.
If input format used for body field has 'Convert line breaks into HTML' option enabled.

I checked and found that neither do I use any MCE, nor do I have the 'Convert line breaks into HTML' option enabled for the input format used.

What else might be causing the addition of extra HTML tags and how can I prevent it?


texts: Why doesn't LinkFormatter::viewElements bubble cache metadata?

texts: I am trying to understand how the token system in Drupal 8 interacts with the cache bubbling system and in LinkFormatter I see $link_title = \Drupal::token()->replace($item->title, [$entity->getEntityTypeId() => $entity], ['clear' => TRUE]); doesn't pass in a BubbleableMetadata object to the token system. But why?


texts: Can I safely delete the migrate tables after migration?

texts:
I passed a site from d7 to d8
I wanted to know if I can delete tables db migrate map d7 and migrate messages d7
they are more than a hundred
I can delete db tables migrate map d7 and migrate d7 messages of types of content that no longer exist on d8?

http://fortecad.altervista.org/ottomigratemapImmagine.jpg

http://fortecad.altervista.org/ottomigratemessaggeImmagine.jpg

regards


texts: Create one-off page with specific fields and template

texts:
I'm new to Drupal and trying to add a single new page to an existing Drupal website. It has its own design (with its own css) and its own content requirements separate from the rest of the site.

I'd like to be able to define a set of custom fields for the page, and then use a specific twig template to render those fields.

Is this possible? I'm struggling to find a way to do this.

I get most of the way there with a custom content type. I can create all the fields I need for the page. But, I don't want it to function as a repeatable content type, but rather as a one-off page that has a specific, single path.

When I try using Page Manager to create a page, I get presented with what looks like a WYSIWYG kind of editor for laying out blocks/panels on the page. I'm hoping to rather simply be able to define a set of fields and use the template to arrange everything on the page.


texts:
I'm hosting Drupal on Dreamhost shared hosting where I have a maximum of 90 MB RAM and a lot of enabled modules.
Is there a way to see how much memory each module is using?


texts: How to check if a user is logged in inside a view

texts:
I can easily check if a user is logged in in most templates by simply using a twig variable, or making a custom one myself. My issue is that I would like to be able to check if a user is logged in inside a custom text field in a view.

I used

{% if logged_in %}
     Test
{% endif %}

But it didn't seem to work. Also

{{ dump(logged_in) }}

came up null. Also I looked in the available options for context filters and relationships but nothing seemed to have anything to do with the current user. Only authors of the content.
Is there a way to know if the user is logged in from a view?

I suspect that it might be possible with some preprocess hook for views but if that can be avoided by using an option in views that would be preferable.

For clarification this is a view that displays a list of articles. Each with an image, title, and a snippet of body text. The article node has a field deciding whether a user login is required. If the user login is required then the body text is replaced for anyone that isn't logged in.

UPDATE: I attempted adding the variable in a preprocess hook but that didn't seem to do anything either.

function mymodule_preprocess_views_view_field(&$variables){
    $variables['logged_in'] = (\Drupal::currentUser()->isAnonymous())?false:true;
}

But {{ dump(logged_in) }} still came up null.


texts: How to connect to drupal 7 using web service?

texts:
can I connect to my Drupal website using web services and pass a variable (with post method) to it? I know that forms in Drupal actually have hidden elements so that it is not possible to submit the form from external sources.

There is also a service module but I don't think I can achieve what I am trying to do with it.

The following is what I am trying to do with Drupal:

When I connect to www.drupal-site.com/web-service (web-service is just an example), I would like to be able to post variables to it and perform complex database queries. I would also like to return the result of the queries in json (using echo maybe). I would also like to be able to remove the headers and footers of my drupal site.

I really need some direction on how this can be achieved.


texts: programmatically save image to node with link in custom module

texts:
Im quite new to drupal 7. But my approach is learning by doing. This have worked fine until now....

My problem is, that I in a custom module, with a form submit, save a node with all the filled fields, including images. (Code below)

My problem is that i want to add a, a href to the images i save, so when opening the node the images will link to the link i have saved.

Is this even possible?

My node_save with pictures is like this:

$who = $user->uid;
$test = 'term_id' . $who;
$test1 = 'sales_id' . $who;
variable_set($test, $base_url . '/Sales/' . $form_state['values']['sales_id_terms']);
variable_set($test1, $base_url . '/Sales/' . $form_state['values']['sales_id_comp']);

$term_id = $form_state['values']['sales_id_terms'];
$file_temp_top = file_load($user->top_banner);
$file_temp_bund = file_load($user->bund_banner);
$file_temp_power = file_load(110);

//$file_temp_top = file_save_data($file_temp_top, 'public://firm_images/', FILE_EXISTS_REPLACE);

$node1 = new stdClass();  // Create a new node object
$node1->type = 'product_link';  // Content type
$node1->language = LANGUAGE_NONE;  // Or e.g. 'en' if locale is enabled
$node1 = node_submit($node1);
node_object_prepare($node1);  //Set some default values
$node1->status = 1;   // (1 or 0): published or unpublished
$node1->promote = 0;  // (1 or 0): promoted to front page or not
$node1->sticky = 0;  // (1 or 0): sticky at top of lists or not
$node1->comment = 1;  // 2 = comments open, 1 = comments closed, 0 = comments hidden

$node1->title = $form_state['values']['sales_name'] . '_1';
$node1->field_betingelser['und'][0]['value'] = $terms;
$node1->field_top_banner['und'][0] = array(
                'fid' => $file_temp_top->fid,
                'filename' => $file_temp_top->filename,
                'filemime' => $file_temp_top->filemime,
                'uri' => $file_temp_top->uri,
                'status' => 1,
                'display' => 1,
);
$node1->field_bund_banner['und'][0] = array(
                'fid' => $file_temp_bund->fid,
                'filename' => $file_temp_bund->filename,
                'filemime' => $file_temp_bund->filemime,
                'uid' => 1,
                'uri' => $file_temp_bund->uri,
                'status' => 1,
                'display' => 1,
);
$node1->field_powerd_by['und'][0] = array(
                'fid' => $file_temp_power->fid,
                'filename' => $file_temp_power->filename,
                'filemime' => $file_temp_power->filemime,
                'uid' => 1,
                'uri' => $file_temp_power->uri,
                'status' => 1,
                'display' => 1,
                'href' => $GLOBALS['root_url'] . '/new-products/',
);
$node1->field_terms_id['und'][0]['value'] = $form_state['values']['kon_id_terms'];

// Add author of the node
$node1->uid = $user->uid;

// Set created date
$node1->date = 'complaint_post_date';
$node1->created = strtotime('complaint_post_date');

$new_path = 'sales/' . $node1->field_terms_id['und'][0]['value'];
$node1->path = array('alias' => $new_path);

// Save the node
node_save($node1);


texts:
So I want menus to output in a custom way. I would not output the following HTML.

       foo

       bar

I would replace it with the following one.

   foo
   bar

So I put in the template.php file the following function (my theme is called mFAC).

function mFAC_links($variables) {
    // custom stuff
}

I am starting with a light alteration, but nothing seems to have any effect. I cleared the cache.

Is there anything I am missing?


texts: How to redirect the user to a specific page after node is added/edited by user

texts:
I'm trying to create a drupal 7 website where users can upload pictures with a title.

When the user uploads an image with title, it has to be approved by the admin who then publishes it. My question is after the user uploads the image, how can I redirect the user to a different page which tells the user that the uploaded image has gone for approval by the admin.


texts: Display a flag link in views based on whether the node has an associated taxonomy term

texts:
All of my nodes of a certain content type are given a category by assigning a taxonomy term. I would only like to add the flag, "My Fruits" if the content has the term "Fruit" assigned to it.

So far I've attempted using a views PHP field to add the flag:

This works to simply print the flag:

<?php
print flag_create_link("basket_01_t01_fruit", $row->nid);
?>

But this, I'm not able to get working:

<?php
if ($row->field_item_produce_type == '3') {
print flag_create_link("basket_01_t01_fruit", $row->nid);
}
?>

Any ideas would be appreciated.


texts: Adding placeholders to the user login block's username and password input fields

texts:
Task

I'm trying to add the placeholder attribute to the username and password input fields of the user login block.

Problem

When I have twig debug on, the only twig file overrides list are the following.

<!-- FILE NAME SUGGESTIONS:
* input--textfield.html.twig
x input.html.twig
-->

I don't want to use either of these twig files as it would apply to every input or every textfield.

Caveat

I'm wanting to accomplish this from within my theme not a custom module. Which I'm not sure is able to be done.


texts: How to have various 'access denied' pages depending on URL

texts:
I'm trying to make multiple access denied pages and show the relevant one based on the page attempted to view.

Use case:

User is limited to only one "CV" node. If they try to create another, they get an access denied page. I want to display a custom page that says something like, "You can only create one CV". A different access denied page, resulting from a different url, would display a different message.

Is this possible? The only solutions I've found seem to create a single page for all access denied notifications.

Cheers,
Oliver


texts: How to render a paragraph 'Text (formatted, long)' as full HTML, not escaped

texts:
I'm trying to create a custom paragraph template that displays as an accordion. I am able to correctly reference most of the other variables, except for the Text (formatted, long) field types as whenever I do .value for the field, it returns the escaped value so it looks like

text

text2

instead of the actual bulleted list.

I am able to get the value using .value|raw, but I read that I should be avoided and I'd like to get this perform correctly.

Please let me know if any further information is required.

The following code is under paragraph--rn-accordion.html.twig. I have two paragraph types, rn_accordion and rn_accordion_section(which houses all the different fields). I tried to mirror this from the bootstrap module to get this working.

The troublesome fields are: {{ item['#paragraph'].field_rn_acc_1.value }} and {{ item['#paragraph'].field_rn_acc_2.value }}

            {# Prints Accordion template. #}

                  {# Loop through all of the accordion sections. #}
                  {% for key, item in content.field_rn_accordion if key|first != '#' %}

                            {# Print the accordion section title. #}

{{ item['#paragraph'].field_rn_acc_title.value }}

                                {{ item['#paragraph'].field_rn_acc_link.value }}

                            {{ item['#paragraph'].field_rn_acc_1_btn.value }}

                            {{ item['#paragraph'].field_rn_acc_2_btn.value }}

                    {{ item['#paragraph'].field_rn_acc_1.value }}

                    {{ item['#paragraph'].field_rn_acc_2.value }}

                  {% endfor %}


texts: Why in drupal files are in .inc extension rather than php?

texts:
Possible Duplicate:
  when to use include (inc) files in module development

Why they include files with .inc extension, not just .php?


texts:
I'm having troubles figuring out how to filter by date using the date range module from Drupal 8 core.

I, of course, found this post: How to filter a View by Date Range (start, end)?

But this doesn't tell me how to use the filter, it only makes the filter work better. So I used this patch but how to make this filter work?

I'm creating a calendar with cultural events and I want to be able to filter on date and genre with exposed filters. So let's say I have a design event from 05-01-2018 until 05-02-2018 (dd-mm-yyyy).

And I want it to show up when I'm searching for what is going on today or this month that concerns design? How to set up the filter for this?

What is the best and most simple way to do this?


texts: Autopopulate EntityReference field using rules?

texts:
I'd like to have an EntityReference field be autopopulated by the node that was just navigated from.

So the workflow would be:

User views page for Business A -> User clicks review link -> User is presented with review form, & EntityReference field is automatically populated with the name/id of Business A.

What I don't know is which action to designate to tell Rules to do this. I have Event set to "before saving content," and Elements set to
"Entity has field, Parameter: Entity: [node], Field: field_venue_reference." These seem like the correct settings for these portions from what I have read, but since I'm new to Rules, I'm not completely sure of that either. Any suggestions?


texts: How can I add menu items when importing nodes into Drupal 7 (with the Feeds module)?

texts:
I'm importing a site using the Feeds module, and I do not see any way to specify which nodes should get a menu item.  How can I do this?

If the Feeds module cannot do this, is there another way?


texts: Set data value in rules not written when using a condition

texts:
I like to create a rule that will overwrite my body field after saving new content. This is content from the same node that has been created(field_update) and some content from referenced users form a user reference field(field_userrefer).

I have a CUSTOM TEXT field called "field_update".
This is is were content is written.

My actionrule is :

set data value "node-body-value" to
[node:field-update]
this works.

I have to create conditions to get the required fields I want to show in the data selection.
This also works very nice because is can see all fields in my data selection auto complete box.

The problem is that when I add these conditions my body field isn't being populated by my custom values.

Any help appreciated.

When i have a set of rules without conditions.


texts: What happened to the edit links in the Page Manager UI?

texts:
I uploaded a site to a shared hosting environment and suddenly I can't use the edit links in the Page Manager UI any more.  As you can see in the screenshot, they've simply disappeared.  I can click the triangle and get a disable link but no edit.

I cleared the cache multiple times to no effect.  I then made a database dump of the server mysql and imported it into a local copy and experienced the same problem, even after clearing the cache multiple times.  I then turned off all of the aggregation options on the Performance configuration page and cleared the cache again, but no change.

Is this a typical problem or something I have uniquely done to screw things up?

EDIT: Upon further inspection, I noticed something else weird.  I am able to access the pages by typing in the URL manually, but when I go to edit a piece of custom content, the Edit option, which is usually just under Disable this pane, is missing:


texts: Best way to approach users voting on and identifying content?

texts:
I am working on a Drupal 7 website, Double Enders, where users can view and add individual boats, categorizing them by design.

I already have several boats that have not been identified by their design. I am planning on using views to allow users to view the boats that do not have designs associated with them. I would like to also give users a drop-down menu with all the designs (which is a view that I use elsewhere in the site) and allow them to use this drop-down menu to identify/vote on what type of design the boat is, tallying their votes.

Looking through the voting modules, it does not appear that any of them allow one to use a view as the options a user can select between. Instead, they all seem to provide some variation on ratings or yes/no.

I am considering using the Voting API module to build the functionality myself. However, before I go down that road, I was wondering if I had missed a module that I could use or another way to get the functionality I desire. Does anyone have any suggestions, or am I right to proceed using the Voting API module?


texts:
I would like SimpleNews use another theme (Bartik for example) than the admin one (Seven). I configured MailSystem to use "Bartik" as theme to render emails, as written in SimpleNews README.txt:

  The template files are self documented listing all available variables.
    Depending on how the mails are sent (e.g. how cron is triggered), either the
    default or the admin theme might be used, if one has been configured.
    To prevent this, Simplenews supports the mail theme setting from the
    mailsystem module (http://drupal.org/project/mailsystem). Install it, choose
    the mail theme and the newsletter templates from that theme will be used no
    matter which other themes are enabled.

In the simplenews.module file, I got the line:

2674.  $theme = function_exists('mailsystem_get_mail_theme') ? mailsystem_get_mail_theme() : path_to_theme();

And $theme is evaluated as "theme/bartik". Great, but it keeps use the "simplenews-newsletter-body.tpl.php" file in "theme/seven" directory.

I struggle with that for weeks now, any help would be welcome!

Thanks.


texts: How can I avoid the feed link is printed in my theme?

texts:
My current theme displays a Subscribe to link that is output from
the core/themes/stable/templates/misc/feed-icon.html.twig template. I don't want to display it in my theme. Whatever I try, I can't find which template or which string prints this link.

How can I avoid the link is printed?


texts: Create Group permission to grant view of all group content

texts:
I'm running Drupal 8.7.11 and Group 8.x-1.0-rc5.

I have a situation whereby I have > 5,000 groups.  The majority of the users are members of 10 groups.  However I have a small set of users who need an overview of all content from all groups.  I have had issues running the site when enrolling users into all of the groups, so I had to give them 'Bypass group access control' in order that they can use the site without it crashing.

However what I would like to do is create a new 'View all group content' permission, which skips the access check, but doesn't give the users the administrative access that comes with 'Bypass group access control'.

Does anyone have an example of how this might be achieved?


texts: Why wouldn't hook_form_submit be called?

texts:
function mymodule_reviewer_node_form($node, &$form_state) {
global $school;
if ($school) {
    $form['field_reviewer_school']['#value'] = array(array('nid' => $school));
    $form['field_reviewer_school']['#access'] = FALSE;
}
  return $form;
}

function mymodule_reviewer_node_form_submit($node, &$form_state) {
}

The form gets submitted successfully, but form_submit never gets called. What might cause this?


texts: How to create a custom block using the RESTfull API

texts: I have to create a block by calling a custom Rest based services but didn't find anything specific to that as of now in drupal8. Any help would be appreciable.


texts: microblog module - problem with max characters

texts:
On the left column on http://ruh.kz, you can the output of the Microblog module. This module uses the node title as a microblog entry; the maximum length of the title is by default 255 characters. In a microblog.module I've made the following changes:

function microblog_form(&$node) {
  $type = node_get_types('type', $node);

  $form['title'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->title_label),
    '#rows' => 4,
    '#cols' => 30,
    '#required' => TRUE,
    '#maxlength' => 500,
  );

  return $form;
}

Now, when I'm typing, it shows only 450 characters or less. Why it happens?


texts: How to add an extra field in file upload widget?

texts:
I know that it is possible to enable a description field in the core file upload widget for Drupal 7.

However, I want to add an extra description field like the one already present. For this I've spent hours googling, but not found the perfect solution. Please, someone, help me to solve my problem


texts: What happened to the og-list view in organic groups?

texts: The new version of Organic Groups (7.2) does not have a the view og-list, which used to display a list of all the groups. Any idea why it was removed and how to get the list of all groups?


texts: Display the total weight of the order in the basket

texts: I installed the module https://www.drupal.org/project/physical in my cart view, I'd see the total weight of the order. How to do this ?


texts: programmatically alter unit price for backend order

texts:
I'm looking for a way to programmatically alter the unit price for products when adding them to an order via the backend (via a hook). I've seen some examples that make use of the cart hooks, but those aren't called via the backend.

Basically -- when someone chooses to add a line item and selects a product, when they add that product to the order, I want to be able to adjust the unit price. I've tried every hook I can think of and nothing seems to impact that process.

I've also tried to achieve this with rules, but there doesn't seem to be any event that is triggered when a product is selected and loaded to the order form. There are events for updating, creating, etc. -- but they are all triggered on save.

This is running on Drupal 7 with Commerce 7.


texts: How to solve Bootstrap Theme settings override problem?

texts:
I'm using the Bootstrap base theme and a sub-theme (cdn) in one of my websites.
Normally everything was fine. Then I installed a fresh Drupal into another server and installed the themes I was using before. The problem appears there, I couldn't change any theme settings of Bootstrap themes via Drupal interface. For example I tick the Fluid container and save but it doesn't change, the box goes back to being unchecked.

The new server configurations may be different from old one.
Does anybody know what Bootstrap need for theme settings?


texts: Plain Unstrucutred HTML Content Types, How to Pull image from them in Views

texts:
This is a plain unstructured node with no CCK structure or anything like that (the site includes thousands of posts so it is impossible to retroactively go back and re-insert the images in using CCK).

How can I pull the first image in the node out and use that image within a view as a thumbnail image? (It's a related posts view)

I'm not 100% sure how to create a view theme, the drupal documentation on it is really confusing and I can't find a good tutorial on how to create a custom view theme either.  So since I think that is the best solution if you know how to do that, could you point me to a tutorial or something that actually teaches you how to create your own themed view (one that makes sense).

Thanks for any tips or advice.


texts: How to remove a line of HTML in webform?

texts:
The company I work for uses Drupal Webform to collect information regarding it's customers. At the very end of the webform, we have a file component with a size maximum of 64 MB. I was tasked with removing the description under the upload.

Just to clarify, I don't want to remove the max size, just the text that says what the max size is.


texts: prevent drupal from redirecting to created nodes

texts: as you know after publishing a node Drupal redirects to that node. How Can I change this functionality ? I want to force it to stay on the same page or maybe redirect it admin page instead of nodes.


texts: Field api - taking responsibility over a field display

texts:
I am writing a Drupal module that deals with the taxonomy terms, which are (as I understand) fields, taxonomy vocabulary , which are as I understand entities. My module should take over the taxonomy term field and vocabulary entity for mirror language display, meaning that once my user is in X language, he will see the X language value of the term/vocabulary name/description.

Looking at the i18n_taxonomy module code I can see that it implements many fields related functions (i18n_taxonomy_field_attach_view_alter(), i18n_taxonomy_field_formatter_view(), i18n_taxonomy_field_formatter_info(), etc). My questions are:

Once I need to to take over a display of a field, how can I do it?
What functions should my module implement for displaying the fields on menus, widgets, plain view, etc?
Same question, only for the vocabulary: is there any difference?
I have spent my time googling this subject, but I have not really found a good reference. Can anyone refer me to one?


texts:
I created a content type (main prod) that is referencing a product content type (sub prod). The sub prod is also referencing another product content type called (option sets) which will be the option sets of that product, with the use of Commerce Product Bundle I was able to combine all the different prices of the sub prod and the option sets and with the use of Commerce Product Attributes I am able to change the option sets to a list text field.

I applied a patch that I saw to calculate the total price of all the chosen option sets and the sub prod on the cart and checkout page. My problem is on the product page itself I want the price of the sub prod to be calculated depending on the option sets chosen via real time of with using ajax.

Can anybody help?

This is the list of commerce modules I have currently installed on my site.

Drupal Commerce
Commerce Product Bundle
Commerce Product Attributes


texts: I am looking to write a field widget to extend the file field in Drupal 7. The reason is that I want to do some file parsing after it has been uploaded. Are there examples I would be able to look at? How should I got about writing this new module? Or is there a better way I can do this?


texts: Generate one-time-use custom links for emails and interact with them to accomplish tasks

texts:
Is there a module that would auto-generate custom unique  one-time-use URLs that timeout after a set time, and can be used to accomplish tasks and progress workflows in Drupal 7?

Use Case 1

User must click link in email to verify their address is valid.

Use Case 2

As part of a workflow process users must confirm they wish to complete an action by clicking on the appropriate link in an email message and depending on the link chosen the node would progress to a different state in the workflow


texts:
I've searched around for quite a bit but can't find the anwer. I'm trying to add a "Edit this page" functionality to my admin menu. Is there an existing feature or module that I'm missing which allows an admin to go directly to editing the page being viewed?

If such a module doesn't exist, can I create one?
I tried creating a link on my admin menu , but it doesn't seem to work:

function admin_edit_menu() {
     $items = array();
     $items['admin/misc'] = array(
      'menu_name' => 'management',
      'title' => 'Edit',
      'description' => 'Edit this page',
      'page callback' => 'http://www.mysite.com/node/' . $node->nid . '/edit',
      'access callback' => TRUE,
      'type' => MENU_NORMAL_ITEM,
      'weight' => -15,
    );
}


texts:
I am trying to install drupal using drush site-install and keep getting the following error at the top of the page.

Warning: Illegal string offset 'field' in DatabaseCondition->__clone() (line 1817 of /var/www/mydrupalsite/includes/database/query.inc).

Even when I logout of administrator, the error still pops up at the top of the page. Can anyone explain what is going wrong and how to get rid of these messages? Everything else seems to have installed properly.


texts: Adding a form to Views Bulk Operation for configurable operations

texts: I have a view with a list of nodes that I want to operate with, but I need additional user input for the function. Until now, I have been handing this by having many similar, but slightly different 'Execute arbitrary PHP script' actions. Is there any way to add a sort of form to accept user input other than the nodes to operate on?


texts: How to create a views filter for users who have never accessed a site?

texts:
I have a view where I am trying to show all users who have a last access value of never, meaning they have never logged in.

The filter however expects a Date value which is no help to me because I just need to filter by users who have never accessed.

Does anyone know a way around this?


texts: Is there a module for google maps in drupal 7?

texts:
On a site that I am building (using drupal 7), there is a feature that I need to include that I can't seem to find; Google maps. I am looking for two things;

1: something that will allow you to put in your home address, and it will give you directions to a preset location

2: something that will allow you to imbed a map of the surrounding area of a preset destination by stating the location in a CCK

do either of these exist? if so, where can I find them?

I need it to look like this:
where instead of an image, the map is actually an embedded google map.


texts:
I want to send an attachment with drupal_mail() using hook_mail_alter(). Do you have any ideas about which parameter should I use?

Does the variable $param help, in some way?


texts: How to print the HTML content of the text field in Drupal 6 programmatically

texts:
I am printing the $node->field_abc[0]['value'] in php code where node is node content and field_abc is text field .

How can I print the html format of the field in Drupal 6


texts: Upgrading to core 8.8 results in a path alias error

texts:
I have been trying to upgrade a site from Drupal 8.7.7 to 8.8, and following the release documentation, I upgraded the core and pathauto module at the same time.
So my composer.json has the core set to ^8.8, and pathauto to 1.8.
After running drush updb I get the following error in the console:
 [error]  ParseError: syntax error, unexpected '::conf' in module_load_include() (line 73 of /var/www/html/docroot/core/modules/shortcut/shortcut.install) #0 /var/www/html/docroot/core/includes/module.inc(99): module_load_include('install', 'shortcut')
#1 /var/www/html/docroot/core/includes/install.inc(88): module_load_install('shortcut')
#2 /var/www/html/docroot/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(41): drupal_load_updates()
#3 [internal function]: Drush\Commands\core\UpdateDBCommands->updatedb(Array)
#4 /var/www/html/docroot/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

When I visit the front-end of the site I see the following:
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: Unable to replace alias "path.alias_whitelist" with actual definition "path_alias.whitelist". in Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass->process() (line 57 of /var/www/html/docroot/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php).

Any idea how can successfully upgrade from Drupal 8.7.7 to 8.8?
Note: I still have a backup of the site and db, so an explanation on the upgrade would also work.


texts: How can I sum up fields that reside in multiple nodes?

texts:
I am using Drupal as an inventory management system and wanted to know how can I sum up fields to get a net total?

Say I purchased 10,000 widgets over 2012, and I want to be able to sum up all the fields in those nodes to get a final total then have it displayed in a block giving me a summary of how much I spent during 2012. I want to be able to archive this data into a type of report.

I know I should use the Views module, but I want to know how others would accomplish this situation.

What kind of performance roadblocks could I run into, if I had 1 million nodes? Would my site crash? can this be lazy loaded. if needed?


texts: Usually the articles in a drupal installation are published on the front page, but what I would like to do is to create a menu link to show all articles (instead of the front page)?


texts: Update core keeping other composer packages

texts:
After upgrading Drupal to the last version with Drush (8.1.15) the other composer.json dependencies (e.g. drupalconsole) are removed.

Are there any way to update Drupal with Drush keeping other composer dependencies?

diff --git a/docroot/composer.json b/docroot/composer.json
index 6089861..b9536cf 100644
--- a/docroot/composer.json
+++ b/docroot/composer.json
@@ -4,28 +4,11 @@
     "type": "project",
     "license": "GPL-2.0+",
     "require": {
-        "ckeditor/fakeobjects": "4.6.2",
-        "ckeditor/image": "4.6.2",
-        "ckeditor/link": "4.6.2",
-        "codemirror/codemirror": "5.27.4",
         "composer/installers": "^1.0.24",
-        "drupal/console": "~1.0",
-        "jquery/geocomplete": "1.7.0",
-        "jquery/icheck": "1.0.2 ",
-        "jquery/image-picker": "0.3.0",
-        "jquery/inputmask": "3.3.7",
-        "jquery/intl-tel-input": "12.0.0",
-        "jquery/rateit": "1.1.1",
-        "jquery/select2": "4.0.3",
-        "jquery/timepicker": "1.11.11 ",
-        "jquery/toggles": "4.0.0",
-        "jquery/word-and-character-counter": "2.5.1",
-        "progress-tracker/progress-tracker": "1.4.0",
-        "signature_pad/signature_pad": "2.3.0",
-        "wikimedia/composer-merge-plugin": "~1.4"
+        "wikimedia/composer-merge-plugin": "^1.4"
     },
     "replace": {
-        "drupal/core": "~8.3"
+        "drupal/core": "^8.4"
     },
     "minimum-stability": "dev",
     "prefer-stable": true,

I've seen that there is a composer project for Drupal but I'm not using it in this project.


texts: Get page number of multistep webform in tpl.php

texts:
I have a multistep webform that I would like to display a video only on page one.

I am trying to find a reliable variable that will only be available on the first page.

I have tried this in hook_form_alter but it is unreliable when the user navigates back to a previous page. It works initially. Page one video shows, page two no video, back to page one no video, page two video shows.

I am using drupal_add_js to add a display:none on the video div when page_number > 1, but it isn't working as I expected. Any ideas?


texts:
For some reason i don't have access to user/login block and don't have a region content .
is there any way to login without them like drush,url ?


texts: What might cause the unexpected workflow state changes after executing a rule?

texts:
I want to change the workflow state to draft from publish and unpublished the node on edit. I used rules for this:

For Unpublish:

For publish:

When I edit a node and save it, workflow state changes to draft through Rules and again changed to published state.

I have not set any trigger settings.

Please suggest what could cause this.


texts:
I'm trying to use a small piece of JS code in my site (D7).
The code should automatically insert a guid to an <input> field with "my-input" ID on page and set this field to "readonly", like this

<input id="my-input" type="text" readonly size="40">

The script guid.js looks like this

function guid() {
  return s4() + '-' + s4() + '-' + s4() + '-' + s4();
}

function s4() {
  return Math.floor((1 + Math.random()) * 0x10000)
    .toString(16)
    .substring(1);
}

document.getElementById("my-input").value = guid();

I've tried to include the file, also with "inline" methods but cannot get it work.

My I ask you for your advice how to do it? I will need also to specify, in which files to make the changes as I'm a Drupal newbie.
On the website, OG and PURL are also implemented if this can influence something.


texts: Is there a way to print out a list of all possible template files for a page?

texts: Including template files used for views, rows, blocks, etc. on that page?


texts: What is the D6 equivalent of D7's hook_filter_info?

texts:
I am backporting a module from D7 to D6, and I am not familiar with Drupal 6.

The following three lines runs a chunk of text in the variable $input through the Markdown filter to produce $output.

$filters = module_invoke('markdown', 'filter_info');
$info = $filters['filter_markdown'];
$output = $info['process callback']($input, NULL);

Provided the Markdown filter module is enabled, it works fine on Drupal 7.  On D6, the call to module_invoke returns NULL (so the rest fails).

The cause is obvious, hook_filter_info did not exist for Drupal 6, so this is invoking a non-existing hook.

It looks like hook_filter is supposed to do the same thing in D6, so I try:

$filters = module_invoke('markdown', 'filter', 'list');

This results in the following array filters[0]['Markdown'].  I don't know how this helps, or - if it is the right start - where to proceed.

Can anyone tell me how to run a chunk of text through a text filter in Drupal 6?


texts: Sending an email using phpmailer drupal 6

texts:
How do I use the phpmailer module. I have it installed and my test email sends. However the php mailer tutorials show examples for using the module outside of Drupal. I want to place some code within a node to quickly fire off an email to myself when x happens.

or is it better to use the durpal mail function, I am using drupal 6, however this is not part of a module but instead will be placed in a node.


texts: Logged-in users getting logged out on some pages

texts:
Here's my problem. Some users are logged into Drupal. When they navigate through the website and hit certain pages, they get "logged out" until they navigate to another one, where they are logged in again.

Different users have different pages on which this is triggered.

If anyone has any kind of lead, let me know !

Thanks,


texts: How to create a views page of discounted products list?

texts:
I'am using commerce discount module in commerce kickstart 2.11
And need to create a page with a list of dicounted products using views filter and/or search API.
I've tryed without any success.
Please Anyone, any help to do this.


texts:
Drush sql-sanitize doesn't work on my test install.

drush @pfdevd6mg sql-sanitize --sanitize-password=newpassword
PHP Warning:  Module 'curl' already loaded in Unknown on line 0

The following operations will be done on the target database:
 * Reset passwords and email addresses in users table
 * Truncate Drupal's sessions table

Do you really want to sanitize the current database? (y/n): y
Sanitize query failed.

does alias aren't possible ?

EDIT: Using Drush 8

ERROR 1146 (42S02) at line 1: Table 'provence-formation_pfdevd6mg.users' doesn't exist
Sanitize query failed.


texts: How to theme field collection form in Drupal 8?

texts: I want to theme the field collection add and edit form. I have a field collection name "field_experience" and want to theme the form of that field collection I tried field--field-experience.html.twig, field--field-collection--field-experience.html.twig. I want to know how I will achieve this. Remember I want to theme the field collection form fields not styling the field collection output


texts: What are the appropriate file security settings and Apache settings for Drupal sites running on a VPS?

texts:
I would be grateful for some help on this one - I have looked at the other posts on this subject with interest, but they don't seem quite to fit my situation. I'm not a great Unix expert, but there are some aspects of my Managed VPS provider's setup which seem strange to me.
Looking at the Apache process (ps -ef | grep httpd) I can see 6 processes running under user 'nobody', but also two processes running under 'root'. This does not seem normal to me, although when I asked the hosting provider about this, their support said it was necessary to run APC. But is this true?

The other thing I don't understand, which may be linked, is that the server seems to create files under my VPS user name (say, 'joe') instead of 'nobody' which is what I would expect. For example, when I run the "security_review" module, it creates IGNOREME.txt owned by 'joe' and group 'joe'.

I can't help thinking that this means that anybody who could somehow download a script to my server could then wipe all the files on it, since the file would be created under 'joe' instead of 'nobody'.

I would also be very glad to have a script to put correct file permissions which does not need to be run by the user 'root'.


texts: How to create related links list in Views

texts:
So for Content Type 'Level 3' I have added a field called 'Related Links' which uses Entity Reference and autocomplete so a user can select multiple pages that are related.

I've been now trying to render these pages as links using Views, however I'm really stuck as to what settings I should be using. I need Views to get the Related Links for the current page on which it is displaying the block, and then display a linked Title of each of the pages that have been specified in the 'related links' field.


texts: How to hide the submit button on a node add/edit form page within which a entity reference select list has no valid option?

texts:
Registration content type has a required entity reference field. The widget of this field is a select list, the options are populated with a views entity reference display output. I want to hide(unset) the submit button if the views entity reference display returns no value.
I've asked a question here for reference, I'm suggested to post a new question.


texts: Replace date by text in date_popup default value (or in-field label)

texts:
I am desperately trying to display a date_popup field in my form with a text eg("please select date") as default value and not a date. Can someone help?
Thanks a lot.


texts:
I have a view and added the title as a field.
For example: How do I print the title?

In Drupal 7 it was as simple as
views-view-fields--[viewname].tpl.php
<?php print $fields["title"]->content; ?>

How do we do this in Drupal 8?
I have created views-view-fields--[viewname].html.twig
I thought it might be {{ fields.title }} but I get the classic error message like so:

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

I then tried {{ field.title }}, {{ title }} and {{ content.title }} but nothing prints.


texts:
Currently I'm working on a 6-language website and all content obviously needs to be translated, including menus. For this, I have enabled i18n_menu and i18n_select (as I had a little experience on the latter regarding this issue), translated the originally French node to English, and both menu items show up when I go to English translation of the node. Any ideas?

There are several discussions on drupal.SO about this, including this  and this one on drupal.org; but none seemed to resolve my issue.


texts:
Let's say I have a field image in a Product entity. When I query a Product, I'd like to include the URL of the field image in the response.

The documentation states we can use image_url.

According to this issue I tried the following but I still get null for my field in the response.

$registry->addFieldResolver('Product', 'image',
  $builder->compose(
    $builder->produce('property_path')
      ->map('type', $builder->fromValue('entity:product'))
      ->map('value', $builder->fromParent())
      ->map('path', $builder->fromValue('field_image.value')), // not sure if value is the correct property here
    $builder->produce('image_url')
      ->map('entity', $builder->fromParent())
      ->map('field', $builder->fromValue('field_image'))
  )
);


texts: What is the difference between drupal/drupal and drupal-composer/drupal-project packages?

texts:
I want to use composer with my future Drupal projects. I installed Composer on my machine and I noticed two packages (drupal/drupal and drupal-composer/drupal-project). When I install the second package, I get a warning message telling that there is no stable version.

What are the difference between those two package?
Is it composer enough for Drupal, or should I use Drush with it?


texts: How does #value_callback really work (nested elements, ...)?

texts:
EDIT: Separated 4th question.

I've just recently started working with custom elements and already came across some weird behavior / questions I'd like to see answered.

1) How does #value_callback work, what should you return in it, etc. ?

Imagine you have pretty simple custom element without set #element_validate:

function TST_element_process($element, &$form_statem, $form) {
  $element['testing_test'] = array(
    '#type' => 'textfield',
    '#default_value' => 'ABC',
  );

  return $element;
}
function TST_value_callback_1($element, $input = FALSE, &$form_state) {
  //example of input retrieving magic
  return ($input['testing_test'] . '_valc_');
}
function TST_value_callback_2($element, $input = FALSE, &$form_state) {
  //example of input retrieving magic
  return array($input['testing_test'] . '_valc_');
}

'TST' => array(
  '#input' => TRUE,
  '#tree' => TRUE,
  '#process' => array('TST_element_process'),
  //'#element_validate' => array('TST_element_validate'),
  '#value_callback' => 'TST_value_callback_1', // or TST_value_callback_2
),

And form:

$ar['inp'] = array('#type' => 'TST');

1A) When you use TST_value_callback_1, the callback gets called and runs but doesn't alter the result value in any way (in submit the $form_state['values']['inp']['testing_test'] contains pure input -> ABC).

1B) In case of TST_value_callback_2 the $form_state['values']['inp']['testing_test'] still contains unaltered input but there's also value in $form_state['values']['inp'][0] which contains the 'right' value (ABC_valc_).

My questions are:

1.1 what exactly are you supposed to return in #value_callback and why do the individual callbacks work in the way they do (or don't do in case of the first one).

1.2 is there any way how to make the #value_callback store the data in 'element root' ($form_state['values']['inp']), i.e. in the same place as if I used form_set_value in #element_validate?

2) How do individual #value_callback work on custom element that is made of other elements?

Let's say you have a custom element (A) that is made of a nested set of other elements with set #value_callback.

for($a = 0; $a < 10; $a++) {
  $element['indiv_elems'][] = array(
    '#type' => 'indiv_element',
  );
}

Then a number of things can appear in $form_state[values][<element_name_in_FAPI_array>] depending on how you approach #value_callback in the custom event (A) (and some of those things make little sense to me).

2A) When you don't use #value_callback in (A) at all, the $form_state[values][<element_name_in_FAPI_array>] will contain array of raw inputs (not processed by its #value_callback function) from each phone_numbers element.

2B) When you set #value_callback in (A) but let it return (let's say) empty array(), the $form_state[values][<element_name_in_FAPI_array>] will contain array of  inputs from each indiv_element element processed by their (individual  #value_callback function) .

My question is:

2.1) Why do the values not get processed by individual #value_callback when parent element's #value_callback is not set. Basically why is there difference between 2A) and 2B).

3) Do I understand this flowchart  correctly that #value_callback is called before #element_validate?

I'm also aware that it will be quite time consuming to answer this question, so many thanks and love ahead! :)


texts:
I am new to drupal. I have installed profile2 module and created one profile named as "Travel Agency". Now I want to send different mail to this user when he/she registered with my site as "Travel Agency". so I have created a Rule for this and it is working it is sending a separate mail which has been setted for the Profile2 user or Travel Agency users.

My rule information is as follows:

Event: After saving a new profile

Condition: Data Comparison .. Selected data: profile2:type equals Travel Agency

Action: send e-mail

The problem is that along with this email it is also sending the email which has been sent to user when he/she registered as Normal user with my site.

Please guide me on this. Thanks for the answers in advanced.


texts: Filter under condition based on value checkbox of current user profile

texts:
I use Views 3.x and Views PHP module.

The task. Make Views filtering criteria that would make two different actions, depending on status of checkbox (TRUE or FALSE) of current user's profile.

Description. Logic diagram:

IF checkbox current user == TRUE
THEN display taxonomy terms, tid == New
ELSE display taxonomy terms, tid == array('New', 'Archive', 'Old', ...) // 50+ taxonomy terms

Please help me.


texts: why drupal webform form setting shows mysql errors in dblog?

texts:
I have created one webform in Drupal 7 in which some form components are present. But when I'm going to view that webform the components(fields) are not displayed. Then I checked in form setting that form was closed but when I'm going to change the form setting to open and saving that form I'm getting error "The website encountered an unexpected error. Please try again later". Then in dblog there was the following mysql error.

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry '39055' for key 1: INSERT INTO {webform} (nid,
  confirmation, confirmation_format, redirect_url, status, block,
  teaser, allow_draft, auto_save, submit_notice, submit_text,
  submit_limit, submit_interval, total_submit_limit,
  total_submit_interval) VALUES (:db_insert_placeholder_0,
  :db_insert_placeholder_1, :db_insert_placeholder_2,
  :db_insert_placeholder_3, :db_insert_placeholder_4,
  :db_insert_placeholder_5, :db_insert_placeholder_6,
  :db_insert_placeholder_7, :db_insert_placeholder_8,
  :db_insert_placeholder_9, :db_insert_placeholder_10,
  :db_insert_placeholder_11, :db_insert_placeholder_12,
  :db_insert_placeholder_13, :db_insert_placeholder_14); Array (
  [:db_insert_placeholder_0] => 39055 [:db_insert_placeholder_1] =>
  [:db_insert_placeholder_2] => full_html [:db_insert_placeholder_3] =>
  [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0
  [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => 0
  [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0
  [:db_insert_placeholder_10] => [:db_insert_placeholder_11] => -1
  [:db_insert_placeholder_12] => -1 [:db_insert_placeholder_13] => -1
  [:db_insert_placeholder_14] => -1 ) in drupal_write_record() (line
  7194 of /home/indiawaterportal/public_html/includes/common.inc).

Please help me to solve this issue.


texts: User login API for social login from mobile apps

texts:
I have installed HybridAuth module for social login (Only Facebook & Google) and It is working fine.

I need the same functionality for mobile apps. Like the user can able to login using the social accounts from mobile apps also.

Please suggest me how to do. Is it possible to do with HybridAuth module or I need to do different way?


texts: drupal_render() returns "Array" instead to render the content

texts:
I'm using Drupal 7 and I have made a custom module in which there is this function.

    function product_search_by_pin_form($form, &$form_state) {
           // Provide a text field.
           $form['pin'] = array(
           '#method'=> 'POST',
           '#action' => '$come_back',
           '#title' => t('Input your PIN'),
           '#type' => 'textfield',
           '#attributes' => array('size' => '20', 'maxlength' => '20'),
           '#placeholder' => 'Type your PIN',
           '#required' => TRUE,);

           // Provide a submit button.
           $form['submit'] = array(
           '#type' => 'image_button',
           '#required' => TRUE,
           '#src' => "/images/upload/search.png",
           '#attributes' => array('id' => 'submit'),
           '#value' => 'Search',);

           return $form;
    } // END of Function

The form is being used from the following code.

    $arr = drupal_get_form('product_search_by_pin_form');
    print drupal_render($arr);

The problem is that Drupal displays the Array instead of showing the form.

How can I solve it?

EDIT
As asked, and after have followed suggestions but without result, please here the code of the module

<?php
/**
 * @file
 * a test file
 */

/**
 * Implements hook_menu().
 */

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

  $items['/examples/myform-examples'] = array(
    'title' => 'Example myform',
    'description' => 'Configuration for TEST module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('product_search_by_pin_form'),
    'access callback' => TRUE
  );

  return $items;
}

/**
 * Implements hook_help().
 *
 * Displays help and module information.
 *
 * @param path
 *   Which path of the site we're using to display help
 * @param arg
 *   Array that holds the current path as returned from arg() function
 */

function myform_help($path, $arg) {
  switch ($path) {
    case "admin/help#myform":
      return '' . t("<b>Myform</b> to test a drupal form") . '';
      break;
  }
}

function product_search_by_pin_form($form, &$form_state) {
       // Provide a text field.
       $form['pin'] = array(
       '#method'=> 'POST',
       '#action' => '$come_back',
       '#title' => t('Input your PIN'),
       '#type' => 'textfield',
       '#attributes' => array('size' => '20', 'maxlength' => '20'),
       '#placeholder' => 'Type your PIN',
       '#required' => TRUE,);

       // Provide a submit button.
       $form['submit'] = array(
       '#type' => 'image_button',
       '#required' => TRUE,
       '#src' => "/images/upload/search.png",
       '#attributes' => array('id' => 'submit'),
       '#value' => 'Search',);

       return drupal_get_form($form);
} // END of Function


texts: How do you turn off comments, by default, for a module defined content type?

texts:
I have a D7 module, which defines a content type, via the appropriate hooks.

By default, comments are turned on for my content type. How do I set the default to off, inside of the code of my module? (NOT through the Drupal interface)

Thanks in advance.


texts:
I am in the process of starting new projects using drupal/recommended-project over the Drupal composer project template. One of the differences I have noted is that the Drupal scaffold tool fires every time even when just installing a new module or theme.

In this case, I get write permission warnings about settings.php, and I have other concerns such as .htaccess or robots.txt being replaced.

I read some of the docs and added this in my composer.json file:

"drupal-scaffold": {
    "locations": {
        "web-root": "docroot/"
    },
    "file-mapping": {
        "[web-root]/sites/default/settings.php": false,
        "[web-root]/.htaccess": {
            "mode": "replace",
            "path": "assets/drupal/.htaccess"
        }
    }
},

This prevents settings.php from being touched, and replaces the .htaccess file from Drupal with one containing our modifications. The drawback that I see here is if .htaccess had some security changes, I would have to do a manual diff and put the custom rewrite rules back in.

Is this the proper way to use drupal-scaffold?


texts: Manage Form Display - not saving configuration

texts:
i'm working on a pretty big User/register site. Today i created some more fields.
Now i want to order them properly with the "manage form display" settings like i used to but it is not working.
Everytime i press save the page is reloaded but no changes are made. Yesterday evening everything worked fine.

Is there a maximum of fields you can use?
Or does anyone has an idea what could be the problem here?

I'm really clueless because 12 hours ago it worked just fine for me...

with best regards


texts: Empty View does not display "No results behavior" for admin

texts:
I have a View content pane with a setup to display "Header" when there is content and "No results behavior" when the view is empty.
The view works fine for authenticated and anonymous users, however it always shows the "Header" instead "No results behavior" for empty view to the admin.

Looking at the html output for the view, I see an empty table with one empty row is being generated for admin, but not for authenticated or anonymous users.

In the view table settings, all empty columns are set to hidden. All fields have hide empty checked with no rewrite. The views has a contextual filter to display no results when filter is missing.

Its baffling that the view works for others except admin.
Any tips will be appreciated.


texts: Drush ignoring `$options['config']` statement in drushrc file from the 'drush' folder at the root of the current git repository

texts:
I'm a long-time browser, first-time poster.

I have a Drupal 7 site set-up using Drupal-Boilerplate structure in a Git repository. I defined some settings in the drush/drushrc.php file. The documentation indicates:

  “Drush doesn't by default know to search this directory. To work around that we need to add this awesome snippet to our local drushrc.php file.”

I added the provided snippet to docroot/sites/all/drush/drushrc.php. But the $options['config'] statement seems to be ignored. The settings defined in drush/drushrc.php are not taking effect.

I believe that the code is correctly defining the root of the Git repository. The $options['alias-path'] statement seems to take effect as the “example” aliases appear when I run drush site-alias. The $options['include'] statement also seems to take effect as the devify command defined in drush/commands/build.drush.inc is available.

The configuration options I have specified in drush/drushrc.php are not taking effect. When I run drush status, the “Drush configuration” lists docroot/sites/all/drush/drushrc.php and my user-specific drushrc.php from my home directory. I would expect to also see the drush/drushrc.php file listed.

I have tried executing git rev-parse --show-toplevel. That returns the correct path to the root of the Git repository. I tried explicitly adding the drush/drushrc.php file by adding the full path in an $options['config'] statement in docroot/sites/all/drush/drushrc.php. None of that seems to have been effective.

I’m at my wits end with this. Please help me StackExchange!

I’m using

Drush 6.3.0
Drupal 7.28
PHP 5.5.11
Windows 8


texts: enforce naming conventions for page aliases by content type

texts:
I would like to set mandatory url naming conventions for custom content type nodes.

When users create a new content type I want to force certain naming conventions for the url alias. For example:

when creating 'Type A' and 'Type B' pages they should have aliases of the form:

www.example.com/a/{user-assigned} (Type A)
www.example.com/b/{user-assigned} (Type B)

is there a way to do this in Drupal 8?


texts: Adding Facebook Like-button to the User menu in the top-right corner

texts:
Do you think there is a way to make a Facebook Like-button appear in the User menu of Drupal 7, right besides the My Profile and Logout links?

UPDATE: I'd like to add the button for my site and the User menu seems to be the best place.


texts: How to combine 3 line charts in a single chart, using the Views integration of the Charts module?

texts:
I want to create a line graph using the  Highcharts library which shows 3 series in a single chart. I have visualization API, views, highcharts library etc. installed in my Drupal website.

I succeeded already in creating a chart which shows only 1 serie, but couldn't get it to work with 3 series yet.

The X-axis is taxonomy terms and Y-axis is the value of nodes on this term (relationship: Taxonomy terms on node).

The view I created has a filter and it filters the views with 3 content types I wanted. So I want to show these 3 content types as 3 different series (line charts), instead of just 1 line chart with everything together.

Here are some relevant details of the view I created:

This is the line chart I was able to create so far:

Here is what I want to achieve (using data that are different though):

How can I visualize my 3 series (for 3 different content types) in a chart similar to the above one?


texts:
I'm trying to update the drupal commons contributed modules but i can't run the automatic updates via ftp because i'm working on aws ec2 server and i don't have the ftp access but only sftp+ssh (+ aws key path). Is there any way to make a manual update of these modules? I don't see the contributed modules directories in /html/modules/ even in html/sites/all/modules/.
I also have tried to put the new unzipped modules folders directly in /html/sites/all/modules and after run the database update but i get some errors.
What is the right way?
Thanks


texts: Acquia BLT - How to put remote config_split config values back into version control

texts:
I have been using Acquia BLT and config split.

I understand how to set up the config splits and deploy them using BLT.

What I don't understand is - once I have a split in place, say on dev, and I've changed the configuration on dev... how do I get that changed configuration which is only in the dev database back into version control?

Doing a cex command on the Acquia server doesn't work - I get a long list of permission denied errors (presumably because without livedev mode on, the code on the Acquia server is read only).

...
[warning] unlink(/mnt/www/html/xxxx/config/default/workflows.workflow.editorial.yml): Permission denied FileSystem.php:124
 [error]  The file permissions could not be set on /mnt/www/html/xxxx/config/default.

So how can I export the config from dev once I've changed it, and get it into my version control system?

Addition: I am expecting that I would have my /config/envs/{env} directory on my local containing the remote yaml config files, so that I could track changes to the split configuration across environments. But maybe this isn't true?


texts: So my question is how I can get programmatically in preprocess node hook, the display mode of a node, for example, to check if view mode is a teaser or full?


texts: Does cron queue manage max_execution time?

texts:
I have implemented an approximately 1000 nodes update using hook_cron_queue_info() and hook_cron(). When I manually run cron job from the Drupal administration pages, I get a maximum time execution error; once this number is reduced by 10, it works fine.

Any suggestion?

function my_module_cron_queue_info() {
  $queues['my_module_batch'] = array(
    'worker callback' => '_my_module_process_queue',
    'skip on cron' => FALSE,
  );
  return $queues;
}

function my_module_cron() {
  $contents = lade_update_nodes(); // get node list for updation
  $queue = DrupalQueue::get('my_module_batch');
  foreach ($contents as $p_file) {
    $process_data = array(
    // set values for process
    );
    $queue->createItem($process_data);
  }
}

function _my_module_process_queue($arr) {
    // code for updation
    watchdog('update node', 'Custom msg');
}


texts: Search API Solr integration with fivestar (or similar) rating system (fascet and sort)

texts:
I'm attempting to sort nodes by ratings using the Search API faceted search with Solr integration. I've already set up fivestar ratings (about 9 per node, its a large multi-axis rating system.) but i'm unable to index these ratings!

Can someone help me understand how to change this so I can use a facet search for ratings?

Otherwise, are there any recommendations on other modules (aside from fivestar) which would allow the votes to be indexed?

Thank you!

Justin


texts:
I'm having problems understanding the menu system. I have an hosting node that has 3 pages:
https://beta.ulyssis.be/hosting/

Menu Hook

function packages_menu() {
  $item['hosting']= array(
    'title' => 'Start',
    'type' => MENU_NORMAL_ITEM,
    'description' => 'Dit maakt ons ULYSSIS!',
    'page callback' => '_hosting_page_main',
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
  );

  $item['hosting/bekijk']= array(
    'title' => 'Features',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 1,
  );

  $item['hosting/kortingen']= array(
    'title' => 'Kortingen',
    'type' => MENU_LOCAL_TASK,
    'description' => 'Deze groepen krijgen kortingen',
    'page callback' => '_hosting_page_discount',
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
    'weight' => 3,
  );

  $item['hosting/pakketten']= array(
    'title' => 'Vergelijk',
    'type' => MENU_LOCAL_TASK,
    'description' => 'Vergelijk onze pakketten met elkaar!',
    'page callback' => '_hosting_page_compare',
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
    'weight' => 4,
  );

  $item['hosting/bestellen']= array(
    'title' => 'Bestel Nu!',
    'type' => MENU_LOCAL_TASK,
    'page callback' => '_hosting_page_order',
    'access callback' => TRUE,
    'menu_name' => 'main-menu',
    'weight' => 5,
  );

  return $item;
}

Problem
When navigating trough these pages, you'll notice that the top hosting menu item doesn't stay as 'active' menu item.

I'm having the same problem with other things, like when reading documentation, that the documentation menu item isn't active to. So I guess I'm not using the menu system as it should or that I'm missing some kind of knowledge about this.

Does anybody know what I'm doing wrong?


texts: views_pre_render add class item to a row

texts:
When pre-rendering a view row is there a way to add an HTML class into a single row of the markup, allowing me to add a new background colour to the event item highlighting its importance? This is for the calendar module monthly view

For example,

Below the is the what I have so far.

function pnc_views_overrides_views_pre_render(\Drupal\views\ViewExecutable $view)
{
      if ((int)\Drupal::currentUser()->id() === 1) {
        foreach ($view->result as $key => $value) {
          try {
            $field_result_value = $value->_entity->field_display->getValue();
            if (isset($field_result_value[0]) && (int)$field_result_value[0]['value'] === 1) {
              // add a class to the change the background color to hi-light its importance
            }
          } catch (Exception $e) {
            \Drupal::logger('viewoveride_pnc_cal_views_overrides')->error($e->getMessage());
          }
        }
      }
}


texts:
I got below code in form_validation

$form_state['values']['field_address'][LANGUAGE_NONE][0][postal_code];

I've tried below tricks but it didn't make red color in textbox.

form_set_error('field_address][postal_code', 'error');
form_set_error('field_address[und][0][postal_code', 'error');
form_set_error("field_address[und][0]['postal_code']", 'error');
form_set_error('field_address[LANGUAGE_NONE][0][postal_code', 'error');


texts: Change the #formatter of a field when printing it in a tpl.php file

texts:
In my node.tpl.php I have used KPR on a field. I notice that is has a lot of options like ['#formatter']. I would like to change these options when I print the field out in my node.tpl.php file.

How can I do this?

I have tried <?php print render($content['field_paragraph']['#formatter'] = 'header'); ?>
But it just prints out the words "header".

The field I am using is an entity field (from the Paragraphs module). I have also created a custom entity view mode (called "header") using the Entity View Mode module. So changing #formatter, should cause it to display with my custom view mode.

I know I can do this in the UI, but I am repeating fields on the page with different view modes, which is something the UI doesn't do (and I don't want to use Display Suit, as it doesn't suit my use case).

Edit

After digging around, the view mode is not stored in ['#formatter'] but
[0]['entity']['paragraphs_item'][5]['#view_mode']

However, I'd imagine the process of changing #view_mode would be the same as changing #formatter.


texts: Website owners to claim their websites by uploading control file ?

texts:
For my website directory I would like users to be able to claim their own websites.

This is needed to allow only validated and authorized users to edit website-related content.

I would like the system to ask users automatically to upload a control file with a filename generated in Drupal 7.

Drupal will check automatically if the filename can be downloaded from the claimed website and if so it will assign authorization to the claimant to edit related content.

How to do this in D7, preferably with existing modules ?


texts: How to get a field's value for all nodes in a content type?

texts:
I would like to get values of a field from all nodes of a content type. How can I do this? EntityFieldQuery seems to return only node ids, so will I need db_query? Sg similar to this In a custom module how do I get all the nodes of a certain type?

I guess I just need to lookup the table name of the field...


texts: How to log configuration changes in a sensible way?

texts:
In order to log simple configuration changes like a site-name change, contributed modules like contrib_log work fine.

It just diffs the changes files in active configuration and logs it.

But when you change a field definition or delete(!) a content type, the logs are not so descriptive and we get a whole lot of .yml files changes log, not really describing what happened. We only see all the .yml files changed and their diff, and that doesn't have much value. I mean there is naturally no log line saying : "New field  added." or "Language French removed".

I understand why it is like that, but I'm looking for a way to add value to these logs.

I've looked into Drupal\Core\Config\ConfigEvents and trying to figure out if there is a way to know when we are changing a content type or a language for example and log this change in a sensible way, without logging a set of unreadable .yml file diffs?

Thank you


texts: Drupal 7 : How to break title of content into multiple lines

texts:
Most of the content-nodes on my site have two parts (English | Arabic). I want to put a line break between the two, so that the broken text does not look awkward. But when I put an html line-break tag, the tag itself shows up in the title.

What to do?

Appreciated...


texts: Can we use the same path for a different route?

texts:
Are we allowed to use the same path for two different routes? For example, can I use the following code?

function mymodule_menu() {
  $items['myUrl/dboperation'] = array(
    'title' => 'some custom db operation for insert',
    'page callback' => 'mydboperation1',
    'access callback' => TRUE,
    'file' => 'my_dboperation.inc',
  );

  $items['myUrl/dboperation'] = array(
    'title' => 'some custom db operation for delete',
    'page callback' => 'mydboperation2',
    'access callback' => TRUE,
    'file' => 'my_dboperation.inc',
  );

  return $items;
}

The code doesn't work. It works when I change the second path.

I was searching for the answer and came across How should I implement hook_menu()? but it doesn't explain what to use for the route path.

Why doesn't my code work? What should I instead use to make it work?


texts: How do I display the submitted data in the same page?

texts: I created a custom form in Drupal 7. I need to display the submitted data in the same page showing the form, without using drupal_set_message(). Is it possible?


texts: How to remove Ubercart properties from content types (SKU, list price)

texts: In the concerned product type, at manage display, I unchecked SKU, list price etc but they still appear. Cleared browser and drupal cache. Any other setting I should be looking?


texts: How can I tell what is causing commerce to throw entity wrapper exception errors?

texts:
I'm attempting to repair and reconfigure a site that was created by another admin. I ran across some issues with commerce coupon that I've been able to get past with help I received here first then here (referenced for insight into the current error).

When I enter edit mode for the "Commerce Coupon Review Pane" view, I get the same ajax error message as before but now with currency_code:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/commerce_coupon_review_pane/preview/checkout/ajax
StatusText: Service unavailable (with message)
ResponseText: EntityMetadataWrapperException:
Unable to get the data property currency_code as the parent data structure is not set.
in EntityStructureWrapper-&gt;getPropertyValue()

I'm also redirected to an error page with same exception when I click on the checkout button.

I don't think its a bug due to the way that this issue cleared up in the previously referenced issues. It seems more likely something happened to the data. It would also seem that getting help from the issue queues would be unlikely because it would be impossible for me to come up with steps to reproduce the error. Unfortunately I don't know how to attack the problem. However, I suspect that when the page tries to load, somewhere along the way, it fails to find data it expects to find. If this is too general of a problem what steps can I take to find out more precisely what is happening?

===============

Update:
Thank you for the responses @pcambra, @tenken and @Clive. It appears that there is a broken relationship. I am missing these settings in the Commerce Coupon Review Pane:

"FIELDS"

 (Commerce Order referencing Commerce Coupon) Commerce Order: Order ID

"CONTEXTUAL FILTERS"

 (Commerce Order referencing Commerce Coupon) Commerce Order: Order ID

"RELATIONSHIPS"

 Entity Reference: Referencing entity

When I try to add them into the view, there is no option to select them.

Also, when I try to load /admin/commerce/orders/carts/ I get the same error but it does not specify a field.

Where is this relationship made and how do I now fix the relationship so they show up in the configuration dialog?

===============

Update:

Following instruction I am now getting these errors. Although this is progress, I turned up nothing useful on restoring broken handlers that was not specific to a particular module.

//when I click on add under FIELDS in the view this error is produced
Notice: Undefined index: base in get_base_tables()
(line 717 of view.inc).

//otherwise these errors are produced each time I try to enter the view
Missing handler: commerce_coupon
reverse_commerce_coupon_order_reference_commerce_order relationship

Notice: Undefined property: views_handler_relationship_broken::$alias
in get_result_entities() (line 1604 of views_plugin_query_default.inc).


texts: How to remove the name of the language? Menu Language Icons

texts: How to remove the name of the language? Use the module Language Icon, I want to make only the flags.


texts: Where is the "add to cart" configuration?

texts:
I'm trying to find the Add to cart form configuration for a product type in the UI.

When I export configuration, core.entity_form_display.commerce_order_item.TYPE.add_to_cart.yml contains the configuration for the Add to cart form, such as this (hiding quantity, creation date, and unit price):

content:
  purchased_entity:
    type: commerce_product_variation_attributes
    weight: 0
    settings: {  }
    region: content
    third_party_settings: {  }
hidden:
  created: true
  quantity: true
  unit_price: true

Where is the configuration page for this in the UI?  I keep clicking around and I cannot find it.


texts: Can a secret Facebook group be automatically synced with a Drupal site?

texts:
I have a Facebook secret group, and a Drupal membership site.

Members on the Drupal site (distinguished by a specific role) are added (and removed) manually from the “secret” Facebook group.

What works
- Our Drupal site users log on to Facebook more than they log on to our Drupal site, so the secret group is a very convenient way to stay in touch with them.

What doesn’t work
- We have to manually add and remove people from our Facebook site - things get out of sync.

Is there anything out there that would allow us to sync up the secret Facebook group with members of our site?


texts:
Is there a way of specifying a default site alias ?

couldnt find it in drushrc example nor aliases example.

motivation
i am sclerotic and lazy :) usually running drush from the dir where the site is, so no alias needed. Now working in a setup where i am logged in on a different server then the actual site, so i need to always provide a site alias for each command. So the usual workflow is:

drush wipe
oh no
drush @stage wipe

so i thought a default site alias would save me from those two lines :)


texts: Modify text of error message for required field

texts:
I have a checkbox with a link in its title text. This is a required field and the error message references the title including the link. How can I modify the error message to remove the link from the error message text?

hook_field_validate() appears not to be called; that was my first attempt after doing some searching.


texts: Linking in views with multiple fields displayed

texts:
I am making a view in Drupal 7 to display grants: the name, the description, the amount of the grant, and the due date for submission.

It's easy to make a view that displays the name, the amount and the date in each row of a table, with the name linking to the full node display.

I've also learned how to display the description below the title, using the rewrite rules for the title, like:

[title]

[body]

What I want is having only the title as link to the full node, not all the text. Can I do this?


texts: Drush cim: error "Table xyz already exists"

texts:
I'm trying to deploy a dev website to a dev server. When running drush cim on the dev server, drush ends with an error message:

  Table honeypot_user already exists

When running drush cim again right after that, the same error comes up again for a while with different table-names. The database does definitely not have these tables before running the config import.

What's the underlying problem and how can I solve that?

Using drush 8.1.17 on a Drupal 8.3.7 (both running offline and soon to be updated for security patches)


texts: Sharing the same code base and one database

texts:
I would like to have multi-sites that share the some code base and one SQL database in Drupal 8.

Is this possible and recommended? I am interested also in security concerns. Is this safe?


texts: Render Array for hook_field_formatter_view not displaying

texts:
I'm updating this question on the suggestion of the initial provided answer.

When trying to render out the content of my custom field, outputting the data into a custom theming function to render on to the page when using the suggested method is resulting in the theming function being ignored, even when attempting to output just static strings of text or using the devel module to test it, nothing happens, the code is updated as below

/**
 * Implements hook_field_formatter_view().
 */
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
  foreach ($items as $delta => $item) {
    if ($file = file_load($item['image'])) {
      list($hours, $mins, $secs) = explode(':', $item['time']);
      $time = ((3600 * $hours) + (60 * $mins) + $secs);
      $element[$delta] = array(
        '#theme' => 'mymodule_formatter',
        '#image' => (array) $file,
        '#time' => $time,
        '#comment' => $item['comment'],
      );
    }
  }
return $element;
}

Hook and Theming function

/**
 * Implements hook_theme().
 */
function mymodule_theme() {
  return array(
    'mymodule_formatter' => array(
      'variables' => array('variables' => array()),
      'file' => 'theme_mymodule.inc',
    ),
  );
}

In the theme_mymodule.inc file

/**
 * Returns HTML for a MyModule.
 */
function theme_mymodule_formatter($variables) {
  $output = t('test');

  return $output;
}

I think I'm a little confused about the naming of the theme hook, when I was copying the image module, the #theme variable was just declared as 'image_formatter' but the function named was 'theme_image_formatter', I'm wondering if I've declared my theme hook wrong.

--Previous question--

Im trying to write my own custom field in my own module, I've written the field setup, and it's accepting and evaluating data fine, that's all good. I'm struggling to grasp what I need to do when trying to write my own theming output function. As an example to the parts of code I'm working on:

/**
 * Implements hook_field_formatter_view().
 */
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
  foreach ($items as $delta => $item) {
    if ($file = file_load($item['image'])) {
      list($hours, $mins, $secs) = explode(':', $item['time']);
      $time = ((3600 * $hours) + (60 * $mins) + $secs);
      $variables = array(
        'image' => (array) $file,
        'time' => $time,
        'comment' => $item['comment'],
      );
      $element[$delta] = theme('mymodule_formatter', $variables);
    }
  }
return $element;
}

And my theming function

/**
 * Returns HTML for a MyModule.
 */
function theme_mymodule_formatter($variables) {
  $item = $variables['image'];
  $image = array(
    'path' => $item['uri'],
  );

  if (isset($item['attributes'])) {
    $image['attributes'] = $item['attributes'];
  }

  if (isset($variables['image_style'])) {
    $image['style_name'] = $variables['image_style'];
    $output = theme('image_style', $image);
  }
  else {
    $output = theme('image', $image);
  }

  return $output;
}

Now this returns the correct HTML for my image, so it actually returns a string like

<img typeof="foaf:Image" src="[img_path]" width="120" height="90" alt="" />

However this doesn't actually render on my page, it doesn't come back with an error, it just doesn't show anything.

When I change my $element[$delta] line in my hook_field_formatter_view() function to say

$element[$delta] = array('#markup' => theme('mymodule_formatter', $variables));

By putting the element into a '#markup' array, it does actually render the image, however I don't want to just throw everything into a '#markup' array if that's not the proper way of doing it.


texts: Need to use JS to insert links in a custom block for Colorbox to use but $scripts have to be called in . How to delay Colorbox JS?

texts:
I have a custom block where links are generated by jQuery (or vanilla JS) based on which panel panes are on a page. Users can use IPE so the links need to be dynamically created.

However, because $scripts is called in the head, Colorbox has already run, found the classes and done its thing meaning my new Colorbox links open as regular links killing my functionality.

Is there any way around this? Can I delay the Colorbox JS and run it in the footer?


texts: Media library widget: Table instead of grid?

texts:
Background
I have a multiple-value entity reference field with target type = media.
It is used for "document" media, so mostly pdf files.
I am using the "Media library" widget shipped with core.
With this widget, items appear in a grid with thumbnail, and can be reordered with drag + drop.
Problems
Most of the pdf files don't have a useful thumbnail, so they all look the same.
Due to the grid display, the title of each document is not fully visible.
The grid drag + drop reorder is less intuitive than a tabledrag, especially if the thumbnails all look the same, and sometimes even the visible part of the title is the same.
Once a media entity is added to the list, there is no link to edit this media entity from the node / host entity form.
Questions
Is there a table version of the media library widget?
Is there a way to show an edit link with each item? Either to edit the media in a form on a new page, or in a popup.
What I tried
Widget settings?
-> The widget does not have any settings.
Configure the display of documents in "Core | Media library" view mode?
-> Items still displayed in a grid.
-> The only field that looks well in a grid mode is the thumbnail. Text fields look weird.
References
Poor soul who asked the same in drupal.org, with no success: https://www.drupal.org/forum/support/module-development-and-code-questions/2020-06-29/how-set-media-library-widget-to


texts:
I have an endpoint that returns an array of Order entities, but it's caching the results so when a new order is placed the cache has to be cleared.

The code within the endpoint is:

// Tried this also.
// $this->orderManager->resetCache()
$orders = $this->orderManager->loadByProperties([
  'uid' => $this->customer->id(),
]);
$response = new ResourceResponse($orders);
// maybe this doesn't work because it's an \Drupal\Entity\commerce\Order[]
$response->addCacheableDependency($orders);

return new ResourceResponse($orders);

What am I missing?


texts: Importing database: Duplicate entry 'X' for key 'PRIMARY'


texts: Add conditional where condition to hook_views_query_alter()

texts:
I was stucked making a few tweaks to a view trying to do the following.
In mysql exists the possibility to use WHERE IF to evaluate some variable/operation to apply differents conditions depending on the result/value, like a common IF/ELSE block, is there any way to do it with add_where() or any other similar method?
I need to apply a WHERE condition to the query when the value of a variable called $scope is G and a different when its L, there's any way to achieve that?

What I need to do is to do this query on Drupal 7 Views hooks

SELECT * FROM tbl1 AS t1 JOIN tbl2 AS t2 ON t2.entity_id = t1.nid JOIN tbl3 AS t3 ON t3.entity_id = t1.uid  WHERE t1.status = 1 AND t1.type = "article" AND IF(t2.field_alcance_nodo_value = '{char}', t3.field_pais_usuario_value = '{string}', t3.field_pais_usuario_value LIKE '%') ORDER BY t1.changed DESC;

but I'm stucked on the IF part...
I'm using the hook_views_query_alter() but I don't know if it's enough.

Thank you in advance,


texts:
I used the following code:

services:
  foo:
    class: Drupal\MYMODULE\Foo
    arguments: ['@request']

In MYMODULE/src/Foo.php

namespace Drupal\MYMODULE;

use Symfony\Component\HttpFoundation\Request;

class Foo {
  /**
   * @var \Symfony\Component\HttpFoundation\Request
   */
  protected $request;

  /**
   * Constructs a Foo object.
   *
   * @param Symfony\Component\HttpFoundation\Request $request
   *   The request object.
   */
  public function __construct(Request $request) {
    $this->request = $request;
  }

  public function bar() {
    if ($ip == $this->request->getClientIp()) {
      drupal_set_message('ip', t('You may not ban your own IP address.'));
    }
  }

}

but this gives me error:

  Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'
  with message 'The service "foo" has a dependency on a non-existent
  service "request".


texts: Redirect user from a custom access callback

texts:
In my module routing I have a custom access callback for a payment page.

_custom_access: 'Drupal\mymodule\Form\PaymentForm::access'

It checks if the user:

is allowed to make the payment (it's their own)
actually needs to (has it already been paid)

It works fine, but in the latter case, whilst I can give them an explanatory warning:

\Drupal::messenger()->addWarning('Fee already paid or no fee to pay.');
return AccessResult::forbidden();

it'd be nicer to redirect them to a page that's friendlier than:

  Access Denied - you are not authorised to access the page.

Drupal / Symfony insists on returning something that implements AccessResult - so I can't return a RedirectResponse.  Any suggestions? Moving the checks to buildForm() seems a bad idea.


texts: Using Views and Date module in Drupal 7 - Limiting Filter Options

texts:
I am creating an event calendar for a festival where user's can log into the site, click "Add new event" and create an event.  I have 2 questions regarding dates.

When the user creates the event, rather than a standard date popup, I'd like for them to be able to choose a range of days (Thursday - Sunday) and a time, rather than the calendar popup or Day/month/year hour minute drop downs.  Is there an easy way to limit this, of even prevent the user from selecting dates outside a certain range?
When showing the events list, I've created a table view.  I'd like to allow the user to select which days to display using an exposed filter.  If I choose "Event date" it only allows me to display a standard date field in the filter (Month Day Year).  I want the user to be able to select "All, Thursday, Friday, Saturday or Sunday" instead.  I was able to add "Day" as a field in the view, and group by the DAY, It just seems I'm not able to then filter by it.

I hope this makes some sort of logical sense.  Thanks in advance for any help.


texts:
I updated some modules, and the site was working fine afterward; then, I made some changes to my .info file, uploaded, and suddenly I'm getting this error.

  Additional uncaught exception thrown while handling exception.

  Original

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column "base.access_exposed" in "field list&": SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.access_exposed AS access_exposed, base.data AS data FROM {rules_config} base WHERE (base.plugin = :db_condition_placeholder_0) AND (base.active = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => reaction rule [:db_condition_placeholder_1] => 1 ) in EntityAPIController->query() (line 152 of /home/content/92/8292092/html/sites/all/modules/entity/includes/entity.controller.inc).

  Additional

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column "base.access_exposed" in "field list&": SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.access_exposed AS access_exposed, base.data AS data FROM {rules_config} base WHERE (base.plugin = :db_condition_placeholder_0) AND (base.active = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => reaction rule [:db_condition_placeholder_1] => 1 ) in EntityAPIController->query() (line 152 of /home/content/92/8292092/html/sites/all/modules/entity/includes/entity.controller.inc).

I do have a database backup that was made before updating the modules.

The error cites entity, but nothing has changed there since Drupal was installed.


texts: Why don't all pages of content show up in the pagination beneath main content?

texts:
On a Drupal 7 site, I have several pages' worth of content, articles that are set to "published" and "promoted to front page". The page numbers underneath the main content part of the block show pages 1 through 5, and the "next >" and "last >>" links. However they do not show pages 6 and beyond. Why not?

I can go to the content that's on pages 6 and beyond, by going directly to the node. I can even enter the URL manually for page 6 and it loads fine, so the articles are there, published, and promoted. However, the pagination does not show links for pages beyond 5. Clicking on the "last >>" link only goes to page 5. In the image below, you can see that I've manually opened the URL for page 6, which loads the content, yet the pagination only shows it on page 5 of 5.

Is there a setting somewhere to choose how many pages Drupal shows? Or is there some other issue?

Note: I'm using the default Drupal front page. I haven't configured a different view. Should this be necessary?


texts:
I've pulled down a site using dev desktop but none of the styles are working. I think it's a problem with the settings file.

There are multiple sites on this environment. In Dev Desktop, I chose to clone an environment, specified a specific site, and cloned it locally. I am able to view the site and images but the stylesheets are loading. I also can't access the admin area. Drush seems to work fine.

The only error I'm seeing is "The file could not be created." In the past I've had to create a settings.local.php file but that doesn't seem to be working, either.

Any thoughts as to what I'm doing wrong?


texts: Apply comments votes to parent node (with Rate module)

texts:
My site have a fivestar field in comments, where users gives their vote and the points are applied to the parent node. This is possible using Fivestar module, following this instructions: http://drupalclinic.blogspot.com.es/2011/09/add-fivestar-ratings-in-comments-and.html

Could the same be done with Rate module (https://www.drupal.org/project/rate) and without custom coding?


texts: How do I display bare, stripped content with no menus, footers, etc?

texts:
Here's what I am trying to do:

I need to have a way to display only the content in a node without any of the Drupal adornment. All I want is the styles to be inserted, and the content itself.

The reason I am doing this is I am setting up a portfolio web site that contains examples of work. Each clip will be displayed in a lightbox2 popup. A lot of the clips were authored in Drupal.

I don't want the site title, menus, and all of that garbage to show inside the lightbox. Just the content.

I did the following, which seems to be a non core files hacking way of doing things:

I created a new content type, called "barepage". I copied some content into barepage.

I created a new content specific template file for barepage: node-barepage.tpl.php.

Just for testing, here is what is inside this file (I commented out the actual content):

<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix">

   <?php if (!$page): ?>
<?php endif; ?>

   <?php /* print $content; */ ?>

  <?php   if (!$page): ?>
<?php endif; ?>

All of the standard Drupal stuff displays: the page header, the primary navigation links, the node title inside the page, and the page footer. But as expected, the content is empty.

of course, if I uncomment $content, the page displays like a standard "Page" content type.

What in the heck do I override to eliminate all of this stuff and just display the content? I'm trying to avoid hacking the template's core files or the Drupal core.

This is with Drupal 6.2, and the Zen theme with the CTI_Flex subtheme.


texts: How to update the below action for each view bulk operations? It is for Drupal 7

texts:
I wants to delete the below folder every time only on each view bulk operations but currently it is getting deleted for each node selected in VBO. I am executing this action in rules module.
Please let men know how to run this only once for each VBO.
$pdfdir="/var/www/websites/test/sites/default/files/pdffolder";
$directory = escapeshellarg($pdfdir);
shell_exec("rm -rf $directory");

This is the code executing via Rules Module.


texts: Use CKEditor on textarea in custom module's controller response

texts:
I am trying to figure out how to use Drupal 8's CKEditor on <textarea></textarea> tags that are part of a controllers markup and not generated from a Drupal form.

Has anyone done this or can Drupal 8's integrated CKEditor only be used with Drupal Forms?

When I try to use ckeditor with the standard way of CKEDITOR.replace('element'); I get the error that config.js and styles.js are missing.  Which should be the case because Drupal has consciously excluded them from their integrated CKEditor. https://www.drupal.org/project/drupal/issues/2604052

After digging around I found the javascript call Drupal.editors.ckeditor.attach(element, format) but I can't figure out what to pass in for the format parameter.  Looking at other javascript code it appears they they use the drupalSettings global variable in javascript to pass it in but it's not there.

Any help on this would be greatly appreciated.

My code is below.

my_module.routing.yml

my_module.myroute:
  path: '/my-route'
  defaults:
    _title: 'Test Module'
    _controller: '\Drupal\my_module\Controller\HomeController::view'
  requirements:
    _access: 'TRUE'

my_module.libraries.yml

scripts:
  js:
    my_script.js: {}
  dependencies:
    - ckeditor/drupal.ckeditor

my_script.js

window.onload = function () {
    let element = jQuery("#testelement");
    let format = "filtered_html";
    Drupal.editors.ckeditor.attach(element, format);
};

HomeController.php

<?php

namespace Drupal\my_module\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Render\Markup;

class HomeController extends ControllerBase
{

    function view()
    {
        return [
            "#attached" => [
                "library" => ["my_module/scripts"]
            ],
            "#markup" => Markup::create("
                <textarea name='testelement' id='testelement'></textarea>
            ")
        ];
    }
}


texts: How can I add some text to the url only if a user is logged in?

texts: I need the url to have something like www.example.com/logged-in/rest-of-url . I can't seem to find much about changing the url other that when I add a new page or if I want to do an alias. Does anyone have any experience doing something like this.


texts:
I want that user can subscribe to content add in several OG GROUP.

How can achieve that ?

Cordially


texts: Programmatically create master/detail forms

texts:
I want to create a master/detail form in my custom module using form api and ajax. I have three content types: CT1, CT2 and CT3. CT1 is the master, and CT2 and CT3 are details of CT1 (they have a reference field to CT1). All of them have multiple fields.
What I want is a form that shows CT1 fields (header) and two tables or grids (details) with add, edit and remove buttons for their items (multi-fields).
I have read this example module, but It recreates all the form every time you add an item, and then I lost the data that the user has completed in the other fields.
Could some one give me and example or guidelines about how to do it?I know how to create forms using form api and how to use ajax, but I need, in other words, two forms inside a form.