texts: Composer using old JSON for contrib module?

texts:
I maintain skilling, a contrib module. This...

composer require drupal/skilling

... reports...

[RuntimeException]
  Could not load package drupal/skilling in https://packages.drupal.org/8: [UnexpectedValueException] Could not parse version constraint ~1.0@alpha2: Invalid version string "~1.0@alpha2"

[UnexpectedValueException]
  Could not parse version constraint ~1.0@alpha2: Invalid version string "~1.0@alpha2"

An older version of composer.json did use the string "~1.0@alpha2", but it was removed a while ago. Download the module's zip from D.O, and there is no such string in the file set once the zip file is expanded.

BTW, use the zip file, or Git the source files into contrib/modules, and Drupal installs everything just fine. It's just the composer install that's the problem.

I tried composer clearcache, but no dice. Using -vvv on 'composer require' didn't give me any info that I could interpret. Looking at composer's cache shows Strange Things. The file $skilling.json refers to the right release, but has '"drupal/token_custom":"~1.0@alpha2"' from long ago.

Help appreciated! The module can't be installed with Composer at the moment.

----- Update ARGH!! ----

@Clive is probably right, but I don't know how to fix it. Tried removing the line with the bad Composer version string in Git history with:

git filter-branch -f --tree-filter 'sed -i "/drupal\/token\_custom/d" composer.json' -- --all

Also tried BFG repo rewrite tool to replace the bad string.

Pushed. Created new releases. Cleared composer cache. composer require generates the same errors.

Afraid I don't understand Clive's suggestion to rebase a fix onto the branch containing the invalid version string. How is that done?


texts: Field collection fields are empty in edit mode

texts:
Problem

My content type has several fields and one of them is a field collection.
Currently I have following issue:
After adding and saving content everything is displayed fine.
When editing, the contents of the field collection are all empty, but are saved in the database.
After adding the same contents in the empty field collection and saving, when editing again the values are displayed.

So I do really not understand why this append, maybe someone can help me understand it and fix the bug.

P.S.: Please forgive my English (still learning).


texts:
How would it be possible to unset the "Cache-Control: must-revalidate, no-cache, private" that drupal adds for logged in users, for a specific role?
I want a specific role, to follow the non-authenticated users cache flow.

More specifically:
We're allowing users to login to our site with a specific "guest" role. This allows them to visit 1 personalized page.
Our goal is that non-authenticated user and the GUEST are being served cached nginx pages.
However, all content is cached with NGINX and is served based on a combination of the SESS cookie(drupal sets that for logged in users) and the HEADERS for each response. All logged in users have the SESS cookie set, however the guest has an additional cookie that tells NGINX to ignore SESS.
The second part of the response is related to the headers drupal sends. Drupal identifies that the user is logged in and sets everything to ""Cache-Control: must-revalidate, no-cache, private" instead of "Cache-Control: public, max-age 86400", that leads to our guests getting cache MISS instead of HIT


texts: Adding a taxonomy specific css file to certain pages

texts:
Im building a web page with multiple sub-portals, which should all have slightly different css styles.
Is it possible to add a certain css file depending on the taxonomy of a node? With drupal_add_css maybe?
Im using Drupal 6.

Thanks,
Max


texts:
Problem: The views page title fails to render as I expect in the Monoset theme.

I'm using Drupal 8.1.9, and the Monoset sandbox theme. Monoset uses classy as the base theme. I've created a view with a title. The Page Title block is enabled and set to display.

If I place:

{{ page['#title'] }}

into my page.html.twig I see the title, though this adds the page title to every page, without regards to the Page Title block settings.

The Seven core theme renders the title as I expect. Bartik and Stark do not.

Looking at the classy templates/views/views-view.html.twig file is this comment:

title: Title of the view, only used when displaying in the admin preview.

I'm guessing that seven is performing correct preprocessing that bartik, stark and monoset are not performing?

My work-around until I disambiguate this issue is to do a twig page override for this views page.

I'm unclear if

Discourage $main_content['#title'] in favor of route titles
title callbacks and
Use _title and _title_callback where
possible

are related issues.


texts: Filter taxonomy term view by referenced taxonomy term

texts:
Using two taxonomies.

Fruit:

Banana
Orange
Blueberry
Strawberry
Lemon

Fruit taxonomy has a term reference to the color taxonomy

Color:

Red
Orange
Yellow
Blue
Purple
Green

Created a view using the built in taxonomy term view in a content pane::

Fields
Taxonomy term: Fruit Color [this is excluded from display]

Taxonomy term: Name

Filter criteria
Taxonomy vocabulary: Machine name (= Fruit)

Relationships
Taxonomy term: Content using Fruit

[Configure Relationship: Taxonomy term: Content using Fruit
Relate each Content with a Fruit set to the term.
Require this relationship]

View Output::

Red
 Strawberry

Orange
 Orange

Yellow
 Banana
 Lemon

Blue
 Blueberry

I would like to add a contextual filter to this view that takes the Color taxonomy name from the url and only shows the fruit for that color.

color/red would only show:

Red
 Strawberry

color/yellow would only show:

Yellow
 Banana
 Lemon

I'm stuck on how to add the contextual filter. I've tried taxonomy term name with validation set to change the term name to id. I also tried the fruit_color field with validation set to change the term name to id.

Should the term name/fruit_color field be configured differently? Do I need to add another relationship?

  Additional info:
  The view displays taxonomy terms.
  The result set is empty when I try adding a contextual filter.
  The relationship field should only show Fruit terms that have been used at least once to tag content.


texts: Is it possible to run drush 8 smoothly on Win10 WSL (Windows Subystem for Linux)?

texts:
As most here know, Microsoft and Canonical worked together to develop a Windows-included Linux-based, Ubuntu-oriented compatibility layer (WSL) and already gives the option to install it for all Windows users. One can now use BASH on his Win10 machine, via CMD or Powershell.

My question is, can it be used to run drush 8 (drush master) smoothly ? I ask since as most of you know, drush 8 / master doesn't run smooth on a Win-only environment.

Till now I ran drush 8 / master on an Ubuntu virtual machine but I wonder if it's possible to run it on Win10 using the new WSL release.

With my very basic OS knowledge, I can't strictly determine if having Bash and Ubuntu binaries in Windows is actually enough to run drush 8 / master smoothly on Win10, or, if something extra is needed and has not yet been released.
I don't know how to integrate the WSL with WAMP/Xampp as well as with the c:/drush folder (or even is these things are even possible), or maybe making some environment variable to anywhere would be enough.

By the way, there is now a new Facebook group for supporting new WSL users in general:

https://www.facebook.com/groups/987976957946948/


texts: EntityFieldQuery to search Content Type for text and select matching Nodes

texts:
I have created Search page which searches Products (Content type) by selecting few option drop down menus (those are selecting taxonomy terms), but also i have an text input field, which is supposed to narrow or define search by keywords.

Now problem is that i need to search several fields at same time.

This script works perfectly (snippet):

$keywords=$_POST ['keywords'];
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->propertyCondition('type', 'product')
->fieldCondition('field_main_category', 'tid', $category, 'IN')
->fieldCondition('field_sku', 'value','%'. $keywords .'%', 'LIKE');
$result = $query->execute();

I got all the product that are matching user entry, even if partial (those %).
But i need to query some other fields too (description and name), to search for terms that user may enter.

But, problem is that i must have one input field, and user may target 3 different fields, so three fieldConditions for same term will cause nothing to be found, because selection is excluding all  if term is not found in one field.

Could I,some way, write EntityFieldQuery query in a way to tell it to "forget" condition if keyword is not found ? (like in bellow example)

$keywords=$_POST ['keywords'];
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->propertyCondition('type', 'product')
->fieldCondition('field_main_category', 'tid', $category, 'IN')
->fieldCondition('field_sku', 'value','%'. $keywords .'%', 'LIKE');
->fieldCondition('field_name', 'value','%'. $keywords .'%', 'LIKE');
->fieldCondition('field_description', 'value','%'. $keywords .'%', 'LIKE');
$result = $query->execute();

Other workaround could be to look all three fields in one place, if i could get combined fields in one condition query (this could be done by hand, by adding another field only for search terms that will be filled with tags that will be searchable summary of all 3 fields, but i am hoping to find the way not to create more field and content, if possible).

Any suggestions or experiences with that ?
Thanks!


texts: Panels not showing default image set in Field settings of content type

texts:
The image you upload to be as a default image for all pages where you didn't upload custom images for each page, so it would show same one image from the content type settings.

It works in Preview when editing the node and it shows in non-panel pages.

In Panels it doesn't render entire field. But if you upload the custom image then it does show it. But not the default one.

I don't get it why


texts:
I have defined the following service.

