texts: How do I react to my field's widget autocomplete selection?

texts:
I'm building a custom field with autocomplete. The autocomplete runs against an array of objects that I keep in my modules PHP code. An item looks like:

  $phrases['s5'] = array(
    'title' => 'S5',
    'description' => t('Do not store in %1.'),
    'placeholders' => array(
      1 => array(
        'legend' => t('Specify the liquid to avoid.'),
      ),
    )
  );

After user selects a match that corresponds to that item, I need to insert its description into the widget form to provide a complete visual feedback. I also need to react in case the description contains a placeholder by showing the legend and showing/enabling a textfield for that. Of course, this behavior should take place not only during node creation, but also upon opening a node with existing information.

My guess is it should be done through javascript/ajax. Does Drupal provide a ready-to-use behaviour or should I provide it in my module's script?

I'm not expecting a thorough tutorial here (although such miracles do happen) but maybe somebody could point me to a module that does this sort of widget behavior, so that I could learn by example.


texts: Views contextual filters summary display nodes id instead of title

texts:
I have a content type customers who has a required entity reference field to a content type groups. I have create a view to show all customers nodes and I have added a contextual filter over the entity reference field to display a summary of groups with a count of customers per group. The view uses fields, and I have added nid, title and reference field from the customers content type.
It works good and if no group is in the argument, It shows the summary, but instead of display the titles of the group, It display the nid of the group.
Following this answer I have put the title when a group is selected, but the summary shows nids.
What should I do to show this nodes titles?

Edited:if I do exactly the same with D7, it shows the titles as expected.


texts: Is there some simple way I can add the author's name as a field to be displayed in my view?


texts:
I enabled the blog module and I created the blog called test blog. I created the template file as page--blog.tpl.php. Here is my code:

News

         <?php
        $type = "blog";
        $nodes = node_load_multiple(array(), array('type' => $type));
        foreach($nodes as $news):
        ?>

                <?php print date( "j",$news->created); ?>
                <?php print date( "M Y",$news->created); ?>

<a href="<?php print $node->nid; ?>">Lorem ipsum dolor sit amet, consectetur adipiscing elit.

<?php $body = field_get_items('node', $news, 'body');
                        $teaser= $body[0]['safe_summary'];
                        print $teaser; ?>

                + Read More

If the heading or ReadMore button is clicked. I want to display full blog content of particular node in the blog content type. How to pass the link in anchor tag.


texts: Alternative for the core statistics module that also includes pages created using Views?

texts:
I want to make a block, which shows the title of 10 most visited contents of my site and then display those as an ordered list.

My pages are created using the Views module. I tried to get it done using the core Statistics module. But it lists only Articles, Basic pages, or Content types which we have created. But it doesn't list pages which are created by Views.

Is there any contributed module for this?


texts: Most simple way to integrate a html/jquery block into the system?

texts:
i want to build a form with jquery and html without using drupal forms api (looks too complicated for me to put effort on that). How can i do this?
How do i have to use a node and how would that be visible?
Does anyone know a tutorial for this?

I would appreciate any kinds of hints...


texts:
Is there any module that provides a way to implement a custom multiple field that enables user to enters both label and value?
For instance I have a product that has a list of features, ie:

Color: Red
Size: Large

And I have another product that has completely different features, like:

Style: Tuxedos
Gender: Male

So I like to be able to make these flexible for the editor to enter as many as features as they need mentioning the labels as well.

Thank you in advance


texts: Is it possible to use an Image Style in a text field?

texts:
Image Styles is a great feature in Drupal. Is it possible to apply a preset Image Style to an image that is brought into a long text type field that uses WYSIWYG in Drupal 7? That is, for use in the basic node, not in a View.

Currently, we're using the IMCE WYSIWIG bridge to insert images in the textfield, and there seems to me no way to indicate what preset Image Style to use.


texts: How to get details like duration, type, etc from uploaded videos and store them in fields?

texts:
I'm building a site that will handle a lot of media files, both image and video. Currently, I have video and image content types setup along with the ability to bulk-upload them.

I'm wondering if there is a way to scrape details from an uploaded video—such as duration, type, etc and store these in fields. I'm not sure how to approach this.


texts:
After using the function kint() (in the submodule Devel Kint that is part of Devel) in my mytheme.theme file to output the variables :

function my_theme_preprocess_node(&$variables){
  kint($variables);
}

I get the following error:

  RuntimeException: Failed to start the session because headers have already been sent by "C:\Drupal\modules\contrib\devel\kint\kint\Kint.class.php" at line 263. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 141 of vendor\symfony\http-foundation\Session\Storage\NativeSessionStorage.php).

My environment is as follows: Drupal 8.7.1, Devel modules:

 devel                       Devel                       Development         8.x-2.1 8002           Installed   no core
 devel_generate              Devel Generate              Development         8.x-2.1                Uninstalled no core
 kint                        Devel Kint                  Development         8.x-2.1 8000           Installed   no core

If anyone should know the cause of this (if it is down to the Devel module then where should I ask the question as the editor suggested that this forum is not the right place to ask about Drupal modules) - please help!


texts: how to change h2 tag for div in block_view

texts:
I've created a block like this

function mymodule_block_view($delta = '') {
    if($delta == 'myblock') {
        $block['subject'] = 'mytitle';
        $block['content'] = myfunction();
    }
    return $block;
}

but the output is like this:

mytitle

I need change h2 to div

mytitle

I've tried with _preprocess_block hook but i cant change that tag

could you please help me?


texts: How to properly call drush command from another drush command?

texts:
I have a drush command that does some stuff and at the end of its execution I want to invoke twig-compile --uri=foobar.com. When I call drush_invoke('twig-compile') I get error about unknown arguments(those were passed to my drush command). I tried things like this before invoking the command drush_set_context('options', ['uri', 'foobar.com']); but no success yet.

How should I reset the options so twigc won't complain about them or how do I invoke the twigc command directly with the uri argument?


texts:
I have a Drupal 7 site with over 400 users. Time to time I use Mass contact to send updates to the users. I noticed that some of the users receives blank email with no body. I get no errors and there is noting on the logs. Not sure how to debug and solve the issue.

List of Modules

Mass Contact Version: 7.x-1.1
Mime Mail:Version: 7.x-1.1
Mail system: Version: 7.x-2.35

Configuration:

Mass Contact:

Maximum number of recipients before splitting up the email = 50

Send as BCC (hide recipients) by default =  is checked

Body text format = Full HTML (Wysiwyg - CKEditor)


texts: How to remove unused tables in the database in Drupal 7

texts: Is there an easy way to detect tables that are no longer used by my Drupal installation? I find it annoying that tables from previously used modules remain. I'll simply drop them using phpMyAdmin if not, but its a bit of a pain, and involves backing it up for obvious reasons! ;)


texts: How to Add\Edit ECK entitys from front-end?

texts:
I'm using the ECK module for defining custom entities. Also there are users that have permissions to add and edit entities from specific bundle. I'm trying to create a front-end menu for these users with 'Add entity' and 'Edit entity' items.

My question: how to provide an option to Add/edit custom entities to the front-end users?


texts: Drupal Commerce: Theming the Add Products form (Bulk Production Creation)

texts:
I am using Drupal Commerce Bulk Product Creation to add products to my site.

I would like to theme the Bulk Add Products form to make it more user-friendly to edit.

I can use page--admin--commerce--products--add-bulk--PRODUCTNAME.tpl.php to override the form. However, I don't know what PHP code to use to print out the product fields.

I found some articles online (1, 2, 3) and have tried the following, but none of them work:

<?php print render($content['form']['product:field_FIELDNAME']); ?>
<?php print render($content['form']['field_FIELDNAME']); ?>
<?php print drupal_render($field_FIELDNAME) ?>
<?php print render($field_FIELDNAME) ?>
<?php print drupal_render($vars['form']['field_FIELDNAME']);     ?>
<?php print drupal_render_children($form['field_FIELDNAME']); ?>

Any pointers would be appreciated.


texts: Should drush configuration export automatically update core.extension.yml?

texts:
The Drupal 8 documentation seems to be lacking in regards to the core.extension.yml file, so I'm a little confused on the right way of updating it.

Should drush be populating it on config export, or are you supposed to manually update it?
Do I need to move it from core to my config/sync folder, or leave it in core?

My file's contents are this, even though I have a handful of modules enabled on the site and have exported my config numerous times:

module: {}
theme: {}
profile: ''

On the site I am exporting from (site a) I am using composer to download modules and drush en to enable them, then drush cex to export the configuration to my sync folder. When I copy the sync folder contents over site b and import via drush cim I run into errors that the modules are not installed / enabled. Manually enabling each module then re-importing was successful.

Both sites are 8.3.7.


texts: How to substitute a value of an exposed filter for views?

texts:
I have a view with an exposed filter with taxonomy tree. Each term can be selected or unselected. If some parent term is selected but every of its child terms isn't selected then all the children terms also should be added to view filter.

But if I select one children term after it, the view should be filtered only by this children term (not by all children terms).

I decided to solve this problem trying to add children terms in the view parameters. By my idea, the view should use this parameters for its execution.

But, unfortunately, I can't understand where to add these params. I tried to use different view hooks, having tried to add them in vars $view->exposed_data, $view->exposed_raw_input, $view->exposed_input. No result.

I also tried to add them in the submit function of the exposed filters form. No positive result also.

Could you clarify me, where can I add new params into the view ?

For example, a user selected term1. In this case term2 and term3 should be added to the view parameters programmatically. And after it, views should use parameters term1, term2 and term3.

I hope, I've described the problem clearly


texts: How to get different languages of the site to appear in that language's Google search results

texts:
I would like,when a user searches english terms the english version of the site to appear in google search results.
When a user searches the same terms but in a different language e.g. german ,the german version of my site to appear in google search results.
How can I do this?Which modules can I use?thanks


texts:
When we create a date field in node form, we can set START and END years to be shown in that date field.
If we are creating a date field programatcaly, how do we do that?

