texts: How to set value of autocomplete deluxe via AJAX?

texts:
I am using https://www.drupal.org/project/autocomplete_deluxe in Drupal 8.

function custom_module_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['field_all_value']['widget']['value']['#ajax'] = [
    'event' => 'change',
    'callback' => 'get_ajax_callback',
    'wrapper' => 'edit-field-test-wrapper'
  ];
}

function get_ajax_callback(&$form, FormStateInterface $form_state) {

  $form['field_test']['widget']['target_id']['#default_value'] = 'A, B';

  return $form['field_test'];
}

On checkbox check I have to fill all the values in auto deluxe form field.


texts: How can I avoid that users vote for their own posts?

texts:
I want to avoid that users can vote for their own posts, as it happens on Stack Exchange sites. For this, I created the following rule:

ON event "User votes on a node", the condition is "execute PHP code" and the code is the following one:

global $user;
return $node->uid != $user->uid;

Still, users can vote on their own posts. What should I do?

Using the following code, I get an error message given below.

global $user;

dpr($user);
dpr($node);

return $node->uid != $user->uid;


texts: audiofile throwing error on file size even though settings changed

texts:
An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (2 MB) that this server supports.

Every time try to upload 8mb mp3 I get the above error even though have changed settings in field edit from 2 MB to 20 MB and using unmanaged VPS with plenty of space and memory plus php.ini file increased.


texts:
First, I apologise for this question, it'll probably look very simple to a lot of you, but I am quite new at this and can't seem to figure it out.

I am working on a project that requires that I import a lot of data from a wordpress site. For that I want to use wordpress migrate. This module recommends me to use drush to transfer the data.

After having had quite a lot of problem installing it (thank you windows) I finally managed it. Now I'd like to use drush on one of the projects that's in my wamp\www file.

How do I do that? I've been looking but can't find the solution

I tried the commands from this: https://www.drupal.org/node/1958170
but it says :
"Command variable-set needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
Command variable- set requires Drupal core versu=ion 6 or 7 to run."

I am working with drush 7 and I am hoping to use it on a drupal 7-*...

Please help!!!!!

==== EDIT ====

Once I'm in the right place I no longer get the "needs a higher bootstrap level".

After reading a few things to sort out my problem (and probably messing things up) it came back, even if I am inside the sites folder.

I can download new modules but cannot enable them
I cannot activate the migrate module and commands

and I don't see the PDO drivers listed when I do drush php-eval "phpinfo();"

What's wrong with drush ?


texts: Modify "head-placeholder" in html.html.twig

texts:
that's the first time I approach to Drupal or a CMS more generally but I've been working since years as FE dev.

I'm creating a theme based on a template created from scratch for the Italian Public Administration(PA) in such way to define a standard for the PA websites.

This is the template project

So I have to fully rely over the CSS and JS files provided by the theme, and can't use a base theme.

I'm struggling to understand how to change the content of the head-placehoder and the title one in the html.html.twig file

  <head>
    <head-placeholder token="{{ placeholder_token }}">
    <title>{{ head_title|safe_join(' | ') }}</title>
    <css-placeholder token="{{ placeholder_token }}">
    <js-placeholder token="{{ placeholder_token }}">
  </head>


texts: Redirection after adding new groups and gnodes using group module

texts:
I am using Group module and Drupal 8.

After adding a new group, the page will be redirected to the corresponding group page(ie. /group/5) but I want to change it to be the group edit page (ie. /group/5/edit)
After relating/creating an entity in group, the page will be redirected to the gnode page (ie. /group/5/content/116) but I want to change it to be the group content page (ie. /group/5/content)

I have read this issue but I want to solve this problem using either installing modules or creating a custom module.

I am new to Drupal and programming so it is great to have some clear and complete elaboration.

Thanks!


texts: How do I programmatically render a view that has exposed filters?

texts:
I can call a view with contextual filters without any problem, but when I add exposed filter value $view->setExposedInput to the call, I just does not work, the exposed value is not applied and being ignored. The filter 'price' field is set in the views filters options and i tried both exposing it and not exposing it to visitors without any luck.
I call this view from my controller class and I need to pass the arguments to both filters and I do not need exposed form to be displayed to the user.

$view = Views::getView($view_id);
if (is_object($view)) {
  $filters = [
       'price' => 500, //my exposed filter value
     ];
  $view->setExposedInput($filters);
  $view->setArguments($args);
  $view->setDisplay($display_id);
  $view->preExecute();
  $view->execute();
  $view->buildRenderable($display_id, $args);
  $content = $view->render();
}


texts: Field and storage settings on base fields

texts:
I am rewriting my config fields (Field API fields) into base fields and I am unsure about one thing: settings.

Field API has storage and instance settings. Looking at base fields, there is the setSettings() method which I presume is equivalent of field instance settings. Then, there is getFieldStorageDefinition()->setSettings() which I presume is equivalent of storage settings.

When I look at the entity reference item and the user ID field on the node entity, the user ID field calls setSetting('target_type', 'user'), which is storage setting and not instance setting. Do I get these two wrong? What is going on?

\Drupal\node\Entity\Node::baseFieldDefinitions() contains the following code.