'salesforce_subscriptions' => array(
    'operations' => array(
      'delete' => array(
        'help' => 'Remove subscriptions from SalesForce',
        ...
        'args' => array(
          array(
            'name' => 'ids',
            'type' => 'string',
            'description' => '',
            'source' => array('param' => 'ids'),
            'optional' => FALSE,
          ),
          array(
            'name' => 'API key',
            'optional' => FALSE,
            'type' => 'string',
            'description' => 'The api key',
            'source' => array('param' => 'api_key'),
          ),
        )
      )
    ),

How can I access this?
The endpoint of the service is: endpoint.
I can access the index service by:
www.example.com/endpoint/salesforce_subscriptions

How can I access delete?


texts: Show a Particular Page in Drupal 7 Table Pager

texts:
I have a table and a table pager in my form.

// $table_rows is an array containing data.
$page = 2;
//$page indicates that I want to display the second page in the table pager
//$page is dynamic. It depends on the user.
$per_page = 5; //No. of items per page
$chunks = array_chunk($table_rows, $per_page, TRUE); // Split an array into chunks of $per_page

$html =  theme('table', array('header' => $header, 'rows' => $chunks[$page], 'sticky' => TRUE)) . theme("pager", array('quantity',count($table_rows)));

The result of my code is below:

It works fine as expected , but my pager number is not. It must  show 2 as the current page. Where am I missing?


texts: How to control a taxonomy view's output?

texts:
On the page referenced below, the two blocks to the left are separate views that represent two different taxonomy terms: "fence type" and "application."

J.C. Greene Rail Fencing photos page

I want to be able to add a new page of photos each job and be able to label type with something like "2 Rail" and application with "Horse fence" for example. But the views need to be dynamic, so that if a new type/application is used, it is added to the list to the left and the styles applied as desired.

For example, if a new fence is installed, and its application is to keep cattle in a field, then I might put "Cattle fence" in the application field, so a new item would be added to the Application block, and upon clicking "Cattle fence," the visitor would see a grid showing one job with one picture (later to see more jobs as more cattle fences are done). Upon clicking the one picture, it would go to that job's page with the slideshow, as shown by the link below (which is what I want to see when clicking on the 2 Rail link in fence type).

2 Rail test view

To get an idea of the view configuration for each block, check out this image:

(Right click & click 'view image' to see the full size.)


texts: How do I create a view with mixed languages, showing the node's original language by default?

texts:
I have a site with mixed languages, Spanish and English. Some content was originally created in English, then translated into Spanish. Other content was originally created in Spanish, then translated into English. The remaining content is either in Spanish or English and is not translated.
How do I create a view that shows all of this content in the original content (non-translated) language, showing a view with a mix of English and Spanish? Then if the user chooses English or Spanish, it will show only those languages.


texts: Search not working for partial word and multiple word

texts:
I am using search api and search api page modules to for search functionalities. Search works fine when I search for matching word. For example if I search keyword 'content', it works but when I search 'conte', it doesn't work. Moreover, if I search for 'content asdf', it doesn't work. However, it works when I perform same search using postman app. So, I guess it must be search api or search api page module. Any advices?

Thanks,

Pradip


texts: How to trigger Rules from Ajax-picture-uploader?

texts:
I'm using Rules with event  "After updating an existing user account". It should trigger whenever a user uploads a new profile picture.

Now I've added an ajax uploader for user pictures, the Avatar Uploader module.

The problem is that the ajax uploader doesn't trigger the rule.

How can I fix this?

Is there some code I could add to change this and make it trigger the rule?


texts: Revision tab is not listing any revision

texts:
I have the Node revision module (diff) installed, and I have many revisions for a node, but the Revision tab is not showing any of them, even though the database table contains the data for those revisions.

What may the reason be?


texts: Is there a way to change the date format in main forum table? I changed the date format in views for topic list, but the date format wasn't changed on main forum page


texts: Module ldap_sso lost when updating module to the new version

texts:
I am in a process of updating the drupal core and some of the modules (quite deactualized). One of them is ldap module, on this server I have no way to update through the drupal administration page, currently the installed version is ldap 7.x-1.0-beta12, the system will follow me to install the ldap version 7.x-1.0-beta15.

As I mentioned, the only way I have to update is manually, I have deleted the files from the server and I have placed the new ones with the version ldap 7.x-1.0-beta15, when I run the update (update.php) it appears that there is a missing module called ldap_sso, and effectively when I review the contents of the ldap module there is no internal module called ldap_sso, but in the ldap version 7.x-1.0-beta12 if it is.

How can I update the module in this case?

Thanks


texts: Drupal multisites share modules and libraries?

texts: I want to duplicate a drupal site to make subsites where each site will utilise the same basic modules and core but just have slight variations in theme and need own database on a dedicated server. To save memory I want to avoid having subsites all containing same modules, I have only briefly read the documentation for drupal multisites where they share the one core but is it possible to share sites/all/modules and libraries as well?


texts: How To Force Commerce Cart View To Update (Ajax?)

texts:
I admit to being a Commerce -novice-. It's getting better, but it's still quite confusing in some spots. I've posted several questions here over the past year trying to skin the same cat in different ways. We have a Drupal 7 cart. The pricing is pulled in from an external web site via http_request which updates the unit price of all items in the cart on hook_form_alter().

The problem is that the -initial- price that displays in the cart is always 0. The user always has hit  to refresh the page for that pricing to update the View. Commerce seems to want to pull the unit price in from the Product nodes so after a user hits  the cart displays but with a 0 unit price. When they hit  -then- our code fires and updates the price.

So... I need is either:
a) a way to force that view to 'refresh' when the page is rendered (ie. it initially loads with the zero prices, runs the http_request code and -then- renders again). Yeah, it's ugly but I'm just sick of this.

b) Figure out a way using the Rules (which I haven't been able to do) to get the line item price to pull in from the http_request with PHP. This -never- seems to work. It -always- wants to use a rule based on an existing field. If someone could give me a tutorial on how to use PHP with Commerce for the Unit Price I'd buy them a CASE of virtual beer!

c) Figure out a way to assign that http_request price as the line item price when the user hits the 'Add' button. Again, probably a noob thing, but I cannot figure out how to override the Unit Price for the Line Item to the value I want. It -always- wants to use the Unit Price from the Product node.

ANY help would be most appreciated!


texts: Do I copy the css files I want to override to a theme I am using?


texts: How to get the name of the month in local language in Drupal?

texts:
I want to display in a tpl.php file:

  30 maart 2015, 11: 34

Currently i'm using below code

    <?php print  date("j-F-Y H:i") ?>

1) How to get the name of the month in dutch instead of english?

2) How to add the comma easily ?


texts: I am a Drupal beginner. I'm using Drupal 7. I created a blog using views. I'm trying to theme the blog node using node--blog.tpl.php but it doesn't work. When I change it to simply node.tpl.php it works. I don't know what is the problem. How can I make it work?


texts: Field Group Conditional State does not work after upgrade

texts:
After recent upgrade of fieldgroup module, the conditional state visibility for field group does not work now.

Please find the previous code that used to work:

function ji_custom_field_group_build_pre_render_alter(&$element) {

  //BioChemistry
  if(isset($element['group_tr_biochemistry'])){
    $element['group_tr_biochemistry']['#states'] = array(
      'visible' => array(
        ':input[name="field_tr_test_ref[und]"]' => array('value' => 12),
      ),
    );
  }

  //CBC
  if(isset($element['group_tr_cbc'])){
    $element['group_tr_cbc']['#states'] = array(
      'visible' => array(
        ':input[name="field_tr_test_ref[und]"]' => array('value' => 15),
      ),
    );
  }
}

However this does not work after the upgrade.  I get an PHP notice instead:

  Notice: Undefined index: #id in drupal_process_states() (line 4651 of /srv/www/www.example.com/public_html/includes/common.inc).

Do let me know the workaround possible. Thanks.


texts:
I am trying to dump a remote Drupal site to a local SQL dump file. In Drush 8 this worked a treat:

drush @site.alias sql-dump > ~/Dumps/dumpy.2019-02-19.sql

Now, if I run this command in Drush 9 (9.4.0) I see the raw SQL just printed on the screen.

If I add 2>&1 to the command, this does not help.

If I add a --result-file= this creates a file on the remote server (not what I want).

Does anyone have any ideas here?


texts:
How do I display/edit the machine name for a View?

Reason for asking is that I tried cloning a view but the name I gave was rejected because it had already been used but I couldn't see where.


texts: How to delay sending emails using Rules to avoid being considered as a spammer?

texts:
I created a rule for users, who subscribed on another user to get messages of this user new content:

Events
  EVENT
    After saving new content
Conditions
  ELEMENTS
    None
Actions
  ELEMENTS
    Fetch users who have flagged a user
      Parameter: Flag: subscribe_this_user, user: [node:author]
      Provides variables: subscribers (user)

    Loop
      Parameter: List: [user]
      List item: Current list item (liker)

     Send mail
       Parameter: To: [liker:mail], Subject: New event on [site:name]!, Message: New content [node:title] by..., From: [site:name

How can I send these emails with delay? I heard that sending a lot of emails is spamming. I heard about Rules Scheduler, but don't know how to integrate that in my rule.


texts:
How can i add a block from mymodule. The content for the block is a form which contain a dropdown listing the themes. I tried with the following code. but it is not working.

function mymodule_block($op = 'list', $delta = 0){
$block = array();
    switch ($op) {
     case 'list':
       $blocks['mymodule_preview'] = array(
      'info' => t('mymodule Preview'),
      'region' => t('header'),
      'weight' => 0,
      'status' => 1
  );
  return $blocks;
case 'view':
  switch ($delta) {
    case 'mymodule_preview':
      $block = array(
          'content' => mymodule_theme_form(),
      );
      break;
  }

  return $block;
}
}

function mymodule_theme_form() {
global $custom_theme;
$themes = system_theme_data();
uasort($themes, 'tmymodule_sort_modules_by_info_name');
$themeOptions[] = 'Select';
$rolesOptions[] = 'Select';
foreach ($themes as $theme) {
    $themeOptions[$theme->name] = $theme->name;
}

// themes dropdown
$form1["themes"] = array(
    '#type' => 'select',
    '#title' => t('Preview the page with themes available'),
    '#options' => $themeOptions,
    '#default_value' => $custom_theme,
    '#attributes' => array('onchange' => "form.submit('themes')"),
);
//Submit button:
$form1['submit_'] = array(
    '#type' => 'submit',
    '#value' => t('Submit '),
        '#attributes' => array('style' => 'display: none;'),
);

return $form1;

}

This creates the block but content just prints "Array" only.
i am using drupal 6 .
 What is wrong in this code?  Pls help me


texts: How to read the session cookie with javascript?

texts:
I'm trying to detect with javascript if a user is logged in.
For some reason the drupal session cookie is not showing up when I use

alert(document.cookie);

It does show "Drupal.tableDrag.showWeight=0" and  "has_js=1" cookie.

When I use a cookie tool I see that the SESS... cookie is set.

Update:

I'm trying to fix a browser caching issue: Varnish sets a "cache-control max-age" header of 30 minutes which causes the browser to cache the page. When a user logs in and then clicks on a link that's already been cached in the browser it will appear to the user that they have been logged out again.

If I could read the Drupal session cookie from Javascript to see if a user is logged in I could then reload that page.


texts: How do I make pagination work with hook_views_pre_render()?

texts:
I have the following in order to reduce duplicates from my view – note that I've tried everything before using views_pre_render (aggregation, distinct, countless modules).
function rinksco_views_pre_render(\Drupal\views\ViewExecutable $view) {
  if ($view->id() == 'rinks') {
    $unique_nids = array();
    foreach ($view->result as $key => $result) {
      if (!in_array($result->nid, $unique_nids)) {
        $unique_nids[] = $result->nid;
      }
      else {
        unset($view->result[$key]);
      }
    }
  }
}

While it works, the second page doesn't take into account the removed duplicates from the first page, and outputs older, irrelevant results.
How can I make pagination work with this?


texts: How can I make teasers refresh when they are flagged?

texts:
I have several flags like "Sold" "Withdraw" etc which appear in Contextual links.  Flagged nodes are checked through node--type.tpl.php and this allows me to add text strings like "Sold" or "Withdrawn", which I theme with CSS to show as large labels.

The problem is that when the end-user flags an item with a Flag toggle, it's not very clear what this flag does. I need that teaser to auto-refresh, so that my labels ("Sold" or "Withdrawn") become visible immediately without the end-user having to reload that page.

I have found this js code , but what it does is slide the node teaser up, which is okey for the "Withdrawn" flag in some views), but is not the correct behaviour for the "Sold" flag.  For the "Sold" I need that teaser to refresh itself.

