texts: How can I show the drop-down lists for countries/administrative areas (from Addressfield) as exposed filters in Views?

texts:
When editing the values of addresses provided by the Addressfield module, selecting certain countries (e.g., the United States) automatically populates a drop-down list of states.

I would like to do the same thing in a View using exposed filters-- when a user selects a country using the exposed filter for country, it should make available a select box for administrative area (state/province).

Adding exposed filters for the country and administrative area do not generate drop-down lists; instead, I simply get a plain text field with the standard options- is, contains, etc.

By installing the Countries module, I can get a drop-down list of the countries (but not the administrative areas).  How can I do this using only the Addressfield module?

Is there a pre-existing solution to make it work like it does on the edit page?


texts: How to call a Rules action settings form via drupal_get_form

texts:
So, I'm trying to embed the form I find at '/admin/config/workflow/rules/reaction/manage/commerce_payment_paypal_wps/edit/3' - which contains the settings for the PayPal business, etc (from commerce_paypal_wps.module).

Looking in rules/ui/ui.controller.inc I can see it's called thus:

$items[$base_path . '/manage/%rules_config/edit/%rules_element'] = array(
      'title callback' => 'rules_get_title',
      'title arguments' => array('Editing !plugin "!label"', $base_count + 3),
      'page callback' => 'drupal_get_form',
      'page arguments' => array('rules_ui_edit_element', $base_count + 1, $base_count + 3, $base_path),
      'access arguments' => array('administer rules'),
      'load arguments' => array($base_count + 1),
      'file' => 'ui/ui.forms.inc',
      'file path' => drupal_get_path('module', 'rules'),
    );

I'm not entirely sure what extra things I should be passing into drupal_get_form('rules_ui_edit_element') to make it render the form as it does normally.

How on earth do I get that rules action settings form to render either through drupal_get_form, or some other mechanism, so I can put it at the URL of my choosing, and make it look a bit more presentable to our clients?


texts: Creating a dynamic URL in node--resource.tpl.php

texts:
I'm trying to create a URL in my node--resource.tpl.php file that contains fields from the resource in question in the URL. The following code is what I've been playing with, but when the user clicks the link it just shows as follows:

http://pf.dev/content/specific-resource-feedback?nid=&title=

Ie. The nid and title are not being filled out correctly. So here's the code I'm using (incorrectly) to create the URL:

    <a href="/content/specific-resource-feedback?nid=
<?php $content['nid']) ?>&title= <?php $content['title']) ?>">
Trouble with this resource? Let us know.

Any ideas why this might not be working as intended?


texts: Drupal Commerce default amount before adding a product

texts:
I want that the Drupal Commerce module checkout by default starts with one specific product , whether you choose another product or not.

Is this possible to achieve this by building a rule? Which rule do I need to build?


texts: How to make private (hidden) node path aliases?

texts:
The site (Drupal 7) has regular nodes that are publicly visible via standard node alias (node/<nid>). I need to be able to create hidden (private) node aliases that are random (e.g., node/9s8d0a8z9d) which will allow the person who has the URL to access the node.

User who accesses the node via random node alias should not be able to see the node id in URL hence the required feature. The main purpose of private URL is to make them expirable. It's ok if user gets to know the node id by digging the site once it gets there, I need to make the node alias obscure just in the URL itself.

I can create multiple node aliases with path and pathauto modules but one of random aliases will eventually be set as default alias which will be visible as node URLs in views or in Content page which is not desired.

Are there Drupal modules that can provide this functionality?


texts: Drupal custom Fullcalendar breaks jQuery version > 1.8

texts:
I have a project where I have created a pretty extensive (custom) fullcalendar implementation.

I am using fullcalendar 2.6 (the latest version at this point).

All is working like a charm untill i change the jQuery version (via jquery_update) to anything that is higher than 1.8...
Then the fullcalendar just dissapears completely (the div is empty)

No errors in the webdeveloper console (chrome), nothing!

I have tried to narrow down the fullcalendar js implementation to the bare minimum (just a title, prev & next buttons) but even that does not work.

Since i want to implement bootstrap into the project, I need to increase the jQuery version...

I have been googling around for this but can't seem to find a clear answer for this.

Anyone?

All suggestions are highly appreciated.


texts: Restrict users from creating new taxonomy term if it does not exist

texts:
i have a content type "Recipe" . And i have a "field_cusine" with type "Term reference" and widget is "Autocomplete term widget (tagging)".

Now while adding the content as an admin. If i add a term which does not exist it will be added .

I want to restrict this for other "authenticated users" on my site. They should see the "Autocomplete term widget (tagging)" but should not be able to add new terms.

Any clue.
thanks


texts: Find the object of a field widget on a form

texts:
I have two fields on a form. One is a select list with an Ajax callback on 'change'. When I am in callback, I want to call a function (addMoreAjax) on the second widget. For that I need to find the object that represents the second widget.
I can get the form object from the form_state, but I am unable to get the widget objects.
Any hint available? Many thanks for your support.
Regards
Christophe


texts: Issues with updating modules on Drupal 7

texts:
I have a Drupal 7 website that I upgraded from Drupal 6 awhile ago. I am trying to upgrade some of the modules that have had updates since then, but I am having issues doing so. When I click the "Continue" button on the "ready to update" screen, I receive the following unformatted text on a blank white background:

  Installing updates

  Status message

  Operating in maintenance mode.Go online.

The url of the page is example.com/authorize.php?batch=1&op=start&id=4206