I have a date field, my_date, I want to to show only next 5 years from now on.
Any help?

$form['my_date'] = array(
  '#type' => 'date',
  '#date_format' => 'd-m-y',
  '#default_value' => format_date($primary_start1, 'custom', $format),
  '#date_type' => DATE_DATETIME,
  '#date_timezone' => date_default_timezone(),
  '#date_format' => 'm/d/Y',
  '#size' => 20,
  '#access' => TRUE,
);

I tried to see structure bu creating a date field and printing the form, but found nothing.


texts: Need a textfield required only when selectlist is set to 'Approved' within custom content type

texts:
This seems like it should be simple, but has been challenging me for a few days now. I have a custom content type which contains a selectlist which defaults to 'Pending' for new nodes. Someone will later come along and set these to 'Approved' and when they do so I need a text field to be available and required prior to saving the node again.

I have tried the available modules 'Conditional Fields' and 'Field Conditional States' but they do not seem to work to make fields actually required. I assume this is because the JavaScript Form state has no effect on server-side logic and validation.

If I was coding this outside of Drupal 7 I would probably make the textfield disabled, required, and give it a default value. Then use an .onchange to check if it is set to “Approved” and, if so, enable it and empty the default value but I am not sure how to implement this with Drupal yet.

I didn't find anything else in the way of modules that seemed to work, so I have now begun looking at the function 'drupal_process_states'. This seems like it might be the right path, but is going to take me a while to figure out.

Any help is appreciated. Thanks!


texts: How to count the number of consecutive days on which verified users accessed the website?

texts:
My main problem is very similar to How to grant userpoints to users who perform a login 5 days consecutively?: I would like to keep track of the number of consecutive days on which verified users accessed the website. Therefore, I added an integer user field Consecutive days and created the following Rule that hooks into "visiting the website" (see How to hook into "visiting the website"?):

{ "rules_extra_consecutive_day_online" : {
    "LABEL" : "Extra consecutive day online",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "2" : "2" } }
        }
      },
      { "OR" : [
          { "data_is" : {
              "data" : [ "site:current-user:field-consecutive-days" ],
              "value" : "0"
            }
          },
          { "AND" : [
              { "data_is" : {
                  "data" : [ "site:current-user:last-access" ],
                  "op" : "\u003C",
                  "value" : "today midnight -1 second"
                }
              },
              { "data_is" : {
                  "data" : [ "site:current-user:last-access" ],
                  "op" : "\u003E",
                  "value" : "yesterday midnight"
                }
              }
            ]
          }
        ]
      }
    ],
    "DO" : [
      { "data_calc" : {
          "USING" : {
            "input_1" : [ "site:current-user:field-consecutive-days" ],
            "op" : "+",
            "input_2" : "1"
          },
          "PROVIDE" : { "result" : { "new_streak" : "New streak" } }
        }
      },
      { "data_set" : {
          "data" : [ "site:current-user:field-consecutive-days" ],
          "value" : [ "new-streak" ]
        }
      },
      { "schedule" : {
          "component" : "rules_reset_consecutive_days",
          "date" : "+2 days midnight",
          "param_user" : [ "site:current-user" ]
        }
      },
    ]
  }
}

The scheduled Rules component at the end of the Rule resets Consecutive days to 0 if necessary:

{ "rules_reset_consecutive_days" : {
    "LABEL" : "Reset consecutive days",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "user" : { "label" : "User", "type" : "user" } },
    "IF" : [
      { "data_is" : {
          "data" : [ "user:last-access" ],
          "op" : "\u003C",
          "value" : "yesterday midnight -1 second"
        }
      }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "user:field-consecutive-days" ],
          "value" : "0"
        }
      }
    ]
  }
}

This seems to work relatively well, but there is a catch: the Last access field is not updated at every page request. As a result, users can increase their Consecutive days during a few minutes right after midnight by refreshing the page again and again.

How can I fix this issue? Should I override the Last access field at every page request or is there an alternative way to correctly update Consecutive days?


texts:
I use services with drupal 7, here the services resources function :

function custom_api_services_resources()
{
    return [
        'res' => [
            'create' => [
                'callback' => 'custom_api_create_user',
                'access arguments' => array('administer access control'),
                'access arguments append' => FALSE,
                    'args' => [
                    [
                        'name' => 'data',
                        'type' => 'struct',
                        'description' => 'data',
                        'optional' => FALSE,
                        'source' => 'data'
                    ]
                ],
            ]
        ]
    ];
}

Here the node access function (empty) :

function custom_api_node_access($op, $data) {
}

For Authentication I use HTTP basic authentication and/or Session authentication

I don't know what I have to do to limit access only for admin. I've tried a lot but never work with authentication.

I feel like it's very easy to use it, but I don't understand it.

I've already posted a message about this issue but differently. Can someone delete the first one, please ?  How do I use the access arguments?

Edit

custom_api.module file :

             'create' => [
                'callback' => 'custom_api_create_users',
                'access callback' => 'custom_api_access_callback',
                'access arguments' => array('administer create field_projects'),
                'access arguments append' => TRUE,
                'access callback file' => array(
                  'type' => 'inc',
                  'module' => 'support',
                  'name' => 'custom_api.resource',
                ),
                    'args' => [
                    [
                        'name' => 'data',
                        'type' => 'struct',
                        'description' => 'data',
                        'optional' => FALSE,
                        'source' => 'data'
                    ]
                ]

custom_api.resource.inc :

function custom_api_access_callback($permission) {
  return user_access($permission);
}

Permission from Database, role_permission table :

Permission : access comments
Module : comment

Permission : access content
Module : node

Permission : access news feeds
Module : aggregator

Permission : access site map
Module : site_map

Permission : create field_credits
Module : field_permissions

Permission : create field_credit_level_1
Module : field_permissions

Permission : create field_credit_level_2
Module : field_permissions

Permission : create field_credit_level_3
Module : field_permissions

Permission : create field_level
Module : field_permissions

Permission : create field_number_of_credit_remove
Module : field_permissions

Permission : create field_projects
Module : field_permissions

Permission : create field_remove_credit
Module : field_permissions

Permission : search content
Module : search

Permission : subscribe to newsletters
Module : simplenews

Permission : use advanced search
Module : search

Permission : use custom search
Module : custom_search

Permission : use custom search blocks
Module : custom_search_blocks

Permission : use text format guestbook_txt
Module : filter

Permission : access comments
Module : comment

Permission : access content
Module : node

Permission : access news feeds
Module : aggregator

Permission : access site map
Module : site_map

Permission : administer custom search
Module : custom_search

Permission : administer custom search blocks
Module : custom_search_blocks

Permission : administer search
Module : search

I have link to add data (client and node : project and client) in drupal website. Only administrators can add data.


texts:
Can anyone help me how to expose the date filter in a view in drupal 7.

I have added post date filter with in FILTER CRITERIA but it is not working

Can anyone help me


texts: How to get the File Description programmatically?

texts:
In Drupal 8, like Drupal 7, you can enable the file description in the file field setting.

But once my file entity is loaded in my preprocess, I don't know how can I get the description value entered for my file.
I've tried (without success) :

$myfileentity->toArray();
$myfileentity->get('description');
$myfileentity->get('description_field');
$myfileentity->label();

Any Idea ?

Thanks.


texts: change field value in a view using preprocess_views_view_fields

texts:
I'm trying to change the value of a field in a view programatically but i find some problems.

first is  that even though I created a Global: custom text field which field id is 'nothing', It's value remain unchanged and the value is applied to a new field created at the end of the view.
Second is that this function creates some errors and drupal send lots of notices:

  Notice: Undefined property: stdClass::$wrapper_prefix in include()
  (line 32 of
  /my/path/sites/all/modules/views/theme/views-view-fields.tpl.php).

  Notice: Undefined property: stdClass::$label_html in include() (line
  33 of
  /my/path/sites/all/modules/views/theme/views-view-fields.tpl.php).

  Notice: Undefined property: stdClass::$wrapper_suffix in include()
  (line 35 of
  /my/path/sites/all/modules/views/theme/views-view-fields.tpl.php).

My code is:

function real_estast_sub_preprocess_views_view_fields(&$vars) {
  $view = $vars['view'];

  foreach ($view->field as $id => $field) {

    // change the global custom text content depend on result (node id)
    if ($vars['row']->nid == 1625){
      $vars['fields']['nothing']->content = '666€';
    }else{
      $vars['fields']['nothing']->content = $vars['row']->field_data_field_price_field_price_value."€/noche ";
    }
  }
}

What's the problem here? I tried to follow all the steps explained in:

How to insert values into Global custom text field of views programmatically?

  Edit:   I soolved the notices form drupal by adding:

  $vars['fields']['nothing']->wrapper_prefix = '';
  $vars['fields']['nothing']->wrapper_suffix  = '';
  $vars['fields']['nothing']->label_html = '';

  But it's like I'm defining a totally new field instead of assigning a
  value to the existing one


texts: How do I paginate results with db_query?

texts: How do I paginate results with db_query in Drupal 7? I didn't find any example using db_query.


texts: How to specify a Rules condition related to select list values?

texts:
I'm now thoroughly confused about trying to set a Rules Condition on a select list. There are two things I want to do:

(a) On a new node of my content type I want to trigger when a certain checkbox in the select list is checked

(b) When a node of the same content type is edited I want to trigger when the state of the checkbox has changed.

For (a) I start out with a Data Comparison and put the name of the select list (node:field-pbxq-stock-status) in Data Selector. On the next page I choose "Is one of" for the Operator and then my list of Data Values disappears, so I cannot select the one I want. It won't allow "node:field-pbxq-stock-status:In stock" or "node:field-pbxq-stock-status:3" (3 is it's index) in that Data Value/Data Selector field.

Update:

These are two more comparisons I've tried.

Both are: After saving new content of type PBX Quote

Text Comparison

Data selector: node:field-pbxq-stock-status:3

Matching text: In stock

Value: contains

List contains item

Selected list: node:field-pbxq-stock-status