$(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {
      $('#'+data.contentId).hide('');
       // $.growl('Flag', 'The article '+data.contentId + ' has been flagged and hidden.');
    });

Drupal.behaviors.moduleName = function()
{
  $(".flag-action").each(function()
  {
    $(this).click(function()
    {
      $(this).parents(".node").slideUp();
    });
  });
};


texts: How to check for view mode in twig template?

texts:
We have one field (field_tabs) that is used on Basic and Article content type. On the Basic page content type, it has a custom view mode (view_mode_vertical) and on the Article content type it has a different custom view mode (view_mode_horizontal).

Basic Page (default view mode) Manage Display

field_tabs (view mode = view_mode_vertical)
title
body

Article (default view Mode) Manage Display

field_tabs (view mode = view_mode_horizontal)
title
body

In a field.html.twig, how can we detect the view mode?

Our two options we explored was either a node template or field template (we went with field). We would like to do this in a way that we only need add the logic for detecting the view_mode in one place. In case we add a third or fourth view_mode, we can simply add another elseif (or switch case) to the code.

Sample Twig code we were looking for:

{% if view_mode == 'view_mode_vertical' %}

...

{% else %}

...

{% endif %}


texts:
I would like to modify the search box to point to a custom search function.
So far, I have modified template.php to detect when the search box is being
called from a specific module and I reset some variables.

function my_theme_preprocess_search_block_form(&$vars, $hook) {
    $uri = request_uri();
    if (preg_match("/\/my_module/", $uri)) {
        unset($vars["form"]["search_block_form"]["#title"]);
        $vars["form"]["search_block_form"]["#title"] = t("SOME SEARCH MESSAGE");
        $vars["form"]["search_block_form"]["#value"] = t("SOME SEARCH TERM");
    }
}

That works fine. But now what I want to do is have that form submit to some module of my own creation. Oddly, this isn't as obvious. Do I need to modify something in modules/search/ ? If so, what?


texts: How to not include page titles in the webform included email values?

texts:
My webform has pages and sections in a webform. The title of the page is not printed out on screen, but it is printed out in the email. The page name was setup as being the same as the section resulting in the email sent having duplicate headings as follows

The form has pages and sections with the form build looking like

I'm using a twig template to print out the results. I could print out each field/title individually however I'd rather just use the 'included email values' functionality. This would make my webform more maintainable. The headings are not in the list of included email values.

Is there a way to manage the headings using this interface? An alternative would be to use inline css on the email. e.g. .x_webform-section-wrapper > h2 {display:none}. I'm not sure all the downstream applications will cope with this.


texts: How do I filter a view by the node taxonomy you're currently on?

texts: I've built a content type and added taxonomy to it. The user can choose one of the 10 terms from that vocabulary when they are building the content. On the node I want to build a sidebar that lists all the other nodes from this content type but filtered to be only the same taxonomy choice. I assume this is done through views but I can't figure out how to build that contextual filter that looks at the current nodes taxonomy.


texts:
I am trying to create module in Drupal 6.22:

function example_video_perm(){
    return array("video access");
}

function example_video_menu() {
    $items = array();
    $items['video/%nid'] = array(
        'title' => '',
        'page callback' => 'video_load',
        'access arguments' => array('video access'),
        'type' => MENU_CALLBACK,
    );
    return $items;
}

function video_load($nid) {
    print_r($nid);
}

But whenever i am typing in http://example.com/video/nid, its getting redirected to 404. Please help.


texts: Mark a location on a map (Google Maps/OpenLayers) on a node creation or edit page - but with which module?

texts:
I have a custom content type, and I would like my users to mark a location on a Google Maps/OpenLayers map, save these coordinates, and on the frontend, show the location's map and the GPS coordinates.

So the user has the opportunity to just simply click on the map somewhere, and mark a location. BUT if the user wants to, he/she can also type an address, and geocode it.
(In this post, the OP just wants the latter opportunity.)

I would also like to have a page where the different locations are listed, which are related to the given nodes. Plus maybe some search opportunities.

Geolocation Field seems correct, but I'm a bit confused whether the other modules are better for this task, or what's the difference between them.

The possible modules:

Address Field,
GMap (unfortunately stating "GMap is considered a legacy module.")
Geocoder,
Geofield,
Geolocation Field
Get Locations,
Location,
OpenLayers,
OpenLayers Locator (that's a buggy feature as an own experience),
etc...

(For example, Get Locations looks promising because of the many opportunities. But OpenLayers too... Geolocation Field seems like a little simpler, but also with less opportunities (concentrating on just marking a place on the map). By the way, I don't really understand Get Locations field's module page, firstly it states that it has "Support for Geolocation (Drupal 7)", but later there's the following sentence: "Please note - Do not install the Location module or the Geofield, Addressfield or Geolocation modules at the same time as Getlocations_fields, this will not work.")


texts:
I'm using Contextual filter on a view block which reads values from URL.
This works on pages that created by Panels; however, it doesn't work on nodes(content type).
I'm using url alias for nodes. It seems like even though the url displayed in defined alias, it doesn't pass the alias value when contextual filter read the node's url.
The field that I'm using for the url alias is text list field.

Is there any way to make a view block with contextual filter on both pages and nodes?

Drupal 7.12 | views 7.x-3.3 | panels 7.x-3.2


texts: Rewrite CCK field output without using templates

texts:
The Views module has the nice option to rewrite the output of a field. This allows to adapt the output of CCK fields using Tokens without having to create a template for that view.

Is there a module that would allow a similar functionality for the "Display Fields" tab of a content type? I need to slightly modify the field output for teaser and body, but don't want to create a full template.

I'm currently using Contemplate for that, but that is more complicated than I need and unnecessary difficult if you're not familiar with the Drupal PHP API. It is also annoying that I need to modify the template every time I add an additional field to the content type, I really only need to rewrite a few fields, not the whole body or teaser.

So, what I would like to have is a simple way to rewrite each CCK field output using any token available for that content type. Does something like that exist?


texts: How to do OR operation on one filter's options of Views 3

texts:
I have two content-types Courses and Groups. Courses is added as entity reference field in Group content-type.
One category field is added in courses content-type.

View is created for list of all courses. Category is added as filter. This category has terms. AND operation is applied as default. Like if user has selected term1 and term2 as filters then courses who has both terms selected are only listed. But I want courses who has either term1 or term2 should be listed.
I am using better exposed filter module and checkboxes for category filter options.

Group filter is created for category where I have added terms as :

term1, is equal to, term_id
term2, is equal to, term_Id

Other options are less than or equal to, greater or equal to, greater than, less than, in between, is empty etc. But no any setting using which I can apply OR operation on single field options.

How can I resolve this issue ? Any help would be appreciated.

Thanks in advance.


texts: Are there any hooks that get called before modules are loaded?

texts:
There are a few user tracking checks I would like to perform before the site main page gets loaded. I don't really want to have to wait for drupal to load all the modules and start running the theme code before I do this.

Are there any hooks that can be overwritten to perform my checks?


texts: rules_invoke_event() not working with 'user_login'

texts:
Very broadly, I want to know how to use the rules_invoke_event() for the event listed in the admin UI as "User has logged in". The parameters I passed to the above function were 'user_login' and $GLOBALS['user'].

I have a few rules which govern the redirection when a user logs in. I want this redirection to work in some other place where the user_login hook is not fired.

I have tried to use the

rules_invoke_event('user_login', $account)

But I am getting a white screen when this part is run. If I replace it with a drupal_goto, it works.

  Note 1: In the admin UI, the event is "User has logged in", the
  user_login was found in rules_user_login(), which uses the same call
  as above.

  Note 2: the $account used here is global $user, or $GLOBALS['user'].

What am I doing wrong here? I suspect something is wrong with the parameters passed to the function 'rules_invoke_event'. On omitting the $account argument, there is an error that says that a token is missing.

Also, there is a function rules_event_invocation_enabled which is supposed to toggle whether the rule events can be called. I have tried to fire the function with both rules_event_invocation_enabled(TRUE) and rules_event_invocation_enabled(FALSE) before the rules_invoke_event('user_login', $account)


texts: customize destination for user_login with modal_forms link?

texts:
I am using the Login Destination module to form rules for login customization. But they seem to be failing when modal_form is opened for the user login.
Can any one suggest something ?


texts: How can I get Autocomplete behave as in most of the sites out there?

texts:
I have a form built with FORM Api. It has a text field, with Autocomplete.
I also have another form, with several fields, some of them with Autocomplete.

It works well, but I have to press Enter Key twice to send the form.

The first Enter key is to select an item.
The second Enter key sends the selected item for process.

The behaviour that I have seen outside, in the wild, and which is customary in thousands of millions of sites is this:

If only one field form (search form, for example), once you click or press enter with the suggested term highlighted, the form will be sent (let's call this behaviour One-Clik). Note: there are no multiple selections option, if not, this behaviour would have to be different.
In several fields form, you just select and press ENTER, and can continue filling other fields. If you want to submit the form, you press the Go button or just click Enter in the autocomplete field if that is the last one you used. This is called Two-Clicks, except that: you can write some words in the autosuggest field, and not choose anything. The desired behaviour would be that just clicking ONCE the Enter key, you would submit the form. So this behaviour is really One-Click, with the only exception that selecting an item by pressing Enter key does not qualify as a click.

In order to have it working, I had to rewrite the autocomplete.js. Is there another solution?

I cannot understand how Drupal cannot manage by default such an easy behaviour, seem in millions of sites. And I can assure that for normal users this is very frustrating and irritating and very counterintuitive.


texts: How to echo block title render in specific  D7

texts:
After creating a dynamic block I need to print block title in specific div or customize it to add css class .
Please check image for more details


texts: Set cookies from first response to next request

texts:
I am newbie to drupal and node.js. I am connecting drupal with node.js server. What I am trying to do is that to get the cookie from the the node.js server response and I need to set these cookies over to the next request to the node.js server

function sample_submit($form, &$form_state) {
  $request_url = "http://localhost/api/authenticate";  //Link to Node.Js server
  $sig =  hash_hmac('sha512', 'secret', 'secret');//hashed the api key using sha512 algoritham
  $options = array(
                'method' => 'POST',
                'data' =>  'apikey='.$sig,//api key for authenticaton between nodejs and drupal application
                'timeout' => 15,
                'headers' => array('Content-Type'=> 'application/x-www-form-urlencoded')
        );
    $result = drupal_http_request($request_url, $options);
}

I am authenticating the request with an api key with node.js server. node.js server create a session cookie with the help of passportjs module. I want get the cookie from the the node.js server and pass the cookie with the next request. That is I want get the cookie from the above function and then to send the cookie along with the request in below function so that only node.js server can authenticate with drupal app.

    function sample_submit1($form, &$form_state) {
      $request_url = "http://localhost/login";  //Link to Node.Js server
      $options = array(
                    'method' => 'GET',
                    'timeout' => 15,
                    'headers' => array('Content-Type'=> 'application/x-www-form-urlencoded')
            );
        $result = drupal_http_request($request_url, $options);
        drupal_set_message(t($result->data));
}

Is there any way or any better way to do this? Any insight into this would highly be appreciated. Thank you.


texts: I have two views, "viewA" and "viewB;" "viewA" contains all the users that post within the day, and "viewB" contains all the users. I need to get the difference between the two so I can get the users that don't have any post. I could use views_get_view_result() and views_get_current_view(), but I don't know how to implement the code.


texts: I've got content-type with 3 integer field. I use Views module to display contents. I've got search. I'd like to create input in that search. After filling that input and entering I want to display contents whose at least one field is equal given value. How can I do it?


texts: load external xml feed in drupal based on login credentials

texts:
We are asked to provide a secure RSS or XML feed to a Drupal based website. The idea is that we provide some basic information about our service (e.g. # of unread messages) based on their Drupal login credentials. Our service can be set up any way needed.

Are there any modules available that can use native Drupal authentication to login to another web service and load the provided information onto the page?


texts: Where is the page in the administrative section where I can put the translations in Drupal 8?


texts: Calculate the difference between two unix timestamp date fields

texts: I need to calculate the difference between two date fields in a table view in Views so that each row in the table shows the time difference in days, hours and minutes . The date fields are set to the Date Unix Timestamp. I've set it like that because I believe it's the best option for calculating 'seconds'. Once we know how many seconds there are between the two dates, we should be able to turn that into a human readable format of let's say days, hours, minutes. Can anyone tell me how this is accomplished?


texts: correct usage of token in href link text

texts:
I have a content type with a text field and want to use that text field as the text in the href link in a block on that page. The block appears as a button and I want to use the text field as the text appearing in that button (which is a link).

The text field is rendered appropriately if I put it in the page, itself. However, I can't get the text into the href properly.

I have tried using [node:field-button-text] as well as [node:field_button_text] but neither is rendered.

I am not using a view and I would rather not have to code anything. Am I just using the wrong syntax or field identifier in my href

[text identifier for a field on the page]

or is there a deeper problem?

Thanks for any help


texts:
I'm wondering if the private file system has a timeout.
Because after many tries of watching a video uploaded by the file system both in public and private mode, with a low speed connection, the video from private always stops loading at around 20 minutes of playing. The same video, from public, works perfect ( it keeps loading after 20 minutes, until the end ).

I've tried on many computers, with different videos, always the same.

Can someone explain me how the private files works, so i can try to find a workaround.

Sorry for my english.

Thanks !


texts:
I'm looking for a way to embed a "node add" form on a landing page.
I was using Form Block, but it appears to bring many error because I was using a development snapshot version.


texts: How can I programmatically get the image style of an image in a paragraph template?

texts:
I have an Twig extension that applies image style to an image and provides a URL for the processed image. The extension looks like this:

protected function setImageStyleUrl($url_field_value, $image_style) {
  $url = ImageStyle::load($image_style)->buildUrl($url_field_value);
  return $url;
}

And I am using it in the template this way:

<img src="{{ set_image_style_url(paragraph.field_image.entity.fileuri, ‘500x200’) }}" alt="{{ paragraph.field_image.alt }}"/>

However, since the image style is defined in the template in my example it is not possible to change it via the menus in the display settings anymore (Structure > Paragraph types > Manage display). So the only way to change it is to edit the twig extension again.

Finally, I want that it will become possible to change the image style from the menus and I am wondering if it is possible to get the image style programmatically from configuration settings instead of writing, for example, ‘500x200’ in my sample?
Or maybe does another approach exist?

Important conditions:

I cannot use Twig Tweak, Bamboo Tweak and another similar modules.
I cannot use {{ content.field_image }} approach (though it works)


texts: Page Navigation issue after executing a jQuery

texts:
Using JSinjector, i included a jQuery and made use of a function. I wrote a query inorder to display the external link within a certain div section (within our site). My code goes here

 (function ($) {
       Drupal.behaviors.YOURTHEMENAME = {
              attach: function(context, settings) {
              $('.div-classname a').click(function(){
              var url = $(this).attr('href');
              var height = $('#div-id-name').height();
              var width = $('#div-id-name').width();
              $('#div-id-name').replaceWith( "'<object data="+url+" width="+width+" height="+height+"/>'" );
               return false;
             });
           }
         };
         })(jQuery);

In concise, the above query does the functionality - " whatever the hyperlinks within the div class (div-classname) when clicked the corresponding website opens within the div with id (as div-id-name). Previously, div-id-name region has a content but when the hyperlink is clicked, jquery executes now the content (within the div-id-name) is replaced with the corresponding site.

Everything goes well the query works..

But my problem here is after the content is replaced with the corresponding link, now when i press the back button - rather than loading the previous page or the website's home page it redirects to the browser's home page (i.e., either google.com or whatever).

What might be the problem? Is there any thing link configuration issues? or do I need to include any code (query)..

I m using Drupal 7


texts: EventSubscriber called on specific node type or path

texts:
I'm trying to set an event that will launch function that loads some data from outside server and print it to javascript div element. I tried many ways but I can't figure out how to make this event be called only on for a specific node type.

Code I got so far:

class eSubscriber implements EventSubscriberInterface {

  public static function getSubscribedEvents() {
    $events[KernelEvents::RESPONSE][] = ['onRespond',27]; //so far it works on respond but on every page
    return $events;
  }

  public function onRespond(FilterResponseEvent $event) {
    //do some stuff
  }

}


texts:
I am stuck in mid of a coupon website where I have to share the coupon to the user favorite page. please help me to know the process on how could I share the full coupon block to the favorite page while clicking favorite button.
mostly all the coupon website has this functionality..


texts: UbertCart Cart does not follow my cart count

texts:
I customized my cart link using Views to show the cart product count. It's not updating the count. However, the normal cart block that came with drupal 7 and ubercart (in blocks) shows the correct count of my products in cart.

The view FIELDS list contains:

FIELDS
Cart product: qty

then use the replacement pattern: Your cart contains [qty] item(s) within the views Rewrite Output of this field.

Not that my custom cart link does not update but it's erratic. Clearing the cache does not seem to also affect my custom cart link. While the normal view cart block is working fine.

I just needed to be able to customize the cart link to say something like 'Your cart contains 2 item(s)  VIEW CART on top of my website. and it seems it does not work though...

Anyone knows this issue?


texts:
How do I reload the theme .info file on Drupal 7?  I added the following line of code in order to add my own Javascript file to the pages:

scripts[] = myJavaScriptFile.js

Now I need to refresh the .info file somehow. It doesn't seem to be doing this on its own. How do I do this?


texts: translatable content: how to set default original language

texts:
I've a D9 site, configured with two languages: Italian (default) and English.
Some content types of the site are translable, the configuration under admin/config/regional/content-language for them is as the following:

The configuration of admin/config/regional/language/detection is the following:

How it is now
When the user adds new content, if the url has en the content is created as English, and translatable in Italian.
When the url has it, the content is created in Italian and translatable in English.
How I want it to have
I'd like for coherence and to possibly avoid unforeseen problems that all the translatable content is created in Italian and translatable in English, independently of current URL\User settings.

The configuration under /admin/structure/types/manage/article is similar to the one under content-language:

How can I achieve that? I've tried to tamper with "Content language detection" but found no working way to set up it (and I've no idea at all if the setting to alter to achieve this result)


texts: Paragraph Bundle $content always Showing null in .tpl

texts:
I am using the paragraphs and views modules in Drupal.  I have created a paragraph bundle called Section Block, Machine Name: section_block and a custom view name Sectional Landing Page Block that has the Sectional Block as an Item within the view to display this paragraph bundle.

I have a content type with the section block paragraph bundle enabled and I have content entered within this content page.  I also have this view added to a custom Block that I have created.

I have created a .tpl file named:

paragraphs-item--section-block.tpl.php

Inside of this .tpl file I am only trying to var_dump the $content to see how I can change the markup for this paragraph bundle.  I am getting a empty array for the $content variable.

What are some debugging methods to help solve this issue?


texts: programmatically taxonomy update node DrupalDefaultEntityController error

texts:
When I programmatically create a taxonomy term and update node, in hook_node_presave() I have the following code:

$node->field_status_tags[LANGUAGE_NONE][]['tid'] = $value->tid;

I get the following error:

  Notice: Array to string conversion in DrupalDefaultEntityController->cacheGet() (line 369 of  includes\entity.inc).

This is the code I am using. I'm sure the value for tid is right.

/**
 * Implements hook_node_presave().
 */
function love_layout_node_presave($node) {
  /*
   *if ($node->nid && $node->moderate) {
   *  // Reset votes when node is updated:
   *  $node->score = 0;
   *  $node->users = '';
   *  $node->votes = 0;
   *}
   */
  if($node->type == 'status') {

   $pattern = '/#([^\\#|.]+)#/';
   preg_match_all($pattern, $node->title, $matches, PREG_SET_ORDER);
   $node->field_status_tags[LANGUAGE_NONE] = array();
   foreach ($matches as $key => $value) {

      $term_name = $value[1];
      $term = taxonomy_get_term_by_name($term_name);
      if(!count($term)){
       $term = new stdClass();
       $term->vid = 1;
       $term->name = $term_name;
       taxonomy_term_save($term);
       $term = taxonomy_get_term_by_name($term_name);
       foreach ($term as $value) {
          //dpm($value,$key);
          $node->field_status_tags[LANGUAGE_NONE][]['tid'] = (int) $value->tid;
        }
      }else{
        foreach ($term as $key => $value) {
          //dpm($value,$key);
          $node->field_status_tags[LANGUAGE_NONE][]['tid'] = (int) $value->tid;
        }
      }
   }
   //dpm($node,'love_layout_node_presave-node');
  }
}


texts: I have a page A that has an inline entity form that is referencing to page B, it's possible programmatically or in another way to get the link address of a file that page A is referencing to?


texts:
I am looking for the best approach to do the following:

I have a content type Product and a content type Invoice, where i can reference products.

I would like to be able to save the referenced products AT THAT TIME (with their price info).
So when the product is changed in the future, the invoice will not be updated with it.

Any suggestions on how to approach this best?

Thanks in advance!


texts: Overriding contributed module functionality

texts:
Every so often, I need to make a little hack to a contributed module to add a bit of needed functionality, usually something specific to the project that the module maintainers probably would not want to use.

Currently, I create a patch file for every hack, and I store all such patch files in sites/all/modules. This way, whenever I update a module, I can easily reapply my hacks and address any conflicts.

I can't help but feel like I'm doing something wrong though. Am I?


texts: How to send user created articles to approval queue?

texts:
I have an approval queue set up on a member's portal. The approval queues contain five content types that I created, one of them being 'Articles' and it is receiving daily RSS feeds. I'd like to also allow any user created articles to go there too.

The problem I have is that there is an Articles Adhoc page that was created in the views that is taking all of the user created articles.

I have disabled this page but the new articles still aren't going to the approval queues.

I checked around the Redaction module but I am unable to find anything on how to get this done.


texts: How do I return a number in render arrays?

texts:
I am building a module in Drupal 8. I am doing a query in database and I return the number of users and the number of nodes. I write of screen this numbers without errors, but I cannot write them in a block.

This is the code I am using.

Module file

/**
 * Implementa hook_theme ()
*/
function my_module_theme() {
  return array(
    'my_module_test' => array(
      'template' => 'test',
      'users' => NULL,
      'questions' => NULL,
    ),
  );
}

The class implementing the block

  namespace Drupal\my_module\Plugin\Block;
  use Drupal\minka_qa_core\FormatUtils;

  use Drupal\Core\Block\BlockBase;

  /**
   * Provides a 'Bloco' block.
   *
   * @Block(
   *  id = "bloco",
   *  admin_label = @Translation("Bloco"),
   * )
   */
   class Bloco extends BlockBase {

     /**
      * {@inheritdoc}
      */
     public function build() {
       //$count = $this->countTest();
       $example = $this->test();
       $example2 = $this->test2();

       print_r($example);
       printf('\n');
       print_r($example2);
       //$questions = $this->countTest2();
       /*$build = [];
       $build['bloco']['#theme'] = 'my_module_test';
       $build['bloco']['#plaint_text'] = 'Questões';
       $build['bloco']['#users'] = $count;*/
       return [
         '#theme' => 'my_module_test',
         '#plain_text' => 'Questões',
         '#users' => $example,
         '#questions' => $example2,
       ];
   }

   public function test() {
     $query = \Drupal::entityQuery('node')
      ->condition('status', 1)
      ->condition('type', 'questoes');
     $nids = $query->count()->execute();

     return FormatUtils::formatNumber($nids);
   }

   public function test2(){
     $query = \Drupal::entityQuery('user')
      ->condition('status', 1);
     $nids = $query->count()->execute();

     return FormatUtils::formatNumber($nids);
   }

}

The template file

Test twig template!

user: {{ users }}

Why isn't my code working?


texts:
I have a content type that contains text, picture and term reference (cat, dog).
I've used views and create a page with cats and a page with dogs.

The problems:

I want only 2 pages indexed by Google. The dogs page and the cats page. I don't want Google to index my nodes separately. Now I have one page with all my cats, one with all my dogs ( << the pages that should be indexed by Google and published for the users) and one page for each cat and one for each dog ( << pages that i don't want).
On my front page I need a 2 column area : column1, column2. Both columns should contain text and image. ( If I create new content type and then use a view I have the same problem as above.)
When I click column1 I want to go to cats page.
When I click column2 I want to go to dogs page.
How can I assign links different links for the view results? I know I have "Output this field as a link" in "REWRITE RESULTS" but it uses the same link for all views elements. I also know about "Link this field to the original piece of content". But this mean that my info from column1 should be in cats page and from column2 in dogs page. And I only wish to display the info from column1 and column2 on my front page.

How could I solve this ? Which is the best solution in order to create something like this ?


texts: How to execute some js code after click on exposed filter AJAX enabled submit?

texts:
I have tried to update the input value of an exposed filter field before submit of the exposed filter through Js.

What I have tried

$('#edit-submit-phrases').on('click', function() {
  alert('check');
});

No alert message.

I also tried:

jQuery('#edit-submit-phrases').mousedown()


texts: Show users pictures who have flagged a node

texts:
I have a event node and a flag to join the event.
I want to show the user pictures who have flagged "Join event"

This is what I have done so far

1.Created a Node View

2.Added a relationship Flags: Node flag (select the required flags
    and tick "Include only tagged Nodes"

3) Added another Relationship Flags : User

4) Added Relationship "Content Author"

4) Added contextual filter: Content: Nid >
Content id from URL > Specify validation criteria > Flaggable = Join Event