I checked the error logs in Drupal, and there are a few errors reports:

  Notice: Undefined variable: finished in _batch_process() (line 344 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefined variable: old_set in _batch_process() (line 339 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefinedvariable: old_set in _batch_process() (line 338 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefined
  variable: old_set in _batch_process() (line 337 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefined index:
  init_message in _batch_progress_page_js() (line 136 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefined index:
  error_message in _batch_progress_page_js() (line 135 of
  /home/mysite/public_html/includes/batch.inc).

  Notice: Undefined index:
  title in _batch_progress_page_js() (line 127 of
  /home/mysite/public_html/includes/batch.inc).

Any ideas on what might be causing this and how I an fix it?


texts:
Can the Window/Browser title be set separately from the page title (which is displayed in an <h1>)?

I'd like to be able to do this in the most direct way possible from code, not using extra modules or configurations (unless that is the best route).

For example, I often use drupal_set_title() on a page definition.  I'd love to call a similar function right next to this to set a slightly different version as the window title.


texts: Why do I get "Access Denied" on every page?

texts:
I've been trying out Drupal 8 on localhost which has been great, and I've now transferred it to a server, but every page gives me Access Denied. I can't even access the front page, or the user login page.

I have tried truncating the session and cache tables, and deleting cookies, but don't know what else to try. I've also installed drush, cleared the cache, and tried user-login drush command - still no access.

What things should I check? How do I fix this?


texts: Twig add attribute with value in a variable

texts:
Using Drupal 8

I want to print out a field's content into the src attribute. I have the following template for my view:

But the iframe gets filled with my own site's "Page Not Found" page instead of the Youtube Video because Twig prints out a whole lot of debug comments before and after printing the variable rows[0].content.

Is it possible to disable the debug comments for a specific field? I don't want to have to be disabling/enabling debug to make sure it works as expected. Because it works if I disable Twig debugging (the comments aren't printed so the URL prints out fine) but it's tiresome to be enabling/disabling to check work.

I also tried using {{ attributes.setAttribute('src', {{ rows[0].content }} ) }} , but no dice.

Another failed attempt was:

{% set iframe_src = rows[0].content %}

My last idea was this:

{% set url = rows[0].content | raw %}
{% set iframe_src = 'src=' ~ url %}

But it prints out src=Array

SOLUTION

The answer is in another question, I'm pasting it here in case that one gets deleted. The author of the following answer is @4k4

field.content is the rendered field. And in views that means it is no longer a render array, but the finally rendered markup. So this is very problematic to use it as a class name, not only because of twig debug.

Better use the row data, where you find the entity object with the field data from the database. Use clean_class to escape it for using it as a class name:

{{ row._entity.field_myfield.value|clean_class }}


texts: How do I change the admin toolbar search input box to type=search?

texts:
I'd like to change the attribute "type" to "search". The search icon goes over the top of the text making it hard to see what you are typing. The themes are a combination of Adminimal for admin and Bulma for the front end. The Bulma front end is the problem.

The source html is as follows.

<input id="admin-toolbar-search-input" aria-labelledby="toolbar-item-administration-search" type="text" size="60" maxlength="128" class="form-text input ui-autocomplete-input" autocomplete="off" tabindex="-1">

I want the type attribute to be search so that the icon is hidden when you enter text.

I've tried overriding the bulma template input--bulma.html.twig. Not ideal from a scope perspective and setting these attributes here doesn't work.

{{ attributes.setAttribute('type', 'search') }}

Ideally I would find a theme pre-process function. I can't see to find one that works. How do I go about it?


texts: How can I direct the user to a different page on a multisite installation based on which subdomain they go to?

texts: I have a site, let's call it www.example.com, and I'm going to create subdomains for it with the same Drupal installation on every subdomain. I can do that. However, when someone goes to a subdomain, I would like them to see a different page depending on which subdomain that they go to. Say for example they go to user1.example.com, can I make that somehow redirect them to an arbitrary page within the Drupal installation? I hope that's clear.


texts: Twig template suggestions for paths such as page--node--page-url

texts:
using D8, I'd like a twig template for a page I've created based off the path of the page and not node %. I look in my twig suggestions and all I see are:

page--node--8.html.twig
page--node--%.html.twig
page--node.html.twig
page.html.twig

As template suggestions. However, as I'm working in multiple environments and don't know what the node number will be when I actually create this page I'd like to just base it off the path I've set for the page which is '404-error'. Anyone know how to do that?

I'm imagining something like page--node--404-error.html.twig

However that doesn't seem to work (I tried it).


texts: Lose ability to use node load with an argument in ajax form submit

texts:
I have a basic form like this, that is literally just a submit button:

function mymodule_form($form, &$form_state) {
    $form = array();

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

    return $form;
}

The form uses Drupal's built in #ajax feature, and calls back to itself because nothing is supposed to change after the submit button is clicked.

I also have this form submit function that submits that form:

function mymodule_form_submit(&$form, &$form_state) {
    $node = node_load(arg(1));

    $query = db_merge('mydatabase')
    ->key(array('nid' => $node->nid))
    ->fields(array(
        'nid' => $node->nid,
        'column1' => 'value1',
    ))
    ->execute();
}

This form submit should, in theory, add the current nodes ID to the 'nid' column of mydatabase, and 'value1' to the 'column1' column. The form submit correctly adds 'value1' to my 'column1', however it adds NULL to my 'nid' column every time. But ONLY when ajax is enabled on the form. When ajax is disabled, it correctly submits the node ID. Which leads me to believe there is either an issue with using node_load in an ajax form submit, or using arg(1) in an ajax form submit.

Any advice would be appreciated.


texts: Is it possible to render a twig template for "later use"?

texts:
I have been asked to create a custom module that outputs a node's content in a way that it will be easy to print or export to pdf.

I came accross this question and this is litteraly what I'd like to do, but I can't manage to adapt it to Drupal. I've seen quite a lot of potential solutions, but I don't know if they'd help.

Here is what I did so far:

// My module's route is '/pdf/node/{nid}

$route_match = \Drupal::service('current_route_match');
$node = $route_match->getParameter('nid');
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$result = $node_storage->load($node);

$response['title'] = $result->getTitle();
$path = DRUPAL_ROOT . '/modules/custom/mymodule_pdf/templates/node.html.twig';

// It would look like so:
$template = $this->get('twig')->render($path, 'title' => $response['title']);

So far, the twig file just contains the following:

{{ title }}

So $twig would contain
The node's title

And all I'd need to to is to put the $twig content as my future pdf's content, but this is the easiest part.

Is this possible to do this?


texts:
I have a site with different sections for separate projects.  Some of the sections are just a single page with a project summary, but others are more involved with several pages.  All the pages are created via a content type "projects."  I have a term reference field in the content type in order to categorize which pages belong to which project.

What I'm trying to do is have a menu automatically generate for all the pages that belong to a specific project.  I've found ways to create menus of terms, but I can't find a way to make a menu of nodes using the term.

Any ideas?
-JB


texts:
I need to find out how to manually create a configuration file, one which will be included with a custom theme as optional/required upon installation.

I know I need to create a file in themes/mytheme/config/optional for a block, but how do I know the exact filename and what to put in it?


texts: Form submissions including HTML in email notifications

texts:
I have a website where the core contact form is submitting the form markup along with the content.
So for example, this is in the email notifying the site owner of the submission:

The sender's name

Williamjeply

The sender's email

artofnegotiations@theonlinepublishers.com

Subject

How negotiations work! A must read  book

Message

LISTENEVERYHOW – How Negotiations  Work, is an easy-to-read book and pragmatic approach to get the best results  from a negotiation. It is adaptable in content and style – as a story book  for leisure readers, life skills manual for entrepreneurs and  professionals, or even as a business school handbook.
&#13;
&#13; This book is written with clarity and easy eloquence of a man who knows what  he is talking about, telling captivating stories in well sequenced chapters  that all end with enticing nuggets. A rudiment skill in negotiation is  listening and the major themes of this book are reflective of the insights that  make the difference in negotiations.
&#13;
&#13; You are one click away from having this excellent book for just $5.99  https://www.amazon.com/dp/B08W5DMQV3/ref=cm_sw_r_cp_awdb_t1_6E8T8CE1VW6P49PPQF8F_nodl

I've made sure the permission allowing HTML emails is checked in the SMTP settings and there are no other obvious errors.
Does anyone have any clues why this is happening?
The issue queue doesn't provide much help on this.
The site was recently upgraded to 8.9.12 and is just using the core contact form.
Thanks in advance.
edit: apparently I'm using this module as well https://www.drupal.org/project/smtp


texts: Setup voting/rating on content to require a "reason" field

texts: Is there a way to setup content voting/rating on Drupal 7 in such way that the user must provide a reason for their vote/rating?


texts: How to add attributes to a specific field's image

texts:
subtheme/templates/image/image.html.twig

controls the style of every image at a website is there a way to overwrite the image.html.twig for a given field let's call it

field--profile--field-trainerfoto--trainer

The field template would be

field--profile--field-trainerfoto--trainer.html.twig

what would the templates name for the image.html.twig be that just overwrites the output of the img tag for the image in the field?


texts: drush features-list-packages in drupal 8 doesn't include prefix

texts:
I've just started using Drush and Features with Drupal 8. I'm running into a point of confusion, and I can't figure out if it's a feature or a bug.

In the past our team prefixed all the site-specific features with some abbreviation, let's say, whg_. Then, when I run drush fl the features would show up as whg_calendar, whg_events, etc. It now appears that features automatically appends the bundle's abbreviation to the feature, great.

The issue is when I drush fl I now get a list of features without the abbreviation: calendar, events, etc. I can use the feature commands to update, revert, etc, but I can't use the pm- commands to modify the modules, since, they are in fact, prefixed. So, in order to uninstall the module I have to pm-uninstall whg_calendar.

Additionally, drush fu calendar creates a new feature at modules/custom/calendar

This seems like an inconsistent way to work with features. This might be a meta question, but, is this a bug, should I report it to the github project?


texts: How to display a menu items for a node but not for it's parent

texts:
I have a page which I don't want to appear in a menu unless the user is already on that page or a child page underneath it.

For example on a shopping site, I would like to have a 'special offers' page positioned in the menu under the 'products' page, but it would only be visible if you're on the special offers page and not from the products page.

E.g. the standard menu

Home
    Products
    Contact us

When on the special offers page:

Home
    Products
         Special offers
    Contact us

Is there a way this effect can be achieved?


texts: Access Denied when redirecting to alternate view

texts:
I've designed a view that shows a table of data.  Within the global header, I've written

  Click here to
  see your events in a calendar
  format.

The intent is to redirect to another view if the user clicks the link(s).  This works correctly if the user is using Chrome or IE as a browser.  However, if FireFox (on Windows), or, Safari (on Mac), are used, the user gets:

  Access Denied You are not authorized to access this page.

And, they are asked to login again.  I've checked permissions and everything seems to be in order.  Does anyone know why this is happening?


texts: 7- Disable a block or edit it without access to the admin interface

texts:
I activated php code in a block in the header, and I put "echo $user;" instead of "echo $user->name;".

Now I get an error on page load and can't edit the block to correct the mistake.

If I could change the active admin theme back to bartik, that would also solve the problem.

Any ideas welcome. Thanks

Edit: ok I think I solved by deleting my custom theme folder. Good that the block was only enabled for the custom theme.


texts:
I have a form which consists of one submit button (Add to cart). I made it submit via AJAX but the problem is that when I press the button the second or third (and so on) times, the submit handler doesn't execute. I think this happens because the form_build_id and form_token fields should be rebuilt.

Do you have any idea on how I can achieve this functionality?

This is the code I am using.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'my_form_id') {
    $form['submit']['#ajax'] = array(
      'callback' => 'mymodule_ajax_form_callback',
      'wrapper' => 'my_form_wrapper',
    );

    $form['#prefix'] = '
';
    $form['#suffix'] = '
';
  }
}

function mymodule_ajax_form_callback($form, &$form_state){
  return $form;
}


texts:
I have a view that lists nodes of a certain type "TypeA" using their titles (and a link to click on).
The view filters out the current TypeA node from that list using a contextual filter set to Content:ID with a default value passed in through the request URL, and the "Exclude" checkbox ticked.
Consequently, when the currently displayed node is not of TypeA, all nodes of TypeA are listed.

I want the block in which the view is displayed to change title depending on whether I view a node of TypeA or not, as follows:

Node is of TypeA, the title is set to "Other TypeAs"
Otherwise, the title is set to "All TypeAs"

I don't know how to further test the query result for the condition, or change the contextual filter (since I always have a Content:ID passed in) to make that happen.

One possible workaround could be to trigger on the URL path because all nodes of TypeA have a custom URL path (via the Pathauto module) configured.

I am using Drupal 8.4.6, soon to migrate to 8.5.


texts: Secure pages and installing new modules (AJAX error)

texts:
I've just configured my website to work with secure pages and everything seems to be working fine except for the ability to install a new module. Whenever I try, I get this error:

  An AJAX HTTP request terminated abnormally. Debugging information
  follows. Path:
  https://www.mysite.com/authorize.php?batch=1&id=329&op=do[1]
  StatusText: ResponseText: ReadyState: 4

It also offers an error page that says this:

  Notice: Undefined index: log in
  update_authorize_install_batch_finished() (line 250 of
  /home1/me/public_html/mysite.com/modules/update/update.authorize.inc).
  Warning: Invalid argument supplied for foreach() in
  update_authorize_install_batch_finished() (line 250 of
  /home1/me/public_html/mysite.com/modules/update/update.authorize.inc).
  Notice: Undefined index: log in
  update_authorize_install_batch_finished() (line 291 of
  /home1/me/public_html/mysite.com/modules/update/update.authorize.inc).
  Notice: Undefined index: tasks in
  update_authorize_install_batch_finished() (line 292 of
  /home1/me/public_html/mysite.com/modules/update/update.authorize.inc).
  Installation failed! See the log below for more information.

All I can find on secure pages and AJAX is to add */ajax/* to the "ignore pages" field. I've done that but I'm still having the same issue.
Has anyone else figured this out? I feel like it should be pretty standard stuff!


texts: How to show attribute dropdown in add to cart form in Commerce 2.x

texts:
The attribute dropdown list doesn't show, instead I get an autocomplete field labelled "Product Variation" and it contains the full title of the variation. When I enter text, a list of variations appear but when selecting a different variation the product doesn't refresh.

I would like it to show the label of the attribute with a dropdown list of the values. I'd like it to say "colour : "Value"". I have two attributes one showing a weight capacity the other a colour. They are both appended to the variation title but I need to select combinations of the two. I've trawled the internet and it seams the dropdown list should work out of the box.

I have a matching Product type and variation type. On the manage display of the product type the variation field format is "Add to Cart". On the variation type the attribute field is enabled but it doesn't show up.

Where am I going wrong please?


texts: In display modes I set to hidden all Title fields, but Views still gives h2 title.


texts: Create a list of CiviCRM newsletters group by CiviCRM group

texts:
I have created a drupal view based on CiviCRM Mailing. I tried to display the recipient group(s) but it's seems to be neither in the field list, neither in the relationships.

Each CiviCRM Group represent a mailing list and we are sending a newsletter to one group at a time. Ultimaly, what i want to display is :

Group 1 :
* date - newsletter 1
* date - newsletter 2

Group 2 :
* date - newsletter 3
* date - newsletter 4

What could be the best way to solve this problem ?


texts: How can I ensure that every page within my drupal 6 site loads a specific Javascript file?

texts:
I want to include the sites/all/themes/fusion/mapsindeed/js/css3-mediaqueries.js
 file so that mediaqueries will work within Internet Explorer 8 and below, like it already does for other web browsers.

How can I do it?


texts: Why is the page content always rendered after blocks displayed on the same page?

texts:
I have a Static Page node at, say, /my-page. It has a title and body. I have also placed a block (pointing to a View) in the "Main content" region, at the very bottom of the list.

However, when viewing /my-page, the block is displayed above the <article> element that contains the page content. An example can be seen below.

Why is this the case? What can I do to always show the page content above everything else that is placed in the same region?


texts: Print commerce pricing attributes to email receipt

texts:
Users cannot see what size or color shirt they purchased in the email receipt because tokens won't print the attribute fields provided by Commerce Product Attributes / Commerce Pricing Attributes / Commerce Product Option combo.

User selects shirt size: XL and color: Green
Both fields can be previewed during checkout.
Email receipt received doesn't show any attributes, user cannot check what size/color they ordered.
(All this can be achieved using default CCK fields under product type, but we're using the combination mentioned above for multiple reasons, many products got different option sets to chose from and certain attributes selected adds extra price to total, like eg size: XXXL costs extra $3+ and this cannot be achieved with default fields).

One of the tokens I found is like eg. [commerce-order:commerce-line-items:0:commerce-pricing-attributes] and email on checkout prints it like this:

Product: BK Test

a:1:{s:9:"coveralls";a:8:{s:25:"field_coverall_embroidery";N;s:25:"field_coverall_text_color";N;s:10:"field_font";N;s:16:"field_shirt_name";N;s:16:"field_patch_side";N;s:12:"field_length";s:1:"2";s:21:"field_coveralls_color";s:1:"4";s:19:"field_coverall_size";s:2:"16";}}

Also more tokens available at admin/help/token like eg.: Attributes  [commerce-line-item:commerce-product:field_attributes]  Pricing Attributes field. and combining them with [commerce-order:commerce-line-items:0:commerce-product] won't work, already tried dozens of variations.

E.g. in Order's view page I addded the view Commerce Line Item: Product Attributes and it displays correctly.

How to print this in the email receipt?


texts: what action can trigger clearing of caches?

texts:
I have a site that is cached for anonymous users. However it seems that something clears caches every now and then (many times daily.) And it is not result of admins activity. I found about it only by chance, when looking at page_cache table, refreshed it after a while and all records were gone.
Question: how to start debugging this? What can I do to track what user action or anything causes caches to be cleared? Thank you.


texts: How to search and replace content type (system)name in database for product types

texts:
Using Commerce kickstart, I wanted to replace the existing example content type names with other names.
I downloaded the database, applied a search and replace, and after uploading the database and clearing caches, the website now shows new content types plus the old ones.
It appears that the website has recreated the old content types..but I have no idea what does that and how to prevent that.
Any ideas?


texts: How to Bulk delete the document from solr without actually deleting the node?

texts:
The scenario is to delete bulk documents from apache solr, without deleting the actual node from the database. I am aware that when the node is un-published it will be deleted from solr.

But as my node are very large containing 1000's of terms I don not want to use node-save to un-publish the node.

Is there any hook or function which un-publishes the node and deletes from solr by minimal load (definitely not node save)  ?

UPDATE:

Drupal Version : 7.15
Modules: Apachesolr


texts:
I am using the preprocess_node hook to extract data from entity references and add them as custom variables which are then spat out in a twig template.

The problem is that now, these custom variables seemingly have no applicable template override.

EG previously, I could output {{ content.address }} (which would contain street name, postcode, country etc) in the node template, and then override the output with a field--node--field-* template.

Now, I am outputting {{ custom_address.postcode }} for example, but there is no apparent template I can make, looking at the twig theme debugging messages.

Is there a way I can use custom twig variables, from the preprocess_node hook, and have template overrides?


texts: User variables defined in hook_variable_info() in rules

texts:
I'm declaring the varialbes of a custom module in hook_variable_info(). Now I'd like to access some of them in rules. How can I do that?

The reason for this is that the Variable module gives me the chance to added fine grained access control for this values. Otherwise I would be forced to give users full access to administer rules.

Update: I found this issue: Make Drupal variables accessible with data browser in rules
To be honest I don't fully understand what it is saying.


texts: I recently converted a Drupal 6 contributed module to Drupal 7 for one of my client project.  I would like to contribute this converted module to the community.  How to upload this in the existing project page?  Do I have to create a patch or will it be a sandbox project?


texts:
I have another question about ubercart. I have a content Type hotel & a content type tript (city trips etc) that people can buy, (just one price). I really don't know if it is possible to add my content type to ubercart so i do not have to add this all again manually.
I hope this question is clear.

Thanks


texts: Conditional Fields module with Google Maps

texts:
I'm trying to initially hide a geofield created with Geofield module using Conditional Fields that uses the Geolocation Field Google Maps Input Widget.

If I click on one of my conditional fields to show the Google Map Input Widget, it shows the Google Map Input with a grey background.  If you resize the browser, the map tiles show again.

Does anyone know of a way to hook into the javascript somehow to reinitialize the Google Map when it is shown?


texts:
Novice here. I'm on Drupal 7.

I have a content type with a title, image and body field. I've created two views to display that content. The two views are on a page and I need help connecting them so that clicking/tapping on the image in View 2 will change content in View 1. Ideally this happens without page reload and View 1 fades in as new image in View 2 is clicked/tapped.

This seems like a filtering thing but I can't filter using images, I don't think!? Are Views the best way to set this up? If yes, what specifically needs to happen for the two Views to connect? If there is an easier way to set this up, what would it be? Help all! Any direction is appreciated.


texts: Is there a central document store in Drupal 6 or a module that does?

texts:
I have a content type in Drupal 6 that consists of 3 main fields, each allows for the upload of unlimited files, which I have restricted to being PDF or DOC based formats. Lets say there will 100 pieces of content based on this type. Whilst most of the uploads made, may well be unique, the customer has identified that there are a few docs, that may need to be uploaded to more than one piece of content.

This led on to the question regarding if there is a central document store of some kind in Drupal (especially 6 in this case). Such a tool would mean that files would only need to be uploaded once but referenced many times from various pieces of content.

Does anyone have any solutions to this scenario?


texts: Attached library not working in IE and old Edge

texts:
I've got a bit of an issue with IE11 and Old Edge 40.
I've got a custom module and I've attached a library that I want to run on every page with some CSS and javascript to the module. But it seems like it's not loading this attachment on my custom_module.module
function custom_module_page_attachments(array &$attachments) { $attachments['#attached']['library'][] = custom_module/library }
but on chrome, new Edge(Edge 45), firefox and every other browser it works fine.
I can tell because I can see that my CSS exists.
Does anyone have any idea why this would be happening specifically on IE and Edge 40 and how to go about fixing this?


texts: What does "The provided host name is not valid for this server" mean?

texts:
I am running a Drupal 8 website, and when I browse to any page, I get a plain white page with just the following error message on it.

  The provided host name is not valid for this server.

What does this mean?  How do I fix this?


texts: Use JSON instead HTML for access denied on some custom paths

texts:
I create a small API for one project using Bathic Authentication. The API consists of some custom paths defined in routes in a custom module. Using JsonResponse() in the controller we send back a JSON object with data.

But in case the user does not have permissions to access the path the route gives back the 404 HTML page. How can I tell Drupal to return a JSON object for my API paths under every circumstances?

Another example: we defined just to accept GET in the route. Using POST will return a HTML error page - we want Drupal to send back JSON with error information.


texts: Views Calc always uses contextual filters of master display

texts:
I have many displays in the view.
One of them is a views calc table.
Contextual filters in the master display and in the views calc display are different.
And when contextual filters differs from master views calc doesn't work correctly.
Views calc ignoges contextual filters of the current display and shows calculation results using contextual filters of master.

Has enybody noticed this issue?


texts: How to create a related page or content type with in an existing custom content type?

texts:
I have created a custom content type that is a product page. It takes various pieces of information relevant to creating a software product page. For example the products Name, System Requirements, and features and builds a custom page for each piece of software that I may make.

The issue is that I have a product page, and several ways to obtain the software:

Potential Trial version download from my site directly.
Link to Purchase from the Mac App Store,
And a link to Purchase it from a FastSpring store.

I am Trying to find a nice way to conceal that all behind one button on my product page, so that I do not have to clutter my Product page with 3 links to various ways to obtain the product. I just want to have a button "Get Product" that can load a separate page or equivalent.

What are some ways to do this in a semi automated way so that it can happen when I create a new product page and then have Drupal also make another page or something that I can fill in with links that I know to acquire the product?

Because I really don't want to manually make two separate content types one for the product and one for the product downloads links and then have to manage a releationship between them for all products.  Trying to make it so that the ways to obtain the product are included in  the product page content type in an elegant way.


texts: How would you convert a link to a media item to the file URL in a menu?

texts: I would like to be able to link to media in a Drupal menu and have the link converted to a file url.  Is this possible?


texts:
Within Drupal 7 I have created an A-Z menu which contains all the links on the site organized alphabetically.  In addition to these links I have 26 additional parent menu links (A-Z) from which all the site links are organized as child links within these parent links.

I then use the sitemap module to display the contents of this menu within a page with a 3 column layout.

My questions what is the most efficient way to programatically alter the 26 (A-Z) parent links so that just the menu link text is displayed without its associated hyperlink which I had to do originally when creating these links which by default I made as the homepage for all 26 parent links.


texts: How to programatically update existing user profile field in drupal 7

texts:
We are using Drupal 7 and the Profile2 module.

We create and add a value to a field in the profile using this code:

$profile = profile_create(array('type' => 'main', 'uid' => $account->uid));
$lang = LANGUAGE_NONE;
$profile->field_headline[$lang][0]['value'] = 'Software Engg';
profile2_save($profile);

How can we programtically update the user profile field 'field_headline'?

Please advice us.


texts: Listing top level terms in views including those without children

texts:
My vocabulary looks like this

Level 1a

Child a
Child b
Child c

Level 1b

Child a
Child b
Child c

Level 1c

Level 1d

Child a
Child b
Child c

Level 1e

I have managed to display parents and children terms using Taxonomy term: Parent term and filter on (Parent) Taxonomy term: Parent term (not empty). But terms without children on the same level with "parent" are not displayed.

To get the children I used filter “(Parent) Taxonomy term: Parent term (not empty)”. If I set the same filter to “is empty”, I get all level 1 terms including those terms without children just like I want it. So right now it seems like an either-or situation. I can only get the top terms or the children terms but not both.

How do I get the top level terms including those without children and corresponding child terms for those with children?


texts: Alter the username label in the login block

texts:
I want to alter the username label. Instead of username, I want to change it to User ID.
I've written the following code to perform this function, but I'm not sure how to implement it.  When I implement it in the page that contains the login block, nothing happens.
function lae_form_user_login_form_alter(&$form, &$form_state, $form_id) {
 $form['user-login-form']['edit-name']['#title'] = t('User ID');
}

Will this actually work? If it will, how do you implement it?


texts:
I'm using OG and OG Extra to make some kind of community website.. but unfortunately I don't see the group content block even when I added it to a region. .
Please what could be the solution for that and is there any alternative
Here's images from my configuration:


texts:
I have a taxonomy field in my view in filters and I have made it exposed to the users with selection type "dropdown" along with "Show hierarchy in dropdown" as checked.

I'm also using Better Exposed Filters (BEF) module where in its settings I have selected the option to display the exposed filter as "nested checkboxes/radio buttons".

Also under more options in BEF's settings I have selected "Add nested all/none selection" so that if the parent taxonomy term is selected then all the child taxonomy terms should also get selected and vice versa. But this thing is not working properly, after selecting the parent term all the child terms are not getting selected neither after selecting all the child terms the parent term by default is getting selected.

Can anyone suggest ideas to make this work properly. Thanks In advance!!


texts: How to access link fields (url and text) value separately in views template?

texts:
My views block has a Link field named field_link, attached to a Content Type named products, and I'm trying access link field values(url and text) separately in views template views-view-unformatted.html.twig.

Following code gives the formatted html.

{{ row.content['#view'].style_plugin.render_tokens[ loop.index0 ]['{{ field_link }}'] }}

formatted html:

View Products

But I want to access the link fields(url and text) value separately. Any help will be appreciated.

I am not able to check row variable via kint/dump as I am getting PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted


texts: Why does my view duplicate the same content ( translation )?

texts:
I have a multilingual site for Properties with 2 languages ( English - Arabic ) and I have a view that give me the all properties that I need to sell.

But when I enter to this view every multilingual content will duplicate like is shown in this image:

This is the filter criterion :

Any idea to solve the duplication problem?


texts: How to render a variable which is having a wysiwyg type format?

texts:
I am creating a variable in admin section that is of form type #type = text_format to get wysiwyg kind of editor. But having difficulty while displaying the field value in template file.
I am trying to print like below in template file:

print_r(variable_get('web_pagetext', ''));

But in frontend its showing like below:

Array ( [value] => text, text..
[format] => full_html )

How I can remove Array([value], [format]) and only text to get displayed.


texts: allow admin user edit others user flag field

texts:
I have a flag named buy, with those field: buy amount, comment, status.

Users can buy a content with buy how many content(buy amount), and leave a comment(comment), and the default status is "wait for reviews"

I want:

Now I wanna allow site administrator to change the  status to "bought success" or "bought failed".

I create a view to list all been bought content, and I want to create a two button "set to bought success" and "set to bought failed" into the view.

I tried:

I try to install workflow module and attach workflow field to the flag. and add the workflow button to views.

Then I wanna to create a rule:

Event: when flag field updated (actually this event is not exist)
Condition: when the workflow field equals 'bought success'
Actions: set the flag's workflow field to

Problems

Although the "set to bought success" and "set to bought failed" button in the view, but the when I click, not thing happend.
The rules not have the event of when flag field updated, and rules can not set the flag's field

How should I do?


texts: Fetch column sum from database and print the output using static/dynamic queries

texts:
in drupal 7, i want to get the sum of a column in the database and display it using a static query and show the display in a block. I am executing the php code at site.com/devel/php from the devel module.

Plese do note that I am not proficient in coding, and i am a script kiddie. I am not a developer, and i have only used the drupal platform as a designer, and have only dealy with the configurations and menus.

the query i want to exectue is very very simple. it is

SELECT SUM(column_name) FROM table_name

i have tried using static query as follows:

$val=db_result(db_query('SELECT SUM(column_name) FROM {table_name}'));
print $val;
then i get --- *"Fatal error: Call to undefined function db_result() "*

i also tried

$query = db_select('table_name');
$query->addExpression('sum(column_name)', 'total');
$result = $query->execute();
print $result;

then i get --- "Recoverable fatal error: Object of class DatabaseStatementBase could not be converted to string in eval()"

I want to print the value of the total sum.
If i remove the print statement, then it works and executes. but i want the value printed.
as in, if i only execute the first three lines

$query = db_select('table_name');
$query->addExpression('sum(column_name)', 'total');
$result = $query->execute();

it runs successfully, but with the print statement it does not.

I am executing the php code at site.com/devel/php. I intend to use this result that gets printed either in a page or in a block.

Is there any noob mistake that i have made, and can you guys guide me to the right resource to get thhis to work.

I have looked at issues that other prople have had and have been copying thaat and modifying it so it used the table i want to use and the column names within it.

Truth be told, I dont know if we cam print variables when we are executing php code in drupal. if i run the query with a print 'Hello', then it prints. So i know that the print statement works, but i am not sure if it prints variable.
If it is not possible to use the SUM in the query, will i have to fetch rows individually using for each, and within the loop add the values to a sum variable to get the total?
Also, in a few of the posts i read that db_quey()/some other function is not there in d7 and was a part of d6. So i am unsure if i am even going in the right direction.

Any help here would mean the world to me.

Regards and Peace from the UAE,

Aamir


texts: How can I have a taxonomy list that shows parent child relationship, but not allow the parent to be selected?

texts:
Now and then I will come across a Drupal site that shows taxonomy terms to be selected in a drop down list. Example:

Fruit
    apple
    pear
Meat
    pork
    beef
..etc

And, while the child of each parent is selectable, the parent is not. How is this achieved, and how can I apply it to my taxonomy vocabulary who terms are 1 child deep?


texts: Views displaying only one record on pagination

texts:
Created a view which displays all user on the website, I have added pagination which displays 10 records on the page.

I am not sure but its displaying only one records but correct pagination link.


texts: making completed webform entries show in separate report/view

texts:
I have created a webform for tracking orders (customer, p/n, order date ship date etc)
I'm trying to figure out how to have entries with the ship date entered to not show in the view so people just see whats in process. It would be OK to have an archive or close link or simply have them dissapear when the ship date is entered but I would still need a report or view for closed orders only. Or, how can I simply mark entries as closed? I assume it would be easy to create a link to the closed records. Any thoughts would be greatly appreciated. thx


texts: Template name convention for view mini pager

texts:
I'm trying to understand drupal's theming system and I thought I was doing quite well when, all of a sudden, I tried to create a custom template for the mini pager of the views module. I'm struggling to understand the right naming convention for the file, altough I've read alot during the past two days.

Here is what I've done:
Test template name: myzen

overridden the function myzen_views_mini_pager in my template.php
This works like a charm, the debugger hits the bps, if any.
I tried to inspect the "Theme information" in the advanced section of the
view edit page but I failed to see something related to the mini pager.
I tried to follow this tutorial and I used the dprint trick to list the possible options and I found this:

Array
(
[0] => views_mini_pager__evento_view__block
1 => views_mini_pager__block
[2] => views_mini_pager__default
[3] => views_mini_pager__default
[4] => views_mini_pager__evento_view
[5] => views_mini_pager
)
according to the tut and to what I found I tried to guess the template name, which should be: views-view-mini-pager--evento-view--block.tpl.php but this, obviously, fails. I tried like hundred of other combination (removing the block part, changing the - with _, using only pager instead of mini-pager etcetcetc) and nothing worked.
fun fact is that I can actually make a template for views-view--evento-view.tpl.php (which override the whole view, of course).

Can you help me in figuring out the right naming convention for the mini pager template in that specific block only?

Thank you!


texts:
I have a search field in my view and also some other filters like filtering between 2 dates or filtering between 2 prices.

Now I have something like this:

When I click on Uitgebreid zoeken ... the div pops open like this:

Now I would like to replace the div that pops open when you click on the link with a pop-up. The pop-up should contain all the filters and the apply button.

But I don't now how to start with this. What would be the best solution?


texts:
Doe anyone know how to change the timezone dropdown list in the user account/registration?
So which file is the menu/settings located in? (Assuming I am using Garland theme if that matters, and the variables will still be stored as a string, ie America/Chicago). Alternatively, how to change the user registration/account settings page so I can key in my own dropdown form.

Thanks!

[The reason is that it is quite difficult to find some locations in the US on it (It would make sense to make the American cities easier to find in their own section rather than in a collective North & South & Central America). So I want to be able to set in some choices manually or at least make it more intuitive (such as sorting by GMT +/-, I understand the issues with timezone, unix time, etc ...meaning they depend on the political area and jurisdiction, along with DST in some states and not so in others, ie Indiana, Arizona etc...)]

I was thinking of changing the format to this:

'America/Denver' => '(GMT-07:00) Mountain Time (US & Canada)',
'America/Chihuahua' => '(GMT-07:00) Mexico/Chihuahua',
'America/Phoenix' => '(GMT-07:00) USA/Arizona',
'America/Regina' => '(GMT-06:00) Canada/Saskatchewan',
'America/Tegucigalpa' => '(GMT-06:00) Central America',
'America/Chicago' => '(GMT-06:00) Central Time (US & Canada)',


texts: Unexpected error after migration to a new host

texts: I'm having a bit of trouble finding out what's going on with my Drupal installation. I started building a site on a test server a while ago. Now it's time to move the entire website as it is to a new host. Therefore, all the database tables with content have been copied to a new database. Also the directory was copied to the new server. Obviously, we had to change the database name, user name and password inside /sites/default/settings.php. At a first glance, the front page appeared as it should, so did several other pages. But when I tried to login, I got an unexpected error. The same occurs when I try to run rebuild.php. So I checked the watchdog database table for a log message and realized that nothing had been written. I assume the reason why the pages get served is because these are cached. Did I miss something here? How exactly can I verify if the database connection is successful and what could be the issue? Thanks for your help!


texts:
I want to render twig when sending email (if it is possible) or include a template.

My code is like so:

/**
 * Implements hook_mail().
 */
function reg_email_mail($key, &$message, $params) {
  $options = array(
    'langcode' => $message['langcode'],
  );

  switch ($key) {
    case 'new_user':
      $message['from'] = \Drupal::config('system.site')->get('mail');
      $message['subject'] = t('User created: @title', array('@title' => $params['title']), $options);
      $message['body'][] = \Drupal\Core\Mail\MailFormatHelper::htmlToText($params['message']);
      break;
  }
}

I'd like to change $params['message'] or part of this with twig. Is it possible?


texts: What are the list of Drupal 7 image cropping modules out there?

texts: Currently I use EPSA crop for cropping images as it uses the same image field without making a new one. What are the list of image cropping modules out there that provide a similar functionality? Epsa crop gives me the ability to crop different sized images for different image styles.


texts:
I am building a Drupal Multi-site.  The look and feel of all of the Multi-sites will be identical it is just the Data that will be different.  Within a site I need to restrict access to various areas so that one  user with the role of "authenticated user" can be restricted to only certain areas of the site, while another user with the same role can be restricted to a different area of the site.  Organic groups seems to be what I am looking for.

My question is, is there any reason that Organic Groups can not work with in a multi-site framework?


texts:
Good morning,
I use the Zen theme. I did override the node.tpl.php putting a copy in myzen / templates /, I saw that the content is printed with this statement:

print render ($ content);

my problem is that having made my own content type, content is an image and text, I would give a different width by css to my image and text. how do I make a reference with css at image and text placed separately?


texts: How to add a placeholder to an exposed date filter form field?

texts:
This is the structure of a date field in my exposed form:

<input id="edit-date-filter-value-datepicker-popup-0" class="form-text hasDatepicker date-popup-init" type="text" maxlength="200" size="20" value="" name="date_filter[value][date]">

I added this code under

function bartik_form_views_exposed_form_alter(&$form, &$form_state) {}

to add place holder.

$form['date_filter']['#attributes']['placeholder'] = t('YYYY-MM-DD');

But place holder is not coming. Can anyone help?


texts:
In the user profiles, I would like to have an education field grouping. In this grouping I'd like to have these text fields.

Degree: BS/BA, MA/MS, PhD, Post Doc, etc
University
Year Graduated
Area of Study

Now, my users will have multiple degrees and such.

Can I create a "repeating" group of these four fields from 0 to infinity?


texts: Drupal 6.x vs 7.x for Multiple Domains and LDAP

texts:
We're looking at using Drupal for our public sites, which will have:

multiple primary domains
multiple sub-domains

We will need to allow our users

to authenticate against LDAP
to get different roles per site
to share content across primary and sub-domains.

Looking at the modules that are stable and under active development, 6.2x looks better than 7; of course 7 is very new. If we go with 6.2 now, we'll have to upgrade to 7 later; if we go with 7 now, we won't have all the functionality that exists in 6.2, specifically LDAP.

How would you address this situation of 6.2 vs 7.x? If you came across this situation, how did you make the decisions? What risks did you weigh? What direction did you go in?


texts:
I have a client using Ubercart who is looking to integrate with QuickBooks. After a bit of searching, I found that Ubercart itself has some discussion of this topic which seems pretty out of date:

http://www.ubercart.org/docs/quickbooks

Then I found an existing module which does not appear to be production-ready:

Ubercart Quickbooks Integration module

And two commercial solutions:

http://www.webgility.com/quickbooks-integration-ubercart.php

http://deepthoughtsoftware.com/courier

Does anyone have experience with any of these solutions? The site is built on D6, and uses Ubercart with a variety of extra modules, including Ubercart Userpoints module, which allows customers to earn store credit. It will be important to bring information about the store credit, along with sales & inventory, into QuickBooks.


texts:
My friend wants me to create a Real Estate Search Engine for him where Users can submit Real Estate Information so that others can view them ( by searching or any other method ).

I want to use Drupal because I have worked with it earlier. If there is a plugin/add-on for Drupal which can help me make a Real Estate Website, please do include a link in your answer to the plugin or module page(The Plugin or module should be free of cost).

Is there any other CMS which I can use ( Real Estate Plugin should be available )? or should I go with Drupal?


texts: Where is the class "placeholder" defined?

texts:
According to the function:

function drupal_placeholder($text) {
  return '' . check_plain($text) . '';
}

It would return the HTML code with class "placecholder".
I had searched the word "placeholder" in the drupal 7 project about 4,800 files. I expected to find the default CSS definition of class placeholder e.g. em.placeholder{} or .placehoder{}. But I can't.

I can only find some files with html ID attribute #placeholder{} was defined.

Some of the files:
 drupal/modules/color/color-rtl.css
 drupal/modules/color/color.css
 drupal/sites/all/module/ctools.css.stylizer.css

Because I want to modify class with my style globally. Please advise if any default definition of class placeholder in drupal 7.


texts: Multi step user registration form drupal 6

texts:
How to do Multi step user registration form in drupal 6 ?

I am having an idea of doing multistep process using custom form.

But i am bit confusing while doing the same case with "user registration".

For example :

Let us consider i am having 10 fields and separating it with three forms like 4+4+2.

Now when i complete the first form and click next button where should i need to save the values of current form. I used $form['storage']. But it didn't helps.

Could anyone please clear me this or provide me an easy tutorial for "multistep user regsistration".

Any help will be thankful and grateful..

Thanks in advance..


texts:
I have three content types

Company

Store

Offer

A Company has many Stores , A Company have many Offers. An Offer belong to many Stores.

Store has a node reference field for Company
Offer have two node reference fields, one for Company and one for Store.

I want that, when creating Offer node, when user select the company, the relevant Stores dropdown populates with stores from that specific company.

Best Regards,
Rafiq Ahmed


texts:
I have some kind of image that I want to have in all my pages of my website to use to return to my homepage.

So far, I managed to get the image in position I want and I already have displayed in all my webpages with reference link to the homepage.

But I want to go a bit far and had an animation to it, so when somebody use the mouse to hover the image I wanted the image to move some px (50px for example) to the bottom.

Yet, all I could do so far was this:

.penduricalho{
  background-repeat: no-repeat;
  position: relative;
  top: -200px;
  right: -200px;
  margin-bottom: -500px;
  -webkit-transition: bottom 0.3s;
  -moz-transition: bottom 0.3s;
  -o-transition: bottom 0.3s;
}

But with the piece of code above the image was in fact moving but it originated other problem that it would move all the content beneath it.

I tried this other code:

CSS:

.penduricalho{
  background-repeat: no-repeat;
  position: relative;
  top: -200px;
  right: -200px;
  margin-bottom: -500px;
}

figcaption {
  position: absolute;
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 10px 20px;

  opacity: 0;
  bottom: 0;
  bottom: : -30%;
  -webkit-transition: all 0.6s ease;
  -moz-transition:    all 0.6s ease;
  -o-transition:      all 0.6s ease;
}

figure:hover figcaption {
  opacity: 1;
  left: 0;
}

HTML:

            aye!!

Still with this code the image wasn't moving, only appteared a text sliding. And that is similarly to want I want, that is, slide my image a bit to the bottom. But when I try to alter this latter code the page unconfigured itself.


texts:
I am connecting to a third party library to connect to authorize.net. In order to begin making any calls to the library, you must first define some constants, such as:

define("AUTHORIZENET_API_LOGIN_ID", "[LOGIN ID HERE]");
define("AUTHORIZENET_TRANSACTION_KEY", "[TRANSACTION KEY HERE]");

My issue is this: I have two separate Authorize.net accounts which need to be updated, both happening as the drupal user saves his account. Currently I have one custom submit handler added to the user_update_form form but I can't use this to make both calls. Should I be able to simply make a separate submit handler for each account, or will the constant be constant though both files?


texts: Field multiple value form validation on "Add more" action

texts:
I've a field multiple value in my form (a node form in my case) and I want to add a custom validation on this field. So when the user click on "Add more" the validation run and if I set a drupal_set_error() in the validate function, no new element is created and then the error message is print to the front.

Can you help me to do this ?


texts: How to set fields value in Views PHP module?

texts: How to define the fields value in Views PHP module?


texts: What's the minimum viable example to attach JavaScript using a page hook?

texts:
Here my module file following the documentation precisely for declaring js files of a module and attaching the created library. But can't see my module js file within the page code source.
Here is my files content:
my_module.librarises.yml :

my_module.lib:
  version: VERSION
  js:
    js/my-module.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings
    - core/drupal

my_module.module:

/**
 * Implements hook_page_attachments().
 */
 function my_module_page_attachments(array &$page) {
      $page['#attached']['library'][] = 'my_module/my_module.lib';
 }

my-module.js (in my_module/js directory):

(function ($, Drupal) {

    $(document).ready(function() {
        console.log('Loaded...');
    });

})(jQuery, Drupal);

In code source I can see "my_module/my_module.lib":

{"path": ..., {"libraries":.., "my_module/my_module.lib",..

But can't get the file js.

SOLVED:
it was a typing error while naming libraries.yml:
my_module.libraries.yml instead of my_module.librarises.yml


texts: A view inside another View, updated with AJAX

texts:
I have a View of taxonomy terms (categories of books). This View lists all of the categories available to the user. Now I would like that, when the user clicks on the Category, a div will appear with a few books (another View, with contextual filter). By clicking on a link, I can go to the full View or to the details of the book, but if I do not click on any link, and go to another section and click on the title, I would like the earlier section to close the div, and another div with new books will appear in this new section.

The schema would be something like this:

Category 1
Category 2
Category 3

When clicking on Category 1, with AJAX there will appear:

Category 1 ---> the next part appears retrieved with AJAX

Book 1
Book 2
Book 3
See more books on Category 1 <--- END of content thrown by AJAX call.

Category 2
Category 3

I have been able to make it work without AJAX, using both modules Views Field View and Views Accordion.

However, I cannot find out how to make it work with AJAX, so no tab content is loaded it will be loaded in AJAX when clicking and opening one tab category, so the browser memory/speed/server requeriment is not impacted if I just want to see books in one category.


texts: Disable ajax history except for some views

texts:
I use Views Ajax history so that customers keep track of a search when they navigate from a view with exposed filters to a product, and then back to the view.

But in other parts on the website, this generates unwanted things, such as node?page=1 / node?page=2 and so on at homepage, whenever using pagers of blocks views.

I performed a huge SEO audit, where these paths are pointed as undesirable, also when you go back with browser buttons it can take 10 clicks before you reach precedent page, not very UX friendly.

But after thinking about it, I really don't know how I could limit ajax history to my products views. Any suggestion welcome !


texts: How to populate a select list in my custom module with the content types of the site?

texts:
I am making my first custom module, and I want to have a select list in the module settings that has all the content types in the site, so that the admin can select which content types to have associated with the module.

here is the code I have so far:

$form['MODULE_select_content_types'] = array(
  '#type'          => 'select',
  '#title' => t('Select Content Types'),
  '#description' => t('Select the Content Types that users can subscribe to'),
  '#default_value' => variable_get('MODULE_unlisted_content_types', array()),
  '#options'       => $select,
  '#multiple'      => TRUE,
);

How do I populate the $select variable with a list of all the content types in the site?


texts: How To Open The Comment Form In Modal Form

texts: I want To Provide The Link "Add Reviews" For Content Type Example "Doctor". Then How I can Use the Comment Functionality For That. So that When the user Click on the Add reviews Link A modal Form  Appears  Having Text Field with "Rating Star". so that user can submit Reviews For that Content Type.


texts: Override container.html.twig template for a specific context

texts:
I would like to override the container.html.twig template but the twig debugging tool doesn't give any suggestion.

I tried to add suggestion following https://drupal.stackexchange.com/a/249565/85029 answer but I end up with the suggestion being container----.html.twig.

The context is a display field with an embed view in a node.

I guess, the solution might be pretty close from what I have now (using the suggestion hook) but I'm not able to have some satisfying suggestion.

My current hook is

function mytheme_theme_suggestions_container_alter(&$suggestions, array $variables) {
  $element = $variables['element'];

  if (isset($element['#type']) && $element['#type'] == 'view') {
    $suggestions[] = 'container__' . $element['#name'];
    $suggestions[] = 'container__' . $element['#name'] . '__' . $element['#display_id'];
  }

  if (isset($element['#type']) && $element['#type'] == 'container' && isset($element['children']['#type'])) {
    $suggestions[] = 'container__' . $element['children']['#type'];
  }
}

Edit :

Ended up with something corresponding to my expectations by adding

if (isset($element[0]) && $element[0]["#theme"]) {
    foreach ($element[0]["#theme"] as $themElem) {
        $suggestions[] = 'container__' . $themElem;
        }
}


texts: The wrong site title is coming up for home page

texts:
For some reason, the title of our website in browser windows and tabs is coming up as something else. We aren't even sure where this title came from, as it has nothing to do with our site.

I checked the page source to see what was showing up in the <title> tags, and sure enough, it's the same, incorrect title.

I tried changing the name of the site and the site's slogan, hoping that would help. I've cleared the caches. It's been going on for about 8 months, before we made some upgrades to core and modules.

Other page titles seem to be working correctly. There are no nodes with this title. We are using Drupal Commons. Drupal version 7.50.


texts: How can I use session variables in a report created with the Forena module?

texts:
I've installed Forena Reports. It's basically working, but I have some questions (see bottom of post to get right to it).

What I want to accomplish is the following

I want an anonymous user of the module page to be able to export their recommendations as a CSV file with a link like 'download now' or something.

Here's the staging environment for the tool I'm talking about, so you can see how it works: http://staging.grantstation-pathfinder.com/pathfinder.

So, as you can see, here's what I have so far

I have a custom module that's a multi-step form. The module prints out each page of the form. The user selects one option on each page (3 pages total) and on the final page submits the form. The module then redirects the user to a 'recommendations' page (page 4 - modulename/recommendations) where some custom SQL prints out to the page recommended resources for that user based on their selections in the form.

The values the users select are saved in session variables.

Here's how those variables get stored as sessions in the form itself. (This is the second page of the form, but they are all basically the same.)

function pathfindertool_first_form($form, $form_state) {
 // .. some code, some other fields, directions, etc.
        '#default_value' => isset($values['role']) ? $values['role'] : NULL,
        '#options' => array(
        t('Grant Writer'),
        t('Nonprofit Administrator'),
        t('Nonprofit Founder'),
        t('Consultant'))
    );
      $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Next'),
      );
      return $form;
    }

    /**
     * Submit handler for the first form.
     *
     * @see pathfindertool_first_form() above
     */
     function pathfindertool_first_form_submit($form, &$form_state) {
      $values = $form_state['values'];

      // Save values to the form storage, add the next step function callback
      $form_state['rebuild'] = TRUE;
      $form_state['storage']['role'] = $values['role'];
      // submit code
    }

On the recommendations page I call SQL and use the session variables to determine which recommendations to display to users.

Here's how I set the session variables and redirect the users to the recommendation's page.

$form_state['storage']['topic'] = $values['topic'];
// set session variables to be used on recommendations page
$_SESSION['role'] = $form_state['storage']['role'];
$_SESSION['level'] = $form_state['storage']['level'];
$_SESSION['topic'] = $form_state['storage']['topic'];
// when user clicks 'submit' redirect them to recommendations page
$form_state['redirect'] = 'pathfinder/recommendations';

I successfully installed and configured the Forena module, and it displays my tabular data from the SQL file I created with the parameters I manually set. The CSV download works too. That's all fine.

How do I ensure the Forena modules uses the session variables set by the user in the multi-page form (and not my predefined parameters)?


texts: Move "Items per page" selector to the top of the content

texts:
This is my problem of the day.
I would like to display the Items per page at the top of the content block.

I'm working on a View Block, this is an Exposed Filter with "Better Exposed Filter".
For now, I'm doing this the dirty way with jQuery and a unstable DOMSubtreeModified bind.
I have a twig with {{ exposed }}, but Drupal doesn't suggest me any deeper twig and if I had one, it wouldn't access the Content div I guess. So I have no idea about how to do this.

Here is the div organisation :

    div.exposed-block

        form.views-exposed-form

            Filter-1
            Filter-2
            Items-per-page (select)

    div.view-block (with my content)

So, the idea is to move Items-per-page to div.view-block.
Or into another that I can create, here is the twig part :

    {{ exposed }}

    {{ rows }}

How would you do this ?

Thanks in advance.


texts:
In what format drupal stores the data in config tables ? is it a json ?

Can i parse it with a online json parser ? or is there any other method ?

sample configuration data :

a:10:{s:4:"uuid";s:36:"52c29e86-0ed2-4927-b801-1e1741951d4f";s:8:"langcode";s:2:"en";s:6:"status";b:1;s:12:"dependencies";a:0:{}s:5:"_core";a:1:{s:19:"default_config_hash";s:43:"dJ0L2DNSj5q6XVZAGsuVDpJTh5UeYkIPwKrUOOpr8YI";}s:2:"id";s:13:"authenticated";s:5:"label";s:18:"authenticated user";s:6:"weight";i:1;s:8:"is_admin";b:0;s:11:"permissions";a:91:{i:0;s:10:"clone node";i:1;s:15:"clone own nodes";i:2;s:15:"access comments";i:3;s:13:"post comments";i:4;s:21:"skip comment approval";i:5;s:18:"edit field_fwd_acl";i:6;s:19:"edit field_p_access";i:11;s:26:"edit field_p_businessowner";i:14;s:24:"edit field_p_destination";i:16;s:20:"edit field_p_garefid";i:18;s:15:"edit field_p_lb";i:19;s:22:"edit field_p_lbmembers";i:21;s:19:"edit field_p_lbping";i:22;s:21:"edit field_p_lbprefix";i:25;s:28:"edit field_p_lbstickysession";i:27;s:25:"edit field_p_maintaccess2";i:31;s:20:"edit field_p_project";i:34;s:16:"edit field_p_sla";i:36;s:19:"edit field_p_somail";i:38;s:25:"edit field_p_template_tnv";i:42;s:21:"edit field_p_weblogic";i:43;s:19:"view field_p_access";i:48;s:26:"view field_p_businessowner";i:51;s:24:"view field_p_destination";i:53;s:20:"view field_p_frontip";i:54;s:20:"view field_p_garefid";i:56;s:15:"view field_p_lb";i:57;s:22:"view field_p_lbmembers";i:59;s:19:"view field_p_lbping";i:60;s:21:"view field_p_lbprefix";i:63;s:28:"view field_p_lbstickysession";i:65;s:21:"view field_p_location";i:66;s:25:"view field_p_maintaccess2";i:70;s:20:"view field_p_project";i:73;s:16:"view field_p_sla";i:75;s:19:"view field_p_somail";i:77;s:19:"view field_p_status";i:78;s:25:"view field_p_template_tnv";i:82;s:21:"view field_p_weblogic";i:83;s:13:"view faq page";i:84;s:26:"access GA autocompletion";i:85;s:24:"access check backend tab";i:86;s:14:"access content";i:87;s:36:"create forward_proxy_request content";i:90;s:38:"edit own forward_proxy_request content";i:92;s:30:"edit own proxy_request content";i:93;s:19:"view uploaded files";i:94;s:29:"use text format filtered_html";i:95;s:24:"administer node adoption";i:97;s:19:"access take control";i:98;s:23:"administer take control";i:99;s:19:"access file browser";i:100;s:23:"administer file browser";i:101;s:29:"access Notification admin tab";i:102;s:34:"access Notification autocompletion";i:103;s:38:"bypass Notification field verification";i:104;s:25:"access backup and migrate";i:105;s:19:"access backup files";i:106;s:29:"administer backup and migrate";i:107;s:19:"delete backup files";i:108;s:14:"perform backup";i:109;s:19:"restore from backup";i:110;s:22:"access ga admin menu";i:111;s:16:"access mailusers";i:112;s:31:"access mailusers autocompletion";i:113;s:35:"access mailusers field verification";i:114;s:17:"administer blocks";i:115;s:23:"access GA admin menus";i:116;s:21:"access GA admin tab";i:117;s:30:"bypass GA field verification";i:118;s:13:"access nusoap";i:124;s:20:"edit own faq content";i:125;s:20:"revert faq revisions";i:126;s:18:"view faq revisions";i:127;s:30:"view printer friendly versions";i:128;s:20:"administer printable";i:129;s:26:"restful delete entity:node";i:130;s:23:"restful get entity:node";i:131;s:25:"restful patch entity:node";i:132;s:24:"restful post entity:node";i:133;s:40:"delete own forward_proxy_request content";i:134;s:28:"create proxy_request content";i:135;s:32:"delete own proxy_request content";i:136;s:20:"grant content access";i:137;s:21:"access private fields";i:138;s:28:"administer field permissions";i:139;s:18:"create field_p_mem";i:140;s:20:"edit own field_p_mem";i:141;s:17:"administer search";i:142;s:19:"use advanced search";i:143;s:14:"search content";}}

I was trying to get the authenticated users list . I got the above config data

when i queried

  select * from config where name='user.role.authenticated';

When i checked the user__roles table  i have only 2 roles named

administrator and manager


texts: Why does the zen theme load javascript in the head element?

texts: Most tutorials for jQuery recommend loading javascript before the closing body tag so that the rest of the page can load first. However the Zen theme (im not sure about others) doenst do this. Why is this the case?


texts: How to pull node reference into view on a search index?

texts:
I'm wondering how to pull the node reference into a view based on a search index. I did this with my earlier product catalog by adding a relationship to the product referenced node, adding the node reference, and then rewriting my image's output as a link.

With the view set on my search index, I don't have the option to add a relationship to the referenced node, so I'm not sure where to pull the node reference from to link  the images back to their product displays.

Any advice would be appreciated.
Thanks in advance.


texts: Migrating single drupal instant to a multi-site thats live

texts:
I am having a drupal site developed and ready on my local server which is a standard drupal Installation. Back on server I have a multisite setup with 3 sites all using same database with different prefix for each site. Now I want to move this site that is on local server to replace one of the site in the multi-site online.

I am confused with the following things:

How do I export the db from a single instant and import it on server?
I only have phpmyadmin access. And all sites in multisite use same db and is prefixed.
How do I export the db from localhost with the required prefix.
Does the multisite db use all the tables I have in single instant?
Will importing the local tables to multi-site db overwrite the tables thats already there or will I have to delete the tables online first and then import?

What are the best steps to follow for my problem, I saw many conflicting info online and in this community. As I am doing this on a live site, dont wan't to break it.


texts:
I am creating a custom form which creates new nodes of type 'book'. I have been able to get the "book outline" to render on my form using

$nid = $node->nid ='nid';
module_load_include('inc', 'book', 'book.pages');
book_outline_form($form,$form_state,$node);
_book_add_form_elements($form,$form_state, $node);

My issue is when i select the drop-down for Book, it does not have "create a new book" as an option

Can someone help me with this issue? Has anyone experienced this before?


texts:
I have created a form which has only a submit button. In the submit function I am generating csv file and saving it to the files folder using fputcsv function.

But Now I need extra functionality of submit. After saving the file it should download the file also.

How to do this? Any one have some idea about this?


texts: Reading internal URLs with single backward slash instead of double (http:/ instead of http://)

texts:
Drupal is reading some internal links with single slash instead of double slashes. This is causing some pages to crash. I first noticed this when I edited a webform and saved.

I checked the settings.php file to see if it's something there, but base_URL has been commented out for the site and I can't see any reference to the domain name with a single slash.
How can I identify where Drupal might be creating these links?


texts: Calendar: How to add additional month specific calendar views

texts:
By default - calendar will create Month, Week, Day, Year views for a calendar.  The month view is for the current month.  I need to create a Next Month view as well.  Or perhaps a view for a specific upcoming month.

How can I do this?

Mike R


texts: How can I restore author and post information for nodes?

texts:
When I create a content type, I disabled showing "author name" and "posting date"; then, I created nearly 100 nodes from that content type.

Now I want to show the posting date in the node content.

When I edit the node, and enable the posting dates to be shown, everything is OK; when I edit the content type, and enable the posting date, I can't see it in node page.

It is hard to edit all nodes to show the posting date. Is there a better way?


texts: Programmatically set active facets on non search page

texts:
I'm using facet api with search api and SOLR. This all works as expected.

For non-search pages I use the views facet block and this displays the facets as required.

What I want to do though is have some of the facets pre-selected on non search pages.

For example:
I have a views page: example.com/london I would like to show facets with 'london' preselected as if I was on a search page for london.

I've tried using a contextual filter on the views facet block and it half works. It shows only the selected city BUT the facet checkbox isn't checked; and if I click any of the other facets it does not show results filtered by city...

Any suggestions how I can get this to work?


texts: How to add javascript with #attached in a node which contains a specific paragraph bundle

texts:
I need to attach js in all nodes with a specif paragraph bundle. I know how to do this with drupal_add_js, but I prefer don't use it to prevent cache problems.

I am trying with hook preprocess_entity but I don't get it, I don't know how to use the ["#attached"]

function THEME_preprocess_entity(&$variables) {
  if (isset($variables['paragraphs_item']->bundle) && variables['paragraphs_item']->bundle == "XXXXX") {
   $variables["elements"]["#attached"]['js'][] = array(
                'type' => 'file',
                'data' => 'myfile.js',
              );
      }
    }

What am I doing wrong?


texts: What is best method for token replacement within node content?

texts:
I am a newbie and have scoured forums (including this one), books, and documentation but cannot find a clear answer to this:

What is the best method (custom module? PHP within node content? other?) to replace a token within the body of a node with the value of a custom user profile field?

Use case: I need to replace text within an external URL with a string specific to the current user. I'm hoping I can put a token string into the URL within the node content, and have the token replaced with the specified value from the current user's profile.

I have not created any custom modules, but am willing to dive into it if somebody recommends a specific path to take.


texts: See my custom entity as a normal page in drupal 8

texts:
I created a custom entity with the drupal 8 console. Everything works well. However, when I am logged in as an administrator, my entity appears in an admin page instead of a normal page like for nodes.

In this case, the title and the edit links (tabs) are displayed in the gray bar of the administration.

How to make my entity appear as a node without the gray bar of aministration?

Thanks for your help.


texts: What is the purpose of using node_submit() before node_save()?

texts:
I am creating a node programmatically , In the code given in the link
http://timonweb.com/how-programmatically-create-nodes-comments-and-taxonomies-drupal-7
after creating a node,
the code goes as follows :

 $node = node_submit($node); // Prepare node for a submit
    node_save($node); // After this call we'll get a nid


texts:
I was searching around but with no clear solution for me!

I would like to add the below HTML code for all my Drupal 8 website pages:

<meta name="viewport" content="width=device-width, user-scalable=no" />

How can I do that, is there a contributed module for it ?

Thank you,


texts: Need Help Finding Permission Needed for Entity Reference Content Type field

texts:
I've got a content type called 'resources' in my drupal 7 site. I have authors who have permission to create new resources and edit all the fields.

However, I have recently added a new 'entity reference' field to 'resources'. This field is a select list and the options are 'none' (the default) or 'on the home page'. The authors can SEE this field when they edit or create a new resource, but the only option available to them is 'none'. However, as an admin I can see both 'none' or 'on the home page'. When I select 'on the home page' it puts that particular resource into a VIEW block on the home page of the site. I'd like authors to be able to do this themselves.

I've tried giving authors the permission to edit all Views settings (just to see what would happen) and it didn't help.

Here's how I have it setup:

Views Block:

Access permission, view published content
Pager: display 1 item
Relationships: entity reference: GS Resource
(identifier: content entity reference from field_gs_resource_2 - require this relationship)

Content type GS Resource:

Entity reference - select list (name: field_gs_resource)
custom permissions: admin/author all have all permissions
target type: content
Mode: simple; target bundle: GS resource

Content type Resource: (for embedding the field into the main content type used when creating resources)

Entity reference - select list (name: field_gs_resource_2)
custom permissions: admin/author all have all permissions
target type: content
Mode: simple; target bundle: GS resource

Does anyone have any idea how to give the author the permission they need to edit this field when creating a new resource?


texts: How can I prevent users from inputting URLs into a field?

texts:
I'm pretty sure this is a dupe of a question from a couple weeks ago but I've been searching for about 15 minutes and I can't find it (somehow forgot to favorite it).

I want to prevent users from inputting their e-mail addresses or URLs into a text field.  How can I automatically reject such submissions?

On the Plain text input filter, there is an option to Convert URLs into links, which also converts e-mail addresses into links.  But what I want to do is remove all URLs, including e-mail addresses, that would be converted via this option.  Is that possible?


texts:
Hi I am a new drupal coder working a project and making fairly good progress with views an such but i am having a hard time with a specific request.

I need to build a block to display a list of stats in various locations

number of registered users

number of tags uses on a certain content type

number of posts of a certain content type

number of comments contained on all posts of a certain content type

number  of revisions on all a certain content type

I am not sure how to get the above data into views.

I would greatly appreciate if somebody could point me in the right direction.


texts:
I have a normal field submit:

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

But I wish he had a complex wrapper without using #prefix and #suffix. This wrapper also has to pass variables.
What is the easiest way to do it? Creating a tpl.


texts:
My migration is not showing up in drush migrate-status. When I try to reimport them with drush config-import --partial --source="modules/custom/complinetmigration/config/install" I get the following error message.

  The import failed due for the following reasons:
  Unexpected error during import with operation create for
  migrate_plus.migration.complinet_xml_to_node2: migration entity with ID market_center_to_D8 already exists.


texts:
I want to add validation to the user's details form.

I've tried to use the #validate to add validation function, but nothing happens.

This is the Code:

function hotphone_checkout_form_commerce_checkout_form_checkout_alter(&$form,&$form_state)
{
 $form['#validate'][] = 'mymodule_validate_check';
}

function mymodule_validate_check(&$form, &$form_state)
{
  dpm('hererere', $form_state);
  die();
}

What am i doing wrong??


texts: How to link a view´s field to attachment´s field?

texts:
I am stuck with links in views. I need to rewrite one field of a view to a link to a field of view´s attachment.

Basicaly: view displays a grid of images. This view has an attachment. In the attachment is a list of [body]. The click on the image should navigate to appropriate [body] in the attachment.

I have set view (with exposed filter, relationships...), but I cannot think how to set up the link. I added field: nid to the attachment, but still don´t know how to link to it from the main view. Maybe I did something wrong, still learning on the go. Could you, please, help me?


texts:
Could someone please explain to me the purpose of the following piece of code?

<?php print theme('links__system_secondary_menu', array(
  'links' => $secondary_menu,
  'attributes' => array(
    'id' => 'secondary-menu',
    'class' => array('links', 'inline', 'clearfix'),
  ),
  'heading' => array(
    'text' => $secondary_menu_heading,
    'level' => 'h2',
    'class' => array('element-invisible'),
  ),
)); ?>

I have researched for quite some time and could not find an answer to it. It would seem this is in all Drupal7 themes and if removed, the "My account" and "Log out" links disappear.


texts: When while saving nodes do I have old and new vid available at once?

texts:
I'ld like to programmatically trigger some very basic email notification when a new revision of a node is being created. I want to send a link to the compare page /node/$nid/revisions/view/$old_vid/$new_vid.

But I wonder on which hook when saving a node do I have the old and the new vid available at once? hook_node_presave() looks like a dead end to me.

This question is not specifically about D7. Though it's D7 I'm using right now, I'ld prefer to find a solution for both D7 and D8.


texts: How to make a chart in Views with date as x-axis (using the charts module)?

texts:
I want to make a simple view using the Charts module.

The x-axis will be a custom field of type Date that I want to show in Y-m-d format and grouped by the same date. The y-axis will be NID with COUNT aggregation.

This seems so easy but the problem is the aggregation of the date field. Apparently, views doesn't like to aggregate those kind of fields. Tried Views Date Format SQL but this only works for core date fields (Posted Date, Updated date...)

So, is there any other way to do this?


texts: Drupal changes language after clicking html link

texts:
Based on the internationalisation module i have my site set up in two languages.

My problem is when ever i click a link which i created with html.
e.g.

link

As soon as i arrive on my page after clicking the link, the language will change.

I have tried:

link

However then drupal changes the link to:

link

resulting in a page not found.

What should i add to my html link to stay in the selected language?


texts: How to get Drush in my path in Windows 10?

texts:
I have Drush 9 installed on Windows 10.  I installed it via Composer using Lando.

I want to put this drush in my system path so that I can use it from cmd.exe, Powershell, and so on. I want to do this because I am trying to run Drupal Behat Extension tests with the Drush driver, which requires drush to be in the path.

What I tried

Windows 10 Control Panel -> System -> Edit environment variables

Under "User variables for MYUSERNAME", I added:

Variable: LANDO_FRIENDS
Value: C:\pathtowebsiteinstalledbycomposer\vendor\bin

Then I rebooted and tried to run drush:

  drush : The term 'drush' is not recognized as the name of a cmdlet,
  function, script file, or operable program. Check the spelling of the
  name, or if a path was included, verify that the path is correct and
  try again.

So then, from PowerShell, I changed to the \vendor\bin directory and ran ./drush.  This opened up a prompt How do you want to open this file?

I don't understand why this is happening.

Here's what does work:

I can run drush from Powershell using lando, i.e., lando drush status.
I can open up a bash shell with the Windows Linux Subsystem and go to /vendor/bin and enter ./drush, which causes drush to load normally.

So drush is definitely installed, but how do I use it from Powershell/cmd.exe?


texts: How can I show comments on nodes displayed in a view?

texts:
I've got a content type with comments enabled for each node, and I've created a view that will just display all nodes of this type.

I'd like it for users to be able to add and view comments in this view. Currently, one solution is to set
Row Style: Nodes, which gives me the full node and the comments; however I want to be able to tweak and control what is displayed on the node (such as shorten the date format, remove some fields).

The other alternative I've tried is to set Row Style: Field, which gives me control on what fields to display, but I can't see any way of getting comment functionality to appear.

What's the best way to address this problem?


texts: How do I prevent a Node from being deleted?

texts:
I want to make some checks and, under certain circumstances, prevent a node from being deleted.

My module makes checks in HOOK_form_BASE_FORM_ID_alter() when the node is being created, but I cannot see where I can get control when the node is being deleted.


texts:
I use taxonomy_get_term_by_name() in one of my modules, and it throws a Undefined function exception.
My best guess is that this is due to Drupal core system not being ready for function calls. I've looked all over and I can't find any way to check when the core system is ready for function calls.
Do you have any suggestion?
The module uses require_once to get the file with the function mentioned above.
The content of the file calling taxonomy_get_term_by_name() is the following.
/**
 * Implements hook_init().
 */
function functions_init()
{
    get_tids();
}

function get_tids()
{
    $terms = ['term1', 'term2', 'term3'];
    foreach ($terms as $term) {
        $result = taxonomy_get_term_by_name($term);
        $GLOBALS[$term] = key($result);
    }
}

This was not an issue when the module was developed, but with a few days of downtime on localhost and a reboot, this started happening.
There is near certainly a workaround through use of EntityFieldQuery,  but I would like to know whether it is possible to check Drupal 7 core availability, which would be useful/needed in other situations.


texts:
How can I get a breadcrumb path by providing $nid?

Example

$nid = 116;
$breadcrumb = breadcrumb_get_crumb($nid);

I have a node type that is always associated with another node, and I want to use that node's breadcrumb trail for this node too.


texts: Fatal error: Unsupported operand types in includes\common.inc on line 3022

texts:
I have upgraded Drupal 6 to latest version 6.36 and PHP to 5.6. I am getting Fatal error saying;

  Unsupported operand type while accessing admin/content/node.

Which is actually nothing but simple addition of an array to variable;

$elements += array('#title' => NULL, '#description' => NULL);

Any help?


texts: I have to manage a rather large site which has problem with cron (white space of death on cron.php and 'segmentation fault' in drush). I could not fix the ong standing problem. Someone has suggested to do the cron job in several steps whcih can also hopefully pinpoint the problematic tables. I am wondering how to do the incremental cron and appreciate your help.


texts: Drupal 7, Is there a module that detects file structure changes?

texts:
Recently one of my clients sites was hacked and hackers uploaded a few directories and files into the web root folder.

I'm looking for a module or a method that has the ability detect file structure changes in the web root of drupal and any sub folder. In the end I want it to be able to email me when files get added or directories get made.


texts: Display additional fields from included content with Entity Reference field

texts:
I'm building a site in Drupal 8 using a content type for products, and I want to show for each product, some "Related Products" that are set in an entity reference field called field_related_products.

Each related product wants to show the title and link (as the field works by standard), but also include the product image and price (defined in fields against each piece of content).

Is there a way to alter the output of the field to do this?

I've seen also that views might be a route to take, but can't seem to get contextual filters to work - the closest I've come is displaying all content that is included as a "related product" throughout the site, which feels a large portion of the way there, but whatever combination I try with contextual filters/default values, it just seems to remove all my results.

Thanks for any advice.


texts:
My theme requires multiple modules to be install before it is fully functional. How can one set module dependency in a theme, so that when a user enables the theme, it will also enable the required modules? So far, I tried to specify the dependencies in the .info file of the theme, however, no success:

dependencies[] = some_module

Any help is much appreciated.


texts: How can I let anonymous users comment only once?

texts:
I'd like anonymous users to be able to comment only once on a node. I thought about checking whether there's already a comment from the user's IP-adress and, if yes, hiding the comment form, but I don't know how to do that.

How can I achieve this?


texts: How do I view the user registration form (as a page/node) while signed in as Admin.

texts:
I can see the user registration form fields at Administration/Configuration People/Account Settings/Manage Display/User Account, however I cannot find a way to display this information as it would appear on a Drupal page/node. What am I missing?

Hank


texts:
I can't get drush to bootstrap my script. I'm using version 5.9.

Below is my test script (test.drush):

#!/usr/bin/env drush

$site = drush_sitealias_get_record('@site1');
_drush_sitealias_print_record($site);

$result=drush_invoke('core-status');
drush_print($result['output']);

while ($arg = drush_shift()) {
  drush_print($arg);
}

And I have the aliases defined in ~/.drush/aliases.drushrc.php (see end of post).

When I run test.drush @site1 it doesn't bootstrap the script with site1. It has access to the alias because it can output the site record. Also it outputs @site1 as an argument. It should remove @site1 from the argument list and bootstrap it but it doesn't.

Below is the output:

$aliases['site1.local'] = array (
  'root' => '/Users/mark/Documents/drupal6',
  'uri' => 'http://site1.local',
  '#file' => '/Users/mark/.drush/aliases.drushrc.php',
);

 PHP configuration     :  /private/etc/php.ini
 Drush version         :  5.9
 Drush configuration   :
 Drush alias files     :  /Users/mark/.drush/aliases.drushrc.php

@site1

BTW running drush @site1 status on the command line works fine

Also, is there any way to change the current site in a script. When I use:

drush_invoke('use', '@site2')
$result=drush_invoke('core-status');
drush_print($result['output']);

it doesn't apply to the subsequent drush commands but it does the next time you run the script.

aliases.drushrc.php:

$aliases['site1'] = array(
  'root' => '/Users/mark/Documents/drupal6',
  'uri' => 'http://site1.local',
  'db-url' => 'mysql://user:password@127.0.0.1/site1'
);

$aliases['site2']=array(
  'root'=>'/Users/mark/Documents/drupal7',
  'uri'=>'http://site2.local',
  'db-url'=>'mysql://user:password@127.0.0.1/site2'
);


texts:
I have about 20 sites that have a common translation. I don't want to go into admin of each site each time the po-file is updated.

Is it possible to import a po-file using Drush?