Data selector: node:field-pbxq-stock-status:3

In both of those cases I'm using the '3' because
I -think- thats suppose to be the list offset?
I'd much rather compare without dependency on
offset, eg:

Some type of comparison

Selected list: node:field-pbxq-stock-status

Matching text: In stock

Value: contains


texts: Autocomplete ahah combo is not working in Drupal 6

texts:
I am using Drupal 6.
I have a form which uses autocomplete and ahah in form. It works fine in Firefox but not in Chrome. if its just ahah or autocomplete it works fine but the combo seems to be not working in Chrome. :(
Below is my form

$form['my_fieldset']['my_field'] = array(
      '#type' => 'textfield',
      '#title' => t('Something'),
      '#description' => $client_exists_text,
      '#autocomplete_path' => 'autocomplete/my_field',
      '#ahah' => array(
         'event' => 'change',
         'path' => ahah_helper_path(array('details_fields')),
         'wrapper' => 'details-fields',
         'method' => 'replace',
         'progress' => 'throbber',
      ),
      '#default_value' => ($form_state['values']['my_field']) ? ($form_state['values']['my_field']) : $client_data['my_field'],

Has anyone come accross such issue, please help!
Thanks in advance!


texts: Is it possible to run a Drupal 7 site without jQuery?

texts:
Possible Duplicate:
  Remove jQuery and find out what is asking it to be included

I'm building a simple site that is focussed on performance and must run well on mobile and other low-power devices. I want to avoid jQuery if I can, and want to know if it's even possible or whether it's simply a compromise I'll have to live with. I don't want to start building with jQuery removed and have to carefully engineer things to avoid it, only to find I'll need it later, thus wasting effort better spent elsewhere.

If it can be removed, are there any gotachas? Any modules to avoid? Anything else to bear in mind?

Another thought: Can it be restricted to certain pages only, where the interaction it provides is required?

UPDATE

There is a similar question that also touches on the issue of jQuery dependency, but where that one broadly asks about dependency tracking and CSS files and theming, this one is focussed on the feasibility of removal of jQuery in Drupal and its performance implications. The accepted answer here is substantially different from the one there, as is the theme of the discussion here. Therefore I'd argue that this is not a duplicate and offers value to the community.


texts:
How can I set up a node form to submit via AJAX?

I can't find examples that show how to do this explicitly. I am trying to run AJAX submission in a popup window.

After adding use-ajax-submit, the request starts correctly, but after saving the node it redirects to the node page and everything crashes.


texts: To show custom user fields in a view does not work for user with uid 1

texts:
I have a view that shows some custom user fields as block on the users profile page. The permission of that view is set to »Access: Permission | View published content«. That means the view should be visible for any visitor.
This works fine on any user profile but not on the  profile of the administrator with the uid 1. On his profile page the view is empty.
Is this a bug or a wanted behaviour? How to solve this?

UPDATE: I tried to solve this by changing the view's access permissions but even if I set them to »none« or »Roles | All« it does not work.


texts:
I created custom node edit pages and I want the edit tab to redirect from

node/2545/edit

to

topic/2545/edit

or

node/2549/edit

to

arts/2545/edit

depending on the content type

This is not an alias this is a custom edit page/view I created, it is NOT the node edit page or an alias of it. it is a completely separate page and I simply want to redirect to this page when I click edit. In other words "I want to redirect to a completely random page when I click "edit"

http://screencast.com/t/zHcFsr8I


texts:
I have a custom module that I created. In it, I've implemented the hook_block_view:

function event_details_block_view($delta = '') {
$block = array();

switch($delta) {
    case 'event_details':
    $block['content'] = array(
    '#theme' => 'event_block_details',
    );
    break;
}

return $block;
}

I then have a file named event-block-details.tpl.php in my module folder. Right now, this is just some basic HTML to test whether or not the block is accepting the theme. When I go to my site however, I am able to see the block in the blocks tab and I can add it to a page, but none of the content displays.

Are there any suggestions as to what could be wrong? This is the first module I've written so I'm unsure where the errors can lie. I use Drupal 7.


texts: Pre-populate a user reference field during drupal commerce checkout - buying a gift for a user without manual username entry

texts: I am creating a gift shop website where users can buy gifts for other users. So on every user profile i want to add a link "buy gift for this user" which takes you to the product page. After adding items to cart and checkout, a "gift recipient" (user-reference) field is already pre-filled with the name of the user from whose profile the shopping was initiated (not the name of the logged in user). Is this sort of thing possible in drupal 7? How can i achieve such? Thanks.


texts: Reinstall a module that has .yml file in config\install

texts:
A good enhancement in Drupal 8 is having list of yml file to import via installation in mymodule_root\config\install, but this means I can not reinstall a module because the configuration settings already exist in the active configuration.

Actually the problem is when uninstalling the module: The imported configuration settings, imported during installation, aren't waived.

Test scenario

Put this sample .yml file in yourmodule_root\config\install\systme.site.yml.

name: 'Admissions at Adelaide'
mail: admin22@example.com
slogan: ''
page:
  403: ''
  404: ''
  front: caslogin
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en


texts: Permission problems after migrating from Apache to IIS

texts:
After migrating from Apache server to IIS (7.5), I have some permission problems in Drupal: modules don't seem to have the permissions to delete (unlink) or create files, not even from/into "sites/default/files" folder.

What really interesting is, that if I create my own test.php with a simple file_put_contents in it, it does create and unlink files without any error messages.

BUT for example from AddThis module I got the following error message:

  unlink(sites/default/files/addthis/addthis_widget.js) [function.unlink]: Permission denied in
  C:\<mydrupalpath>\source\includes\file.inc on line 481.

After that, I right clicked the mentioned file, Properties > Security tab > added Everyone with "Full control" rights. Not surprising, this way unlink was already successful.

BUT after that, I can see this it in the Drupal log:

  "The directory sites/default/files/addthis is not writable, because it
  does not have the correct permissions set"

OK, tried to set the right permissions with icacls with granting "modify" and "write" permission to sites/default/files directory like this:

c:\<mydrupalpath>\source\sites\default\files /t /grant "IIS APPPOOL\MyDrupalAppPool":(OI)(CI)(M,W,RX)

OK, result is "Successfully processed 228 files".
Refreshing Drupal site in browser...
Hmm, didn't work, the same error message again (permission problems)...

I don't understand... if I query the rights with icacls on "files" OR files\addthis directory, it says my application pool does have "modify" rights:

IIS APPPOOL\MyDrupalAppPool:(OI)(CI)(M)

I do have permission problems with Gallery module too... :(

What should I do not to have permission problems in "files" folder when modules try to delete from/write into it?

Thanks in advance!


texts: How to redirect all unpublished nodes of a certain type

texts:
Problem

I'm running a job site where content appears and disappears quickly. This means I end up with a lot of 404s from Google indexing pages only for them to disappear.

I want to redirect all unpublished nodes of a certain type to a particular page, depending on a value on the node and display a drupal message depending on what just happened.

I'm trying to come with a solution which is easy to maintain and will scale, should the site grow to have thousands of nodes.

Has anyone solved this sort of problem? What kind of solution did you use?

My current ideas

Use the redirect module.

I've created a module which will redirect all my nodes when they're unpublished via either a cron action or a form action using the redirect API.

The problem is this creates a lot of redirects. While it might take a while to become unmanageable, several other questions mention the module scales quite well into the thousands I would like it to be future proof is possible.

One option to solve this was to delete unused redirects however because I run Varnish in front as a cache, it is unable to tell which redirects have been active.

Do it server side

I'm running Nginx, I presumably could set up a location block which would redirect all 404s.

If I put the node information I needed in the URL I could just grab it from there and then redirect each set of nodes.

This is an ok solution, but the pages are redirecting to country so there would have to be 330 location blocks in my nginx config, which isn't particularly slick.

It also makes it impossible to set a message on page load.

Use the rules module

You can setup content viewed redirects using the rules modules but unfortunately Varnish caching breaks this.


texts: How can I see all the places an asset or entity is referenced?

texts:
In Drupal 8, I have a requirement from a client that they be able to find a reference of a given asset (file, node, entity, etc) throughout a Drupal site. The ultimate goal is to know that if they want to delete this asset, it's not going to create 404 errors throughout the places on the site where this is referenced in other content.

I'm thinking about a Views page where the name or ID or some type of identifier would be a contextual filter and then would show a list of all nodes or blocks where that relationship exists.

Any thoughts on how to approach solving an issue like this?


texts: Body content appears to anonymous viewer but not to site admin

texts:
In Drupal 7, on my front page, when logged in as admin, the node's content is not rendered.

However, when I log out, I can see content

This only occurs on one content type (called Front Page). No other content type mimics this behavior.

We're using Responsive Premium as our base theme, of which it is based on omega.

Is there a permission that I have forgotten about?


texts: What is the difference between an entity in Drupal 7 and a content entity in Drupal 8?

texts: The Drupal Examples "entity" project was really helpful for me when I was learning the entity API in Drupal 7. I have seen no explanation though for why this doesn't exist in Drupal 8 or why it was renamed, etc.


texts: I'm trying to set data value for a date field. The value is 7 days after a node was created. This works fine but I would like to have a fixed time of 6pm as the time value. Currently the time is set as the same time as the created node. How do I fix this?


texts: permisssions set to 755 - image upload is not possible - in drupal-commons 6x 24.

texts:
hello and good day hope  you are all well!

newest update:
Now i have created a second installation with partly other conditions:(haviing permissions 755 with user vhost: www on /home/vhost/WWW/campus-24.com/sites/default The selected file xxxxx could not be uploaded. Only JPEG, PNG and GIF images are allowed. Well this is a new error - i had not this error before - what can i do. Guess that i have a made a big step... what do you think!?

Here the original-thread-start: just installed a drupal -commons version 6x 24:

when i try to upload images i get errors - and after doing some search in the system and the adminstration-controll i fould out: the reported error

image upload is not possible - in drupal-commons version 6x 24 {released on jan 18th ):  i have done some research and found out that i have: 755 -  in directory sites/default/files

Allthough i have the permisssions set to 755 -

what can i do here - just lemme know!

The directory sites/default/files is not writable
see the path where i i have recogniczed the error

http://schulcenter.org/?q=admin/build/themes/settings

The directory sites/default/files is not writable

Well what can i do here?!

update: thx alexandru and Mpd - thx for the answers; well everytime i touch the permissions i get  lost.- (i have troubles n issues with permissions and file users. see here https://superuser.com/questions/382792/setgid-bit-always-unset-when-changing-file-permissions  hmmm - well MPD guess that you are right and i am pretty lost -here . what can i do now??


texts:
I have created a dependency like the following, but it seems that acquia_lift is still not running before gtmscripts. How can I achieve this?

 GTMscripts:
 version: 1
 header : true
 js:
   assets/js/GTMscripts.js: {}
 dependencies:
    - acquia_lift/acquia_lift


texts: Export data to CSV programmatically in drupal 7

texts:
I am using the following code to extract all the users belonging to a group:

// Send response headers to the browser.
drupal_add_http_header('Content-Type', 'text/csv; utf-8');
drupal_add_http_header('Content-Disposition', 'attachment;filename=csvfiles.csv');

$output = '';
$keys = array(t('User id'), t('Username'), t('Email'));
if ($keys) {
  $output .= implode("\t", $keys) . "\n";
}
$members = _get_users_in_group($gid);
foreach ($members as $member) {
  $user = user_load($member->uid);
  $output .= $user->uid . ',' . $user->name . ',' . $user->mail . "\n";
}
print $output;
exit;
}

Even though I load all the users correctly the output I get is in Chinese. That means something is breaking the CSV format. Any ideas how to export data to CSV in Drupal 7?


texts:
I have the Realname module installed to display the real name of my users in my database rather than the name. ie realname Bob smith however name is bsmith. However the search box only looks for name or email. So when users search by Real Name somethings nothings appears. Any suggestions on how to solve this issue?

On another page I have a view of the contacts and an exposed filter to search by realname but I want to keep the search box in the header and have the functionally to search users and also news items etc.


texts: Installation profiles: add module/theme search path?

texts: I'm trying to create a "base" installation profile with the modules and settings i need for every project which the specific project-profiles should derive from. It's no problem to run the install-part of my basic profile, but is there a way to use modules and themes that are stored in the 1st profiles folder?


texts:
How can the administrator delete an "impolite" comment and approve comments before publishing?

Globally speaking, what is the best management of the comments?


texts: Filter data from two content types with different criteria in view

texts:
I've got these two content types, A and B. It's pretty straightforward to set up and display them in the same view. However, I can't get them filtered. I've added two filters rules, one for each content types, a1 and b1 respectively, in the hope that I can extract the right parts of the data from A and B and show them in my view. But that doesn't work out.

//
a1=published and content type A and category=aa
b1=published and content type B and tag=bb
//

Here is what I got while trying to do so:

no rules at all,
view displays all the stuff from A and B
rule a1,
view displays A only
rule b1,
view displays B only
rule a1 or b1,
shows nothing

filter groups i used

Is there anything wrong or filter criteria can only be applied?
Any help is appreciated.

--update 1--
I did some more experiments about grouping filter criteria:

 - case 1
Content: Published (Yes)  AND
Content: Type (= Portfolio)
OR
Content: Published (Yes)  AND
Content: Type (= Blog entry)  AND
Content: Tags (= frontpage) | Settings
 - case 2
Content: Published (Yes)  AND
Content: Type (= Portfolio)
Content: Tags (= frontpage) | Settings
OR
Content: Published (Yes)  AND
Content: Type (= Blog entry)  AND

"Content: Tags" is a unique field which only appears in content type "Blog entry" . To my surprise, case 1 and 2 will yield the same result, blog entries, even though "Content: Tags" has nothing to do with the content type "portfolio".

--update 2--
a bug?
Incorrect filter group OR behavior


texts: Why does PhpSpreadsheet fail to identify my Xlsx file in public://?

texts:
I'm working on a module that imports a Xlsx file and inserts the rows to database. Everything works fine, except PhpSpreadsheet throws the error Unable to identify a reader for this file when my uploaded file is in public. This error doesn't happen when the file is in base_path(). Why is this happening? Below is my code:

public function submitForm(array &$form, FormStateInterface $form_state) {
    $connection = \Drupal::database();
    $fid = $form_state->getValue("xlsx_upload");
    $input = File::load(reset($fid));
    $input->setPermanent();
    $uri = \Drupal::service('file_system')->realpath($input->getFileUri());
    //$uri = '/home/joe/file.xslx'; <--- this works perfectly.
    $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile($uri);
    $spreadsheet = $reader->load($filename);
    $dataArray = $spreadsheet->getActiveSheet()->toArray();
    $connection->truncate("mitacan")->execute();
    $connection->query("SET NAMES utf8");
    foreach ($dataArray as $dataItem) {
      $connection->insert('mitacan')
      ->fields([
        'stokkodu'      => $dataItem[0],
        'logo'          => $dataItem[1],
        'resim1'        => $dataItem[2],
        'grupkodu'      => $dataItem[3],
        'grupadi'       => $dataItem[4],
        'grupindex'     => $dataItem[5],
        'paketadedi'    => $dataItem[6],
      ])
      ->execute();
    }
    drupal_set_message('Excel verisi veritabanına eklendi.');
  }

EDIT: The above code throws "PHP message: Uncaught PHP Exception InvalidArgumentException: "File "" does not exist ." at File.php line 137", even though line 137 throws an exception saying it's not a file, but \dpm(is_file($uri)) returns TRUE.


texts:
In my module, I add javascript with a url parameter:

drupal_add_js(libraries_get_path('mylibrary') . '/MyLibrary.js?config=MY_CONFIG_PARAM');

When I view the HTML page source, the line loading the script looks like this:

<script src="http://example.com/sites/all/libraries/mylibrary/MyLibrary.js%3Fconfig%3DMY_CONFIG_PARAM&amp;nbbffw"></script>

The '?' and '=' are encoded. Trying to load this script results in an error, because browser can't find it (but if I manually decode it in the browser bar, it's found).

How to add javascript with a parameter, so that it won't get encoded?


texts:
I have a salary content type and i want to reference the salary value from another content type.
Can i make a node reference to some field but not the title field?


texts: Temporarily disable all modules for troubleshooting

texts: I have a bizarre error going on in the Drupal admin and I want to disable all modules to test if any of them are causing the problem. I have dozens of enabled and dozens of disabled modules. I can go through the process of writing down each module and its status, then manually disabling and re-enabling. However, that seems pretty tedious. Is there a better way to temporarily disable all modules without having to manually remember and tick them on/off?


texts: Entity reference for feed imports not working on some referenced nodes

texts:
I've posted this problem on drupal.org but I feel that it's so cryptic that maybe it deserves a larger audience.

For some reason, when I'm trying to import users that are associated with group nodes some imported users do not have any referenced group nodes associated.

I've noticed that the group nodes that cannot be referenced are only nodes that have been imported via a previous feeds import. Despite this, users that are created through the user creation form CAN be associated with the group nodes that do not work through the feeds import process.

There are two php warnings that occur when an entity reference cannot be created through the feeds process:

Warning: array_keys() expects parameter 1 to be array, boolean given in entityreference_feeds_set_target() (line 132 of /home/angelo/dev/client/profiles/openatrium/modules/contrib/entityreference/entityreference.feeds.inc).

Warning: reset() expects parameter 1 to be array, null given in entityreference_feeds_set_target() (line 134 of /home/angelo/dev/client/profiles/openatrium/modules/contrib/entityreference/entityreference.feeds.inc).

This implies that for some reason
127: $handler->getReferencableEntities($value, '=')
isn't returning what it's supposed to and I'm not too sure why.

Has anyone else run into this issue?


texts: Best option to upgrade Drupal 6 Video field to Drupal 7

texts:
I'm trying to update a Drupal 6 site to Drupal 7.

I'm trying to move a video CCK field to Drupal 7. If I try to move to a video field, I get a message telling me there is not way to migrate.

How can I upgrade Video from 6.5.2 to Drupal 7.2.7?


texts: Making the header/footer of a views Content Pane available in 'Allow Settings'

texts:
Currently in views, when using a content pane, under 'Pane Settings' there is the link 'Allow Settings' which shows these options:

However, I would like to allow the header and footer also as options to be overwritten in the panel pane.
The reason for this, is that I need context keywords from the Panel, which are not available in the view itself.

How could I accomplish this?


texts: Why boost module does not work for https sites in D6&D7?

texts:
For my site now Boost module is working fine. It wasn't working though it was indeed generating the HTML files. I tracked it to .httaccess rule:
RewriteCond %{HTTPS} on [OR]

After commenting out it's working fine. But any idea why it is made to skip specifically HTTPS sites?
I will mention the D6 Boost .htaccess rules:
### BOOST START ###

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTPS} on [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID
  RewriteRule .* - [S=1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###

I've had to comment out RewriteCond %{HTTPS} on [OR]


texts: Views help from Advanced Help isn't being displayed or I can't find it

texts:
It turns out that I actually hadn't installed Advanced Help on this Drupal setup and was only using regular 'Help'

I'm using Views 7.x-3.5 (API version 3) and Drupal 7.17

I installed Advanced Help (some time ago now) and cleared all caches

When I go to /admin/help I see a list of the following...

Help topics

Help is available on the following items:

Administration menu
Advanced User Management
Block
CKEditor
Color
Comment
Content Access
Contextual links
Dashboard
Database logging

Date
Field
Field SQL storage
Field UI
File
Filter
Help
Image
List
Menu

Menu Block
Node
Number
Options
Path
Pathauto
RDF
Rules
Rules Forms Support
Search

System
Taxonomy
Text
ThemeKey
Token
Trigger
User
Webform

The following is constantly displayed in structure > views

  If you install the advanced help module from http://drupal.org/project/advanced_help, Views will provide more and better help. Hide this message.


texts:
On my local Drupal 8 multisite environment in sites/default/settings.php I have:

$config_directories['staging'] = 'sites/default/config/staging';
$config_directories = array();

Because the default direction for the configuration files sites/default/files is .gitignored.

Is above correct, or do I have to delete $config_directories = array(); and put only the first line? How do I have to setup $config_directories properly so I can version my Configuration with Git?

Is $config_directories the same in both settings.php for the local site and production environment. In other words; is settings.php the same for the local site and production environment, except the database information?

Acquia Dev Desktop also gives:

$config_directories['sync'] = 'sites/griffioenrotterdam-dev.dd/files/config_CBOBWbcJU487p7Gc5z5e4GPzL6pSuEKQytsN6heKUULhL8ziYY7DUJoAbHI-dUxnFEfpzk0W7Q/sync'

What about that?

My steps to set this all up where:

I set up a local Drupal 8 multisite environment using Acquia Dev
Desktop. All worked fine.
I have a Git workflow setup
Now I try to make instances of my local site (clone) for Dev and Prod environments
With git I pull the Drupal 8 code to my production server
I adjust settings.php in sites/default/settings.php
I dumped my local Database using drush
I import the Database in Database connected to staging (Dev) environment

But when I visit http://staging.griffioenrotterdam.nl/ it doesn’t look good.

--- Update ---

$config_directories['staging'] = 'sites/default/config/staging';

Is from an old Drupal 8 version.

Now you have to use:

$config_directories = array(
    CONFIG_SYNC_DIRECTORY => './../config/sync',
);

But when I go in admin to Reports > Status report > it says:

  The ./../config/sync folder does not exist. You may need to set the
  correct directory at the file system settings page or change the
  current directory's permissions so that it is writable.


texts:
My task is to create a field that is visible to the author node.

Let's say the content type is "article" and the field is "textid" that contains the node ID number.

I've already created it with Display suite as a custom field with token [node:nid], so the result is some text with number of the node ID.

How can I make that field visible only by the node author?

What hook should I use?


texts: How do I access the first value of a multiple value text field using replacement patters inside a rule?

texts: For example, lets say I have a list of objects each stored as separate values of a text field. How would I access the individual values? I have tried using delta and I have tried using entity token but nothing has worked. I hope my syntax was just a little off.


texts: 'invalid render array key' error when using an associated array for a twig variable

texts:
I have a list of images, and I want access to both the direct path to the image, and the path with an image style applied to it available to a twig template.
I'm grabbing the images in my .theme file like so.

$images = $node->get('field_image');

foreach($images as $image){
    $image_style =Drupal\image\Entity\ImageStyle::load('photos')->buildUrl($image->entity->getFileuri()),
    $image_path = file_create_url($image->entity->getFileuri()),
}

I want to be able to access these attributes for each image by storing them in the $variables array.

I attempted to do so by using

foreach($images as $image){
    $image_style =Drupal\image\Entity\ImageStyle::load('photos')->buildUrl($image->entity->getFileuri()),
    $image_path = file_create_url($image->entity->getFileuri()),
    $variables['photos'][]['image_style'] = $image_style;
    $variables['photos'][]['image_path'] = $image_path;
}

However that didn't work and I received errors. After that I figured that maybe I needed to supply a more explicit associative array so I tried

    $variables['photos'] = array();
    $photo_paths = array();
    foreach($images as $image){
        $photo_paths += [
            $i => [
                'image_style' => Drupal\image\Entity\ImageStyle::load('photos')->buildUrl($image->entity->getFileuri()),
                'image_path' => file_create_url($image->entity->getFileuri()),
            ],
        ];

        $i += 1;
    }
    $variables['photos']= $photo_paths;

But then I receive the error

  User error: "image_style" is an invalid render array key in
  Drupal\Core\Render\Element::children() (line 97 of
  core/lib/Drupal/Core/Render/Element.php).

and

  User error: "image_path" is an invalid render array key in
  Drupal\Core\Render\Element::children() (line 97 of
  core/lib/Drupal/Core/Render/Element.php).

These errors continue for each image. I'm guessing that $variables can't handle nested associative arrays? Is there a way I can use an associative array inside a twig variable? Or is there another way to accomplish the same task or storing the path and image style for each individual image to be displayed in a for loop in twig?


texts: Webform multistep form previous button asks to fill the required fields

texts:
I'm working on a D8 project and I have a multistep webform. Everything works fine but when I click the previous button I'm getting errors that the required fields shouldn't be null in order to go to the previous step. Is this a configuration I need to change or is there a way to avoid it?

Thanks in advance.


texts: Strange characters after URL -> /#.UAfaBbTY-iE

texts:
I'm not sure how it's happened, but on each page there are some characters appended to the URL, similarly to the following one:

http://example.com/rndsite/#.UAfaBbTY-iE

They seem to be the same for each page. Anybody know what is causing this?


texts: Rules governing views-based free text search

texts:
I have a search feature that uses Views. There is a search box 'filter' that's just a text box which enables users to input text to search the database. Pretty standard stuff.

I'm curious to know however if there are any rules governing how this search functions?

(Ie. if I enter one word, fine it searches on that term. However if I enter two terms I notice it returns no results, even if I know both terms are in a node and in that exact order!). But if I put two or (more?) words in double quotes " " it seems to return items that have both of those words, although not in that sequence necessarily.

Anyway, I'm just wondering if anyone knows if there is a list of rules governing a Views-based search text? thanks.

Note: my search filter is based off 'search: search terms'.


texts:
I would like to store some extra (meta) data about my nodes. Exactly like the promote or sticky columns in the node_field_data table.

In Drupal 7, I sometimes solved this problem by binding an extra property onto the node object. To add an extra column to the node table, I used code something like this:

/**
 * Implements hook_install().
 */
function mymodule_install() {

  // Add foo field to node table.
  $spec = array(
    'description' => 'Some description.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'initial' => 0,
  );
  $keys_new['indexes'] = array('foo' => array('foo'));
  if (!db_field_exists('node', 'foo')) {
    db_add_field('node', 'foo', $spec, $keys_new);
  }
}

/**
 * Implements hook_schema_alter().
 */
function mymodule_schema_alter(&$schema) {
  $schema['node']['fields']['foo'] = array(
    'description' => 'Some description.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  );
}

/**
 * Implements hook_uninstall().
 */
function mymodule_uninstall() {
  db_drop_field('node', 'foo');
}

I'd then add a field to the node form and save values, on submission, with something like node_save().

I also solved the problem using a tracking table. Simply creating a custom table schema and creating some CRUD operations to alter the values in the table via a form.

For the users table there was a special column, called data, if I remember correctly, where extra user settings could be defined and stored.

What is the best way to do this in Drupal 8?


texts: How to add Jquery Validation to Custom form and set error to field?

texts:
I want to implement client side validation using jQuery on my custom form.

I have enabled clientside validation contributed module

I have successfully attached custom js file using following code:

 $form['#attached']['library'][] = 'custom_form/cl-validation';

And in the JS file I have written below code:

(function ($, Drupal) {
  Drupal.behaviors.custom_form = {
    attach: function (context, settings) {

        var selectedCountry = ''

        $("#country").change(function(){
          selectedCountry = $(this).children("option:selected").val();

        });

        $('#user-number-value').keyup(function(){
              $(this).val($(this).val().replace(/(\d{2})|([a-z]{2})\-?/,'$1-'))
        });

         $("input#user-number-value").focus(function() {
            if(selectedCountry == undefined || selectedCountry == '') {
                $('#user-number-value').va('')
               // I want mark country dropdown as red and show a error
            }
        });

    }
  };
})(jQuery, Drupal);

I am not getting how to do this using jquery and stop form submission.

Any help?


texts:
I need an instant preview of what an entire node will look like before getting published. Ideally preview gets updated by every change user makes to the form., probably in an iframe beside the form.

The closest I can get is using Page Preview Module, but I need it without the context of a fully rendered page and without having to click preview button.


texts: Uninstall core forum.module while keeping content type and taxonomy

texts:
I'm upgrading a site from D5 to D7 and have a large amount of forum posts. However, I no longer want to use the core forum module, instead using views...

When I disable the module, I lose access to the "Forum Post" content type that the module creates. Also, Drupal doesn't have "ownership" of the "Forums" taxonomy.

On the plus side, the content remains. However, I can no longer add new "Forum Post" content and, since the forum module isn't enabled, I can't even create automatic aliases for the "Forum" taxonomy.

Is my only option to run through node_convert, and hope for the best? Or is there a few things I can manually edit in the DB that would give me full ownership of the content type and taxonomy (as if I had created them from scratch and never installed the module in the fist place)?

Thanks!


texts: Why with new bootstrap 3x-3.13 it doesn't work?

texts:
After update bootstrap module my theme doesn't work correctly. I use this code in my template.php (sub theme based on bootstrap).

function mytheme_preprocess_block(&$variables) {
  $block = $variables['block'];

  // Create css id attribute based on the block's administrative name
  if ($block->module == 'block') {
    $custom = block_custom_block_get($block->delta);
    $id = strtolower($custom['info']);
    $variables['block_html_id'] = $id;
  }
}

It was before I updated module

It's after


texts: rule setting for action after saving new comment

texts:
I need some help for a rule setting for this scenario:

after saving a new comment
all the users who bookmarked the node by a flag
shall get an e-mail

So i tried to set:
- Event: "After saving a new comment"
- Conditions: "Node is flagged" as bookmarks - Node: "comment:node" - user on whose behalf to check: ??users who bookmarked the node??
- Action: "Send mail" to ??users with this condition = true (or users who bookmarked the node)??

I believe i think the wrong way.
What`s the right way to build the rule for this scenario?


texts: How to convert a command line table (drush output) to any spreadsheet? (csv,excel,ods)

texts:
I often use commands like drush pm-list or drush views-list to get some listings of what my current project is using and for sake of usability I would like to import that stuff in a spreadsheet programm (I dont care which, csv can be imported bascially everywhere).

I digged into drush code and find out that it uses Console_Table for generating table like output. Maybe someone has an idea how to implement/ find a generic way to get a csv output from it.


texts: Which hook can I use for a Drupal webform Post to a Google Spreadsheet?

texts:
I have a webform with some options and fields. When user submit the form i receive an email.

I want to hook right before(or after) drupal send the email and populate my Google  Spreadsheet so i can review from my Google Drive account.(And send the email as normal)

I have make the connection with a custom php file. I don't know what hook i can use.


texts: How to format an integer field as Date/Time using Views module

texts: I created a custom Entity with one of the properties named 'created' and set with the Drupal REQUEST_TIME in seconds. I want to display this property using the Views module as a formatted Date/Time field. The Date/Time format option is not offered on the Views field settings dialogue.


texts: WYSIWYG Image Upload in Basic Page (CKEditor and CKFinder)

texts:
I was able to use CKEditor and CKFinder to add in-body image upload capability for article nodes.
However, the functionality was not transferred to basic page nodes.
What do I miss? Thanks!


texts: Ajax is not working for Drupal comments form

texts:
I have created two content types slideshow and slides. I am assigning slides to slideshow with the help of node references. One slideshow can contain n number of slides. When I am showing slideshow I am using ajax to show the slides on the slideshow page there are two buttons one is Previous and second one is Next so that user can navigate to the next or previous slides and user can comment on slides means while navigating to the slides user can comment on slides. I have altered the comment form with the help of hook_form_alter so that page get not refreshed at the time when user comments on the form( I am using ajax api for this ). Everything is working for the first slide means ajax is working fine for the first slide and page is not getting refreshed and for the other slides it is not working.
There is one more problem when I was on the second slide and clicks on the previous slide first slide will be displayed and on this page when submits the comment page is getting refreshed.

I searched on the google and other forums I am getting some information related to the Drupal.attachBehaviors() function but I dont know how to use this function.

function lcl_ajax_comment_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'comment_node_article_form') {
     $form['actions']['submit']['#ajax'] = array(
      'callback' => 'lcl_ajax_comment_callback',
      'wrapper' => $form['#id'],
     );
   }
 }
function lcl_ajax_comment_callback($form, $form_state) {
  // Return the actual form if it contains errors.
  if (form_get_errors()) {
    return $form;
  }
  lcl_comments_remove_status($_SESSION);
  $comment = $form_state['comment'];
  $node = $form['#node'];
  $comment_build = comment_view($comment, $node);
  $notify_text = variable_get('lcl_ajax_comments_notify', '') ? theme('lcl_ajax_comments_notify_text') : '';
  // Append comment to root comment wrapper.
  $comment_output = drupal_render($comment_build);
  $commands[] = ajax_command_append('#comment-wrapper', $notify_text . $comment_output);

  // echo "<pre>"; print_r($form_state['values']); echo "</pre>";exit;
  $node = $form['#node'];
  $new_form_state = array();
  $new_form_state['build_info']['args'][] = (object) array('nid' => $node->nid);
  // Don't pull from cache.
  $new_form_state['input'] = array();
  $new_form_build = drupal_build_form($form['#form_id'], $new_form_state);
  $new_form_output = drupal_render($new_form_build);

  $commands[] = ajax_command_replace('#' . $form['#id'], $new_form_output);
  // $commands[] = ajax_command_replace('#comments', $new_form_output);

  return array('#type' => 'ajax', '#commands' => $commands);
}


texts: Isn't it possible to have multiple buttons  along with a submit button?

texts:
I have a simple Drupal 7 form, with 3 dropdown select lists and a submission button. I want to add another button to the form which does some function (but not submitting the form). I want to bypass the validation part for the form and directly run the submission handler of that button.

The button I am using is the following one.

$form['my_fieldset']['click'] = array(
  '#type' => 'button',
  '#value' => 'click me',
  '#limit_validation_errors' => array(),
  '#executes_submit_callback' => FALSE,
  '#submit' => array('my_module_click_submit'),
);

FYI, all the select lists have #required=>TRUE, and #type=>'submit' for the button also doesn't work.

When I click it, it shows the error about the fields being required. How can I avoid that error, avoid validation handlers are run, and just run the code in my_module_click_submit()?

Also, I dont know why, but even if I fill the entire form and then click this button, the page just gets refreshed and my_module_click_submit() does NOT run. What's wrong?

I haven't put anything fancy inside my_module_click_submit(); I just wanted to see if it works. The submission handler I am trying is the following one.

function my_module_click_submit($form,&$form_state) {
  drupal_set_message('Click me button is clicked');
}


texts:
I am new to drupal and I am  using  services module for using REST   and  RESTWS module. I used RESTWS and could get the content of the node by  http://base_url/node/1.xml and now I need to add a node and users from my external PHP application in to  drupal. I googled and I found here that we need to use http://base_drupal_url/drupal7/test_endpoint/users . I tried to create a service from Drupal 7, but I dont know what should I give on endpoint title ,name and endpoint path and I assume I need to give the same endpoint path in the curl.

Any help as to how to check if rest server is installed and how to create endpoint path would be of great help.

I am using Drupal 7 with services  module services-7.x-3.0-rc3


texts: Problem with swfobject_api or jwplayer module

texts:
I have a problem with swfobject_api or jwplayer module.

When I use this code in node.tpl.php everything is fine.

$config='sample';
$flashVars=array( 'file' => 'path to flv' );
print theme('jwplayermodule_render_player', $config, $flashVars);

When I use this code in front-page.tpl.php the code is not working.

In node-tpl.php this JavaScript is added.

<script type="text/javascript" src="/projects/theme/sites/all/modules/drupal/jwplayermodule/jwplayermodule_jwembedder.js?c"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "jwplayer": { "files": { "jwplayer-1": { "flashplayer": "http://localhost/projects/theme/sites/default/files/jwplayermodule/player/player.swf", "width": "400", "height": "280", "controlbar": "bottom", "wmode": "opaque", "file": "/projects/theme/sites/default/files/1057680_0.flv", "config": "http://localhost/projects/theme/sites/default/files/jwplayermodule/configs/sample.xml", "events": [  ] } } } });
//--><!]]>
</script>

In front-page.tpl.php, it is not added.

I put <?php print $closure ?> in footer.php, and included it in front-page.tpl.php and node.tpl.php.


texts:
I have a two taxonomy vocabulary labeled as "Region and Category". Also made this as entity reference to a custom content type.

Now, I created a view of contents of "Business Page" and I want to create a contextual filter by taxonomy term, both Region and Category.

Temporarily, what I did is just focus on one taxonomy, by Region, to test if it works.

Please see images below for my configuration:

And this is the result:

My problem it is only working on term ID and not term Name.

I want to input the term Name and result would display on the page.

PS: I have a Pathauto enabled and added URL aliases to each terms.


texts: Protected Pages configuration not showing in admin/config/system

texts:
I am trying to use the Protected Pages module, using drupal version 7.24

I have installed and enable the module, applied the module's permissions (which are visible under /admin/people/permissions#module-protected_pages) but the configuration menu is not visible in admin/config/system as documented. In the permissions menu, I have allowed anyone to access to the configuration page, but to no avail.

Manually navigating to admin/config/system/protected_pages does not work (just defaults to admin/config/system/)

Is there thing that I can do to either get it to show up or manually edit the settings?


texts: How to import nodes and their translations from a csv using Feeds?

texts:
Is there a way to provide the original and translated values of the title and the body in a csv for example, and the Feeds module to produce the translated nodes automatically (and synced with the original nodes - [tnid])?

I have tried using "Feeds: Entity Translation" but with no success.I have set the fields to be translatable but i don't see the translation fields available in the node-importer.

Any advice on the best practice on this?

Should i better go with a Migrate implementation?
All ideas/implementations welcome!

Thanks.


texts: Extract Admin OG members from basic page with views

texts:
I have added a group reference field to basic pages. That is every book page belongs to an OG group. When displaying a basic page, I want to display the list of admin members of the OG group in a block.

So, I have a view in a block with the following :

In contextual filters

Content: Nid

In Relationships

OG membership: OG membership from Node
(OG membership from node) OG membership: Group Node from OG membership
(Group node from OG membership) OG membership: OG membership from Node group
(OG membership from node group) OG membership: User from OG membership

In fields

(user from OG membership) User: Name (User name)

This view display all the users of the group associated to the current basic page.
Now, how can I filter theses users to only keep the ones which have an "administer member" role ?

Any help would be greatly appreciated.


texts:
I have a site that heavily uses the book module to organize hierarchical documents. I would like to include a View in a Book Outline.

Here is a simplified example: The Parts Department of a company has documentation of all of its standard operating procedures. These procedures are organized using Drupal's book outline. The department also uses a content type called "Part" to individually enter descriptions of each part. A view was created to display a glossary of parts. This glossary should be in the book outline, but I cannot find a way to insert a view into a book outline.

Example: Parts Department Standard Operating Procedures

Page: Procedure 1
Page: Procedure 2
Page: Detail APage: Detail B
Page: Procedure 3
Page: Detail APage: Detail BPage: Detail C
View: glossary of parts -- NEED TO GET THIS INTO BOOK OUTLINE.

Thanks for your help.

Jordan


texts: Display content in dependency of special roles

texts:
We use Drupal 7.26 on Windows which Apache.
We use the book module for our software documentations, which can have special variants eg a user manual, a configuration manual, a user manual written for use with a special program. To realise this we use the module "Restricted Text" and "Content access" to give users the possiblity to see the content in dependency of their roles. The roles are for "user" manual, "configuration" manual or maybe in variant for "AutoCAD".

With restricted Text module you can make content visible/invisible with special input filter in dependency to the roles eg [restrict:roles=RT_CONFIG]Content which is only visible if you have the role RT_Config [/restrict].

Now I'm searching for a possibility to filter the content for the user, independent from the user roles. An example: A user should be able to view one manual in 2 variants, for this he has these roles:

RT_Config (to see the content which belongs to the configuration manual)
RT_ACD (to see the content which belongs to special variant AutoCAD)
RT_INV (to see the content which belongs to special variant Inventor)

My suggestion is, that the user make a choice to see the configuration manual in variant AutoCAD, but the content depending to Inventor should be invisible - for this the user maybe musst temporary loose the role RT_INV. Is this possible?

Thank you for any idea to this complex thing.
Matroschker


texts: Why do start and end dates in views appear the same but are not in content?

texts:
When adding fields to a view I have two entries for date.
One for the start date and one for the end date.
However in my view they are both the start date.
I check my content and it shows differing values for start and end dates.

Why does views not render the end date?


texts: How do I create a Rule "When role is removed, send email to the user"?

texts: I am trying to create a rule that sends an email to the user when a role has been removed from their account. I can't seem to find a rule reaction under User "When role is removed". How do I create a rule to do this?


texts: Set image format of field_view_field image field

texts:
I'm using a function to place an image from a user field into nodes that the user creates. The display is set to thumbnail in default, user account and tokens, but it shows up as original in the node. Is there a way I can set the format in the function I'm using somehow?

function MYTHEME_preprocess_node(&$vars) {
  $node = $vars['node'];
  $user = user_load($node->uid);

  $logo_var = field_view_field('user', $user, 'field_business_logo');
  $logo_print_var = drupal_render($logo_var[0]);
  $vars['logo_print_var'] = $logo_print_var;
}


texts:
I've got a question about filtering by post count.
Is there any chance to filter users by post count? I didn't see any user_stats, between the view filters.


texts:
I am building a car directory with 500+ car models x 10 years. Every car listing will have many computed fields calculating various aspects of car model like fuel cost, maintenance, insurance, model depreciation, price after 5 year etc.

Now in depreciation computed field it takes the set value from depreciation rate field (which is different for every car) while adding the car. This Depreciation is region specific and I might have to change or tweak few values as we progress based on people feedback, updated research etc. I need some solution, with which i can change the depreciation rate field and republish the nodes to take effect the new values. In current select list option i can't change any value once that value is in use.

I have tried Views batch update (as a tweak), and that's my last option if I can't get this functionality somehow.


texts:
My scenario looks as follow: I have a form element of checkboxes, e.g. 3. If the rightmost checkbox is marked, the other 2 are greyed out and so on. I don't know how to do this, because if I use the #disabled property all of them are greyed out.

I thought about to make several single checkboxes of type #checkbox and use an ajax call and look at the $form_state and rerender all of them as single ones (disable them then etc.). But there is a problem that I use a form in a drupal block, and I haven't got the &$form_state as a parameter of the function.

What is the best method to do this?


texts:
Here is what I'm trying to do is display a certain page in a view instead of all of the basic pages.
How would I go about doing that?


texts: Print comment form inside node's page instead of a link to comment page

texts: How can I print comment form inside node's page instead of a link to comment page (Drupal 6) ?


texts: Adding Class to views row if View style is Unformatted list / Content

texts:
I need to add a CSS class to a views row depending on a field. So far this is easy going if I use Fields as Content (add class via replacement patterns then).

But I find it far more difficult to do this when using Row style "Content" and a custom view mode (e. g. Teaser).

I found the following code to work for me if I use Row style "Content":

function mytheme_preprocess_views_view_unformatted(&$vars) {
foreach($vars['view']->result as $rkey => $rval)
{
    $node = node_load($rval->nid);
    if(isset($node->field_breite) && !(empty($node->field_breite)))
    {
        $vars['classes_array'][$rkey] .= $vars['classes_array'][$rkey] . " " . $node->field_breite[LANGUAGE_NONE][0]['value'];
    }
}

}

I like to ask if this is a suitable approach or am I maybe wasting resources by loading each node and can I grab the node data easier somewhere else?

PS: It is not a option for me here to use Fields in the View as content because I want to use different content types in the view with different fields.

Settings:


texts: Gmap click marker should zoom the map and display other markers

texts:
I have two content types: City and Place.
Both of them use a location field which has lat long fields enabled.

The Place content type has a node reference field to City content type.

I want to display a google map, which will display the City nodes markers. Clicking on any marker will zoom the map and will display the place nodes markers in that city.

And then clicking the place marker which will open its detail page.

Is it possible with gmap and views or any other module? Or a custom script will be used?


texts: How to add an action button to item of content type page?

texts:
I have a page which shows the details of an Event content type item. I added in my second sidebar a block which content a button. Here is a screenprint of what I have so far:

I want to use this button to update the status of the item (a field with machine name "field_event_status"). Before the validation I want to show a confirm popup.

Any help to get this to work?


texts:
I have created View permission field in the events content type. Its field type is Role, so I can select which roles can see the node.

This works fine, but when I add events content type in the view this will displays all the data. I want to filter the data by the View permission field for the currently logged-in user.

I want to show data to the roles which I selected in the node View permission field. I have tried with contextual filter with user:uid, but I don't get what I am expecting. Actually, I don't know how to do that.

How can I achieve this?

Note: I want to integrate with my content type field View permission. I will select a role in View permission field. That roles only can see the view result.


texts:
I am trying to use omega-wizard but I think I am using the wrong version of Drush. I want to use the drush the is in Acquia Dev Desktop but when i type which drush I get the one that was last installed with MAMP (running OSX).

When trying to run drush omega-wizard I get this message:

The drush command 'omega-wizard' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you   [error]
have installed new extensions.
                                                                                [error]
Drush was not able to start (bootstrap) the Drupal database.
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another
site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush
topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed
shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.34
 Site URI               :  `http://default`
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /Applications/Dev Desktop/php5_5/bin/php
 PHP configuration      :  "/Applications/Dev Desktop/php5_5/bin/php.ini"
 PHP OS                 :  Darwin
 Drush version          :  6.2.0
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/khrysztov/Sites/devdesktop/acquia-drupal-7.34.40.6204
 Site path              :  sites/default
 File directory path    :  sites/default/files

I cannot see any reference to the database there in the parameters and the default theme is not Garland.

Any ideas?


texts: How to extend a test class of dependent module

texts: I am creating a module with dependency on another contrib module. When I am trying to extend the test class in dependent module, it works fine locally(using test UI). However when I try to test my new module in qa.drupal.org it throws error saying that the  'Class not found' as the dependency module is not enabled.


texts: How do I construct a thin controller with a dependent service?

texts:
For the first time I am trying to architect a reasonably complex Drupal 8 module, and not sure of best practice for the controller.

I need to route paths to a controller.
I intend the controller to be
thin (very little logic, doesn't need to testable)
Heavy lifting will be via service class/es configured and defined by the module.

Extending ControllerBase should be the right path for a thin controller, however when I look in Core at the moment I notice a number of controllers that both extend ControllerBase and implement ContainerInjectionInterface. I would only implement ContainerInjectionInterface to be able to inject a different container for testing, not just selection of service in the create method, but Core is still in flux and I am not sure exactly why they are doing this.

I feel that I should extend ControllerBase, add a __construct that fetches the container and pulls in the non-standard service/s that I require via $this->container()->get() and indeed that does work. I also don't need the create method required to implement ContainerInjectionInterface.

Am I correct? I know I will need to go through a few iterations of getting the services right but want to get THIS bit right from the start and understand why I am doing it.

Thanks in advance.


texts:
I'm trying to build me a search function using the exposed fields in a view. But for some reason, the exposed fields don't show up...

My main search module is enabled, my D7-website is indexed and I have a module called Better Exposed Filters enabled. But still, no exposed fields are popping up. What do I do wrong not to get any exposed fields?


texts:
What would be the drupal 7 options to generate the footer links?

Writing the links by hand could lead to 404 errors if links change...


texts: Why there are random line breaks in emails sent through drupal?

texts:
I noticed drupal includes line breaks in emails it outputs.

For example in admin/config/people/accounts we can customize message users receive when they signup and/or when they forget their passwords etc..

The thing is, when the emails are sent to the users, they contain line breaks that seem to be completely random and arbitrary.

I first thought the problem came from the webmail provider, so i tried with different services (gmail, hotmail, yahoo etc.. )

Any suggestions on how to fix this ?

Thanks


texts: Escape forward slashes in hook_update_n() descriptions for display on update.php

texts:
I've created a module update function:

/**
 * Create alias for node/add/video-submission.
 */
function my_module_update_7103()
{
  // magic
}

But on update.php the message shows up without the forward slashes:

  7103 - Create alias for nodeaddvideo-submission.

What can I do to force the forward slashes to display?


texts: How to display items in Rules data selector in alphabetical order

texts:
Because of my sites having a lot of fields, it takes me a lot of time to select fields in the Rules data selector, because they are sorted by date created.
What should I do to make them sorted alphabetically?


texts: Delete selected comments of a particular node?

texts: Is there any module in Drupal 7 for deleting selected comments at one go for a particular node?


texts:
Let's say that I want to replace the block_content_type plugin of the core block_content module to ad some features while not having to rewrite a whole module to achieve this.

It is very easy to replace a service by providing your own service definition with the same key as the to-be-replaced service. How do I replace a plugin with another one?


texts: How do I add an Ajax submit to a Node form?

texts:
I have an node form which I am trying to submit via ajax using

$form['actions']['submit']['#ajax'] = [
      'callback' => ':submit'
    ];

The form is submitting properly and the node is getting saved/updated. But on submission I need to display the default message provided on the default submit handler. Also, the validation is missing as well.

How can I achieve the whole node save process along with the validations and messages via ajax?


texts: Displaying arbitrary HTML (or webgl) inside a Drupal frame (Drupal 7)

texts:
I would like to have a page inside my drupal site that would show a webGL Canvas but it seems that Drupal tries to shield its user from doing any direct HTML hacking on a page.

How would one embed a webGL Canvas (or any other arbitrary html for that matter) inside a Drupal page?


texts: How do I unset hook_field_storage_load()?

texts: I'm trying to unset hook_field_storage_load() and hook_field_storage_write() in hook_module_implements_alter() without success. Is there any other way to turn off those hooks?


texts:
I am trying to generate an RSS feed, but it does not validate. I googled around and found RSS Feed does not validate using Views RSS module, but unfortunately it's for Drupal 7, while I am using Drupal 8.4.4.

What a similar method for Drupal 8 would be? The XML I get has an empty line before <?xml version="1.0" encoding="utf-8"?>, which I believe it's the main problem.

<?xml version="1.0" encoding="utf-8"?>
  <rss version="2.0" xml:base="https://example.com/feeds.xml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
    <channel>
      <title>Title</title>
      <link>https://example.com/feeds.xml</link>
      <language>en</language>

      <item>
        <title>UAE Lenders Upbeat as Growth Prospects Surge</title>
        <link>https://halaltimes.com/uae-lenders-upbeat-growth-prospects-surge</link>
        <description>  &lt;img src=&quot;/sites/default/files/styles/large/public/Article/growth-prospects-surge-in-uae.jpg?itok=VEwWB-9R&quot; width=&quot;480&quot; height=&quot;320&quot; alt=&quot;&quot; typeof=&quot;Image&quot; class=&quot;image-style-large&quot; /&gt;


texts: I am working on a production site, moving settings from a development site for a mobile environment. However, I am receiving the above error. I can not figure out what is causing this error. It does not matter what theme I change my jquery mobile environment too. I've checked all the modules and they seem to be the same versions. The only thing I can see that is different is in the development site I can uncheck/check the block cache, on the production environment I can not do this.


texts: What will happen if a custom module has the same name as a contrib module?

texts:
What are the consequences of two modules sharing the same machine name?

For instance, if I write a custom module named 'views' and do not have the contrib module 'views' enabled, will the update manager attempt to update my custom module according to the contrib project status?


texts: Add a class to a image for a specific view

texts:
I need add a class to a image for one specific views.
I tried:

theme_preprocess_field() but it doesn't work
theme_preprocess_image() but it's for all the images
I tried what suggested in Override image template for field image_formatter own, but it is too complex to simply add a CSS class
This answer is the more accepted but I like other ways

Is it possible to override a field/image template file for a specific view?


texts:
Is possible to clear the cache using drush (or else?) when I don't have the codebase anymore.

Here is the use case: I deleted the codebases of a lot of sites with backing up. Now I'm going to backup and delete the databases but I forgot to clear the caches before deleting the codebases. Now its too much work to restore all the sites one by one and clear the caches and do everyting again.


texts: Using Migrate API, is it possible to UPDATE entities on subsequent imports?

texts:
I am using Migrate API with Migrate Plus, Tools and Source CSV to create Commerce Products from a CSV file. The CSV file will be updated daily where the product info (prices, stock level, etc) may change. As far as I can tell, Migrate doesn't recognize changes to the source of existing content once it's been imported.

Is there a way to re-import a file and pull changes to the file (source)


texts: Rule to loop over products with one specific SKU in Drupal Commerce cart

texts:
I'm still a novice at Rules.  I'm using Drupal Commerce and have the Flat Rate shipping service enabled.  I'm using Rules to calculate a surcharge to the flat rate based on the number of items in the shopping cart.  So far this rule works.

However, I now want to modify the rule so that it only calculates the surcharge based on the number of products with a specific SKU.  All other line items in the cart, which may be other products, should be ignored for the purposes of this calculation.

If I was just coding this, I would put an if statement in the loop and look at whether the current line item has a specific SKU.  But I totally don't understand how to do that with Rules.

Thanks for any help.

Here is my current rule:

{ "rules_createspace_flat_rate_calculator_expedited_" : {
    "LABEL" : "CreateSpace Flat Rate Calculator (Expedited - US)",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_order", "commerce_line_item",     "commerce_shipping" ],
    "ON" : { "commerce_shipping_calculate_rate" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "commerce-line-item:type" ], "value"  : "shipping" } },
      { "data_is" : {
          "data" : [ "commerce-line-item:commerce-shipping-service" ],
          "value" : "ship_manuals_to_you_expedited_"
        }
      },
      { "commerce_order_compare_address" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "address_field" :     "commerce_customer_shipping|commerce_customer_address",
          "address_component" : "country",
          "value" : "US"
        }
      }
    ],
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-line-item:order:commerce-line-items" ] },
          "ITEM" : { "order_line_items" : "Order line items" },
          "DO" : [
            { "data_calc" : {
                "USING" : {
                  "input_1" : [ "order-line-items:quantity" ],
                  "op" : "*",
                  "input_2" : "250"
                },
                "PROVIDE" : { "result" : { "shipping_volume_surcharge" : "Shipping Volume Surcharge" } }
              }
            },
            { "commerce_line_item_unit_price_add" : {
                "commerce_line_item" : [ "commerce_line_item" ],
                "amount" : [ "shipping-volume-surcharge" ],
                "component_name" :    "flat_rate_ship_manuals_to_you_expedited_",
                "round_mode" : "1"
              }
            }
          ]
        }
      },
      { "commerce_line_item_unit_price_add" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : "1000",
          "component_name" : "flat_rate_ship_manuals_to_you_expedited_",
          "round_mode" : "1"
        }
      }
    ]
  }
}