5 ) Add field User Picutre

Many thanks for your help


texts: Add contextual information to exposed filter

texts:
My goal is to create a My Tasks list that displays ContentType:Tasks that are assigned to the user. However, this page should have an exposed filter that would allow the user to see tasks assigned to other users.

I've created the view and I created an exposed Filter Criteria that references Content:Assignee

With this setup I get a page where I can see the tasks assigned to any user depending on what I choose at the filter. I would like to setup the filter to choose the logged in user as a default value.

I'm aware that I can create a contextual filter that would allow me to list all items relating to the logged in user, but I don't see how I can allow the user to filter to another user.

Is there a way to choose the default value of the exposed filter to userid ?


texts: How to turn off panels in-place edit bar

texts: I know this maybe a silly question but how do you hide panels in-place editor bar?(The bar that has layout adjustment buttons.) I found a post that said there's a on/off setting on general settings page that I can use to hide it but I couldn't find that option. I need to hide it because that toolbar is covering Theme developer checkbox. I can't disable the module either because it's in used. Any suggestion?


texts:
I have upgraded my site from 8.1.3 to 8.4 after that, while i load any pages. CSS is not been applied

View source:

while inspecting in browser

Cases tried: Placed an image file in the (core/themes/seven) folder and I can successfully access it from the browser.


texts: How to read file submitted through file field in block configure form

texts:
I have created a block through custom module and added file field in block configuration form using below code.

function mymodule_block_configure($delta){
if($delta=='mymodule'){
    $form = array();
    $form['mymodule_file']=array(
        '#type'=>'file',
        '#title'=>'Upload text file',
        '#name'=>'files[sample]',

    );
    return $form;
      }
 }

When I try to check this field in hook_block_save, the form element is empty even when the form is submitted after browsing the file.

 function mumodule_block_save($delta,$edit=array()){
    if($delta=='mymodule_block'){
    dpm($edit);
    }
     }

$edit['mymodule_file'] is empty after the form is submitted.

Am I missing anything?


texts: How can I validate a fieldset or any other kind of group in drupal Form API?

texts: I want to create a survey witch contains a couple of questions for every group. For example: I have a group about dogs with 5 difference question (every question has 3 options) and I have a group about cats with difference quetions. Now I want to validate by group. for example making it require to answer at lease two quetions on each group. How Can I do it?


texts: Per language menu item settings in node forms

texts:
I'm working on a drupal 8 website. On every node the admin can choose wether or not to show a node in the main menu, and where it should be placed. This works great with the menu settings node form shown on every node edit page.

But at the moment I'm transforming the site to a multilingual website all is fine and via the menu settings node form it is possible to change the menu title but I can't choose to show a node in the menu for one language only.

So for example, I have a about England page that I want to show in the menu of my English site only and not in the menu of my Dutch site.

I thought it might be possible to only create an English node for this. But when I choose to add this English node to the menu it is shown in both my Dutch and English site even though there is no official Dutch version of the node. It's not official because I can't find it in the admin/content view but if you try to edit or show it it is there for some reason.

So for example when I create an English node with nid 62. When you want to see this you go to /en/node/62 but the url /node/62/ is also available and this is where the menu item on the Dutch site points to.

I also tried to have the node in both languages and unpublish one of them but then the menu item is removed from both menus.

Hope someone has a solutions for this, any suggestion is welcome.
Thanks in advance.


texts: Using hook_form_alter to enter placeholder in mailchimp signup fom