$fields['uid'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Authored by'))
      ->setDescription(t('The username of the content author.'))
      ->setRevisionable(TRUE)
      ->setSetting('target_type', 'user') <---- this

\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem contains the following code.

  public static function defaultStorageSettings() { <---- STORAGE, not field
    return [
      'target_type' => \Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'user',
    ] + parent::defaultStorageSettings();
  }


texts: Drupal 7 Views table style with exposed filters

texts:
I want to place my exposed views filters in a tabular format, something like below

How to achieve this?


texts: How can I force users to input a shipping address when using the Commerce Paypal WPS submodule?

texts:
I just built a store in Commerce using Drupal 7 and I am taking payments by the Commerce PayPal WPS submodule.  However, when I tested checkout, I found it was possible to buy a product without supplying a shipping address.

In the PayPal Express Checkout documentation, it shows there is an option for forcing users to provide an address.  However, the WPS documentation is less comprehensive and does not include any information about whether it is possible to force a shipping address to be displayed or not.


texts:
Is there a way to unpublish a node if a user selects an option from a select list in field?

I have a field that has a list of cities. What I would like is if the user selects a certain city like London for example, the node is automatically unpublished so it can be moderated.

I have been trying with rules but every time I test my rule nothing happens so I'm sure there is something wrong with my rule or maybe there is an easier approach?


texts:
I am struggling to get the appended parameter from the url when redirecting an entityform.

I have an entityform that user can get to from multiple pages on the website. I want to redirect the user back to the page they came from versus just sending them to a generic landing page after filling out the form.

I can get the path into the url - www.website.com/form-page/?source=page-I-came-from
However, when I go to redirect them, What do I put into the redirect field so it redirects them to www.website.com/page-I-came-from

I have tried:
%get[url]
%get[q]
[url:absolute]
[url:path]

If I put [current-page:url] I get the entityform page url - How do I get the path from the url from the referring page to show up. I have tried many things and I am falling short.

I have not found anything that can help me to get this to work and I have spent hours trying.

Please does anyone know how I can do this?


texts:
I have a node template but instead of outputting $content, I want to have more control over what the template displays by printing each field individually.

Below are the fields I want to include:

$title
field_img
$body

What code would I replace  with? Also, are there any significant disadvantages to using this method?


texts:
Is there any example how to set up form element with type file to upload it via AJAX. I want to be same as field image in node type article.

thx


texts:
I have a menu that renders different items based on the entity association of the node being rendered.
I've been trying many difference combinations of cache configurations for my custom block:
        return [
            '#theme'      => 'my_custom_menu',
            '#menu_items' => $menu,
            '#cache'      => [
                'keys'     => ['custom_menu', $node_id],
                'contexts' => ['route.name'],
            ],
        ];

This will work once when i flush the cache. But navigating to a different page, with a different menu association returns nothing in the block html. I've had this sporadically happen with local, but more consistently happen on Pantheon. I installed the https://pantheon.io/docs/modules#advanced-page-cache module but it doesn't fix anything.
I've tried url.path, i've tried just the contexts array, just the keys array. Nothing works.
Anyone come across this?


texts:
Is there any way to check for differences with config in Drush 8?

I checked the list of drush 8 config commands and I couldn't find anything.

The reason I need this is that I have a site that runs behat tests via CircleCI, and sometimes I need to import the configuration more than once.  So, I wanted to write a bash script that uses Drush to check whether there are any configuration differences, and if so, automatically re-imports the config in a loop until there are no more differences.

I'm stuck on Drush 8 because the behat extension only supports Drush 8.


texts:
I have several vocabularies some of which are related to the same concept. Ex:
- Car
- Bicycle
- Boat
- Tags
- Countries

In the above example, Car, Bicycle & Wheel could all relate to "Vehicles".
I would like to group these vocabularies in order to pull out all vocabularies related to Vehicles...

Is there any way I can add this relation ?


texts: How to change the format of Last seen: in author pane in advanced forum?

texts:
I have installed Advanced forum and Author pane module. Now, I did found the option of date format for Joined:__________, But not able to find the date format for Last Seen:________, The Last seen option shown very granular details like, Last Seen: 1 min 20 sec ago, I just want like,

Last Seen: 1 min ago

Last Seen: 2 hr ago

Last Seen: 1 day ago

Last Seen: dd/mm/yyyy


texts: Block loaded via AJAX needs to use $_SERVER['HTTP_REFERER'] but cannot because that is the page itself

texts: I'm caching my site and blocks but using the AJAXblocks module to load a dynamic module that I do NOT want cached after the cached page has already loaded. This works great, but now what I want is for that dynamic block to look at the $_SERVER['HTTP_REFERER']. Unfortunately when doing this via AJAX the referer is the page itself. I'm not very great with PHP but is there any easy way to look at the page's actual referer after loading this via AJAX?


texts:
I have created a page in Views, and the path is node/%/images. Now I want to put a dynamic link in the header. I want to link to http://www.example.com/node/add/album/[nid], where "[nid]" is the node ID of the node being viewed. How can I do this?

How do I add HTML tags to it? I want to make it as a image button.


texts: How to remove subdir from base URL after installing site with Composer on a shared host?

texts:
I've managed to install drupal 8 using composer and following script:

composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --stability dev --no-interaction

I decided to use composer since it seems to be the new way and you get all the dependencies with it.

But the structure is different then installing drupal by downloading it to the server. And that's my problem.

I'm using shared hosting and before composer everything landed in the folder public_html. But with composer there's a folder called web inside public_html that holds drupal itself (or at least it seems that way to me). So instead of having a url like www.mydomain.com I end up with www.mydomain.com/web to reach the site.

My question is how do I do to hide /web from the url? Or do I do something when installing via composer?

I've done a temporary solution that hides /web just from the frontpage. Had to create a new .htaccess in public_html which included following:

RewriteRule ^$ web/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /$1 [L]

But as soon as you click on a different page the /web is there again.

Any hints or of course answers are most welcome.

Thanks //Tobias


texts: Out of the box the date field can accept a 'from' and 'to' date parameters and the 'to' date field will auto update when the 'from' field changes. As work has progressed on my site the field no longer automatically updates. Any idea as to why this would happen?


texts:
I'm finding a lot of resources for 7 but not much for Drupal 8.

I'm displaying a content type with a date field in a view. I'd like a dropdown that presents users with a list of years for filtering purposes.

When I add that field as a filter I'm presented with two options:

A text input date, preferably in machine-readable format
An offset from the current date, also text input

Neither of these are very useful in an exposed filter. Is there a way I can filter only on the year using a dropdown?


texts: Invalid datetime format for a field never submitted?

texts:
I'm working my the edit page for my mobile app which is fetching data from a Drupal site. I'm fetching data, I'm editing it, and submitting it. However, when submitting back, I'm getting Internal Server Error : An error occurred (22007): SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2009' for column 'field_yapim_yili_value' at row 1 but I'm not even fetching that field. It's a field collection, if that matters. In fact, I even grep'd my codebase for that field, it doesn't even exist. I checked the content type, it's not required. Any ideas how I can debug this?

UPDATE: Below is what I have in Chrome development tools network tab

node[type]:oyuncu
node[title]:Ergün YOLSUZ
node[language]:und
node[field_tc_kimlik_no][und][0][value]:1737769758
node[field_sgk_durumu][und][value]:devam_ediyor
node[field_kategorisi][und][0]:oyuncu
node[field_kategorisi][und][1]:yardimci_oyuncu
node[field_telefon][und][0][value]:05352107332
node[field_telefon_2][und][0][value]:02122111048
node[field_adres][und][0][value]:Mecidiyeköy mah Şehit Ertuğrul Kabataş Cad.
node[field_yasadigi_sehir][und][value]:34
node[field_e_posta][und][0][value]:ergun@magicleaves.com
node[field_cinsiyet][und][value]:bay
node[field_gogus][und][value]:75
node[field_bel][und][value]:96
node[field_kalca][und][value]:116
node[field_dogum_tarihi][und][0][value][date]:1 Nis 2016
node[field_boy][und][value]:170
node[field_kilo][und][value]:75
node[field_goz_rengi][und][value]:kkahve
node[field_ten_rengi][und][value]:esmer
node[field_ayak_no][und][value]:46
node[field_egitim_duzeyi][und][value]:Lisans
node[field_oyunculuk_egitimleri][und][0][value]:-
node[field_diller][und][0][value]:Almanca, İngilizce, Türkçe
node[field_beceriler][und][0][value]:Bateri, gitar, piyano, okçuluk, kılıç sanatları, dans, bilgisayar,
node[field_kisisel][und][0][value]:Çok acayip adamım ben. Cidden bak.
node[field_videolar][und][0][video_url]:
node[field_videolar][und][0][description]:
node[field_okudum_anladim][und][value]:0


texts: How to provide template for particular view mode?

texts:
I want to theme the search result view mode with a template.

I had it in my head that naming a template file node--article--search-result.tpl.php would do the trick, but I'm obviously wrong about that.

I realise I can do node--article.tpl.php and within this check $view_mode, but this is awkward with all the other view modes that I don't want to template.

Ideas?


texts: Features local permission issue Warning: mkdir(): Permission denied in features_export_build_form_submit()

texts:
When I am trying to generate a new feature on local, it runs in permissions issue beginning with

  Warning: mkdir(): Permission denied in
  features_export_build_form_submit()

There is no www-data user on local. My environment is Mac OSX Mountain Lion.

This is an extension of this question
Folder permissions, owner/groups

Which deals with a similar issue on the server level. I am looking for the response for my local.

Current permissions for sites/all/modules/features are

  drwxr-xr-x  22 myusername  wheel   748 Aug  7 16:41 features

wheel is the group and root is its user.

Thus what user should own this directory to not run in to the mkdir permissions denied issue on Drupal frontend?

Thanks.


texts:
I have a Docksal stack that includes Varnish (with the acquia Docksal stack).
I made a static HTML page in the docroot, and Varnish is caching it, as shown by the HTTP headers:
$ curl -IL http://varnish.cx.docksal/cached.html
HTTP/1.1 200 OK
Server: openresty/1.15.8.2
Date: Mon, 22 Jun 2020 09:01:45 GMT
Content-Type: text/html
Content-Length: 0
Connection: keep-alive
X-Content-Type-Options: nosniff
Last-Modified: Thu, 18 Jun 2020 10:39:03 GMT
ETag: "0-5a85962945fc0"
X-Varnish: 5 3
Age: 2
Via: 1.1 varnish-v4
X-Varnish-Cache: HIT
Cache-Control: private,no-cache
Accept-Ranges: bytes

I've set up a new Drupal 8 site, created one node, and the HTTP headers show it's not getting cached by Varnish.
With https://www.drupal.org/project/adv_varnish enabled, I get this:
$ curl -IL http://varnish.cx.docksal/node/1
HTTP/1.1 200 OK
Server: openresty/1.15.8.2
Date: Mon, 22 Jun 2020 09:02:06 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/7.3.11
X-Drupal-Dynamic-Cache: MISS
Link: <http://varnish.cx.docksal/node/1>; rel="canonical", <http://varnish.cx.docksal/node/1>; rel="shortlink", <http://varnish.cx.docksal/node/1>; rel="revision"
X-UA-Compatible: IE=edge
Content-language: en
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Expires: Sun, 19 Nov 1978 05:00:00 GMT
X-Generator: Drupal 8 (https://www.drupal.org)
Vary: X-Bin
X-Grace: 10
X-TTL: 0
X-Tag: 32f5 de19 143b 864e 4f2e e312 1baa 1f8b 88c8 e062 678c 7c65 0b6e 93b3 7d01 76fd 7c7e 09a2 476d 4999 e459 f70b 4016 fd28 67aa 5ff8 a8bc bdb1
X-Adv-Varnish: Cache-enabled
X-Varnish-Secret: 648858c54f78622c9df4c549f87d71cda274420faedc3c5de92a856cb939a914
X-Deflate-Key: b91f02cf5af93c1c9141ba365d5852c9d12df6fd39f8b5d9c3b80dc1bc1428e1
X-Drupal-Cache: HIT
Last-Modified: Thu, 18 Jun 2020 15:38:17 GMT
ETag: "1592494697"
X-Varnish: 32772
Age: 0
Via: 1.1 varnish-v4
X-Varnish-Cache: MISS
Cache-Control: private,no-cache
Accept-Ranges: bytes

Without that module enabled, I get this:
$ curl -IL http://varnish.cx.docksal/node/1
HTTP/1.1 200 OK
Server: openresty/1.15.8.2
Date: Mon, 22 Jun 2020 09:15:40 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/7.3.11
X-Drupal-Dynamic-Cache: MISS
Link: <http://varnish.cx.docksal/node/1>; rel="canonical", <http://varnish.cx.docksal/node/1>; rel="shortlink", <http://varnish.cx.docksal/node/1>; rel="revision"
X-UA-Compatible: IE=edge
Content-language: en
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Expires: Sun, 19 Nov 1978 05:00:00 GMT
X-Generator: Drupal 8 (https://www.drupal.org)
X-Drupal-Cache: HIT
X-Varnish: 98338
Age: 0
Via: 1.1 varnish-v4
X-Varnish-Cache: MISS
Cache-Control: private,no-cache
Accept-Ranges: bytes

In both cases, Varnish isn't caching the page (I'm loading it twice, and I'd expect to have a Varnish cache hit the second time).
What am I doing wrong?


texts: Selecting the child term first while using 'Hierarchical' Select module

texts:
I have a taxonomy category in the following hierarchy: Country->State->City.

Now, I have a field in one of my content types which uses the Hierarchical Select module. In the front end, users are supposed to chose the Country, based on which the states corresponding to the selected Country are auto-filled. City list is auto-filled based on the selected State.

Now, is it possible for me to allow users to select City first and then autofill the Country and State fields based on the selected city? Basically, is there a way to first select the child term, and then based on that selected chose the parent term?


texts: What is the equivalent of module_load_include()?

texts:
I have a good amount of experience with D7 but not much with D8, so I'm wondering about the "proper" D8 way of doing things here.

So I've got ModuleA and ModuleB

ModuleB depends on ModuleA.

I need to call a function from ModuleA inside of ModuleB.

In D7, this was done by module_load_include(), and D8 appears to have both this function as well as the ModuleHandler class.

I am trying to instantiate this class and use the load method, but it is throwing an error because I am passing nothing to the constructor:

$module_handler = new \Drupal\Core\Extension\ModuleHandler;
  $module_handler->load('ilib_connect');

TypeError: Argument 3 passed to Drupal\Core\Extension\ModuleHandler::__construct() must implement interface Drupal\Core\Cache\CacheBackendInterface, none given, called in /var/www/company/web/modules/custom/ilib_sso/ilib_sso.module on line 31 in Drupal\Core\Extension\ModuleHandler->__construct() (line 109 of core/lib/Drupal/Core/Extension/ModuleHandler.php).

So I'm not passing anything currently to the constructor (not sure what precisely to pass), and calling the method statically is not a problem, because the load() method references its object and thus causes this error:

Error: Using $this when not in object context in Drupal\Core\Extension\ModuleHandler::load() (line 122 of core/lib/Drupal/Core/Extension/ModuleHandler.php).

So how am I supposed to use this particular class? Or should I just use module_load_include()?

What is the Drupal 8 way of doing things?


texts: Panels variant selection rules using query string in the URL

texts:
I need a variant in Panels' selection rule of "String: URL path" to be related to the the query string of the URL:

Variant 1 - String: URL path = mypath/page?querystring=1

Variant 2 - String: URL path = mypath/page?querystring=2

Surprisingly I can't find a solution for this!


texts: Migrating nodes with image- and textfield to file-entity with image and description

texts: What is the approach to convert existing nodes consisting of a multivalue field-collection-field (containing an image-field and a textarea-field as caption) to the file-entity which the media module uses?


texts: Where in the MySQL database schema is the URL alias for a group relation?

texts:
I am building a report outside of Drupal that pulls data from a Drupal 8 database.  The report shows titles of different nodes and I want to link those titles to the web page for that content.  This is working fine if I use the standard /node/X path, but I would like to use the URL alias.  I don't want the url alias of the node itself (which I did find thanks to this Which mysql tables contain the URL Alias path data? post).  Our content is related to groups, so I want to use the URL alias that is created as part of the group entity relation.

At first I checked the url_alias table, using this query to look for the node id in the source field, but I didn't find the alias set up for that node :

select u.alias
from url_alias u
where u.source LIKE '%4806%'

Then I tried to check the group tables.  I only find 5 tables starting with group in the MySQL schema, and I didn't find the URL alias for the entity reference in any of them:

group_content
group_content__group_roles
group_content_field_data
groups
groups_field_data

Does anyone know where that URL alias from the group relation is stored in the MySQL schema?


texts: How do you return an entity property of 'type' => 'struct'

texts:
I am using Drupal 7.x and have a created a custom entity. I am using the Entity API module to extend EntityDefaultMetadataController and override public function entityPropertyInfo() to add properties for displaying when my entity is viewed.

More information on  hook_property_entity_info:

http://www.drupalcontrib.org/api/drupal/contributions!entity!entity.api.php/function/hook_entity_property_info/7

I understand how to return different types of properties such as 'text', 'int', 'list', 'entity', and so on, using callbacks.  However, I have not been able to successfully return a type of 'struct'.  My field is always empty when I try to display it.

Example code:

  $info['properties']['my-structure_property'] = array(
  'label' => t('My Structure Property'),
  'type' => 'struct',
  'getter callback' => ?  // What should this return?
  'property info' => array(
    'sub_field1' => array(
      'type' => 'text',
      'label' => t('Subfield 1'),
      'getter callback' => 'entity_metadata_sub_field1_property_get', // Returns a text field
    ),
    'sub_field2' => array(
      'type' => 'entity',
      'label' => t('Subfield 1'),
      'getter callback' => 'entity_metadata_sub_field2_property_get', // Returns an entity
    ),
  ),
);

What should I be returning in my callback?  I have tried returning an object, an array...?


texts:
I have an html template variable called "sitepage" that needs to be set by a module based on node relationships.

Is there a way to set html.tpl variables from a module?

function dc_preprocess_html(&$vars)
{
    $vars['sitepage'] = '/*Insert Business Logic as described below*/';
}

The logic for what the sitepage should be is as followed:

If we are on a car model or car make page then find the car make node and check to see if there is a node reference to an Advertiser node.
Using the advertiser node, check the field "field_sponsor_site_page" to determine the site page

I can easily do this in the module code, but need to do this so I can put the variable in html.tpl.php

The way it works now:

I have 2 pages in play:

Car Detail Page: model/[Car Make Node FIELD_COLLECTION_ID]
List Cars of a particular model: makes/[Car Make Node Id]

A car make node has a node reference to Advertiser. The advertiser has a sitepage that needs to be inserted into html.tpl.php in both cases based on this business logic


texts: Highlight the argument passed in the exposed filters

texts:
I have a view page like http://localhost/drupal/myviews, which looks like in the following screenshot:

I pass arguments to this page using a URL like http://localhost/drupal/myviews/voc3; the page looks like in the following screenshot:

So all this works fine.  When the argument is passed within the URL, can I highlight that argument in the exposed filter?


texts: How to make a custom block listen to context module?

texts:
I've been creating my own module that consist an array of blocks. I plan to print them using context as oppose programatically as I already have the module on use (no need to reinvent the wheel). However, whenever I use context to display a block on a region, it always display it on the highest part of html body tag.
e.g.

<body>
  block content rendered here...

as oppose to my custom region,

<div class="l-info-bar">
  I want my block content rendered here...

I cleared the cache several times. Made sure that the context is set to display the block on info bar region.

Here's my code for reference.

    function custom_module_block_info() {
      $blocks = array();
      $blocks['my_block_top_navigation'] = array(
        'info' => t('Top Bar Navigation Menu'),
        'cache' => DRUPAL_CACHE_GLOBAL,
      );
      $blocks['my_block_avatar'] = array(
        'info' => t('Avatar'),
        'cache' => DRUPAL_CACHE_GLOBAL,
      );

      return $blocks;
    }
    /**
    * Implements hook_block_view().
    */
    function custom_module_block_view($delta = '') {
      $block = array();
      switch ($delta) {
        case 'my_block_top_navigation':
          $block['subject'] = '';
          $block['content'] = _custom_module_block_top_navigation_content();
          break;
        case 'my_block_avatar':
          $block['subject'] = '';
          $block['content'] = _custom_module_block_avatar_content();
          break;
      }
      return $block;
    }

function _custom_module_block_top_navigation_content() {
    lots of code here...
}

function _custom_module_block_avatar_content() {

   lots of code here...
}

I'm guessing you have to prep your block so context can actually place it to certain region?

Update1: I forgot to mentioned that normal blocks works on context and normal block display (only my custom block doesn't work on normal way and context—which is why I though problem lies in my coding—not context module). I also tried printing the block through code and works perfectly but I don't want extra code I don't need because I have context on use.

Update 2: I also replaced the block content with print t('TEST') and still printing above body through normal means and context. Works well printing using code.


texts: Programatically updating node immediately after creation causes PDOException

texts:
I'm working on a Drupal 7 site where nodes represent jobs in a queue. When a node is created, a custom module with hook_node_insert launches another program using exec. This program tells Drupal that the job has finished by requesting a page on the site at site.com/jobcomplete/NODE_ID/IS_ERROR. The callback for this page then does:

$node = node_load((int)$node_id);
$node->field_completed[LANGUAGE_NONE][0]['value'] = ($error == 1) ? -1 : time();
node_save($node);

The problem with this is that sometimes the program errors out almost as soon as it's started. When this happens the callback is called before the request that created the node in the first place is completely finished, resulting in 'PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded' when node_save is called.

How can I get the callback to wait for the request that created the node to finish before trying to update it? sleep() doesn't seem to work.

Thanks.


texts: Customize login block's position in page.tpl

texts:
I'm trying to position my login block in my page.tpl file. Everytime I insert the code

<?php print drupal_render(drupal_get_form('user_login')); ?>

in my page.tpl file. It throws an error. The error it throws is

  Strict warning: Only variables should be passed by reference in include() (line 79 of C:..\sites\all\themes\neptune\templates\page.tpl.php).

How can I fix this issue?


texts: How to show the Image Title Tooltip on Click?

texts: I have a carousel-view with some Images in it. Each Image Field has Alt and Title attribute. When i am hovering over the images, the title tooltip appears. Thats what i want. Additionally i want to be able to click on the image to get the same result. I guess the solution would be in Javascript, but how do i trigger the same default Behaviour like on Mouseover with a click?


texts:
I want to convert my query results from a database, which is SQL_ASCII database encoded, to UTF-8.

$result = $query->execute;
$converted_data = array();
foreach($result as $record){
    $converted_data[count($converted_data)] = drupal_convert_to_utf8($record->name, 'sql-ascii');
}

I used drupal_convert_to_utf8 but it returns blank all the time. I was confused if sql-ascii should be the second parameter of drupal_convert_to_utf8. The database encoding, where the query results is fetched, is SQL_ASCII in postgres.

UPDATE:

According to the official documentation, It

  Requires the iconv, GNU recode or mbstring PHP extension.

What are they? Am I going to install/include it or what?


texts: When using aggregation to get the taxonomy count, how can I exclude the currently displayed term?

texts:
Based on these instructions I created a view that shows the number of nodes that contain taxonomy terms from a given vocabulary.

This view is displayed as a content pane in Panels on the taxonomy page with the Contextual Filter Taxonomy term: Parent term (when the filter is not available, provide a Fixed value of 0).  This gives me a list of all terms of the same level (the sibling terms), which is what I want.  However, I don't want to show the term for the currently selected page, as that is already being displayed in Panels.

How can I exclude the term for the given page?

Example:

On the "Apples" taxonomy page:

Apples (7)
Oranges (5)
Pears (3)

-> I don't want to show the result for "Apples."


texts: Body field doesn't display in any view mode

texts:
I inserted some articles in my Drupal 7 site, the body field  doesn't display, the manage display setting is ok, I tried to change the theme.
Even though I still to display it in edit mode.
One thing is that I imported this content type with bundle copy , it's the same Article default content type with some custom fields.


texts:
I used the Drupal migration module (browser) to migrate a Drupal 7 site to Drupal 8. Even though I had to restart the migration a few times, it migrated all the users and the nodes.

I can't figure out how to migrate the images into the database. I'd like to use the new Media entity in Drupal 8, but I have no idea how to migrate the images. Considering these options: writing a custom module, using existing plugins, exporting as csv in Drupal 7 (Views Data Export) & importing in Drupal 8, or some other method.

Once I get them migrated, they will of course need to be associated with the node they are used, which relies on the user reference too.

Any help would be greatly appreciated.


texts:
I have created a view with table format but i am not able to print field variables in twig template of view suppose machine name of eck field is field_large,field_quote_source and so on.

 <ul class="bxslider">
  {% for row in rows %}
<li{{ row.attributes }}>
  {% for key, column in row.columns %}
        {% for content in column.content %}
          {{- content.separator }}{{ content.field_output -}}
          {{ content.field_large }}
        {% endfor %}
  {% endfor %}
</li>
 {% endfor %}
 </ul>


texts: How to use modified (calculated) value of a field in Drupal entity query condition?

texts:
I have a link field for a content type. I am implementing a validation where users cannot enter a domain name in the field if it has been used already. For that purpose, I need a direct way to derive domain from the field value (full url) for comparison with the domain name of the url entered.
$result = \Drupal::entityQuery('node')
->condition('type', 'ABC')
->condition('field_1', parse_url($url_entered)['host']->execute();

The problem is field_1 is a full url where as I only want validation over the domain name.
Is it possible to do using Entity Query? If not, any suggestions?


texts: What hook for triggering an action after saving a new node?

texts:
I'm running Drupal 7 and I want to re-save the user account of the node author after deleting a node of content type picture. I want to do this because I have some code called in hook_user_presave() that counts the number of pictures a user has added and saves it in an integer field in the user.

I looked at hook_node_submit() and hook_node_update(), but when then are invoked, the node is not yet saved, so if I save the user at that point, the int value is one less than it should be (because the added node has not actually been saved yet).

Is there a hook for reacting after a node has been added?

Related question: Hook for reacting after deleting node


texts: How to create a custom home page template?

texts:
I've built a few drupal sites, and always end up creating a content type for Home Page so that I can have a custom template for my home page content, however it seems excessive to have a whole content type just for this. Is there a better way to have a custom home page template?

Wordpress has the front-page template, is there something like that for Drupal?


texts: How do I create a view that shows the results of a content type related to the current page?

texts:
I have two content types on my site: "mountains" and "trip reports" with the idea being that users can create a trip report for any particular mountain they have visited.

My "trip reports" content type uses an entity reference field so that the user can select from the list of "mountains" content type.

I want to create a view to display as a block on the "mountains" pages that lists the recent trip reports associated with that mountain.  How do I structure my filter in Views?  I can either get all trip reports to show up (i.e. trip reports associated with all mountains, or none to show up!

Here's my current view setup:

Fields:

Content: Title

Filter Criteria:

Content: Published (Yes)
Content: Type (= Trip Report)

Contextual Filters:

Content: Title

Relationships:

Entity Reference: Referencing entity


texts: How to hide "Anonymous (unverified)" in views?

texts:
I have a view that lists nodes created by the site users, therefore I have a column for usernames, that specific column looks like this:

+---------------------------+
| userA                     |
| userB                     |
| Anonymous (unverified)    |
| userC                     |
| userD                     |
| userE                     |
+---------------------------+

I want like to display an empty string for Anonymous users, just like this:

+-------+
| userA |
| userB |
|       |    <--- Empty text instead of "Anonymous (unverified)"
| userC |
| userD |
| userE |
+-------+

I know I can modify the username "Anonymous" using a small custom module and hide "(unverified)" from the theme settings, but this is not what I'm looking for, I want Views not to display the username if the user is Anonymous.

Thank you.


texts:
I've a site developed with Drupal commerce.

I'm using the context filter to display a block with related products.
I want to display 4 products, first ones I've selected with entity field, if there aren't (or not enough) ones that have the same category, even if these are not enough I want ones that have the category with the same parent of my product.

To do this I used a view and set the contextual filters with Views Module Contextual Filters OR. With my contextual filter I'm able to extract the related products, then the products of the same category, but can't extract products that have the same parent category. Also I can't order my products, first related ones, then the ones with the same categories, etc.

I am attaching a screenshot for clarity.

Any suggestions?
Thank you


texts: Append parameter to URL accross all pages

texts:
I am on Drupal 7. My website will have a country select form on the first page where users will pick one country from a list. All these countries speak the same language (Spanish), so they are basically under the same language pack. My idea is to create a Vocabulary with all the countries I need. Then, in order to guarantee consistency accross pages (allowing me to filter content when necessary), I want to append a parameter to the URL like this:

path/to/my/page?country=ur

I want this parameter to be added to all the links on the menu in my website. Drupal will read the parameter currently in the URL and will append that same parameter to all URLs on the menu.

My idea is to use Rules to catch the current country code and append that same parameter to all links on the menu, both on top of the page AND on the footer (yes, there are two menu bars). What would be the code to add those parameters to each menu link? Do I have to run the code twice in order to change URLs from both top and bottom menus, or is it possible to inject the querystring into a single resource that will be pulled to build both menus? For the menus, I am using Menu Block module.

If you have a better idea to tackle this, please, suggest. Thank you!


texts:
I have a site with a webform, which when submitted sends an email. The form has a file upload which should then attach the file as an attachment to the email. I'm not getting any attachment.

I've created a hook for hook_mail_alter and tried hardcoding any attachment to be sent but every email i get has no attachment.

function my_module_mail_alter(&$message) {
  $file_content = file_get_contents('sites/default/files/tmp/test.pdf');
  $message["params"]["attachments"] = array(
    'filecontent' => $file_content,
    'filename' => 'test.pdf',
    'filemime' => 'application/pdf'
  );
}

I've debugged the MailManager.php just before the email is sent and the $message variables param['attachement'] has the valid contents from the code above.

I've instaled modules: SMTP (so i can send emails from my local), MimeMail and enabled MailSystem The emails are being sent without any issue, but again never with an attachement.

I don't know what i'm doing wrong, any ideas?

Core: 8.6


texts: A particular content type forces preview before save. How do I turn this off?

texts:
I've set up a new content type, but for this (and none of my other custom content types), it forces a preview before the save button appears.

Is there a way I can turn this off? I've looked around and can't see an obvious option to turn it off, but maybe I'm being blind. It's really frustrating.


texts: Does Google crawl Drupal sites in maintenance mode?

texts:
I'm using Aegir to clone copies of my site under a subdomain name ie test.mydomain.com.
These copies are in maintenance mode to keep away spammers and prying eyes.
I then use these copies to carry out tests and development work before committing changes to my main site mydomain.com

But am I hurting my SEO by the existence of these cloned sites? Does google crawl a sites which has been put in maintenance mode? Will it penalize me for having so many dead end subdomains?


texts: How to use view to display a list of nodes?

texts:
My site have a restaurant node type and each restaurant node has multiple menu items. Each menu item has food name, price , discount, etc.

What I want to do is creating a view that shows a list of all menu item node list which belong to a specific restaurant node.

Can anyone tell me how can I do that?

Thanks!


texts:
I have developed website which is hosted on hostgator now I want to host it on platform.sh. Could anyone give me step by step procedure to migrate my website to platfrom.sh?
I am using windows 8.1 for development. Could you please explain how to use git. Could please give step by step procedure how to use it. I am on windows platform. I am bit confused how to use it.


texts:
I have a custom module that has a form like this :

    /*
 * Sytems settings form for listing skill
 */
function skillbar_form($form, &$form_state) {

    $form['skill1'] = array(
        '#type' => 'textfield',
        '#title' => t('What's your skill ?'),
        '#default_value' => variable_get('skill1'),
        '#description' => t('Enter your skill'),
    );
    $form['skill2'] = array(
        '#type' => 'textfield',
        '#title' => t('What's your second skill'),
        '#default_value' => variable_get('skill2'),
        '#description' => t('Enter your second skill'),
    );

    return(system_settings_form($form));

}

This form will get information from user like (What's your skill ?).

FIRST : i want to redirect user after submiting this form to another form
SECOND : i want to reuse data from first form ("what's yous skill ?") and use variable's from first form to creat second form an let user to add their percentage of skill like : 90 %
Any help would be appreciate it

EDIT :


texts: Users of a specific role on a map with proximity search

texts:
I need to create a "find a doctor near you" kind of thing.  We will have registered users that when given a specific role, will be put on the find list.

Can anyone point me in the right direction for this?

And a couple of specifics:  Since the site will use Ubercart, it will be using the address field rather than location module.  So I currently have address field, geofield, geocoder and openlayers installed.  But I am having a hard time getting my head around it.


texts: How to strip html comments plus all tags inside it?

texts:
Any idea how can I remove this in $vars['closure']; ?

I tried the methods explained by kiamlaluno in this thread but I cant remove the above code in the view source using preg_replace but no luck.

//Remove omniture tags in unpublish node
  if(arg(0) == 'node' && $vars['node']->status == 0) {
    $vars['closure'] = theme('closure');
    $omnitureTags = preg_replace( "/\


texts: Display Views results in a specific order?

texts:
I have a Views result set that I would like to give a very specific order not just 'ascending, descending' or defaults.

Currently I am saving them in reverse order and sorting by date updated descending, but this is somewhat of a pain.

Any thoughts on how to do this? Existing modules? Thanks!


texts:
I have a Product content type with a list field of Groups (another content type). I would like to be able to have a 'Select All' item in the Groups list that allows the user to relate the product to all groups.

Note: This isn't the same as using javascript or ctrl+a to select all items in the list, because that approach would mean that when a new group is added it would not automatically be selected.


texts: Sensible way to rewrite a field for all views in Drupal 8?

texts:
In Drupal 8 seems one has to create 2 or 3 files plus folder structures to do even the simplest of tasks. So I am trying to figure out how to do a simple hack without all the overhead.

I have a node type for which I attached images. There is a parent node for which I want to display one of the images from the children. I created an Image field for the parent.

So literally, all I need to do is query the database, grab a child's image at random (in every view, each time the parent is viewed, I want the image re-assigned randomly), and rewrite the parent's image field accordingly. This was so easy in Drupal 7...

Does anyone have an idea of how to do this in Drupal 8 in the simplest possible manner, ideally editing just one file?

Thanks!


texts: Glossary view: Show all results separated by letter

texts:
I have a glossary view set up.  When I go to example.com/glossary/all, all of my results are shown, but I'd like them to be separated by letter. The layout I'm looking for is exactly like this...

https://drupal.org/glossary

For example..

A

Amy
Angie
Annie
Amanda

B

Billy
Bob
Ben

C

Catwoman
Cathy
Crystal
Caitlyn

Is there a way I accomplish that with Views?


texts: Can I use the Rules module to send mass emails to authors of selected nodes?

texts:
How can I leverage the Rules module to look for nodes where a CCK field has a specific value, and when found, email those node authors?

For example, if I wanted people to login and update their profile when I add a new CCK field, how would I do that?


texts: How do I add certain Fields to a View (not all fields are showing in Add list)?

texts:
I'm creating a view where I'd like to output a custom field. I am basing this off an already existing view, which already uses the said custom field.

However, when I hit the 'Add' button in the View's Fields section I do not see the same Fields as the already-built view.

Is there some way to associate the View with a certain group of Fields so that I can add them?


texts:
How I send a mail with attachments using the mimemail module? In drupal 6 it was using the function:

mimemail($sender, $recipient, $subject, $body, $plaintext = NULL, $headers = array(), $text = NULL, $attachments = array(), $mailkey = '', $send = TRUE)

But I am not able to figure out how to do this in drupal 7.


texts: How to override configuration variables in settings.php

texts:
I need to override configuration variables declared in the settings.php. How this can be possible? Any help me on?

Note: I am trying to override a custom configuration variable, not any default one.


texts: set variable in user object Recommended practice

texts:
I use a field in user account to store some user variables. These variables are not accessible by the user.
I am worrying about the efficient of using the user_load in every page in order to access the variables.
Maybe it is better to use the variable_set() ? What is the recommended procedure of setting/accessing variables in drupal?


texts: How to open external links in new window?

texts:
I'm using the "filtered HTML" text format in the node body with the "convert URLs into links" option enabled.
I would like to have all external links open in a new window. How can I do that?


texts: Drupal db_select Query to over ride empty array inside NOT IN ()

texts:
I had a query (part of a big query):

$query->add_where(1, '10',
  db_select('users_roles', 'r')
    ->fields('r', array('rid'))
    ->where('r.uid = users_node__users_roles.uid'),
  'NOT IN');

In that query there is a subquery that returns all the the rid (role id) of a specific user uid.
It will work fine if there is at least one role for a user in the role table, otherwise the subquery will return empty which will make the query:

10 NOT IN ()

How can i change the value of rid to 0 if it is empty (if the user has no roles)?

Is there any mysql case conditions to check empty of a field?

Thanks in advance.
Prem


texts: What are the various steps to contribute my own module to Drupal.org?

texts:
I wrote a custom javascript thing for the Views module but I'm not sure how to go about publishing this on drupal.org.

I know there are a lot of requirements, but what are the steps to be completed and where to publish (contribute) this module?

It seems daunting since I never contributed a module before.


texts: Best way to build bio content specific to the user

texts:
I'm creating a website where users can report on news in their area. Needless to say, I'm hoping to have thousands of users eventually.

I'm wondering what's the best way to give them a place to add/manage a biography about themselves. What should I do between the following options?

Add a field in the user profile database and call the database on my template override
Create a new content type named bio, treat it as a page and use entity/views to display the correct bio page based on the search

Originally I was going to go with the user database path, but something inside me is nagging me to treat bio's as pages for easier theming/searching. I think it's because I want the bio to be searchable like the articles are, and display as a whole page when selected without having to write a lot of backend code or more template overrides.


texts: How do I get node revisions to use my custom template?

texts:
I have a custom node template for my content type of Listing, node--listing.html.twig. It is quite heavily customised for the client. However when we go to view a revision (e.g. /node/144/revisions/273/view) it doesn't seem to bother loading a template at all, not even node.html.twig - the fields just get dumped onto the page.
Any ideas how to force it to use the custom template?


texts: How to style individual webforms with  different css class and html elements?I have a few webforms and I need different html elements like divs, spans etc and css class for each webforms


texts: How to teach PhpStorm to recognise drupal {table} SQL syntax?

texts:
I'm dealing with some really old drupal project full of SQL queries. PhpStorm's understanding of SQL is very handy however I have problems with drupalism like {table_name}. IDE complains that <reference> expected, got '{'.

How can i set up PhpStorm so that it will understand that the string inside curly braces is just a table name? Or at least make it ignore the curly braces?


texts: What are all the directories for in the new Drupal 8 structure?

texts: Drupal 8 re-arranged all the directories and locations of modules/themes etc. Where do things go now?


texts: Multilingual multisite problem after changing standard language

texts:
We have a multisite and one site is multilingual with (i18n). It contains a lot of translated views (title and standard words like "more" being translated with Views translation (i18nviews)). This works very well as long as the standard language (atm german) is not changed. If we change to another language as standard the view translations are not working anymore, which means the new language gets mixed up with the old standard language on that specific view items.

Has someone else run into this? Where is the configuration setting to get this solved?

Thanks in advance.

Background for this is, that the client wanted another language as front page (so if there's a hint how to solve this in a multisite environment other than changing the standard language, be welcome. We have tried a bunch of htaccess redirects to no avail).


texts:
I have made my custom module in Drupal. I have a link that should open a popup window.

What arguments should I pass to l() so that the generated link would open a new popup window?


texts: What are the limitations of the theming system?

texts:
Can every theme function in include/theme.inc be overridden by a template (*.tpl) file?
Can preprocess functions be used to add variables to any theme function?


texts: Add an image to a views title (Taxonomy Term View)

texts:
I have a view listing nodes of my taxonomy terms. All well and good and my view shows nodes of every taxonomy term with the taxonomy term name as the view title.

My taxonomy terms though have an image assigned to them. So is there any hook or any other way to show the taxonomy term title next to its corresponding image? Something like this?

Example image:

And here is a screenshot of the view. Notice the path that is taking the term id as a parameter to display nodes of a specific term.

EDIT: I am using the default Taxonomy Term View

Views UI


texts: Poll with multilingual choices in Drupal 7

texts:
I've installed the poll module in Drupal 7 and I want to have a multilingual poll, so that the choices could be in differents languages and sum the votes of the choices. I've found these posts:

Multi language Poll output

Poll in two languages

The problem is that I'm not able to develop the solution because I don't know where I have to apply the patch since i18n module in drupal 7 doesn't include the i18n_poll subfolder.

Thanks in advance


texts: How to configure Cloudflare module to work better with tag purging?

texts:
I've been trying to get cache purging figured out on my sites which are hosted on Acquia. I've installed Acquia Purge and the Cloudflare modules in an attempt to help with invalidating caches.
This setup works great for clearing Varnish (i.e. using drush @my-alias pinv url https://...).
However, Cloudflare is getting inundated with tag invalidation requests. I'm constantly getting "Exceeded Api limit of 1205/1200 limit purges/day." errors which blocks me from even purging Varnish.
I've looked around at the purge admin pages and I'm pretty confused with these pages.

Is it possible to setup purge so that only Varnish is purged using core tags and Cloudflare is only purged when drush pinv is used?
I found a page to configure the core tags purger. Is it a good idea to blacklist more tag prefixes here? Currently it looks like nearly every tag is is getting queued and my queue is getting large really quickly.


texts: Is adding indexes to a Drupal database safe?

texts:
I have been searching and reading about this, but I have not seen anything definitive about the topic of adding indexes to Drupal tables (both core and contrib).

My main concern is what happens with any custom indexes when you update core or contrib code and there are schema changes.  What happens in this case?

EDIT:

I think some context may help.  I am primarily concerned with adding indexes to tables to tune site performance (queries showing up in the slow query log, pages with slow views, etc).  This may involve adding an index to a table in someone else's module.  For example

I install module foo
Module foo creates table foo
I add an index to table foo
Module foo has an update that changes the schema

What happens?


texts: trigger event before content is parsed after ajax

texts:
I want to ajaxify my site. Everything, that is usally parsed as "Page Content" sould be opened in a lightbox.
So the idea is to ajaxify every link and let #lightbox be filled with the result.

but before ajax parses the request-result, I want some javascript to be done. So I want an event to be triggered after the ajax respond, and want to parse the result by myself.

any suggestions?

EDIT:

I could store the content in an hidden div#object, and use an ajax_command_invoke('body','trigger',array('myevent'))  to trigger a function attached to myevent. Does this make sense?
than I just dont know how to implement this to all links.


texts:
I accidentally update jQuery version from 1.5.2 to 1.82 using Drupal's jQuery update module.  Is there any way to rollback the update and go back to my 1.5.2 version?

Changing the option exists only in the dev version. So I downloaded the dev version and set it to 1.5.2. However, now, I am getting this message:

  jQuery could not be replaced with an uncompressed version of 1.4.4, because jQuery 1.5.2 is running on the site.

Don't know what that means, because I am not trying to run 1.4.4.


texts: Using a Drop Down and available Dates in a Content Type

texts:
I am running an event that spans a week.  During the event different vendors are able to have shows that run a few hours each.  What I would like to do is create a form for the vendors to fill out with their name, a description of the event and when it is happening.  I was originally using the date field, but it allows them to choose any date which has become a problem.

What I would like to do is have the actual days show up as a drop down with "Thursday, Friday, Saturday and the values of "3/1/2013", another one for Hour and a last one for minutes.

I figured out how to handle the views to display the information I want.  But what I can't figure out is a way to load this information onto a calendar.  I assume I have to combine all that information into a single database date field, but I can't for the life of me figure out how.

Any suggestions would be very much appreciated.  I am using Drupal 7 and, while getting better am still relatively new at Drupal.

Thank you.


texts: How do I hide nodes tagged with a specific taxonomy term in views?

texts:
I'm on d7. I  have a multi taxonomy term vocabulary that I allow users to add up to three terms. I'm using the flag term module and have a global flag set up to flag a term as hidden.
Ive set up a filter in my view that only shows nodes that have terms that are NOT flagged as "hidden".  This is working when one a node only has one term that is hidden, but when it has two or more that are not, it shows the node in my view. How can I make it so that if a node has a term flagged as "hidden" it doesn't show up in my view list even if it has another term that is not flagged?
Thanks.


texts: How can I display individual feed item images that are defined within an RSS feed (media:content tag) using Aggregator?

texts:
I'm fairly new to Drupal and as such would appreciate a bit of patience if I get lost in any in-depth explanations. :)
Currently running Drupal 8.9.7. I've been trying to get the Aggregator module to work with <media:content medium="image" url="https://mywebsite.com/myimage.jpg" width="200" height="300" /> in my RSS coming from another site.
I currently have the Aggregator Feed Item titles displaying along with their posted date in a nice listing view but now I'd like to extend this and add a small image for each feed item which the address for these images is included in the RSS. It's basically a small floating box that shows latest news stories from another site that I manage.
I understand that the Feeds module apparently can do this but since I'm on Drupal 8 it doesn't seem to even let me install Feeds (It just says Feeds is already installed which it isn't. Conflict with Aggregator?).
Is there a way that I can get these <media:content> images to display next to these feed items in my view?
EDIT FOR CLARIFICATION:
Thanks so much for the responses. Hopefully this clarifies it a bit further. Here's what I'm trying to accomplish with EACH item (different title,date,description, and image per item) coming from the single RSS feed.
WordPress Site RSS Feed:
<item>
<title>News Article 1</title>
<pubDate>Fri, 20 Nov 2020 14:10:58 +0000</pubDate>
<description>A news article.</description>
<media:content medium="image" url="https://www.myfakewordpresssite.com/wp-content/uploads/NewsArticle1Image.jpg" width="200" height="300" />
</item>

https://www.myfakedrupal8site.com Aggregator View Block:

I'd like to load the image from the URL from the remote site rather than having to store it on the Drupal site. I just need to be able to get to that URL so that I can display it in this block view. How can I go about getting to that media:content tag?


texts: How can I get comments creation date of a node and convert it to custom format in my theme, I tried to make some operations on node comments date in "MyTheme.theme" file and in MyTheme_preprocess_comment section.


texts: Extending Drupal Functionality to Custom PHP Page

texts: I have Drupal 7 site which is working fine. I added a custom PHP page to my site in the root directory of it. I want to extend the Drupal application functionality to that one page so that I can have access to the different Drupal classes and basically extend Drupal through my page. What includes do I need at the top of my page to be able to access the Drupal application as if I were within the Drupal site?


texts: Which module can be used to get the number of logged in users per day and supports views?

texts:
I need to get number of users logged in a site / per day.

For ex :

May 1 : 123 logins

May 2 : 140 logins

...

May 30 : 400 logins

I've looked into few modules like login_history and counter. Login history tracks this data, but does not support Views. Is there any module which does this out of the box ?

Thanks


texts: Search box feature for two fields to list customers

texts:
A friend of mine who I have built a Drupal site, wants a Search box feature on the Drupal homepage I.e Trade Search box, so a visitor can select a specific trade and area code and retrieve a list of tradesmen from the back-end not just the Content on the website per se.

I will need to populate the back-end with a list of trades and the Traders Post Code and make this accessible from the homepage with two search fields.

Is there a module as such, as the Search API module/views is the closest thing to what I am looking for?

Thanks


texts: How to import a live Drupal site into Acquia Drupal Dev Desktop?

texts: I would like to make some major changes to our live Drupal website. I'd prefer to do it in a safe local development environment on my laptop. What are the steps/process to exporting a live Drupal 7 and importing it into the Acquia Drupal Dev Desktop?


texts: Place to put patched module under contrib or custom

texts: I am using a contrib module which has a patch in queue to be reviewed, the patch solves my issue. Where should I keep the patched module, keep it inside contrib module or should I move it under custom module directory and keep a watch on issue till it approved and then move it again to contrib? What is the preferable place to keep such module.


texts: "Drupal\Component\Plugin\Exception\PluginNotFoundException: The 'integer' plugin does not exist."

texts:
When I try to update from drupal 8.27 to 8.35, I get the following error. How can I resolve this issue?

  Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "integer" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of C:\Users\ven_arajendra\Sites\devdesktop\offshore2-dev\docroot\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).


texts:
Does anyone know of a good replacement for the Linodef module?  We are upgrading from Drupal 6 to Drupal 7 and need to figure out a way to replace the functionality of Linodef.  I've tried updating the module, but this seems to be a daunting task.

Any help is GREATLY appreciated.


texts: How to get the row added by ajax in the right place?

texts:
I have a table form created from a custom entity:
  public function buildForm(array $form, FormStateInterface $form_state, $contract = NULL)
  {

    $form['subscriptions'] = [
      '#type'       => 'table',
    ];
    $form['subscriptions']['#header'] = [some stuff here];
//  here is the query to retrieve data from entity...
    $results = db_query($query);
    foreach ($results as $key => $value) {
      $myKey = $key * 10;
      $form['subscriptions'][$myKey]['somefield'] = ['#markup' => $value->designation];
      $form['subscriptions'][$myKey]['anotherfield'] = [
        '#type'          => 'number',
        '#default_value' => $value->$sTemp,
      ];
      $form['subscriptions'][$myKey]['addRow'] = [
        '#type'  => 'submit',
        '#name'  => $myKey,
        '#value' => '+',
        '#ajax'  => [
          'callback' => '::ajaxAddRow',
          'wrapper'  => 'my_form_wrapper',
        ],
      ];
    }

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

    $form['submit'] = [
     '#type'  => 'submit',
     '#name'  => 'submit',
     '#value' => $this->t('Submit'),
    ];
  return $form;
  }

The ajax callback:
  public function ajaxAddRow(array &$form, FormStateInterface $form_state)
  {
    $myKey = $form_state->getTriggeringElement()['#name'];
    $form['subscriptions'][$myKey + 5] = $form['subscriptions'][$myKey];
    return $form;
  }

The submitForm:
  public function submitForm(array &$form, FormStateInterface $form_state)
  {
    if ($form_state->getTriggeringElement()['#name'] == 'submit') {
        do some stuff then exit the form
    }
    else {
      $form_state->setRebuild();
    }
  }

When I click on '+' in some row, the form is displayed again with a copy of the row added to the table.
But the copy is added at the end of the table.
How can I have the copy added just after the original one?


texts: How do I remove the colon from my field labels?

texts:
I simply want to be able to remove the colon from my rendered field labels, for example:

Hotel name:
to
Hotel name

I copied field.tpl.php and removed the colon there, but no matter what Drupal refuses to accept it and is pulling the colon from elsewhere.

How can I do this with a template.php function?


texts: Drupal CMS - Find Content - how to drop the ?destination=admin/content in the edit link?

texts:
I'm using drupal 7.  When I go to the CMS at the url http://mysite.com/admin/content, the edit link for each of the content records are

http://mysite.com/node/206/edit?destination=admin/content

I want to convert the url to:

http://mysite.com/node/206/edit

How do I do this?

The reason I want to do this is because I want the user to always see the result of his work after he's saved it. Additionally, there are important Call-To-Action requirements on the /node/206/edit page that appear immediately after saving a record.  These CTA requirements are not available in the admin/content area.

Additional Info
I applied a bandaid solution for now.  I went into my admin theme at /theme/nameoftheme/page.tpl.php, then I replaced the statement

<?php print render($page['content']); ?>

with

<?php print str_replace('/edit?destination=admin/content', '/edit', render($page['content'])); ?>

Can someone please provide me with a more elegant solution, so I don't have to use this band-aid solution?


texts:
Is there a way to retrieve an arbitrary user entity via tokens inside a node field?

For example:

Let's say I have a field name Source, which contains a reference to an external news publication.

I have a user on my site named "Jane Doe".

I want to be able to put something like this in the source field.  The example is a little fudged b/c I don't think Tokens has a "link" type token, but the question is more about getting data for an arbitrary user:

New York Times, citing [user:link:Jane Doe].

And have that rendered as

New York Times, citing Jane Doe.

What I have tried

I've attempted this in the node body field (using the token_filter module).

I can get data for the current user with, such as with the token [current-user:url].

But I haven't figured out how to get data for an arbitrary user.

I've tried:

[user:url:1]
[user:url 1]


texts: How to control (rename) filename of uploaded file

texts:
I am building a site for my school.  Teachers will be able to upload their CVs.  Their files will be PDFs and I need to have them in two languages (English and Greek).  So I have a File field type with limited (2) allowed number of values.

It works alright, however I would like to control the filenames.  Ideally I would like to use their email (username) value and add a suffix.  Say if someone has the email 'myname@somewhere.com', it would be ideal to rename their 2 pdf into: 'myname_en.pdf' and 'myname_gr.pdf'.

So, no matter what filename they upload, I would like to rename it and save using the above mentioned filenames.  I understand that this might be tricky, since the email might also being given at the same time (when creating new content of type 'staff').  However, email value is required (CV is not) so can I safely assume that I have the username portion of the email value? How can I get that substring and use it to 'create' my filenames?

I am not sure such a thing is possible, I guess it might be.

I tried to search around, but found no definite solution.

This thread seems relevant, however the chosen answer points to two other, also relevant threads.

The first one is quite old (May 2012), and has no chosen answer.

The second one is from 2014, and also has no chosen answer.

I couldn't find anything else ..

I 'm new to Drupal, being using it for a couple months.  I 'm still fighting my way out of the Desert of Despair, so please show some understanding.

I feel fairly confident with twig and templates, but haven't really grasped the idea of pre-hook functions (?).  I have a feeling this is a case where I need to use them ...

There is also mention of a relevant contrib module, specifically this: https://www.drupal.org/project/filefield_paths

However, it's still in beta version for D8, released in December 2015, and its development version hasn't been updated since March 2016.

I couldn't find any other info ..

Finally, perhaps I need to mention that I have changed the default directory for all uploaded CVs, they 're all kept under a non-time specific dir with a simple title, like 'Teachers-CVs'.

Thanks for your time - any help would be greatly appreciated...


texts: Is it possible to publish from my local computer a node in my drupal page remotely?

texts:
I wonder if it is possible from a SH script on my local computer, publishing content on a remote installation of drupal.

Why have a gammu sms gateway and when a new sms on my local computer I want to be published in my drupal page.

This is an example of a script that warns of a new sms

    #!/bin/sh
INBOX=/path/to/smsd/inbox
PROGRAM=/bin/cat
for ID in "$@" ; do
    $PROGRAM < $INBOX/$ID
done

Could you do something similar to send this SMS to my remote drupal page?


texts: During a Drush pm-uninstall, is there a way to see what sql queries were run?

texts: Is there a way to find out what sql queries were run during a drush pm-uninstall module? The reason I want to find out is because I want to see if certain tables were removed during the uninstall. Sometimes modules like ubercart leave orphaned tables even though you uninstall them. I had to find the hard way after installing and testing a few other modules and see my database tables balloon up.


texts: On click of checkbox send email to selected recipients using module

texts:
 <?php
 if( isset($_POST['persons_names_Str']) && !empty($_POST['persons_names_Str']) )
  {
 $list = $_POST['persons_names_Str'];
 //print_r($list);
 //$to_arr = explode(",", $list);
 //$to = array_filter($to_arr);
 //echo $to;
 //print_r($to);
 $to = $list;
 $subject = "Test Subject";
 $body = "This is temporary email from Lawandmoney. ";
 $headers = "From: no-reply@lawandmoney.com\r\n" .
 "X-Mailer: php";

 $to =  "no-reply@lawandmoney.com";
 $headerFields = array('BCC: '.$list.', "From: no-reply@lawandmoney.com" ."X-Mailer:    php"');
 if (mail($to, $subject, $body, implode("\r\n", $headerFields))) {
 //if (mail($to, $subject, $body, $headers)) {
  echo("
Message sent successfully! our lawyer will contact you as soon as   possible
");
  } else {
  echo("
Message delivery failed...
");
  }
  exit();
  }

  ?>

  <?php
   $sql = "SELECT * FROM lawyer_details WHERE city LIKE :city AND speciality LIKE   :speciality";
   $result = db_query($sql,array(':city' => '%'.  db_like($_SESSION['selected_county']).'%' , ':speciality' =>  '%'.db_like($_SESSION['lawarea']).'%'));

 $rows_count=$result->rowCount();

 if($result && $rows_count>0)
 {
 while($row = $result->fetchAssoc())
 {
  ?>

<input type="checkbox" name="checkbox[]" id="email1" value=<?php echo  $row['email_id'];?> /><?php echo  $row['first_name'].' '.$row['middle_name'].' '.$row['last_name'];?>

<?php echo $row['street_address'];?>

 <?php

  }
  }
 else
  {
 echo "No Result Found";
 }
 ?>
 Send  Email

only just add jquery file in head section.


texts:
I have been using CKEditor, but didn't like the table editing capabilities so attempted to move to TinyMCE.  Having done this, all links now appear as plain text in the following format :

[url=http://somedomain.com/page]Page[/url]

It looks as if a filter has been dropped, or it is incorrectly configured, but I don't know how, or why. Can anybody help?


texts: It is possible get parent entity block by entity block_content? I don't know the block's machine name but I have a uuid of block_content


texts: How do I resolve a unresolved dependency error after using Composer to install modules?

texts:
I'm going to pull my hair out if I stare at this problem any longer. I've seen the similar questions and tried everything but I can't fix this issue with module dependency versions.

I'm using Composer require drupal/<module_name> and I've tried including specific versions too but that hasn't worked. I see that the current version number isn't being displayed at the end of the error message which makes me wonder whether the system knows what version is even installed?

I also don't understand how so many modules can be asking for different versions of the same dependency. How can you possibly resolve that :|

I should also add that I was in the process of converting manually installed modules into Composer controlled dependencies. I'm not sure if that would make a difference.

It really seems to me that Drupal doesn't know what versions of Modifiers and Paragraphs are installed but I don't see how.


texts: need to embed a flex slider in an image field

texts:
Flex slider is working fine on the site.
Made an example and it works fine.
I have an image field in a content type and set its display to flexslider full.
I can upload only one image (although it is set to unlimited), how can I embed the flexslider carousel in that image field?


texts: Create email everytime a webform is sent off (in custom module)

texts:
I'm trying to write some code that sends off an email every time a webform is submitted/edited.

I tried using hook_webform_component_presave() figuring I could just stick some mail code in this function and it would work... it didn't.

This is what I have

mymodule_webform_component_presave(&$component){
  mail('test@mail.com', 'subject', 'message');
}

I am aware that this can be done through a webforms setting, but that's not what I need.


texts:
I've got content type which panelized using Full page override. So I would like to attach an existing node into newly created node and assign it into the region as normally you would do this at /node/%/panelizer/page_manager/content.

How this can be achieved programatically?

So far I've the following code:

<?php
# Usage: drush scr panelizer-test.drush.php

# Input variables.
$content_type = 'my_content_type';
$node_title = 'Content 1';
$did = 811; // Hardcoded display id from panels_display table (e.g. bootstrap_threecol_stacked).

# Load ctools includes.
ctools_include('plugins', 'panels');
ctools_include('common', 'panelizer');
ctools_include('context');

// Find the node in order to attach it to panelizer.
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
  ->propertyCondition('type', $content_type)
  ->propertyCondition('title', $node_title)
  ->propertyCondition('status', 1)
  ->range(0,1)
  ->execute();

if (!empty($entities['node'])) {
  // Load the node.
  $nid = current(array_keys($entities['node']));
  $node = node_load($nid);

  // Create an empty context object.
  $node_context = ctools_context_create('node', $node);
  $node_uuid = $node_context->data->uuid;
}

// Submit Panelizer content form (/node/%/panelizer/page_manager/content).
$new_pane = panels_new_pane('node', 'node');
$plugin = ctools_get_plugins('ctools', 'content_types', 'node');
$form_state = array(
  'contexts' => array( 'panelizer' => $node_context),
  'pane' => $new_pane,
  'plugin' => $plugin,
  'values' => array(
    'nid' => "$node_title [id: $nid]",
    'override_title' => TRUE,
    'override_title_text' => 'FOOBAR',
    'override_title_heading' => 'h2',
    'links' => FALSE,
    'build_mode' => 'teaser', // or: 'full'
    'op' => 'Finish',
  ),
  'op' => 'add',
  'subtype' => array('title' => 'Existing node'),
  'subtype_name' => 'node',
  'step' => 'form',
  'wrapper_callback' => 'ctools_wizard_wrapper',
  'conf' => array(
    'build_mode' => 'teaser',
    ),
  'no_redirect' => TRUE,
);
drupal_form_submit('ctools_node_content_type_edit_form', $form_state); // And save it.
if ($errors = form_get_errors()) print_r($errors);

// Submit Panelizer main form (/admin/structure/types/manage/%/panelizer/page_manager/content)
$display = panels_load_display($did);
$layout = ctools_get_plugins('panels', 'layouts', 'bootstrap_threecol_stacked');
$renderer = panels_get_renderer_handler('editor', $layout);
$form_state = array(
  'values' => array(
    'display_title[hide_title]' => '0',
    'display_title[title]' => '%node:title (foo-bar)',
    //'panel[pane][top]' => '12867,12868,12869,12870', // See: pids from panels_pane table
    //'panel[pane][left]' => '12860',
    'panel[pane][middle]' => "12861,12862,12863,new-$node_uuid", // We need to use new pane uuid, not node's uuid.
    //'panel[pane][right]' => '12865,12866',
    //'panel[pane][bottom]' => '',
    'op' => 'Save',
  ),
  'display' => $display,
  'renderer' => $renderer,
  'layout' => $layout,
  'no_redirect' => TRUE,
);
drupal_form_submit('panelizer_edit_content_form', $form_state); // And save it.
if ($errors = form_get_errors()) print_r($errors);


texts: Rules condition: check for a product with particular value for a field in the cart

texts:
I have to aplly a custom fee if in the cart there's a product with a certain value for a field (producs with particular kind of battery). I use Commerce fees for applying the fee.

Every time the cart is updated I have to check: if there is at least one of those products the fee is applyed; if there's not (or there's not anymore) I have to not apply or remove the fee.

Removing a fee is a problem, as the module doesn't allow this.
But the bigger problem is whith rules: in conditions I can look for a particular SKU (only one) or a particular content type; instead I have to check something like this: "if there's in cart at least one product whith the value 1 for the field_battery,..."

Field_battery is a boolean field thath allow to the store's owner to flag products whith particulr battery, that require the extra fee.

I'm trying with the event "After updating an existing ordine commerce" btu I need help for conditions...

Thanks.


texts: "Allow multiple values" vs "Allow multiple filter values to work together"

texts:
In Views, when adding an Argument for a vocabulary term id, I'm presented with the following 2 options:

Allow multiple values
If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).

Allow multiple filter values to work together
If selected, multiple instances of this filter can work together, as though multiple values were supplied to the same filter. This setting is not compatible with the "Reduce duplicates" setting.

The first option is perfectly clear to me. The second, however, I'm struggling with. What exactly does it do, and how does this differ from the "Allow multiple values" option?

Can the two of these options be used together? If so, what would be the expected outcome?

Thanks!


texts: Create a Display Suite Custom Block Field Programatically

texts:
Can anyone provide sample code for a custom module and/or provide a reference for hook_ds_fields_info that utilizes 'field_type' => DS_FIELD_TYPE_BLOCK, that will actually render in admin/structure/ds/fields.  I'm working in 7.2-2.14 of display suite.

The API documentation appears to be incomplete as listed here:
http://www.drupalcontrib.org/api/drupal/contributions%21ds%21ds.api.php/function/hook_ds_fields_info/7.

I'm thinking I may be missing some sort of related render function for the block to appear (https://ohthehugemanatee.org/blog/2014/04/02/how-to-create-a-custom-display-suite-field/) however even using this example barebones in a standalone module I don't necessarily get my custom block to show.  I am referencing a custom block initially built out in a custom module.

function module_ds_fields_info($entity_type) {
  $fields = array();

  $fields['title'] = array(
    'title' => t('My Custom Module'),
    'field_type' => DS_FIELD_TYPE_BLOCK,
    'ui_limit' => array('article|*', 'audience_page|*', 'overview_page|*', 'page|*', 'product|*', 'product_overview|*'),
    'properties' => array(
      'block' => 'my_custom_module',
      'block_render' => DS_BLOCK_CONTENT,
    ),
  );

  return array('node' => $fields);

}


texts: Import CSV to nodes/entities in Drupal 8 including a UI

texts:
What’s the best solution for importing CSV files into nodes or entities in Drupal 8 that offers a UI so content editors can import regularly?

I’ve heard D8 Migrate works well but I understand there’s currently no UI for the import process.

CSV import via Feeds doesn’t appear to be ready yet.


texts:
Im using

views_embed_view('view_name', 'view_block_name', $node->nid);

and im getting error Notice: Undefined variable: node in functin include()
So in D7 We cant use $node inside page.tpl.php?


texts: Why are there two default image options in an image field

texts:
When you create a field of type image in Drupal 7, there are two default image fields.

One is in settings and the other is in field settings. There is a message with each of those two settings, but I still don't understand how they are different. In each case, they upload to the sites/default/files/default_images folder.

What is the difference between the two settings fields?


texts: How to get order information on the checkout complete page?

texts: How do you get the order information such as user's name, address, e-mail and products he ordered, on the checkout complete page on Drupal Commerce for Drupal 7?


texts: Add content in Panel page - programmatically

texts: I want to add some content in existing panel variant (Custom panel page). I want when I enable my custom module in hook_enable for example I add some content in this exist panel page. How is the best way to do this.


texts: How to copy/clone menu of a node when clone with Entity Clone module?

texts:
When cloning a node using Entity Clone module, the menu link are not copied. As menu link item is created and managed on the node form level, there is no reference of the menu link item in the node entity level.
See menu_ui_form_node_form_alter for more details.


texts: Remember field values while editing the node

texts: I have a situation where i want to get the recently added value in the field while editing the node. For example: if i have a field called name where i enter the value initially, i want the field to have the recent value when i open the node to edit it. Can anyone please let me know how do we achieve it?


texts: How to pick up where migrate_d2d_ui leaves off?

texts:
I ran into some trouble upgrading a Drupal Commons site to the latest version after it had initially been launched on a beta version of Commons 3. To work around the issues and hopefully start with a cleaner slate, I thought I'd instead try migrating the data to a freshly installed site using the Migrate and Drupal-to-Drupal data migration modules.

So far, the vast majority of what I need migrated is handled automatically just using the migrate_d2d_ui without any custom code. However, there is one important entityreference field (og_group_ref) that doesn't seem to be getting migrated.

A lot of the documentation and example code seems to be written before migrate_d2d_ui and assumes that you're defining the migration group from scratch. It's unclear to me how to augment what migrate_d2d_ui already handles. Can anyone point me in the general direction for adding just a single field to the automatically generated migration group?


texts:
I have a content type "course" and a taxonomy vocabulary "Course categories" and a Webform
"Register" the user will register by choosing the course category in select list then use the course related to this term .

Now i have a list for terms and a list for courses
The problem is i don't know how to link between the two lists so the courses list show only
the correct course


texts: How to make user as an exposed filter option in filter criteria of a normal view?

texts:
In a view, I want list of users of specific role to be exposed filter option, which will list all users of that role.

Example: What I want is in view type like order or customer of ubercart(example), I want user to be filter criteria with exposed filter option of specific role(buyer or seller). If i select one user that particular user order should be listed.

Is that possible?? If so then how?

Thanks in advance.


texts:
My employer maintains a Drupal site we did not develop so we don't fully understand it. Recently I installed Boost on the dev site, it improved page load speed tremendously, but when I installed it in Production, after a day or so links to the home page were being diverted to another page, the URL of an older site that is now superseded by a subpage within the new site. It seems that this redirect may be legacy code that is no longer necessary. In any case I located the code that generates this redirect in the html.tpl.php file. It is completely custom as the default html.tpl.php has nothing resembling it. I'm going to test removing it, but was hoping somebody might be able to offer a more knowledgeable explanation of what it is doing.  Here's the code:

global $base_url;
$href = $base_url;
$path = drupal_get_path_alias($_GET['q']);
if ($path[0] == 'awards' OR strpos($_SERVER['HTTP_HOST'], 'awards') !== false) {
$head_title = $title . ' | Alternatesite.info';
$href = "http://www.alternate_site.info/";
$is_alternate_site = true;
}
else {
$href = $base_url;
$is_alternate_site = false;
}

There is probably a way to cancel this redirect either in htaccess or Boost, which are probably beyond my pay grade. I will try removing the code first.

Thanks to anyone who can shed light on this.


texts: Theme UberCart catalog page to use custom html

texts:
Working with Ubercart 3.x on Drupal 7.

I want to theme the /catalog/1 page, where it shows my products. I want to use completely custom html that has divs nested with tables nested with divs.

I know that I can override with my own view, but I have no idea how to get the data that the existing view is using?  I want to make my own tpl.php file that will loop the products for that catalog, but I don't know which variables to access, or what functions to call.

Thank you


texts: How to get Drush to use alternative php.ini

texts:
I'm trying to get Drush up and running on my webserver via SSH. I'm new to working with SSH so hopefully someone can help me work this out. When checking Drush's status it mentions that the disable_functions are not empty.

So I copied the webservers php.ini to the .drush file but it still uses the php.ini from the webserver and not from my .drush folder.

I tried finding a solution online but can't get this to work. A couple of thigs I tried are:

Using a drush.ini file. If I add this I is found by drush and shown in my drush status. But it doesn't solve the disable_functions problem. It also shows the webserver php.ini file. So it's the php.ini first and then the drush.ini.
I added export PHP_INI="/path/to/.drush/php.ini" to my .bashrc file and when I run echo PHP_INI it shows the right path but it doesn't solve my problem. I also did the source ~/.bashrc to reload the .bashrc. But this didn't help.

This is the complete drush status:

The following restricted PHP modes have non-empty values:            [error]
disable_functions. This configuration is incompatible with drush.
Please check your configuration settings in
/opt/alt/php56/etc/php.ini or in your drush.ini file; see
examples/example.drush.ini for details.
exec() has been disabled for security reasons preflight.inc:380      [warning]
exec() has been disabled for security reasons preflight.inc:425        [warning]
exec() has been disabled for security reasons preflight.inc:380        [warning]
exec() has been disabled for security reasons preflight.inc:380        [warning]
 PHP configuration      :  /opt/alt/php56/etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home/bin/drush
 Drush version          :  8.0.3
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :

Hopefully someone can help me getting this Drush installation to work.
Thanks in advance.

Zeb


texts: Save Commerce Order and Customer Profile on validation fail

texts:
I'm using Commerce Postal Code Filter to blacklist some delivery postcodes.

When a delivery matches the blacklist validation fails and form_set_error is applied.

The problem here is that this means the Customer Order fields and Customer Profile Shipping fields are not saved.

I know this is normal, because failed validation in other tests could mean illegal entries.

For the postcode filter however, I'd still like to save data on failed validation. This will allow the client to see the user's input delivery address and telephone in order to make a call.

Any ideas how to go about this?

Ideas
- Set to validate, but change order status - could this make it serve  first checkout page?


texts: How do I reference an image inside my custom module directory?

texts:
I want to ship a default image in my custom module. I know I can reference images in the files directory with public://, but how can I properly reference my module's URL path?

Update: I need to pass this URI to image_style so a raw path to the module directory won't be enough:

  $render_image = [
    '#theme' => 'image_style',
    '#style_name' => 'blah',
    '#uri' => $uri,
    ...
  ];


texts: How can I insert search box in front html page?

texts:
I tried to show the search box in a custom front page, which is a regular HTML page.

How can I achieve it?


texts: Trigger a rule when a module update is available

texts:
It would be terrific to have Rules integration for when the Update Manager module finds an update. Is there a way to do this?

Potential ways I'd use this would be to have an update page, customized emails, adding logs in Heartbeat, and so on.


texts:
I created a view, that is simple page containing nodes of a specific content type.

It had worked before I started to translate nodes.
I added a new translation for my node and now I have duplicated entries of the same node displayed on the page.

I have solved this problem for one view with just enabling aggregation.

But with this one it doesn't work.

It outputs the same node twice. And the language is the same, but at first they have different languages.

Really, I don't understand what is going on with the translation modules, or what causes such a weird behavior. I have asked a lot of questions about translation in Drupal, and each time I try to do anything related to the translation, I get a new error.

Maybe I am going crazy, but something terrible is happening with the Drupal translation modules.

Please suggest how to deal with this ?


texts: show order payment option in order (admin/commerce/order)

texts:
I am using commerce kickstart (In admin/commerce/orders) How to show payment options for (authenticate) user. As, i give all the permission for authenticate role.

admin page screenshot show quick edit option Edit, invoice, payment, and delete

authenticate role page screenshot show quick edit here it is not option for any of the above.


texts: Overriding the User entity list_builder handler

texts:
I'm trying to override the User entity list_builder handler to add another column to the table and implement some JavaScript search functionality.

The code I'm using is below which is in my modules mm.module file.

function mm_user_override_entity_type_alter(array &$entity_types) {
  $entity_types['user']->setHandlerClass('list_builder', 'Drupal\mm_user_list_builder\UserListBuilder');
}

The issue I'm having is this code gives me the following error

Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException</em>: The &quot;user&quot; entity type did not specify a list_builder handler.

Which from what I can tell is not correct, even $entity_types['user']->getHandlerClasses() tells me the list_builder handler exists.

Why is this error happening & how best to resolve it? Or is there a better way for me to add a column & search to the user list page?


texts: How to create a page without any theme via custom module?

texts:
I created a page using a custom module, it has a template file too and it works well. But when i visit my page it shows wrapped by my default theme, it's obvious. The thing is that i would like to show that content in a clean page.

Is there a function or something that lets me do it? without modules like ThemeKey


texts:
Using the Drupal 7 tableselect form field, is there a way to attach javascript events to the checkboxes?

I am trying to build a custom pricing table that lets you add different options, which modifies the displayed total. When checking off an option, I need to pass the value through AJAX and return a new total price. Not sure though how to attach events.


texts: Can I reference field item & label in node.html.twig?

texts:
In Drupal 8, I defined a content type (say example) and made a separate template for it: node--example.html.twig.

I wonder if I can reference the item or label of a specify field in node--example.html.twig, instead of reference them in field.html.twig? By which I mean can I use something like the following, which I know is not working?

{{ content.field_example_field.label }}


texts: How to prevent the conversion of text URL to link?

texts:
I am creating a basic page having some text links as follows:

http://localhost:8080/student
http://localhost:8080
http://localhost:8080/login

D8 automatically converts this text URL to links as follows

http://localhost:8080/sutdent

http://localhost:8080

http://localhost:8080/login

I don't want to convert the text URLs to links. I also checked the text filters but did not work for me.

How to prevent this conversion?


texts:
I have a content type for events. There is an optional field where the user can provide a link that overrides the default link to the event.

For all of our internal events, the link should take website users to the node of the event. However, for events that are held elsewhere by third parties, the link should take the website user to whatever external link is official for that event.

I'm having difficulty creating a single link field in a view that is the value of the external link, unless there no value, in which case it falls back to the node link.

I can make a re-written field that is [override_link][path], but that always shows the path, no matter what. I only want the path when there is no override_link value.

This is in a Drupal 7 site.


texts: Selecting English from language selector fails

texts:
I have setup a multilingual website using the i18n and domain access modules. Each country has its own domain and on a few of these domains multiple languages are available. eg. fr.domain.com has the available languages French, English, German and Dutch with French being the default. When selecting English as a language from the language selector on this French domain the translation fails and instead either loads the domains default language or I receive a 'Page Not Found' error. I have checked that all English content is available on this domain. All other languages translate correctly when selected from the drop down.

I'm really not sure where to go from here as I'm not too familiar with i18n modules so any help would be appreciated.


texts:
Is it normal practice to write code (JS/PHP) in feature?

I was thinking that feature should contains ONLY settings, however I've read that some developers write code there and they believe it's fine.

the reason why I ask I found a video on drupalize where they write code in feature so I'm in doubt now.

Any pros and cons to that?