texts: Print Group Title of ER OG Reference field

texts:
I've got a flag with a form. One field is an Entity Refernce, OG Reference that allows the flagging user to select one of the "teams" the user is group member.

I want to rewrite the field.tpl.php to show not just the team name but also the group's title it belongs to.

All this in a view. So I have to use the content of the field to get the group it belongs to.


texts: Removing the comma between Attribute Option and Attribute Price in Ubercart for Drupal 7

texts:
Discovering Product Attributes in Ubercart was quite a find. However, my client does not like the way the dropdown looks. Previously, all the prices had + in front of them, but I was able to remove them taking a clue from questions by other Drupal users (sites/modules/ubercart/uc_attribute/uc_attribute.module line 1361). But, finding where to get rid of the comma eludes me.

If you have any further clues, I would be most appreciative!


texts: Different roles depending on a user's field

texts:
I have a problem that I have not a clear idea of how to solve it, the problem is the following: We have a user form registration where there's a mandatory field that is Country. I have also a content type that is called mobility that has a field, incoming country (among others). The thing is that now, I have to make that only users of for example USA, can modify the contents where USA is the incoming country.

I've seen that this could be "done" by just allowing a user from a certain country to view the USA contents but it's not the perfect approach since when I'm in a link like "../content/id/edit" i could try different id's and be able to modify a content that I would not be able theoretically. The only way I see to do it "well" would be to do some approach like having one role for each country but is not scalable.