texts:
For the signup form I'm using the Mailchimp Signup module. The idea is to hide the label, which I did using the unset(); function, and put an a placeholder in the input field where people enter their emailaddress.

Here's the code:

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

  if ($form_id == 'mailchimp_signup_subscribe_block_mysite_group_form') {
    //dpm($form);
    unset( $form['mergevars']['EMAIL']['#title']);
    $form['mergevars']['EMAIL']['#placeholder'] = t('Your emailaddress');
    dpm($form['mergevars']['EMAIL']['#placeholder']);
    }
}

dpm($form['mergevars']['EMAIL']['#placeholder']); returns the string Your emailaddress nicely in the green drupal message frame. Yet, the actual placeholder isn't there in my input element. Looking at the attributes of the particular inputfield in question, the attribute isn't added either:

<input id="edit-mergevars-email" class="form-text required" type="text" maxlength="128" size="25" value="" name="mergevars[EMAIL]">


texts: How to hide/show menu items using based on group membership?

texts:
I want to hide and/or enable certain menu links that are present on my main navigation bar depending whether users are/aren't part of any group.

I am currently using the Rules module with these settings but these delete and recreate the links completely! I just want to hide them from the view.

I have used the "update menu item" as action.


texts: On the theme "busy" how to remove the "0 comments" at the bottom?

texts: I have already deactivated the ability to comment on every page but now it just says "0 comments" this is very annoying.


texts: How to loop through a taxonomy vocabulary to find the top category in a nested tree?

texts:
What I have so far is this

$term=therm_id_that_I_already_have;

$parent = db_result(db_query("SELECT h.parent FROM {term_data} d INNER JOIN {term_hierarchy} h ON d.tid = h.tid WHERE d.tid = $term"));
$term = $parent;

$th=taxonomy_get_term($term);

probably I need a while of something...


texts: How to only allow a user to edit his/her own users?

texts:
For instance, my site contains two roles:

employer.
company.

Every company has to be able to add, edit and delete there own employees.

As you may understand, companies should not be able to edit or delete users created by other companies.

How can I achieve this?


texts: Files inside the CSS folder gets automatically deleted when I clear the cache

texts:
When i set my uploads path to ../ on file system, my files inside the css folder get deleted when i clear the cache. My aim is to be able to upload my files on the root outside drupal installation which is possible so far except the deletion of my files. I tried deleting the content of the .htaccess file that gets created in the root folder but there's no luck.

My directory structure is:

root/

----css

-------menu.css(file that get erased)

----drupal

-------drupal installation

----js

-------javascript

----other HTML files

Thank you


texts: How are access permissions prioritized when multiple modules implement them?

texts:
I have the Group module setup where I only allow view permission for group content to group members, so I have closed groups. But additionally, I want groups to also make some content public to non-members (but authenticated users) or to anonymous users even.

I have setup the Permissions by Term module for this where I made an "Additional view permissions" vocabulary that has two terms "all authenticated users" and "public". Those two terms I have granted permission to the respective roles. I had hoped that this would override the group permissions, but it doesn't. If I am not logged in, group content that has the "Additional view permissions" set to "public", still is not accessible to anonymous users.

I guess my question is: how does Drupal determine the priority of multiple modules arranging permissions for the same node, and can I influence this? In my case the group permissions seem to take priority, causing view permissions to be denied. But if it would first look at the permissions by term module, it would actually allow access.


texts: Is it possible to remove the contextual link for deleting a node?

texts:
In Drupal 7, can I somehow remove the "delete"-link from the contextual menu?

Some users don't realize that this actually deletes the node. They think it only removes it from the current page but still exists in the database.


texts: Referencing/relating content between content types

texts:
I'm completely noob on Drupal, actualy I'm trying to find a way to build a website idea using it.

I want to let users/visitors to create travel tips, so at this site I'll have contents like: Countries, States, Cities, Places and tips.

A tip must be related with a Place, that is related to a City and a State Country. Also a tip must contain any number of images related to it.

The thing is, I' just can't find a way to do it with a fresh install on Drupal, neither find somewhere I can see an code example of it, if I need to really code it.

I thought in creating a Entity type, but didn't found how to do it without coding, and I also need a way to let users upload any number of images they want, and them show everything on a page (I believe this is the easiest part, after I get the other ones).

Anyone can help me with a quick way to figure this out? Maybe a few blog post links, a ebook, videocast, anything.

Thanks!


texts: Get value for drupal date pager next or prev or current

texts:
I am looking around a way to get the date pager next/prev/current value inside the current view.I am listing events in a month and have used date pager.Display is of month type so in header it shows the month value.and in the next and prev it shows the next month. I need to know the value for the pager navigation.
Thanks in advance.
Arpit


texts: Upload large file to azure storage and link it in Drupal

texts:
I have some large Files (>3GB) to upload to a Drupal (running on azure). Because of the size of the files, I think i need to upload it to the azure storage (with Azure Storage Explorer) and then use the file in Drupal. This all works fine so far.

But: When I create the content page, I can't find a way to browse the azure storage instead of the local File system?

I use Windows Azure Integration. But this just gives me the possibility to upload a file to a azure storage blob. When I try this with a large File in the Drupal installation, it takes forever (ok, I didn't wait until the end). I am looking for the other way around: upload file to azure storage. Use this file in Drupal.

Does anyone have a solution? Or how would you solve the problem?

Using the proposed Remote File Source worked for me when I choose "File Attach". I have to upload the file to the web-server though and not to the azure storage. But doing this with filezilla does the job.


texts: CSS/JS aggregation, huge number of files

texts:
I use css and js aggregation for increase the speed of a drupal 7 website.
Now, when I log in with an user A, four news files (one css and one js) are added in the files website directory. (for each website page)
Then, when I log in with an user B, four news files (one css and one js) are added in the files website directory.
...etc

I'm afraid because the website will have many thousand of users.
So, there will be huge number of css/js files.

When theses files are deleted ? Can I configure that ?


texts:
I need to upload on Drupal 8 a file from an URL programmatically without using a form and a field type 'managed_file'.
I'm not sure how to do this, I found different web pages on it but it's often the old version of Drupal and only some part of code.

What exactly I want to do :

I Have an URL (for example a PDF document, a *.doc, ...)
I need to save it on Drupal and create the associated record in the database


texts: How to get a dynamic delta token in a multi-value field via views

texts:
Here’s the situation…

I have a multi-value PHOTOS field in views. The image ALTs are all unique.
These photos are output into a slideshow, and I’m building a custom caption for each slide (photo) by combining HTML and TOKENS.
Unfortunately, I’m only able to grab specific Delta numbers within the token list… such as [node:field_photos:0:alt] or [node:field_photos:1:alt]. But this obviously only passes that single Delta image’s ALT to all of the multi-value images.

**It’s required that these images remain in the same multi-value row and NOT in their own individual rows.
Is there any way to define a dynamic Delta based on the actual image shown? Something like [node:field_photos:?:alt]
In Drupal 7, there was a Compound Token module, which seemed like it may work. But in Drupal 8, I haven’t been able to find anything close to a solution.
Any help would be greatly appreciated. Thanks!


texts: How to check if field value has changed on a node?

texts:
I have a node type that holds a field of users, when this node is saved I am emailing all the users in this field.

This node might be updated from time to time and I don't want to re-email these users, but I want to check for any new users added to this field.

What would be a good way to check this? Could I simply check $form_state against $form for that field when it is submitted, or is there a better way to achieve this?


texts: On /admin/structure/types/manage/article/display I can enable custom display settings for various view modes. But what if I want one custom view mode to be almost identical to another? Is there a way to copy the settings of a certain view mode to another view mode?


texts: Display content referring other content in a mapping table

texts:
I have the following problem I can't figure out how to solve - note I am a Drupal newbie...

I have two content types; TypeA and TypeB. TypeA includes an entity reference field of TypeB to create a static relationship, similar to a "related work" or "is part of" use case.

This relationship displays fine in the full display mode for TypeA and all is well on that front.

I fail, however, to display this relationship as a mapping table in a third content type, where all TypeB nodes represents columns, and all TypeA nodes are displayed in individual rows like the following example:

Example:

Consider we have the following three nodes of TypeB: NodeA, NodeB, and NodeC.

We also have 5 nodes of TypeA, all along with the following relationships to TypeB nodes as follows:

Node1 (NodeA, NodeC)
Node2 (NodeA)
Node3 (NodeB, NodeC)
Node4 ()
Node5 (NodeA, NodeB, NodeC)

The mapping table then would look like this:

      | NodeA | NodeB | NodeC
------|-------|-------|------
Node1 |   X   |       |   X
------|-------|-------|------
Node2 |   X   |       |
------|-------|-------|------
Node3 |       |   X   |   X
------|-------|-------|------
Node4 |       |       |
------|-------|-------|------
Node5 |   X   |   X   |   X

Obviously, I do not want to maintain this table manually, but be built depending on the actual dynamic content of the site.

EDIT

The following constraints also apply (forgot to mention them in the first place):

When I unpublish or delete a node of content type TypeB, the entire column of this mapping table needs to disappear
The view (anticipating that I can implement this through crafty Views configuration) should not be cached, or cache-cleared upon change (is that even possible?)
The "X" in the example table would ideally be replaceable with other code or content I control (e.g. a little image, or glyph or so)

Thanks a lot,

Michel


texts: Show a sale price and discount percentage in Commerce 2

texts:
I want to show the original/list price and sale price (actual price) in my store as well as the discount percentage: N% off!

In Drupal 7, there is the excellent Commerce Price Savings Formatter module-- just install the module, set the prices, and you're done.

What can I do in Drupal 8?  I have tried to use the built-in promotion feature in Commerce 2, but as far as I can tell the promotion UI can only be used to create coupons, not discounts that automatically apply to the relevant orders.  (based on a reading of the documentation and experimenting with the module).


texts: How Can I change the fields order without using CCK

texts:
I want to change the order of the fields in each node. I know that I can use CCK but I would like to do this in hook_node_load

Is it possible?

Thx :)


texts:
The ckeditor on my site suddenly stopped working without changing anything.

This is what I tried up to now:

update all other modules and drupal core
remove ckeditor
clear caches of drupal and browser
download the latest drupal ckeditor module
download the latest ckeditor full version and copy it in ckeditor/ckeditor
copy all to modules/ckeditor
check if ckeditor.config.js is their.
turn module on
check status report -> no error
set permission -> admin -> full html

PROBLEM: ckeditor is not showing nor is its configuration (admin/config/content/ckeditor).

**extra info*
jquery version 1.7
using the default
compression level production
jQuery and jQuery UI CDN none*

Non of the answers found on this site concerning this subject has been of help yet.
I tried using firefox and chrome.

Thanks in advance.


texts: Run hook_init on every page except AJAX page executions

texts:
In my hook_init functions I often check what the current page is before loading js or css files and in some cases control actions on module stored session info based on values in the session and the current path.

The module I'm currently working on stores extra information for orders users choose to use Checkout by Amazon to pay for. I haven't spent the time to figure out how to make CbA work as a payment method yet so right now I have to alter the Ubercart checkout form to include their widgets and then hijack the form submission to handle the API calls and build its own review and completion pages.

I store the necessary information in a module specific session variable. If the user reviews their order then goes back out to any other page, I keep the session going, only destroying the order so it can be rebuilt when they go to checkout again.

Now the issue I'm having is that I have two cases where the whole session needs to be reset.

If the user completes the order then moves to any page other than the order complete page
If the user goes to any page other than the checkout page from the review page

The second is usually handled because they'll likely hit the shopping cart page to checkout again if they go somewhere else (I'll be adding a tracker to force people to the cart page if they leave the review page sometime soon).

The issue I'm having is that I am doing this with code like the following:

function uc_cba_init(){
  if(strpos($_SERVER['REQUEST_URI'], '/amazon/') !== FALSE || (arg(0) == 'cart' && !arg(1))){
    if(isset($_SESSION['uc_cba']['order']['complete'])){
      // if on order complete page, remove unnecessary session items for the order, including cart products
      // otherwise delete the module session
    }
  }else if(isset($_SESSION['uc_cba']['order']['complete'])){
    // remove unnecessary session items, cart products, and module session
  }
}

The problem with this is that there are a lot of ajax calls flying around and they tend to trigger the init function which means that when the user reaches the order complete page, the ajax call just before that page clears out the session which destroys the order complete information (no order id given to the user for reference or any other instructions for managing their order).

My question would be, is there a simple way to ensure the init only executes its code if the page it is being executed from is not being called from an AJAX hit?

I can test for the shopping cart page, checkout pages and node pages but that won't be fool proof since it won't catch views, taxonomy and other module generated pages that do not have a source path of node/X.


texts:
I know how to create drush commands in a project, but there are a number of commands which I would like to add to my local system simply because they affect my particular workflow a lot.

In Clisp, I can define this in .clisprc.lisp. In git I can add commands to the ~/.gitconfig command, I'm looking for similar for Drush.

So, for example, I might like to have a locally defined Drush command, add-squeeky-table:

drush add-squeeky-table

And I would be able to call that on all Drupal 7 projects installed on my system.


texts: Feeds import to import the contents of a .txt file into a node field

texts:
I've been using feeds import module with good success to import content from CVS files into nodes. It even works great for importing images that I place in the public:// folder.

I'd like to now import the contents of a .txt file into the body of a node. Anyone know how to do this? So basically, I'd like to my node content in the file public://content-1.txt, and then put "public://content-1.txt" into my CSV file to indicate to feeds to open up the text file and take its content and place it into a field. When I do this right now, it literally puts the text "public://content-1.txt" into the field, and not the contents of the file.

Any suggestions would be much appreciated.

Thanks!


texts: How do I fix the missing top 1/2 inch of the content box?

texts:
I made a number of formatting changes to several basic pages using a Bootstrap-based premium theme. The changes accomplished what I wanted but I subsequently noticed that, when I visited the site as an anonymous user, the top roughly 1/2 inch of the content part of each page is not displayed. It's as if the top of the page is hidden behind the horizontal menu bar at the top of the page rather than appearing correctly a 1/2 inch down.

I backed out all the changes I could remember making but it's still broken. It displays correctly when logged in as either admin or an authenticated user. I don't know how to even begin troubleshooting this issue. Can anyone point me in the right direction?


texts: Inserting additional AJAX using hook_flag

texts:
I'm trying to insert additional AJAX commands when a Flag link is toggled.  The flags link type is 'JavaScript toggle'.

Hooking into the Flag callback seems simple enough using hook_flag.

function hook_flag($op, $flag, $content_id, $account, $fcid) {

    if ($flag->name == 'flag_name') {
        // Additional Ajax Commands
    }

}

The AJAX command I'm looking to include is:

ajax_command_replace("#div_id_to_replace", 'New content');

Is it possible to insert AJAX using hook_flag?  If not, what would be the most appropriate way to swap out div content (in addition to the actual Flag AJAX) without a page reload when a Flag link is toggled?

Update: Found the Flag API (JavaScript) page while crawling through the docs. Hopefully will have an answer to add shortly.


texts:
How I created the folder i want to delete:

$form['logo'] = array(
'#title' => t('Upload logo'),
'#type' => 'managed_file',
'#description' => t('Allowed extensions: .gif .png .jpg'),
'#upload_location' => 'public://myfolder/',
'#upload_validators' => array(
  'file_validate_extensions' => array('gif png jpg jpeg'),
  'file_validate_image_resolution' => array('500x250'),
),);

Now how to delete it? I have tried this

file_unmanaged_delete_recursive('public://myfolder/');

and

drupal_rmdir('public://myfolder/');

There are files in the folder I'm trying to delete.


texts:
I'm getting used to use the Drupal watchdog() function. It provides me a very simple and accessible way to log events in my code.

However, I would like to use the same (or very similar) function in some other PHP projects outside Drupal. Accessing the results via the Drupal reports interface would be nice.

Does anyone know any proper way to include the relevant files of a Drupal instance to provide this functionality in custom PHP code? I know that there are already other PHP logging solutions which may be better, but I'm looking for something similar to watchdog().


texts: show archive block on every page containing certain content type

texts:
I have created one archive block using views for a content type. It holds the list of all the contents grouped year+month wise.

  Now I want to display it on the left sidebar of all the pages having
  this content type.

Using Block configuration of this archive block I have displayed it on certain pages, but I can't set it to appear on all the pages of type node/*, because all nodes do not contain that very content type.

Please help if anyone knows the solution to it .


texts: If end date is empty show "Now" or "Current" or something else

texts:
In some of the content type I have a field date with collects start date and end date.
The end date is not required and is empty as default value.

When I show date in teaser or node or view it will show start and end date but I want a condition

if (empty($end_date)) {
 print "current";
} else {
print $end_date;
}

of course I can set it in the node.tpl.php, for the teaser and the node, and with alternative text if empty in the views with field setting.

Now would like to know if there is any way to do it with the API. Something I can do in the template.php and not in every single node--CONTENT-TYPE.tpl.php and in every single view.

I'm looking for something like

function my_module_date_api ($something) {
if (empty($end_date)) {
     print "current";
    } else {
    print $end_date;
    }
}

Thanks in advance


texts: If theme folder contains no html.tpl.php file, which html.tpl.php would Drupal default to using?

texts: I’ve taken over a site wherein the theme folder does not contain any html.tpl.php. In this case, which html.tpl.php would get used?


texts: How to use current Workflow state as a Panels selection rule

texts:
How can I use a nodes current Workflow state as a selection rule in the Panels Page Manager UI?

It does not seem to be available under "Selection rules."


texts:
I have troubles adding a simple additional properties (like alt or title) to the image field type.

In the .module file I defined an alternative class for the image field.

function image_video_link_field_info_alter(&$info) {
  // Change the default widget for fields of type 'image'.
  if (isset($info['image'])) {
    $info['image']['class'] = '\Drupal\image_video_link\LinkedImageItem';
    #$info['image']['column_groups']['videolink'] = ['label' => t('Link to a video.')];
  }
}

I extended the ImageItem class with some additional properties.

/**
 * @file
 * Contains \Drupal\image_video_link\LinkedImageItem.
 */

namespace Drupal\image_video_link;

use Drupal\image\Plugin\Field\FieldType\ImageItem;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\TypedData\DataDefinition;

/**
 * Extends the default PathItem implementation to generate aliases.
 */
class LinkedImageItem extends ImageItem {
  /**
   * {@inheritdoc}
   */
  public static function defaultStorageSettings() {
    $settings = parent::defaultStorageSettings();
    $settings['default_image']['videolink'] = '';
    return $settings;
  }

  /**
   * {@inheritdoc}
   */
  public static function defaultFieldSettings() {
    $settings = parent::defaultFieldSettings();
    $settings['default_image']['videolink'] = '';
    return $settings;
  }

  /**
   * {@inheritdoc}
   */
  public static function schema(FieldStorageDefinitionInterface $field_definition) {
    $schema = parent::schema($field_definition);
    $schema['columns']['videolink'] = [
      'description' => "Link to a video.",
      'type' => 'varchar',
      'length' => 512,
    ];
    return $schema;
  }

  /**
   * {@inheritdoc}
   */
  public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    $properties = parent::propertyDefinitions($field_definition);

    $properties['videolink'] = DataDefinition::create('string')
      ->setLabel(t('Videolink'))
      ->setDescription(t("Link to a video on Vimeo."));

    return $properties;
  }
}

I believe I have to update the database in the .install file as I am getting the following error.

  Undefined property: stdClass::$field_gallery_videolink

How do I do that? Is my method even valid?


texts:
I'm making form in Drupal 7 website using php and trying to implement the under mentioned "action" attribute to the form. What i am trying to achieve is when the user clicks the submit button of the form the page should be redirected to page--generator.tpl.php in which the output of the form is shown.

This is what i am trying to achieve. This is the code from node.tpl.php, from where the user clicks the input and then print that input on the image on the next node i.e.page--generator.tpl.php