Any solid approach to solve this problem?

PD: I can't solve it by IP (there's a module) because this user when (s)he registers, choose the country that is from (explaining why would be a bit long but it's a correct approach for what we are looking for)


texts: How do I serve up a themed 500 error response page?

texts:
Has anyone developed a custom themed page for 500 errors on a Drupal 8 site? There is no maintenance offline template equivalent, and core out of the box simply delivers an unstyled stack trace. We've been toying around with a solution in .htaccess, or by hooking into Symfony's exception events.

Anyone had success with either of these approaches?


texts: I have installed and enabled geofield and geofield map, when i am editing the fields for my content types I have no choice for geofield_map?


texts: Metatag is not showing on front page whereas the front page is set from custom content type

texts:
I have a custom content type "Community" and a page from this content type is selected as front page on the drupal 7 site (from system/siteinformation). i am using Metatag module. All other pages are showing the metatags but the front page does not.

I've also tried by overriding the metatags in admin/config/search/metatags/config/global:frontpage/edit, but still not showing up.


texts: Method addWhereExpression does not consider fields without values

texts:
Tell me how to create the correct query.
In its own handler filter for views, a $this->query->addWhereExpression query is created, where the fields in the nodes are selected. If all the fields are fill, then the filter works, that is, the request is handled correctly, but if some fields are not filled, then the filter ignores these nodes.
Example

    <?php
$definition = [
                        'table' => 'taxonomy_term__field_kurs',
                        'field' => 'entity_id',
                        'left_table' => 'node__field_currency',
                        'left_field' => 'field_currency_target_id',
                        'operator' => '='
                    ];
                    $join = \Drupal::service('plugin.manager.views.join')->createInstance('standard', $definition);
                    $this->query->addRelationship('taxonomy_term__field_kurs', $join, 'node__field_currency');

    $snippet_min = '(node__field_price.field_price_value * taxonomy_term__field_kurs.field_kurs_value * (100 - node__field_discount.field_discount_value)/100 >= '.$min;
    $this->query->addWhereExpression($this->options['group'], $snippet_min);
    ?>

That is, if the node node__field_discount.field_discount_value field is empty, it does not exist in the database, and the filter does not display the node. How to make a condition to work.


texts: How to create custom template suggestion, when there is no hook suggestion?

texts:
I would like to create different templates for different nodes, but I cannot see any hook suggestion with theme debug. This is the template from quiz module.
So in theme debug it looks like that:

<!-- THEME DEBUG -->
<!-- CALL: theme('multichoice_alternative') -->
<!-- BEGIN OUTPUT from 'sites/all/modules/contrib/quiz/question_types/multichoice/theme/multichoice-alternative.tpl.php' -->

I was searching for the right answer, reading about template suggestions, trying different things, but without any luck so far.
I know, that I can create custom template for the whole block, but is it possible to create that custom template for the element which doesn't have any hook suggestions?
Thanks!


texts: How to theme all pages after a certain url

texts:
I'm using Drupal 8.7.8

I would like to create a new twig theme file for all pages that are after a certain URL.
For example: example.com/example/this-page

"This-page" is what I want to create my twig file for. But there doesn't seem to be an option in the theme debugging for anything after example.com/example.

Another example...The twig file would be named page--example.html.twig ... Is there no way to say page--example/*.html.twig ?