<?php
    if (!$is_front && $page ){
        echo"<form  method=POST action=".$base_url."page--generator.tpl.php>"
         ."<input id=post name=post_id type=hidden value=".$node_url."/>";
        if ($nid == 1){
        echo"<strong> Enter You Name <strong>"
         ."<input type=text name=input>"
         ."<input type=submit name=submit value=submit>";
        }

    else {
        switch ($nid){
            case 2:
            echo
         "<strong> Enter You Quote <strong>"
         ."<input type=text name=input>"
         ."<input type=text name=input>"
         ."<input type=submit name=submit value=submit>";
            break;
            case 4:
            echo
         "<strong> Hello Quote <strong>"
         ."<input type=text name=input>"
                 ."<input type=submit name=submit value=submit>";
         break;
        }
        }
         }
             ?>


texts: Add link to view data if no matching record

texts:
I have a view that shows taxonomy terms with a relationship to show nodes that have a term reference to that term (relationship not required, aka LEFT JOIN).

For terms that don't have a matching node I would like to show an "add content" link.

The usual "no results" behavior doesn't seem work in this situation. What's the trick?


texts: Translating string "Comment" inside comment form in Drupal 7

texts:
I have a Drupal 7 site in Spanish, and I found several strings that are not translated. So, I took note of them and went to the Translate Interface admin section and translated everything except for a string.

The comment form has 3 labels: "Your name", "Subject" and "Comment". The first two are perfectly translatable, but "Comment" does not appear in the translation list.

I've implemented hook_form_alter() in my theme's template.php, to see the form structure with:

if( $form_id == "comment_node_blog_entry_form" ) {
  dpm($form);
}

According to dpm(), the 'Comment' string (not translatable) is referenced as:

$form['comment_body']['und']['#title']

while the 'Subject' (translatable) string is referenced as:

$form['subject']['#title'];

If I try:

if( $form_id == "comment_node_blog_entry_form" ) {

  // this works:
  $form['subject']['#title'] = 'TEST';

  // this doesn't work:
  $form['comment_body']['und']['#title'] = 'TEST2';
}

So the questions are:

1.- Why "Comment" is not translatable? Shouldn't it have the same exact behaviour as "Subject"?

2.- Why can't I change the "Comment" string in my hook?

3.- If it's finally possible, will be possible to assign it to = t('Comment'); so that the translation is available in the "Translate interface" section?

Thanks.

PS: Other strings that I can't translate are the text formats ("Full HTML", "Filtered HTML", "Plain text", etc). I will try to translate also by using a hook, when I solve this.


texts: How to how a table with previously collected data in a custom form page?

texts:
I have a table named "Table1" in my Drupal, where I added fields by getting the inputs via form. The form is created by custom module. My next requirement was to again create another form, but this time I want to show the user by means of a Table format, the previously collected data in the form page itself. But I got stuck in this part.

The idea is: I want to bring the contents of "Table1" having attributes "empid" and "empname" in the right side of Form Page, so that the user can check the contents and enter current input accordingly. How is it possible?


texts:
I use https://www.drupal.org/project/esi module.
I have declared the function:

function _my_devel_esi_test() {   return 'ESI test is successful!';
}

,
which has the callback

$items['my-devel/esi_example'] = array(   'title' => '',   'page
callback' => '_my_devel_esi_test',   'access callback' => TRUE,   );
return $items;

I invoke this function in a theme:
[esi:include src="http://example.com/my-devel/esi_example" /]

but it does not work.


texts: Contact form - Custom fields are not sending content

texts:
I've done a custom contact form with 2 more fields, but I can't get values of those 2 custom fields.

I modified contact.module in core to see what are coming from form submit, found my custom fields but they are empty. I just don't know why they are empty.

Value of contact_form in contact.module:

$contact_form = {"contact_form":[{"target_id":"feedback"}],"uuid":[{"value":"5470b680-99db-4d5a-8c00-ae043dce67e1"}],"langcode":[{"value":"pt-br"}],"name":[{"value":"Name"}],"mail":[{"value":"some@mail.com"}],"subject":[{"value":"Any"}],"message":[{"value":"Any message"}],"copy":[{"value":0}],"recipient":[],"field_customa":[],"field_customb":[]}
;

Any clues to make this contact form work?


texts:
I'm using google analytics module for a drupal 7 multisite, and it works perfect in all browsers but in ie 11 where surprisingly the googleanalytics.js script is no loading.

any help?

thanks.


texts: How do I add an attribute in an anchor tag?

texts:
I want to make a module which will add some attributes in an anchor tag, whether the user adds in CKEditor or it is from Drupal menu system, before rendering it to the browser.

I can do it through jQuery with $('a').attr('data-anchor', 'arial');, but is there any way to do it through a module?


texts:
I'm managing a smaller project that uses Drupal 8.

The site allows for users to register for an account.
There is a simple feature which sends the user a welcome email along with their 'login details' so that they can keep it for future reference.

I was told that it would be impossible to send out the actual password in that email and it would only be possible to send out some thing like:
Password: Password chosen during signup.

This is due to Drupal encrypting its data and for some reason sending out a decrypted password in an auto-generated email would not work.

Any second opinions on this? How would you solve this?


texts: How to exclude an item from a view if it appears in another view on the same page?

texts:
I am very new to Drupal and now I am trying to build some small website to try different things out.

I made my website's homepage a Panel, and in it there is a "Promoted News" View, and under this view there is a "Latest News" View.

I want to be able to exclude from "Latest News" any news item that appears in "Promoted News".

Is that possible to do without having to write code? And if not, how can it be achieved?


texts: How can I hard-code a URL with translations in a template?

texts:
I already followed Get node alias in template.

In the template file I have this code.

{{ 'About Us'|t }}

I am using multiple languages, so it should work fine with /th/about-us.

I want to achieve it directly in the template file. How can I do it?


texts:
I've added a webform component of type Select list. How do I configure the select list to let users select multiple options?

Thank for reply to let me know there is a check box call multiple, but I have no idea where is it.


texts: Send an email when the roles are changed

texts:
I'm trying to send an email to users after their role has changed. So far, the rule is triggered every time the profile is saved (even without role change); I suspect that the data comparison is not handling the array correctly?!
Any help to improve the following rule or to achieve the same feature with a different condition will be very much appreciated.
{ "rules_role_changed" : {
    "LABEL" : "Role changed",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_update" : [] },
    "IF" : [
      { "NOT data_is" : { "data" : [ "account:roles" ], "value" : [ "account-unchanged:roles" ] } }
    ],
    "DO" : [
      { "mail" : {
          "to" : [ "account:mail" ],
          "subject" : "Role change for [account:name-raw]"
        }
      }
    ]
  }
}


texts: Alphabet sorting does not work properly with unique characters

texts:
I've a view with sorting by first character and it does not work properly for unique characters (f.x. danish characters: ø å æ).

What should I do in order to sort they properly?

Thanks.


texts: Missing filter and sort criteria from views

texts:
I'm following along a NodeOne video where it describes how to use the Views module. It looks like I'm missing a whole lot of filter criteria. Such as, all the "User:... " criteria, and the "Field:..." criteria is missing from the sort criteria menu.

This is a more or less fresh install of Drupal 7, and the only module I've installed is the views module, plus its dependencies.

How do I get those criteria to appear in the filter and sort menus?


texts: hook_form_alter building dynamic textfields

texts:
In hook_form_alter I am fetching data from the database. Some of the data has several textfields, lets say addresses. People can have several addresses.

How can I pass the count of rows to my form, and have it rendered with the row count?

I try to do the following in hook_form_alter

function personalinfo_form_alter(&$form, &$form_state, $form_id) {
    $i = 0;
    foreach ($arr as $value) {
        $form['personal'][$i]['address']['#value'] = $value;
        $i ++
    }
    $form_state['num_names'] = $i;
    }

And in my function personaladdresses($form, &$form_state) , where the texfields are actually build

I want to use $form_state['num_names'] to do a for/while loop to build the textfields with the addresses.

But it seems that hook_form_alter is called AFTER the for/while loop, so it will never get the correct value from $form_state['num_names']

how can I pass a value to my form function before the for/while loop?


texts: Redirect for anonymus user doesn´t work from Controller

texts:
Community,
i´ve got a simple COntroller for redirect my users by visiting a special path (localhost/drupal8/check). At the moment the redirect works for the administrator and for registrated user, if they are logged in, but not for the quests of my site (i know that it is only a local site).

namespace Drupal\testmodule\Controller;
use Drupal\Core\Controller\ControllerBase;

class EntityChecker extends ControllerBase {

  public function redirectToFront($bundle, $label) { return $this->redirect('<front>');

}
}

In the log i´m getting the following error:

  [30-Jul-2018 09:30:25 UTC] RuntimeException: Failed to start the
  session because headers have already been sent by
  "C:\wamp64\www\drupal8\vendor\symfony\http-foundation\Response.php" at
  line 1274. in
  C:\wamp64\www\drupal8\vendor\symfony\http-foundation\Session\Storage\NativeSessionStorage.php
  on line 141 #0
  C:\wamp64\www\drupal8\core\lib\Drupal\Core\Session\SessionManager.php(164):
  Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()

Thanks a lot for helping me


texts: How to Display Message of the Day Through Drupal View

texts:
i have created content type name "Message of the Day". each content of the content type ("Message of the Day") should be automatically change and display one content each day. how to do in the drupal view?

for Example

A bird in the hand is worth two in the bush
A cat may look at a king
A chain is only as strong as its weakest link
A change is as good as a rest

the above contents are added in Message of the Day content type. through views i want to display one content each day.


texts: How do I recalculate the price based on a given address?

texts:
I have a basic commerce shop setup and I need to recalculate the price based on the delivery region within the country.

The first approach I tried was to add a list field for the customer profile type and defined various regions. The idea was to recalculate the price based on the selected region and the current total price with the price resolver, the problem was I couldn't access the custom added field value, after the information had been entered in the order information form.

I should note that all purchases would be make by guest accounts.

Is it possible to access this information that way?

I'm currently looking at the shipping module but it seems it doesn't really support this approach because it's more oriented towards characteristics such as weight and dimensions.

Any advice on how to tackle this issue?

I'm using Drupal 8.