texts: Why drush "assume yes" -y option do not work for some commands

texts:
Drush has global option -y (or --yes) which allow you not to type y on every promt during given command execution. (There is also -n or --no option to which following applies as well.)

This works perfectly when you run something like:

drush en i18n -y

The propblem arises, for example, when you trying to run rsync in that manner:

drush rsync @staging:sites/all/themes @production:sites/all/themes -y

Drush just don't get the -y option, and prompts you for a confirmation.

What is this and how to make use of -y option?


texts: Editing nodes of a particular content type always times out and wipes out field data on the first try

texts:
Using Drupal 6.24.

So I have 2 custom content types that are almost identical set for making blog posts and news entries (essentially content for separate but similar blogs). Lately every time we need to edit one of these nodes after its creation, the save process always times out and, while the node body content is generally updated just fine in the process, all the custom field data for that node gets wiped out and we have to scramble to put it back. This doesn't happen for any other content types that we know of so far, and luckily the timeout generally only happens the first and maybe second time we try to edit a particular node at the time so we can still fix everything and make our edits eventually.

Any idea what might cause this and how to stop it?


texts: How to add existing taxonomy terms to node on saving

texts:
I've a field organization_name which is term reference with unlimited values. Whenever somebody saves the node I want to attach a few more terms in this field.

I've tried doing using hook_presave and also using submit handler of Forms API.

But the problem is that they both expect the term to be filled with plenty other values as below. Where do I get those values? From taxonomy_term_load ?

This is the dsm out of the form_state array in the form submit handler.


texts: variable_get() using "default value" with no reason in Pressflow 6

texts:
I'm currently having a problem with variable_get() that sometimes with no reason, returns the default value instead of the one from the database.
I'm using memcached here (and the Drupal memcached module, of course).

Did anybody else also have this problem?
How to fix it?


texts: Limit certain users from filling webform based on their location

texts:
I have a contact us form, that I want only users from the US to see, fill and submit.
And the other users to see that form but a message says "web form is not available in your country" if the user is from outside the sates.
Is there a module to do so? or I just have to make my own? thanks.


texts: Article view with links to other articles

texts:
So I'm trying to create a view which displays the most recent article belonging to a specific taxonomy term and pulls out just the links to other articles which have the same term.

I want to display the article content and below that 4-5 links to other articles of the same taxonomy. I want to display this view as a block.

Is this possible? How can this be done?


texts: A better solution to make image field into div background?

texts:
In Drupal 7, I want to turn my image field in Views to looks something like

so I can apply the JQuery Parallax scrolling effect. However, I'm not able to get the full "absolute path" of my image, even I use the "absolute path" on "output this field as a link" and "strip HTML tags" features. All I got is the file name, not the full absolute path.

Another issue I have is the "Global: Custom text" in fields, it does not has the text filter option, so I would not be able to write the above code.

So far, I only found the "BackgroundField" module for the replacement. Anyone know a better solution for div background image?

PS: the CSS trick only make it looks similar, they are totally differnt.

------ update info on Feb. 2 2015 : 12:58pm ---

The Views that I have is a list of node that contain Title and other fields. Therefore, each node should has their own background from image field.

------ update info on Feb. 2 2015 : 02:46pm ---

Looks like the "BackgroundField" module I mentioned above is similar to Background Images, which does not work too.


texts: How to Use aggregation:Yes with Image Field

texts:
In view having 3 field ID,Title and Image and using relationship and fetch the record according to the taxonomy value  and want to fetch the distinct result according to title .For this using Use aggregation:Yes but with image its some sql error message and without image its working fine

       SQLSTATE[42S22]: Column not found: 1054 Unknown column
    'node__field_hero_image.field_hero_image_' in 'field list': SELECT
    node_field_data_node__field_artist.nid AS
    node_field_data_node__field_artist_nid,
    node_field_data_node__field_artist.title AS
    node_field_data_node__field_artist_title,
    node__field_hero_image.field_hero_image_ AS
node__field_hero_image_field_hero_image_, MIN(node_field_data.nid) AS nid,
MIN(node_field_data_node__field_artist.nid) AS
node_field_data_node__field_artist_nid_1 FROM {node_field_data}
node_field_data LEFT JOIN {node__field_artist} node__field_artist ON
node_field_data.nid = node__field_artist.entity_id AND
node__field_artist.deleted = :views_join_condition_0 LEFT JOIN
{node_field_data} node_field_data_node__field_artist ON
node__field_artist.field_artist_target_id =
node_field_data_node__field_artist.nid INNER JOIN {node__field_work_type}
node__field_work_type ON node_field_data.nid =
node__field_work_type.entity_id AND node__field_work_type.deleted =
:views_join_condition_1 LEFT JOIN {node__field_hero_image}
node__field_hero_image ON node_field_data.nid =
node__field_hero_image.entity_id AND node__field_hero_image.deleted =
:views_join_condition_2 WHERE
((node__field_work_type.field_work_type_target_id =

:node__field_work_type_field_work_type_target_id)) AND
((node_field_data.status = :db_condition_placeholder_3) AND
(node_field_data.type IN (:db_condition_placeholder_4))) GROUP BY
node_field_data_node__field_artist_nid,
node_field_data_node__field_artist_title,
node__field_hero_image_field_hero_image_ LIMIT 11 OFFSET 0; Array (
[:node__field_work_type_field_work_type_target_id] => 15
[:db_condition_placeholder_3] => 1 [:db_condition_placeholder_4] => work
[:views_join_condition_0] => 0 [:views_join_condition_1] => 0
[:views_join_condition_2] => 0 )


texts: how to get values from two content types using one entity reference

texts:
I'm using Drupal 7 and have 3 content types -

Product
Purchase
Sales

In sales content type, I'm using entity reference I want to fetch and display "product name" from Product content type and "MRP" from Purchase content type. How can I achieve this by configuration?


texts: Adding variables to page--taxonomy.tpl.php

texts:
How do I add preprocess variables to page--taxonomy.tpl.php which will be available only to the vocabulary Project Type? I know my code below is wrong.

function themename_preprocess_taxonomy(&$vars, $hook){
    $vars['testing'] = 'It works!'; // This doesn't work :p

    // If that checks out, how to limit it only to a specific vocabulary (e.g. Shoes)?
}


texts: Why is the CSS in my sub-theme not working?

texts:
I'm a Drupal newbie, but hoping someone can assist. The site was working okay, but I've tried to implement a sub-theme and things seem to have gotten messed up.
What I was trying to achieve is to include my own CSS/JS files, and figured that a sub-theme seems like the proper way to do it. Well, I did install the sub-theme, but no CSS or JS from the sub-theme was loading (or referenced in the page anywhere). So, I played around some more and eventually stopped the entire site from loading.
So, now I'm getting "The website encountered an unexpected error. Please try again later.", and the Apache error log says:
"Uncaught PHP Exception Drupal\\Core\\Asset\\Exception\\IncompleteLibraryDefinitionException: "
 Incomplete library definition for definition 'global-styling' in extension 'my_theme'" at ..."

My theme is called "my_theme", and is meant to be a sub-theme of awesome_zymphonies_theme. Went to loads of places trying to figure out the sub-theme stuff, given the abysmal Drupal documentation, but ended up with a directory called "my_theme", under /drupal/themes/, and directories of /css/ and /js/, with CSS and JavaScript files in each, respectively, and two files: my_theme.info.yml and my_theme.libraries.yml. Permissions are all okay, and owned by apache:apache.
drwxr-xr-x. 2 apache apache   26 Mar 24 20:30 css
drwxr-xr-x. 2 apache apache   25 Mar 24 20:30 js
-rw-r--r--. 1 apache apache 1300 Mar 24 20:57 my_theme.info.yml
-rw-r--r--. 1 apache apache   86 Mar 24 20:30 my_theme.libraries.yml

The file my_theme.libraries.yml looks like this:
global-styling:
css:
  theme:
    css/my_theme.css: {}

js:
    js/my_theme.js: {}

The top portion of the my_theme.info.yml file looks like this:
name: My Theme
type: theme
description: Sub-theme of 'Awesome Zymphonies Theme.'
package: core
base theme: awesome_zymphonies_theme
core: 8.x
core_version_requirement: ^8 || ^9

#Libraries
libraries:
  - awesome_zymphonies_theme/bootstrap
  - awesome_zymphonies_theme/global-components
  - my_theme/global-styling

#Regions
regions:
  header: 'Header'
  primary_menu: 'Primary Menu'
  slideshow: 'Slideshow'
  homepagemessage: 'Home page message'
  topwidget_first: 'Top First Widget'
  topwidget_second: 'Top Second Widget'
  topwidget_third: 'Top Third Widget'
  ....
  ....

Additionally, not sure if I need to include the two lines:
  - awesome_zymphonies_theme/bootstrap
  - awesome_zymphonies_theme/global-components

... or do they get inherited from the parent theme?
So, I guess three questions there really. Any assistance would be most appreciated. Thanks!


texts: Moved Drupal 6 site to new server - can't login

texts:
I'm migrating a client's site to a different server because we're changing web hosts. The domain name still points to the old site for now and I either use an ip address or a temporary url to preview the new site. However, since I moved it, I can no longer log in, I get an "access denied" error message. Is this a known issue? How can I resolve it?

EDIT: I oddly don't have this problem when I download the site to my hard drive and run it locally.


texts: White screen after installing on Ubuntu 15.04

texts:
I got the following error while installing Drupal 8 on Ubuntu 15.04.

  Uncaught PHP Exception
  Drupal\Core\Database\DatabaseExceptionWrapper: "SQLSTATE[42S22]:
  Column not found: 1054 Unknown column 'checksum' in 'field list':
  INSERT INTO {cache_config} (cid, expire, created, tags, checksum,
  data, serialized)

I downloaded Drupal via drush dl drupal-8 --select and used the beta15 branch. The web facing install screens ran perfectly. It was only after pressing either link for visiting the site or running the update script did this error occur.

How might I begin trying to fix this?

The output of php -v is the following.

  PHP 5.6.4-4ubuntu6.2 (cli) (built: Jul  2 2015 15:29:28)
  Copyright (c) 1997-2014 The PHP Group
  Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
  with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
  with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans

MySQL version is 14.14 Distrib 5.6.25, for debian-linux-gnu (x86_64) using  EditLine wrapper.


texts:
Drupal 6 possible noob question. Is there a way to get a list of cron tasks from the Drupal 6 Admin? I am a themer for the site. The original dev is long gone. Everyone complains of slowness and 500.shtml errors. I looked in the log and noticed that these are most often associated with a cron task that runs hourly. But I can't see what those jobs are. Once I get the list is there also a way to disable unneeded tasks from within Drupal?

I'm running Windows on my client machine. I don't have DRUSH.

Thanks In Advance


texts: How to change value of a node field after a webform is submitted?

texts:
I have a content type "items" with a Select list field with the options 0|Free and 1|Reserved.

I am trying to change the fields value from 0 (default) to 1 when a certain webform is submitted (the webform gets the Nid from the url).

For this I have made (and enabled) a custom module (by following a tutorial I found) with the code below:

function reservable_item_change_status_webform_submission_insert($node,$submission) {
  if($node->nid == 5){ //my webform has an id of 5
    $nodeID = $submission->data[3]['value']['0'];
    $reservableItem = node_load($nodeID);
    if($reservableItem ->type == 'items'){
      $reservableItem->field_item_status['und'][0]['value'] = 1;
      node_save($reservableItem);
    }
  }
}

My problem is that nothing is happening. No errors, but the field status is not being changed to reserved.

I am using Webform version 3.2 because the tutorial stated it was meant for Webform 3.x. I will test with 4.x after I get this working.

Any help would be greatly appreciated.


texts: How to show all terms with are used in Content?

texts:
I have Content type: Products. It has field (Brand) on taxonomy base.
I use Views and want to see list of terms (all brand names) wich are used in my materials on the Product type base. I understand that it is possible to chose Taxonomy as base for Views building, but I want to build View on Content base.


texts: How to share a D8 configuration without the UUID limitation?

texts:
How can I share a Drupal 8 configuration (content type, custom view/menu/block, etc.) with another website without the UUID limitation?

Each site has a unique UUID, and refuses to work with the configuration file of another website. It's a big problem that doesn't allow users to share their configuration with the world.


texts: How to keep  or  tags from getting in WYSIWYG editor with ckeditor?

texts:
Seems simple, but I haven't been able to find any way to do it.

To be clear, I want ALL other tags for this text format, just not font or style tags.

Thanks.


texts: Is there anyway to upload a picture to a user image field via services without an FID?

texts:
So I want to update a user image field (let's say field_picture for the sake of convenience).

Preferably I only want to make one AJAX call rather than two, so I'd prefer to not have to create the file, get the fid back and pass that to the user.

Is there anyway to just pass in a local URI or anything like that, or do I need to essentially do two calls?


texts: How to add indexed:has taxonomy term id(with depth) in the contexual filter of view?

texts:
I have created a view and added indexed fields to that view to show content.

I want to show content related to taxonomy "related place" as well as its related child taxonomy content. For selecting child taxonomy I used simple hierarchical module, but the problem I am facing is that I'm not getting any option to select Indexed:has taxonomy term id(with depth) in contexual filter to show content .

The propose of using indexed fields in views for filtering content using facet api.

I've tried everything to achieve this, but no result.


texts: How to get a certain header on FunctionalJavascript tests

texts:
Since Drupal 9 is around the corner I'm working on puhsing some contrib modules (and a couple of my own) to be Drupal 9 ready. That involves on updating my tests to use replace deprecated code. Currently I'm working on this issue from Devel module, which replaces \Drupal\FunctionalJavascriptTests\JavascriptTestBase with \Drupal\FunctionalJavascriptTests\WebDriverTestBase but since this I cannot get headers during FunctionalJavascript.

My question what is the proper way to get them. I've checked tests in core but I just can't figure it out.

The code I'm working on is like so:

/**
 * Wait until the toolbar is present on page.
 */
protected function waitForToolbar() {
  $session = $this->getSession();
  $token = $this->getToken();
  $page = $session->getPage();

  $toolbar = $page->findById('webprofiler' . $token);
  $this->assertTrue($toolbar->hasClass('sf-toolbar'), 'Toolbar loader is present in page');

  $session->wait(1000, 'null !== document.getElementById(\'sfToolbarMainContent-' . $token . '\')');

  return $token;
}

/**
 * Return the Webprofiler token.
 *
 * @return null|string
 *   The page token
 */
 protected function getToken() {
   $token = $this->getSession()->getResponseHeader('X-Debug-Token');

   if (NULL === $token) {
     throw new PHPUnit_Framework_AssertionFailedError();
   }

   return $token;
 }

As shown the header is required in order to get an element that is generated using Javascript. Perhaps theres another workaround than fetching the header, but not sure how right now.

Thanks in advance.


texts:
I am trying to figure out how to use views to list out ALL my taxonomy terms that are grouping node titles.
Example:

Taxonomy Term 1
- Node Title 1
- Node Title 2

Taxonomy Term 2
- Node Title 3

Taxonomy Term 3
-Message: There are currently no Node titles at this time, please check back

Taxonomy Term 4
- Node Title 4
- Node Title 5


texts: Where does drupal_mail() get the return-path and sender?

texts:
I want to send a simple mail using drupal_mail(). I don't understand from where it gets sender and incorrect_mail@gmail.com as return path. From where does it get this email?

function rappel_mail($key, &$message, $params) {
  switch($key) {
    case 'informations':
      $message['subject'] = $params['subject'];
      $message['body']= $params['body'];
      break;
  }
}

function my_module_passwordOublie_envoie_password ($email) {
  $response = array();
  global $language;
  $mail_user = user_load_by_mail($email);
  if (!$mail_user) {
    return func_succes(950, $response); // just to check if mail exists
  }
  else {
    $to = 'my.real.email@gmail.com';
    $from = 'noreplay@noreplay.com';

    $params = array(
      'body' => t("hi, you've just received a drupal mail"),
      'subject' => t("test mailing"),
    );
    $message = drupal_mail('rappel', 'informations', $to, $language->language, $params, $from, TRUE);
   }
 }

This is Postman response (because I'm working with services on a custom resource that send mail using drupal_mail()).

"Return-Path": "????@gmail.com", <=== those emails are valid (mine too but i've delete this email every where it was ! )
"Sender": "????@gmail.com",<=========
"From": "noreplay@noreplay.com" <=== good one


texts: Adjust block according to stage in multi-step form

texts:
I've build a multi-step form using the following tutorial. Which is quite nice!

Can I also change a block based on the step you're in?

I'm my case I have an activity registration form, build according to the example above. Step 1: choose a location, Step 2: Choose a time, Step 3: Confirm.

I also have a custom block next to the form which has information on the activity a user is going to register for. (based on the url variables). Can I change the contents of the block according to the step the user is in?

I would think this step information needs to be passed to the block, based on the step your in, but how?

EDIT

I just tried something, but this is not going to be right
I have this hook_block_view:

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

  switch($delta) {
    case 'MODULE_info_block' :
      $block['content'] = MODULE_info_block_view();
      break;
  }

  return $block;
}

And the block construction:

function MODULE_info_block_view($test = 'testdata') {
  dpm($test);
}

In the form I can call:

MODULE_info_block_view('this is form data')

But offcourse I get two dpm messages then... Is it allowed to call the block construction somewhere in a form?


texts:
How do you get the weather module to recognise SVG files?

I have my SVGs in: /sites/default/files/icons/svg

They are named correctly: 01d.svg, 01m.svg ...etc.

and that is where I am pointing to (icons/svg) from: admin/config/user-interface/weather.

PNGs work fine, but when I switch to SVGs the display falls back to the default icon set?

Thanks.


texts: How do I define the default cache and cache settings programmically in a Kernel test?

texts:
A user provided a set of site caching configuration settings that cause some errors. For example:

$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.memcache';
$settings['cache']['bins']['discovery'] = 'cache.backend.memcache';

On top of that, the memcache module states that users must include the following in their site configuration:

$settings['cache']['default'] = 'cache.backend.memcache';

I would like to extend some core Kernel tests to run with the memcache module configured the way the user described. I can easily enable the module by adding it to the $modules array in the MyTest class. What else do I need to add to ensure the “site configuration settings” are the way the user recommends. I was hoping I could add something to the MyTest::setUp() function to change the settings, or better yet, have a dataProvider to supply a variety of settings to the test function to test against. I thought there would be something obvious in the system.performance configuration item, but it looks like cache.default is a service. Do I need to redefine this service programmically? How do I do that? The memcache module does not automatically override the cache.default service in its services.yml file.


texts: Exposed filter (by terms), only to show terms related to this content type

texts:
I'm using the Vocabulary 'Tags' in multiple content types.

I have a view showing 'Content Type A', and I want to have an exposed filter showing only the 'Tags' used in 'Content Type A', not every content type.

Any ideas on how this can be achieved would be greatly appreciated, thanks!


texts: Using webform 4.x values in other fields/descriptions on multi-page webforms

texts:
Is there a way to output values of other field values in a multi-page webform? Say I have a 3 page webform. First page is name, email, then address. How can I reference the name value in the last page of my webform? I tried [webform:val-name] and it doesnt work in the description field.

Or is there a way I can call it via javascript? Are these values stored somewhere?


texts:
I am trying to use structure_sync within my Drupal 8.4.4 project to export the block content of custom blocks as a configuration (see also the discussion "Custom blocks cannot be properly exported and imported").

Installation via composer went fine and the module also reports everything goes fine when trying the export-blocks function for example:

$ drush export-blocks
Exporting blocks...
Exported "Copyright"                                          [ok]
Exported "Social Links"                                       [ok]
Exported "Flyout"                                             [ok]
Successfully exported blocks                                  [ok]
The custom blocks have been successfully exported.            [status]

However, no configuration files were actually created in the sync_dir (or elsewhere).

Is there some other undocumented pre-requisite?


texts: How to automatically send a push notification when content is created?

texts:
I have set up and configured the Push Notifications module for a site. But, I want to automatically send a Push Notification to all the mobile devices registered in the site when content of an specific content type is created. Can this be done?

I have called the content type "alert", and the user that can send alerts doesn't have access to the administration console, where the push is sent from.


texts: Crumbs is not showing parent of taxonomy term

texts:
I’m using Drupal 7.5.2 and am attempting to use the Crumbs module (version 7x-2.5) to show parent and child paths in the breadcrumbs trail and it’s not working.

My URL alias structure—which I am attempting to recreate in the breadcrumbs—is as follows:

My Great Node Pile: A view page that is neither taxonomy term or a node.
Category: A view page that is connected to the parent taxonomy term.
Category Child: A view page that is connected to the child taxonomy term.
Node: The node associated within that parent category and child category.

Only one category—child or parent category—can be associated to a node at any given time.

My “Entity Parent” settings for all node content types is as follows; note all content is based in the path of my-great-node-pile/ which is a stand-alone view that is simply the “home base” for this stuff; it is neither a taxonomy term parent item or a child item:

my-great-node-pile/[node:field_category:parent]/[node:field_category]

So if I have a node that resides in the aliased area of “My Great Node Pile” titled “Cool Stuff” that has this parent/child taxonomy term URL structure; using Pathauto for that so do not take this pseudeo-example 100% literally:

my-great-node-pile/field-category/field-category-child/cool-stuff

Then I would expect my breadcrumb trail to be this:

My Great Node » Category » Category Child » Cool Stuff

But with the default Crumbs settings, this is the bizarre breadcrumb trail I am getting:

My Great Node » Category Child » My Great Node » Cool Stuff

What? If the entity parent is [node:field_category:parent]/[node:field_category] then why is it apprarently rendering as [node:field_category]/My Great Node?

Example Note: The names of items here—including tokens—are neutralized to protect anonymity of the project, but I assure you all tokens and examples here are proven to have the values they should have via the output of the Devel (version 7.x-1.5) module.


texts: How to search for nodes inside the boundaries of an area?

texts:
I am interested in searching for nodes inside the boundaries of an area .e.g. nodes inside "London" .How can I do that with Solr?
The existing modules only provide searning based on a radius you set.
Are there any other libraries that could help apart from drupal modules?
thanks


texts: Unable to override views-view-unformatted.tpl.php

texts:
I have a view page named latest and try to override the template views-view-unformatted.tpl.php by creating below templates in the theme folder

views-view-unformatted--latest.tpl.php
views-view-unformatted--latest--page.tpl.php
views-view-unformatted--page.tpl.php
views-view-unformatted.tpl.php

but none of them works. I clear the caches, rescan template files. I use views 3 and Drupal 7.23.

Can anyone please help me override this template views-view-unformatted.tpl.php


texts:
I searched but cannot find an answer to my question.

I'm using Drupal 7 and created content with image. The path of the content is http://example.com/page/content

My problem: I want to share the URL of the image to facebook.

http://example.com/sites/default/files/image01.jpg

But the request URL shows "404 not found".

I have set the media to show in public.

Did I miss something?


texts: How to remove unused files from directories

texts: I want to remove/delete files from site directories (e.g. /sites/default/files/*) that are not used in site. There are thousands of files that causing fillup size. Any suggestions for this?


texts:
I am developing a site in Drupal 7 and caching slows my work significantly. For example, I had a theming function for a form. I was puzzled, why doesn't it work. Until I cleared the cache and it was fixed.

How to turn it off completely?


texts:
Hello after messingabout with drupalfor about the past 8 years im finally making my first 'shop' type of website. Ive been scratching my head the last week or so trying to make it as easy for me to maintain as i can. I'll have to add a lot of products and im trying to keep the workload down. anyhow....if anyone can help or suggest a better way then id love to be privvy to the information that you have.

So i have Vendors, Products and Product Ranges. Vendors will stock differant Product Ranges and then differant products in the ranges. Ive gone for a

Content Type: Vendor (term ref: Range)

Content Type: Product (term ref: Range)

So when i create a Product Node and give it a 'Range' tax term i can then show the Vendors that sell the 'Range' beside the node via tax term argument. This all works as hoped but now im starting to run into other problems.

I was wanting to create a page view of all the Products. No problems there BUT....i need to add a filter to the view for which Countrythe Product is available in. The Vendor Content Type has a 'Country' term referance field (UK< USA, etc) Somehow i need to 'pull that' from the referanced node (Vendor) and display it on the Product Page View.

I have tried adding a Relationship of ......bah i duno what im doing any more. Any relationship i use wont allow me to assign the fields with the relationship. You'll all be as confused as i am by now and will just move on leaving me in my node relationship hell :(


texts: How to set 'html' email template for webform email setting?

texts:
Is there any way to use html email for e-mail template in webform email setting?

In my webform node I go to: node/113/webform/emails/1 to change the setting but I don't see any 'html' option. Look my capture:


texts: Views Exposed Filters loading javascript each time

texts:
I have an exposed filter with ajax enabled in a views. Every time I click different filter option it reloads the javascript. Is this the normal behavior or known issues with views 3?
Is there any way to prevent reloading entire javascript?

Thank


texts: How to layout the theme within the regions?

texts:
I'm very much beginner to the drupal and learning to themeing, and I'm confused how to make regions within the regions?

+----------------------------------------------------------+
| +--------------+                +---------------------+  |
| |              |                |                     |  |
| |    header1   |                |   header2           |  |
| |              |                |                     |  |
| +--------------+                +---------------------+  |
|                       header                             |
+----------------------------------------------------------+

page--front.tpl.php

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

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

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

And I did the change in .info file like:

regions[header1]        = Logo Area
regions[header2]        = Search bar and Navigation

But it's not displaying as the picture describes better it:

Update:

The rendered html is like this:

But What I wanted to be like this:


texts: Problem downloading Drupal with Drush - tmp directory?

texts:
I'm relatively new to Drush, but I have used it to download Drupal many times. Today, I'm getting the following error when I try to download Drupal to my local MAMP environment:

copy(/tmp/drush_tmp_1383508894_5276ab9ec3885/drupal):
failed to open stream: No such file or directory             [warning]
filesystem.inc:235
 Project drupal (7.23) could not be downloaded to /Users/timerickson/htdocs/drupal.

I can't find any basic info on the tmp directory. Where is this directory supposed to be? How do I best resolve this problem?

Thanks.


texts: How to limit search results based only on OG group membership?

texts:
I followed the tutorial about How to Create Custom Search Pages Using Just Views in Drupal 7.

I have selected the blocks option instead of page option in views as I want to add it as a block in the organic group homepage.

How do I restrict the search using relationship and context filtering in the Views settings so each logged in user can only search for published content of their group only (NOT SITE-WIDE)?

EDIT: I have already tried the following:

Contextual filters > (OG membership from node) OG membership: Group ID
Relationships > OG membership: OG membership from Node

(Which I got the idea from the default og_content view that comes with OG Groups!)

Can this be done with hooks?


texts: What's the difference between enabling Node View (and adding a variant) and creating a new Panel page?

texts:
To learn more about Panels, I've been repeatedly traipsing through screencasts by Shane Thomas and Johann Falk. Right now I find myself confused about the distinction between: enabling a copy of node_view so one can add a variant for a content type, and, creating a new panel page for that content type.

Code Karate's screencast series is directed to learning about Panels, but #129 takes a side-step into creating a copy of node_view Page (through Page Manager) to create a variant, selecting by content type. I wonder why Page manager is being used for a tutorial about Panels.

I want a page for a specific content type, but I would like to use a Panel page to get there. How do I do this?

I'm also not clear on what invokes a Panel.

Note: I've read this question/answer by @Letharion about the difference between Page manager and Panels which is a bit too high-level for me at this stage.


texts:
My question may seem vague but I'm confused and need advice on Drupal 7 media files management, so please bear with me. I'm looking for existing modules or ways to build the following functionality with minimal effort:

1) Image management. I'm building a site that is mostly text articles with a random image or two scattered here and there (an average Wikipedia article may be a good example). I want to be able to

1.a) insert scaled image thumbnails into my text and provide an explanation of what is in the image right under it (exactly as they do in Wikipedia). This doesn't seem to be standard Drupal feature when handling images.

1.b) if it is possible I also want my image thumbnails to be clickable with links leading to original unscaled images (again something that can be seen at Wikipedia, though they first lead you to another page that contains image information and copyright status).

2) Media file management. Sometimes I want to attach a file to an article that browser itself won't handle, something like .mp3 or .pdf. If I simply add a File field to an article, it won't offer any protection against anyone who decides to download it. Can I possibly make downloading a file a bit more complex - like forcing a visitor to enter captcha first?


texts: Unable to set file upload destination private when programmatically creating new content type with file field

texts:
I am creating a module to upload video to an in house media converter - as part of the module installation I create a new content type called "user video" which has a file field as part of it.

I need to set this file field so it saves to the private files directory, however I am unable to do so. I can create the content type and add the file field - but never manage to get the upload destination to be private.

Sometimes I am able to change this via the admin interface, but sometimes this option is greyed out.

I have included the code below and would be grateful for any assistance.

//Create the file upload for the video to be converted
  $field_name = 'uploaded_video';

  //  Create the field definition array.
  $field = array(
   'field_name' => $field_name,
  'type' => 'file',
  );

  $field = field_create_field( $field );

 //  Create the field instance definition array.
  $instance = array(
      'field_name' => $field[ 'field_name' ],
      'entity_type' => 'node',
      'bundle' => 'user_video',
      'description' => 'A field for uploading video and audio content.',
      'label' => 'Video to upload',
      'settings' => array(
          'file_extensions' => 'mp4 avi wmv qti mov',
          'uri_scheme' => 'private',
          ),
      'widget' => array(
          'type' => 'file',
      ),
  );

//  Create an instance of the field and bind it to the bundle.
field_create_instance($instance)


texts:
If i try to update node revision like this:

$node = node_revision_load(59);
$node->set('publish_on', null);
$node->save();

or simple save:

$node = node_revision_load(59);
$node->save();

I have a PHP memory error, (i have 1gb allocated)


texts: Duplicate webform data to second database?

texts:
I want to duplicate the results from the webform module to a second database.

Is there a convenient way to do that, or will I need to manually write all the queries to store and retrieve data?


texts: rendered entity usage in "add node" form for an entity ref field

texts:
In one of my "add node" form, I would like to display the 'name' field of referenced content type rather than the title.

Let's say, Content type 'Car' contains a field called 'owner'  which is entity ref to content type 'person'.  'person' has a unique title but also has a field called 'name'.

While displaying to the user '/node/add/car' form, I like to give the user a 'select list' for the field 'owner'.  I want to populate this field with the names of the 'person' nodes in the system and not their 'title'.

So in 'manage form display' of the content type 'car', I used 'select list' and in the 'manage display', selected for the 'owner' field, format of "rendered entity". But this displays only the title in the dropdown list in 'add/node/car'.

When that did not work, I tried using the new d8 feature,'display mode'.  I created a display mode called "nameview" and created a "nameview" display for content type 'person' which displays only the field 'name'.  I then used that view mode in the "manage display" for 'Car'. Still I get only the titles in 'add/node/car'.

What am I doing wrong? or is this a bug in d8?


texts: How do i increase length of existed link title field in Drupal 8?

texts:
I want to increase the length of existed link title field. As matter of fact already have data in that field and don't want to lose.

Any suggestion? How can I do that nicely in Drupal 8.
thanks


texts: Filter taxonomy terms view by a term of another taxonomy of the same node

texts:
I have a content type "Product" with 2 taxonomies attached - "Brands" and "Product Types".

Brands:
  - Brand 1
  - Brand 2
  - Brand 3

Product Types:
  - Glasses
  - Sunglasses
  - Contact Lenses
  - Accessories

So in db i have nodes like (Node title, Product Type, Brand):

"Node1", "Glasses", "Brand 1"
"Node2", "Glasses", "Brand 2"
"Node3", "Sunglasses", "Brand 1"
"Node4", "Sunglasses", "Brand 2"
"Node5", "Sunglasses", "Brand 3"
"Node6", "Contact Lenses", "Brand 3"
and so on

On some page about glasses I need to create a list of all brands with glasses in db. With previous example data it will be "Brand 1" and "Brand 2". For contact lenses page it will be only "Brand 3", but for sunglasses page it will be "Brand 1", "Brand 2", "Brand 3".

I tried to create a taxonomy "Brands" terms view with added relationship "Content using field_product_types", set the filter with "Product Type" = "Glasses", but got no results.

Also tried to create content view of "Product" nodes with filters by "Product Types" and "Brands", but couldn't enable aggregation by Brands field.

Summary: how to list only those terms from taxonomy which has associated content of one specific term of another taxonomy?

Is there any way to do it with views or some module?

My Drupal core is 8.1.1.

Thanks!


texts: Drupal Form Button + "Are you sure"-Button

texts:
I am trying to add an own JS function to a Drupal Core Form - think Config, Development, Clean Cache. This function basically just asks if the user is sure. Here is what I have so far:

Drupal.behaviors.confirm_delete = {

    attach: function (context, settings) {

         jQuery("#field-module-subsections-values input[id$='-remove-button']", context).bind('mousedown', function (ev) {

            ev.stopImmediatePropagation();
            ev.preventDefault();

            var followLink = window.confirm(question);

            if (followLink) {
                jQuery(this).click();
            }

            return false;

        });
    }
}

The problem I have is, that the function gets called before the click-event (thanks to mousedown), but the Ajax action on the button still fires. Maybe someone has a hint as to why?


texts: Drupal 7 db_query how to return regular array from varchar field

texts:
I am attempting to combine two arrays - one is stored in the database in a varchar field. Something like this.

["0","1","2","68","69","95","96","97","98","99","100"]

I am bringing in a similar array that comes from the front end.

["0","1","2","45","66","95","97","98","99","100"]

I need merging the two and remove duplicates.

   //merge post data and stored data
      $merge = array_merge($arr1, $arr2);
      //remove duplicates
      $merge = array_unique($merge);

My problem is that when retrieving the varchar field, I am not getting a normal array but an associative. Here is my code.

$arr2 = db_query('SELECT stats FROM {my_db} WHERE uid = :uid AND nid = :nid', array(':uid' => $usid, ':nid' => $noid))->fetchAll(PDO::FETCH_ASSOC);

I need this to return a regular array, not an associative to combine the two and remove duplicates. Does anyone know how?

When I do a print_r() on $arr2 it returns the following.

Array
(
    [0] => Array
        (
            [stats] => ["0","1","2","68","69","95","96","97","98","99","100"]
        )

)

I can't seem to be able to merge it and pass it to array_unique() on.


texts: Connecting to multiple databases of different type for form submission

texts:
I'm developing a GIS mapping system and for that I am using pgSQL, however I am bounded to using mysql for the drupal install because we use Drupal 6 mulitsites using mysql already.  I know I can get around this problem by hard coding using php, html to create my forms that submit to this. I know from Drupal Community Documentation this is not possible as standard. Is it possible via any other method to utilise the Form API and submit to an external DB in a different structure such as pgsql? or do i continue coding my forms by hand for each node?

The example below is exactly what I would like to do however it is clearly shown in the link above that this will not work.

// ... header of the settings.php file

$db_url = array (
"default" => "mysql://user:pass@host/db",
"second" => "pgsql://user:pass@host/db"
);

The code below is from the Form API getting started doc, however it doesnt specify the databse it is actually connecting to?

function test_myform_submit($form, &$form_state) {
 db_query("INSERT INTO {table} (name, log, hidden) VALUES ('%s', %d, '%s')",
   $form_state['values']['name'],
   $form_state['values']['access']['log'],
   $form_state['values']['hidden']);
drupal_set_message(t('Your form has been saved.'));
}


texts:
guys.

I've this issue, i did migrate a user list from csv file with Migrate module to Profile2. I'd use one only value for the import with the format dd/mm/Y.  All was fine, but at the end the birthdays fields are empty.

What is the right way to import (update) my user birthdays.

Thanks!


texts: How to show inline error messages when submitting webform using AJAX

texts:
I have a drupal7 setup. I have a webform, which I am submitting using ajax.
I have implemented a nice solution given over here.
Everything works fine including validation and after submission messages.
My concern is, error/validation messages are getting displayed at the top of webform.
Following is a piece of code from hook_form_alter:
    $form['#validate'][] = '_custom_subscribe_form_validate';
    $nid = $form['#node']->nid;

    $form['actions']['submit']['#ajax'] = array(
        'callback' => '_custom_subscribe_js_submit',
        'wrapper' => 'webform-client-form-' . $nid,
        'method' => 'replace',
        'effect' => 'fade',
    );

Is there any way to arrange a placement of error messages which are defined within _custom_subscribe_form_validate, to be set to inline or as suffix to respective form field.
    if (empty($email)){
        form_set_error("submitted][email", t('Please enter valid email.'));
    }

I have tried clientside validation module, but it's not working since I'm using ajax for form submission.
I have been searching for the solution from many days, any help will be appreciated.


texts: Limited editing of just the order of entity reference field

texts:
I would like to give some users the opportunity to edit the ORDER of a field of entity references holding multiple references-- but not the references themselves.
One option would be to post process the field and turn off the editability of the form element. But this seems like to create the form element and then disable it.
Is there a better way?


texts: Problem in deploying Drupal 8 application

texts:
I am trying to deploy a Drupal 8 application to another folder from development.
Using PGSQL as database server.
I have database named xyz.
I am copying that database to another one named abc.
The problem I am facing:
When I use old database xyz for new code base, it is running fine.
But, when I use abc, which is exact copy of xyz, it is showing error.
Following is the error I am facing:

Array
(
    [%type] => Recoverable fatal error
    [@message] => Drupal\Core\Render\Markup Object
        (
            [string:protected] => Argument 1 passed to Drupal\Component\DependencyInjection\Container::__construct() must be of the type array, boolean given, called in /PROJECT-PATH/core/lib/Drupal/Core/DrupalKernel.php on line 890 and defined
        )

    [%function] => Drupal\Component\DependencyInjection\Container->__construct()
    [%file] => /PROJECT-PATH/core/lib/Drupal/Component/DependencyInjection/Container.php
    [%line] => 119
    [severity_level] => 3
    [@backtrace_string] => #0 /PROJECT-PATH/core/includes/bootstrap.inc(552): _drupal_error_handler_real(4096, 'Argument 1 pass...', '/Applications/M...', 119, Array)
#1 /PROJECT-PATH/core/lib/Drupal/Component/DependencyInjection/Container.php(119): _drupal_error_handler(4096, 'Argument 1 pass...', '/Applications/M...', 119, Array)
#2 /PROJECT-PATH/core/lib/Drupal/Core/DrupalKernel.php(890): Drupal\Component\DependencyInjection\Container->__construct(false)
#3 /PROJECT-PATH/core/lib/Drupal/Core/DrupalKernel.php(465): Drupal\Core\DrupalKernel->initializeContainer()
#4 /PROJECT-PATH/core/lib/Drupal/Core/DrupalKernel.php(655): Drupal\Core\DrupalKernel->boot()
#5 /PROJECT-PATH/index.php(23): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#6 {main}
)

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

Can somebody please help me solving this.

EDIT:

I have correctly changed settings.php file for new code base and also changed the correct database name.


texts: Authenticating users and uploading content with Services module

texts: I am trying to learn how to set up a service that will accept http-posts including user login and password, authenticate the user, then allow the user to upload a file that will be used to create a new piece of content.  I could not find any good resources explaining how to handle user authentication with the services module nor did I find any good resources about how an upload or content creating could be accomplished.  Does anyone know of any such resources I may have missed?


texts: Validation constraints on form fields ignored

texts:
Trying to figure out custom validation with constraints, but no luck yet. Right now, my form posts content and gives no errors when form is filled out incorrectly.

(Please avoid suggesting validation modules -- I know those exist.)

Maybe somebody knows what I'm missing? Or maybe it's done different when I'm doing specific fields? Or maybe this isn't how to do it on a back-end content submission form?  Here's what I have so far:

I built a module called "custom_validation." It contains custom_validation.module:

  <?php

/**
 * @file
 */

/**
 * Implements hook_entity_type_alter().
 */
function custom_validation_entity_type_alter(array &$entity_types) {

  /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */

  $entity = $entity_types['node'];
  $entity->addConstraint('BlogpostError');
}

Then, in subfolder src/Plugin/Validation/Constraint, I've got two files.
BlogpostErrorConstraint.php contains:

namespace Drupal\custom_validation\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Prevent article creation if errors.
 *
 * @Constraint(
 *   id = "BlogpostError",
 *   label = @Translation("Added blog post category instead of story author in author field", context = "Validation"),
 *   type = "string"
 * )
 */
class BlogpostErrorConstraint extends Constraint {

  /**
   * {@inheritdoc}
   */

    public $notByline = '%value is a blog post type. Please add a byline';

    public $noImageSource = 'need image source';

}

BlogpostErrorConstraintValidator.php contains:

namespace Drupal\custom_validation\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

/**
 * Validates the BlogpostError constraint.
 */
class BlogpostErrorConstraintValidator extends ConstraintValidator {

  /**
   * {@inheritdoc}
   */
  public function validate($items, Constraint $constraint) {

    if (!isset($items)) {
      return;
    }

    // limit this to 'blog entries' content type
    if ($items->bundle() == 'blog_entry') {

      // now loop through each field...
      foreach ($items as $delta => $item) {
        // an array of phrases we don't want in the field
        $bad_bylines = [];
        array_push($bad_bylines,"Value one","value two","abc123");

        // adding validation...
        //byline field
        if (in_array($item['field_byline'], $bad_bylines)) {
           // not sure of syntax here
           $this->context->addViolation($constraint->notByline, ['%value' => $item->value]);
        }

        //main image source field...
        if ($item['field_main_image_source'] == '') {
           $this->context->addViolation($constraint->noImageSource, ['%value' => $item->value]);
        }
      }

    }

  }

}


texts: How to bypass HTML mail for specific Webform

texts:
I have configuration Mailsystem to send all webform emails as HTML, I thought I could use the "key" in mailsystem's configuration to specify which webforms' submissions get sent as HTML or plain text. Unchecking the checkbox on the webform's email handler to say "Send email as HTML" only strips HTML from mail, but the wrapper is still HTML.

While keeping HTML emails for most webform generated emails, how do I configure one to be sent as plain text?


texts:
Im using Drupal 6 with Audio.

I have created a view that shows a list of files to download and play. There are two fields which both show the download link. I would like to change the second download link field so that it strips all the info and only prints the filename from the url contained in its content. So instead of

<*a href-"file/path/music20.mp3">Download <a*>

I would like to see

music20.mp3

or

music20

Thanks in advance


texts: How can I disable JavaScript in Drupal themes or Drupal itself?

texts: How can I disable JavaScript in Drupal themes or globally?


texts:
I want to track IP address of visitors in my site using statistics module.

A log of which is attached here( 3 day log). I can't figure out if an IP address is used by a bot or human being. For example when I checked the 2nd and 3rd IP address, they turned out to be that of Google and Microsoft( Bing). But I've no idea about the first ip address with 900 visits in 3 days.

I want to track malicious user ip address for Adsense invalid clicks.


texts: Hide 'successfully added to cart' message

texts:
I use commerce checkout on a Drupal site but it is primarily an information site. So I effectively want to hide the cart from the user.

This means that on addition of a product to the cart, I want to remove the Drupal message 'Product' added to your cart.

This can't just be hidden in CSS because we want other checkout messages to still be visible.


texts:
I have just installed the Views Field View Module (https://www.drupal.org/project/views_field_view), which enables to append an existing View as a field inside a View.

But when I want to Append a View field, I get an AJAX error (HTTP 200) :

Une erreur HTTP AJAX s'est produite.
Code de statut HTTP : 200
Informations de débogage ci-dessous.
Chemin : /admin/structure/views/view/cat_chisme_liste_des_enfants/preview/default/ajax
StatusText: OK
ResponseText : php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
... and so on ...

And the field configuration form displayed is not usable.

(Drupal 7.67)


texts: Can a Panel be converted to a Mini-Panel?

texts:
I have a panel.  I have my link to the panel.  What I can't do is put that page as a block.  Honestly, I'm not sure the purpose of a panel if you can't put it anywhere other than link to it.

I read you can use mini-panels to make a block.  Is this accurate?  If it is can I convert a Panel that I already have into a Mini-Panel so that when I go to the blocks, I will see that Mini-Panel and be able to assign it to a region?

Am I misunderstanding things?

Thanks.


texts: Change default user relationship on Drupal Commerce customer profile

texts:
I need to change the relationship of Drupal commerce module "Customer". I wish I no longer use the relationship user ID, but the id of another custom entity. We find the example of using this relationship to the url admin/trade/customer profiles-Part "User Information" => "Owned by ...", this is where I will wish in the end that the address is not connected to a user but a separate entity that I created myself.

Is this possible? I looked a little deeper into the Customer module, but I am afraid of losing myself in a bad voice, I need your advice and some ideas :)

Thank you in advance


texts: Module is reported to be missing, but it's present and active

texts:
I have a field type that have some default dependencies, such as Ctools and Views.
I need the Able Player module, which is for Drupal 7.
I installed this module, configured the Able Player libraries and checked that all is OK in the report section.
This module is installed in /sites/all/modules/able_player folder.
In my info file I wrote the following line.

dependencies[] = able_player.

When I attempt to activate my module, Drupal says that the Able Player module is missing, but it is present and active.

For a test, I tried some other modules, such as the jQuery Update module, and it works fine.

Why does Drupal say the module is missing?


texts: How to determine the priority of css files in info file for a theme?

texts:
I have several css files in a theme info file. Suppose i have two definitions of h2 in different files? How to configured the files so I manage to get the h2 definion I want?

I edited the question as I do not get a solution yet. The question refered as an answer is problaby one of the reasons. So I first set the order of the files oke. They are now oke. Other changes are reflected.

So specific.... I now have two H2 definitions in 1 css file.

h2 {
    font-size: 19px;
}

and

.page-shop .view-header h2 {
    font-size: 100px !important;
}

But still the first is applied in the shop page..

Any suggestion?

For everybody who is reading this; I found my solution:

I'm using Sublime Text editor for css styling. As everything in the syntax had the good color I thought the file is build up good. But in some try and error I saw one line like below:

form-item ( font-size: 10em;}

Note that instead of openening with a { it is opening with a (

And because of this the rest of the css file is not processed well.


texts: How to count webform radio button submissions

texts:
What would be the best way to count all submissions (True & False) of a radio button type in a web form?

There are about 100 radio buttons in each survey form so need to get a total number of True values


texts: How to programmatically build a page and a form in the same page

texts:
What I'd like to do is build a page with two things:

On one half of the page, custom markup with data from Drupal.
On the other half, a custom form also submitted to Drupal.

There are a lot of tutorials on how to programmatically build pages in D8 (create route, extend controller, return render array, etc.). There are also a lot of tutorials on how to programmatically build forms on D8 (create route, extend form base, return render array, etc.). However, I could not find any resource on how to build both onto the same page.

How would I go about doing this?


texts:
Context

Drupal 8
Switching to Drupal for intranet site in large organization

Background

OtraganixLocker Corporation is switching to Drupal from a custom-made home-grown intranet site. They want to use D8.

The problem is, the old custom-made intranet had the following permissions for
(its equivalent of) D8 nodes:

add content
edit own content
edit any content
delete own content
delete any content
view own content
view any content

Moreover, the granularity of the permissions worked down to the "content-type" level on the old intranet.

Moreover, the granularity of the permissions on the old intranet permitted user-based-assignment as well as role-based-assignment.

Question

Drupal 8 seems to be missing the view own content and view any content permissions that the old intranet system had.

Moreover, there seem to be a lot of ways to handle this, at least in D7.

Is this missing functionality accounted for in D8 core and simply missing from the front-end interface, or is it also absent from D8 core?
If it is not absent from D8 core, which specific function or functions in the D8 API account for this functionality?

See also

Blog post detailing the lack of granularity issue
Blog post addressing lack of granularity issue in D8


texts: Migrating content with referenced taxonomy field is to be migrated by term name

texts:
Is it possible to migrate content with term reference fields, but instead of referencing terms by their tid they are referenced by their term name?

instead of this:

field_tags:
  plugin: sub_process
  source: field_tags
  process:
    target_id: tid

Do something like this:

field_tags:
  plugin: sub_process
  source: field_tags
  process:
    target_id: [term name]


texts: Subscribing the new user to a mailing list as a part of registration

texts:
What is the simplest way to configure Drupal in such a way, that every registering user is asked for his email and permission to send him  info about site updates?

That way I want to postpone serious site building, but have a solid user base just from the now.


texts: How to create a term reference field programmatically

texts:
I need to add a taxonomy reference field to a node bundle, programmatically.
I found a couple examples here, but one actually is incorrectly titled and is about creating a from field for it, and the other is from 2012.
I have tried the following, based on the couple of suggested examples I found, and a further suggestion that one use the field/field storage export as a guide.
When it runs, it silently fails. The field is not created, nor is there an error thrown.
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;

$handler_settings = [
      'target_bundles' => [
        '<vid>' => '<vid>'
      ],
      'sort' => [
        'field' => 'name',
        'direction' => 'asc',
      ],
      'auto_create' => FALSE,
      'auto_create_bundle' => '',
    ];

$fields['<field_my_field>'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('<My Field>'))
  ->setDescription(t(''))
  ->setRequired(TRUE)
  ->setSetting('target_type', 'taxonomy_term')
  ->setSetting('handler', 'default')
  ->setSetting('handler_settings', $handler_settings)
  ->setRevisionable(TRUE)
  ->setTranslatable(TRUE)
  ->setDisplayOptions('view', [
    'label' => 'hidden',
    'type' => '<vid>',
    'weight' => 0,
  ])
  ->setDisplayOptions('form', [
    'type' => 'entity_reference_autocomplete',
    'weight' => 5,
    'match_operator' => 'CONTAINS',
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE)
  ->setCardinality(1);


texts: Show exposed filter entry with match number

texts:
I want to have some view filter like this one for example.

I want a list of option [a select..] with the number of results they provide.

Can I do this in some way?


texts:
I want  create to something like adf.ly script with Drupal. I am using shurly (developed by Jeff Robins) for URL shortening, and it works fine, but I want to display an advertising page for 10 seconds before redirecting to the final URL, which is not a feature provided by this module.

It has a hook called hook_shurly_redirect_before() which may help me, but I don't have enough knowledge to use it.

Can anyone explain how I should use this hook?


texts: How do I create a merge request for a project?

texts:
I'd like to create a merge request for a drupal.org project. I found a page on drupal.org titled Issue forks & merge requests which seems to address this but I'm not really getting anywhere. The page says:

On an issue page, make sure the fork is created and you have access.

If the fork has not been created yet, click “Fork {project}”
If you do not have push access yet, click “Get push access”
If you see “✓ You have push access,” you’re all set!

The only place I could find a "Fork" button was on https://git.drupalcode.org/project/project_name/-/forks. But when I click on that I see just see a namespace with my name, and a greyed out "select" button, which, if I hover over it, displays "You have reached your project limit". But I think I'm in the wrong place anyway.
The instructions start with "...on the issue page" so I created an issue on drupal.org for the project, on the issue page there are no links that mention "fork" anywhere to be seen.
What am I doing wrong?


texts: Alter menu link lists dynamically in regards to user's role?

texts:
I have a navigation menu in a menu block. I want some of the links in the menu to be hidden if user doesn't have role xxx.

What is the best way to do so?


texts: How to link menu item to a page in Drupal7, that can display database content?

texts:
I am using a custom module in my Drupal7 to add data in a form and then inserting it into the database. The form has fields like "Menu Name", "Image", etc. I want to know :

How can i show this dynamic content in my site, by clicking on each of the menu items?
In other words, how to link dynamic content to the menu items? The name of the menu item will be equal to one of the fields (Menu Name) in the form in my custom module. Each of the menu item pages can have a different design & layout (based on form data).

Do i need to hack my page.tpl.php?

Do i need to create as many .tpl pages as those of menu items for showing the dynamic content?
I just want to know What is the best way to achieve this.


texts: Creating a new Form element in ajaxcallback function not affecting form state

texts:
I am trying to insert new form fields into exiting wrapper within ajax callback function.

I succeeded doing so, but trying to get those new fields values inside submit function failed because they are listed in the form state values array.

How can I make their values available to be used inside the submit function.

$form['test'] = array(
        '#type' => 'select',
        '#options' => array('- Please select -' => [1=>'one',2=>'two']),
        '#ajax' => array(
            'callback' => '::testSelectedCallback',
            'wrapper' => 'fields-wrapper',
            'effect' => 'fade',
            'event' => 'change',
            'progress' => array(
                'type' => 'throbber',
                'message' => NULL,
            ),
        ),
    );
$form['fields-wrapper'] = array(
        '#type' => 'container',
        '#attributes' => ['id' => 'fields-wrapper', 'class' => ['hiddenselect']],
    );

public function testSelectedCallback(array &$form, FormStateInterface $form_state) {
$form['fields-wrapper']['new_item']= array(
'#type' => 'textfield',
'#title' => 'My new item',
);
$form_state->setRebuild(True);
return $form['new_item'];
}


texts: How do I reset a user's name using Drush in Drupal 7?

texts:
To change a password I would use:

drush user-password USERNAME --password="SOMEPASSWORD"

Is there a similar way to change a user's name using Drush from the command line?


texts:
How I can set which rss feeds are put at my frontpage like that

Feeds are produced by Views.

Right no feed link exists in frontpage.
What would be also the right syntax for HTML5?


texts: Filter items in a view, without affecting number of items in pager

texts:
I want to filter items in my view:

<?php

function permissions_by_term_views_pre_execute(\Drupal\views\ViewExecutable $view) {
  $view->query->addWhere(
    0,
    db_like()
      ->condition('nid', 9, 'NOT IN')
  );

  return $view;
}

Unfortunately I get this error:

  Fatal error: Call to a member function condition() on a non-object in
  /mnt/c/Users/peter/Dev/pbt-d8/modules/permissions_by_term/permissions_by_term.module
  on line 95

I have flushed the cache. How can I get rid of this error?


texts: Using TB Megamenu, how to close one submenu when I open another submenu?

texts:
I'm building a couple of (Drupal 8.9.13 and Drupal 9 based) sites where I use TB Megamenu megamenu module (https://www.drupal.org/project/tb_megamenu) to create the menu. All is working fine on desktop/laptop etc, when I hover over the top menu items the related submenu slides open, when the cursor moves away it folds away again.
On narrow screen/mobile, the menu collapses to a hamburger in header. When I click the hamburger, the menu appears as intended, with the top level (no-clickable) items appearing.  When I click each of the top items the related submenu items appear, again as intended.
However, when I then click another submenu trigger, the other submenu opens, but the previously opened submenu stays open as well. Taking up lots of vertical space and pushing parts of the menu off the screen.
What do I need to change to have only ever one submenu open at any one time (i.e. triggering a new submenu closes the one that was opened before)? There is no setting for this in the TB megamenu configuration (drupal module), and no instructions on this in the documentation. I assume I have to add some (java)script either in my theme .js file, or change add something in the TB Megamenu tb-megamenu-frontend.js, most likely an onClick event that runs through all top items with submenus and closes all others but the clicked one?
I had the same issue a long time ago with the Mobile Sliding Menu  (see that question and answer. I have tried the javascript that was suggested there (adapting the class names to match my TB menu etc), but it doesn't work here.
I have exactly the same behaviour (of submenus staying open) on all versions of TB megamenu, (from D7 to D8 to D9, various older as well as latest development releases), and would love to find out how to address this..
Many thanks for any help on this!


texts: What is the alternative of hook_custom_theme in Drupal 8?

texts:
I need to change the theme based in custom criteria.

Some nodes should be displayed with one particular theme and others with the admin theme.

In D7 I could simply use the pathauto module and set the node url to admin/[node-title]. It works in D7 because all url starting in admin will use the admin theme in D7.

An alternative way to do the same thing would be to use the hook_custom_theme() function in D7. I did not find any similar function in D8.


texts: What might block the creation of thumbnails?

texts:
My Drupal 8 does not create thumbnail. I have set my files folder's permission to 775 and the folder 2016-10 is not there.

There is no error shown in the log, and the temporary directory is /tmp.


texts: How do i check the duplicate entry in the table?

texts:
I have created a custom form as below. And the  user has to fill all the fields for the submission(I am storing all the fields after submission).

Question is how do i check if the email address has already been entered ?


texts: Is EntityFieldQuery really this inefficient?

texts:
I am an admitted newbie to the Entity API, but am trying to cure that.  I'm working on a site that uses a number of content types with various fields attached to them; nothing fancy.  So, when I want to retrieve a set of entries, I have been, in my ignorance, calling directly down into the database and doing something like this:

$query = db_select('node', 'n')->extend('PagerDefault');
$query->fields('n', array('nid'));
$query->condition('n.type', 'my_content_type');

$query->leftJoin('field_data_field_user_role', 'role', 'n.nid = role.entity_id');
$query->condition('role.field_user_role_value', $some_value);

$query->leftJoin('field_data_field_withdrawn_time', 'wt', 'n.nid = wt.entity_id');
$query->condition('wt.field_withdrawn_time_value', 0);

$query->orderBy('n.created', 'desc');

$query->limit(10);

$result = $the_questions->execute()->fetchCol();

(yes, I could probably collapse a bunch of these lines into a single $the_questions-> statement; pls ignore that for now.)

Trying to rewrite this with EntityFieldQuery, I come up with:

$query = new EntityFieldQuery();
$query
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'my_content_type')
  ->fieldCondition('field_user_role', 'value', $some_value)
  ->fieldCondition('field_withdrawn_time', 'value', 0)
  ->propertyOrderBy('created', 'desc')
  ->pager(10);

$result = $query->execute();

if (isset($result['node'])) {
    $result_nids = array_keys($result['node']);
}
else {
    $result_nids = array();
}

which gives me the desired results and is surely much prettier.

So, now I'm wondering about performance.  As a start, I throw each of those bits of code into a stupid for() loop, capturing time() before and after execution.  I run each version 100 times over a not-very-big database, and get something like this:

Direct version: 110 msec
EFQ version: 4943 msec

Obviously I get different results when I re-run the test, but the results are consistently in the same ballpark.

Yikes. Am I doing something wrong here, or is this just the cost of using EFQ?  I have not done any special database tuning with respect to the content types; they're just what comes from defining the content types in the usual, form-based way.  Any thoughts?  The EFQ code is definitely cleaner, but I really don't think I can afford a 40x performance hit.


texts: Backup & Migrate: Restored changes lost after clearing cache

texts:
I have a live and a development version of a Drupal 7 site. I want to keep them as close in content as possible so I am using the Backup and Migrate module to take a backup of the live site and restore it onto the development site. This works fine until I clear the cache on the development site after the restore and things like views, menu items and entity forms disappear for some reason. They work fine after the restore up until I clear the cache.

Anybody have any idea what's going on?

I'm using the features module if that makes any difference.


texts: FlexSlider, Media Galleries, & Nodes (entity reference)

texts:
If this has been asked before I apologize.

I'm somewhat new to Drupal but I know enough to dig myself a hole trying to find a solution to an idea.

I would like to use entity reference to display a media gallery and have the gallery formatted as a FlexSlider with thumbnail navigation.

I have tried both Flexslider Fields and FlexSlider Entity Reference but I can't seem to get either to work properly with Media Galleries.

Any suggestions?

I need it to be a simple interface a non-tech content creator can use without issue.


texts: Update module with Drush + commit with Git

texts:
What's the best way to update a module and commit with git?

Currently I'd use drush pm-updatecode then inspect with git status. The problem then is there are many files that have changed, been added or been deleted. Then performing an add or rm on the right files seems a bit cumbersome.

Would it be better to first do rm on the module, commit, then drush dl, add, commit?


texts: How to run entityfieldquery on all fields in node that reference users

texts:
Is there a way to run EntityFieldQuery on all fields of a node that reference a user?

Thanks!


texts: Reset boost cache in a busy site without crash

texts:
We are having a high traffic Drupal 6.x site (25,000) uniques per day, mostly landing pages.

Everythings works OK, with great performance, until we try to reset the boost cache.

Once we reset it, Drupal tries to regenerate HTML from PHP and MYSQL, and we reach a performance crisis where the site crawls and becomes unusable due to slow performance.

Is there a better solution? I imagine there could be a script which clears cache slowly, resets files one by one, wait(10 seconds), wget the url, and then go to the next url.

More info added (edits):

The site has about 20,000 nodes.
We have two Linode 4096 machines: 4 GB RAM, 8 CPU (4x priority), 192 GB Storage, 8 TB Transfer each. Only one of them stores MySQL.
The reason we do manual purge is because when Boost purges pages by itself, we can get to a point where a lot of pages are not in the cache. This can cause a big performance hit.
When the server is too busy, PHP returns WSOD and then Boost caches it! So we get a page, in cache that is actually WSOD!!! Since this is a critical problem, we decided to affectively disable Boost from purging cache on it own and do it On Demand.
Why clear the boost cache? The CSS and JS files are global. If we change the CSS, or add some JS, then we "drush cc css-js" to load the new changes. Doing that, the CSS/JS files are deleted and we are left with cached HTML pointing to non-existing CSS/JS files. So we get "broken" pages. The solution is to refresh the Boost cache.

Will the advagg module help?

Any other solutions?

Pleae advise.


texts: Drupal 6 - emfield is blank when logged out

texts:
I have created a content type and have added the Embedded Media Field. As i was logged in as administrator everything was showing ok but when I logged out and checked the page it was empty.

The text is showing ok but the enfield fields does not show the tumbnails of the youtube videos.

When i see the node while I am logged in as administrator everything looks correct but when I log out the corresponding emfields will not show up.

Has it to do with permissions? Because I have rebuilt them.

I check the php error.log and i see no errors.

Has anyone had any similar problem?


texts: How can I get the Contact Form "Manage Display" Settings programmatically?

texts:
I am trying to use hook_mail_alter to create a custom contact mail.

I want to get the display setting of the contact form.

(example path: http://mysite/admin/structure/contact/manage/my_contact_form/display/mail)

The things I want to know are:

Field Label
If its disabled or not
Field order
Field ID

How can I get this information in the PHP script?

EDIT:

I was able to get most of the information I wanted. but I couldn't get the field weight to display in the right order. I have a display mode called 'mail' and I want to get the weight of each field in this mode.

for now the code looks like this:

/**
 * Implements hook_mail_alter().
 */
function contact_plus_mail_alter(&$message) {
    if (isset($message['id']) && $message['id'] == 'contact_page_mail') {

        $siteName = \Drupal::config('system.site')->get('name');
        $siteMail = \Drupal::config('system.site')->get('mail');
        /** @var \Drupal\contact\Entity\Message $contactMessage */
        $contactMessage = $message['params']['contact_message'];
        $entityType = $contactMessage->getEntityType()->id();
        $bundle = $contactMessage->bundle();

        $contactForm = $contactMessage->getContactForm();
        $form_title = $contactForm->label();
        $recipients = implode(',', $contactForm->getRecipients());
        /** @var \Drupal\Core\Field\FieldItemListInterface[] $fields */
        $fields = $contactMessage->getFields();
        $data = [
            'title' => $form_title,
            'fields' => [],
        ];
        foreach ($fields as $key => $field) {
            $fieldDefinition = $field->getFieldDefinition();
            $data['fields'][] = [
                'label' => $fieldDefinition->getLabel(),
                'info' => $field->getValue(),
                'display_options' => $fieldDefinition->getDisplayOptions(),
                'weight' => '', // I want to get the field weight for the 'mail' display mode.
            ];
        }
        // TODO: order the data by weight

        // ... send the email
    }
}


texts: Trigger: after updating account - by anonymous user?

texts:
I have created an action sending me an e-mail if a user account has been changed/updated.
The e-mail contains tokens of the original user fields and the new entries for comparison.

Since these data could be changed by anyone with user management rights I'm also interested who made the changes and thus check for [current-user:name]

How can it be that this trigger fires when the change (or actually no visible change for me) has been made by "Anonymous"?

Wouldn't it be either the user himself/herself or a user with account rights to trigger this event? And yes, my Anonymous role has no user permissions set; I've checked this.

I was wondering if there is any other module triggering this event? Do you have any pointers what's going on here?


texts: Adding a loading indicator to form submission module

texts:
I have a custom module that is altering a webform to add custom submission handling using:

$form['#submit'][]='paymentComplete';

From the time the user clicks the submit button, until the paymentComplete() function completes it takes 2-3 seconds, but the user experience doesn't really indicate what is going on. How can I add some type of 'waiting indicator' that starts right BEFORE the request to execute paymentComplete()?


texts:
The famous Webform module gives a beautiful nicely designed "Submit" button.

How can I change its text from "Submit", to anything else? I want to change it to another language but I found no way to do it by the UI, or by the Translation mechanism.


texts: How would you implement a limited time featured node?

texts:
I am using Drupal 6.

I would like to create for a limited time (start date, end date) another version of a node that would share almost all its properties. This featured version is in fact a recipe sponsored by a company, so we have to put the company logo, etc.

About the only thing that would change is a couple of line of data, another category (keeping the other ones) and the main image.

An exemple of the node I want to create a featured version is here :
http://www.moietcie.ca/cuisine/recettes/entrees-et-amuse-gueules/acras-de-morue

The big difficulty is to have the possibility to create a temporary version. After the date is passed, it must return to normal. Hence, I must keep all the data of the normal version.

I first thought of hijacking the translation system since we don’t use translations and force a fake language: French — Featured. Content without this translation would fallback to French (the normal version).

I did some quick tests, and beside the fact that my admin menu is now in English, it works but I hate my idea. I have to modify core modules of Drupal and I know this is bound to fail at some point.

Do you have any ideas ?

Thanks a lot


texts: Module Structure question from perspective of PHP dev

texts:
I'm new to drupal, and am unsure how to aproach writing a module. My uni is moving to drupal, and I'm working on getting a courses module to display information about courses at the uni.

List of things I need to implement

A list of courses in a specific subject that can be put in many places on the site, with differnt subjects
Search page

I think I understand how to do this one, at least

List of courses based on search parameters
List sections in a specifc course and term

I've figured out how to make custom pages and pass data around in the url by follwoing the drupal menu example. From here, I could just custom write everything, and return straight html, and it seems like that would work, but not be the "correct" way to do it in drupal.

The data will be available in an API of sort, I don't know much about it yet. NOrmally I would just make a data class that had sample data in it, and deal with the data later, but it seems like this won't work in drupal.

Should I be aproaching this by trying to get the views module to do the views for my module? It seems like this would be the correct way to do it, but the query is stupidly complex SQL, and the output can't just be a list.

Also, where is a good tutorial on how I should be using content types? It seems like I should be using that effectively as a data class, that somehow gets passed to a view(possibly the views module, maybe just a view I write myself for a page), which renders it, but I haven't been able to figure it out.

Sorry that there is no concrete answer for this, I just really need pointers on how to aprocah drupal modules.


texts: How content type field can get a value from a view

texts:
I need a field in my OG content type to get a numerical value from an existing view (OG members base table), so that I can use Computed Field module to run a simple calculation against the value of another field on the same node ($z=$x/$y).

FWIW the view result is the count of members within the group to which the content type belongs. The view has a 'content:nid' contextual filter with a 'group node from OG membership' relationship, if that's worth mentioning.

I've used the Views Field View module to display the value on each node, however Computed Field cannot see it. I considered doing the desired calculation within another view, but I believe it would be more efficient in my case to run the calculation upon saving each node.

I'm using Drupal 7.37 with OG 7.x-2.7 and Views 7.x-3.1.

If you have a suggestion that involves some coding, I would be very grateful for any guidance as I'm a total php noob.


texts:
I am trying to use Drupal 8's core function to open a page in a modal window. Unfortunately it is very hard to find some official documentation about it, and most of the blogs covering this topic seem to be outdated. But as far as I know, it should be possible to create a modal dialog by adding the following attributes to an a-element:

class="use-ajax” data-dialog-type="modal"

So that a full example would look like:

Where in my case /impressum/lizenzen/43 is a path to a views page.

This seems to work, but only when I am logged in as admin. As this does not seem to be an permission problem, I assume it is related to the admin theme (Seven), that might include some core libraries that Bootstrap (the which I use for my site) might not.
But oddly enough, in the title bar of the modal appeared, instead of the page title, the string ´Array´, what makes me assume, that an unexpected array to string conversation took place:

Could somebody

lead me to the official documentation of cores modal API,
explain to me, what could be the reason that it works as admin only.
And finally tell me, why on earth an array to string conversation takes place calling a modal?


texts: How to have on-page comments in Drupal 7?

texts:
Currently, if you enable threaded comments on Drupal, the user has the ability to click on "reply". This takes the user to another page where they can write the comment. I want this functionality to happen on-page. In other words, if they click "Reply", a comment box must drop open using JavaScript or Jquery.

First prize is if there is already a module available or some setting that does this that I am missing. Alternatively, I would assume the best way is to just include the code in the Template File of the comments being generated?


texts:
I am trying to use theme_pager to create pagination as below, but pagination does not appear. I have tried using var_dump(theme('pager', NULL, 10)) and the result is NULL.

$q="SELECT DISTINCT(node.nid) AS nid, node.type AS node_type, node.vid AS node_vid, node.title AS node_title, node.language AS node_language, node.created AS node_created, node_revisions.teaser AS node_revisions_teaser, node_revisions.format AS node_revisions_format FROM node node  LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE (node.type in ('slideshow')) AND (node.status <> 0) AND (node.language='$lang') GROUP BY nid ORDER BY node_created DESC";
$result = pager_query($q, 10, 0);
//Process data.
return $output . theme('pager', NULL, 10);

also i tried to simplify the query and to make it from one table as below, but this didn't work as well

SELECT nid, title, language, created FROM node WHERE node.type='slideshow' AND node.status  0 AND node.language='en' ORDER BY created DESC

Any idea is highly appreciated!


texts: I am trying to create a custom field widget and change the HTML of the field through a .tpl file or a theme function. The idea is my field will store some integer value (it will be updated by another form) and show the value in the from of a progresbar. My question is how can I change the HTML of the field. Same question is asked here also. Please help if anyone have any clue.


texts: How to use multiple styles for Nice Menus?

texts:
I'm having two Nice Menus, both are displayed in my website's top bar. I created a default CSS layout for them and everything looks quite nice. However, I'd now like to change the layout of the second menu's parent a bit.

How can I set up this alternative style?


texts:
I am looking for a way to produce a dropdown filter by year of drupal 'post date'. i was able to produce somewhat of this result with an exposed criteria but that requires updating.

Is there a way i can just make the sort criteria exposed with dropdown of years?

this is what i have so far

if ($form_id == 'views_exposed_form_clone_of_post_by_date_block'){
  $year_filter = array();
  $years = array();
  $counter = 0;
  for ($i=date("Y");$i>=2009;$i--){
    $counter++;
    $years[$counter]=$i;
    $dstart = $i."0101";
    $dend = $i."1231";
    $year_filter[$counter] = array('title'=>$i,'operator'=>'between','value'=>array('type'=>'date','value'=>$i,'min'=>$dstart,'max'=>$dend));
    $form_state['input']['edit_created']['#options'] = $years;
  }


texts: Views partial Contextual Filter on username

texts:
I have a view of users with a contextual filter for username which works great for whole usernames, but I need to allow this to work with partial names, or specifically whole words (userames are full names with spaces in this case), so if someone search for 'David' it will list all the 'David's, regardless of their surname.

Any help?

EDIT: a bit more googling revealed this, which was able to solve my problem: http://n00bsys0p.co.uk/blog/2012/08/21/drupal-views-3-contextual-filter


texts: drupal webform composite element with entity autocomplete and its field value token

texts:
I have created a composite field .
field - "Items" is a entity reference .  this entity has also a field "price"
filed - "MRP" is a computed token field aiming to grab value of field price of the referenced item field
here is the image
token does not work for MRP field and it does not shows the price of selected entity
below is my yaml source of the form.
Can anyone tell me what i am doing wrong here with the token ?
'#type': custom_composite
'#title': 'Order form'
'#element':
  items:
    '#type': entity_autocomplete
    '#title': items
    '#target_type': node
    '#selection_handler': 'default:node'
    '#selection_settings':
      target_bundles:
        product: product
  mrp:
    '#type': computed_token
    '#title': MRP
    '#template': '[webform_submission:values:items:entity:field_price:value]'
    '#ajax': true
  quantity:
    '#type': number
    '#title': Quantity
  amount:
    '#type': number
    '#title': Amount ```


texts: How to change DateTime field value on form submit

texts:
I am trying to update a DateTime field in an altered form submit. Something like:

php
function my_module_form_submit($form, FormStateInterface $form_state) {
  if (!$profile->field_someother_field->isEmpty()) {
    $date = new DrupalDateTime();
    $date->setTimezone(new \DateTimezone(DATETIME_STORAGE_TIMEZONE));
    $string = $date->format(DATETIME_DATETIME_STORAGE_FORMAT);
    $form_state->setValue('field_date_updated_details', [$string]);
  }
}

But this fails with various messages (depending on whether I set the value as an array or directly as string).

Any advice?


texts: How to reference a submodule in composer.json file?

texts:
I just learned now that you should not include composer.json files in submodules.

But can I have a reference to a submodule as a dependency?

Imagine I have a module named AAA with a submodule named BBB and I have a module named CCC with a submodule named DDD with a dependency on the submodule BBB.

Now it is clear to me I don't need to put a composer.json file inside the submodule DDD, I need to put the composer.json file inside the module CCC folder.

But I need to make the dependency with the module AAA or with the submodule BBB?

Something like this for module CCC is correct?

{
  "require": {
    "drupal/BBB": "^1",
  }
}


texts: How to access fields for the Registrant settings (RNG)

texts:
At the RNG module there is a possibility at the Settings to add fields to the Registrant settings. As I understand the idea behind this is to add some fields to the registrant. I want to add a color to the registrant.
But how can I access these fields? After I register for an event I can see my registrants on the Registration List, but I can't see the additional fields.  I also have no idea how to add the content to these fields?
Thanks


texts: How can I set up the user password when I create a new user using the Rules module?


texts: Hierarchical Select with taxonomy in Views

texts:
I have a generic content which can be differencied by a taxonomy term. Then i've created to views filtered by a taxonomy. I want to enable a second filter, exposed  , based on the taxonomy, depending on the first filter also bases on the taxonomy but not exposed.

For example:
I have the following taxonomy:
Type :

News

First
Second

Publication

Third
Fourth

My content is 'Article' and the Type is 'News > First'
In my View 'News', I can only see the content News ( First or Second), this part is easy. What I need is an exposed filter where i can only choose First or Second from News depending on the fact that I'v already done a previous filter based on the first level of this taxonomy.

How can I do that?

Thanks


texts: Why isn't my new module listed in the list of modules?

texts:
I am trying to build a new module, but, it is not listed in the list of modules.

This is the content of the add_new_chapter.info file:

;$Id$

name = Chapters field
description = Will create a field that will refrence a node of type chapter type
package = Online School Development
core = 7.x
files[] = add_new_chapter.module

I placed the add_new_chapter.info file in the directory "add_new_chapter" at
drupalroot/sites/all/modules/add_new_chapter.

what I expect is to see a new category ("Online School Development") in the page listing the modules but it doesn't get listed.

I tried to clear the Drupal cache, but the module didn't get listed too.


texts: When directly loading a Commerce 2 Order Item, why is the entity cached for anonymous users?

texts:
I'm using the following to load a Commerce 2 Order Item:

    $order_item = \Drupal\commerce_order\Entity\OrderItem::load($order_item_id);

If I empty the cart for an anonymous user (thereby removing the Order Item), using the above code still loads the item as if it still exists.

The caching issue does not exist when logged in.

Why is the Order Item caches when loaded directly like I'm doing above?

How can I load a refresh version?


texts: Autocomplete for a reference field with taxonomy term content

texts:
I'm trying to create a Paragraph with a Views Reference field. The View itself has a context filter, which filters the node entities I created by the tid of a taxonomy reference fields. This all works well.

How do I manage to have the context filter option field (the one marked yellow in the following screenshot) in the edit form of the views reference paragraph have an autocomplete functionality? I don't want editors to memorize the taxonomy term's IDs, but instead type in the title of the taxonomy term and get suggestions on which term ID the editor wants to choose.


texts: Make a from element visible when a radio button is clicked

texts: I have a problem to make a date and a list element in a form in HTML invisible if the user selects one way, and visible if the user selects two. How can I write the JavaScript code for that?


texts: Entities and Plugins. What's the relationship?

texts:
As a fairly experienced Drupal 7 developer, I'm thrilled by all the new goodies in Drupal 8, but haven't quite figured out the relationship between entities and the new plugin system.

I've followed a number of tutorials on both topics, but haven't come across how they would fit together? Do they fit together?

I'd be very grateful for an explanation of how these two features coexist and inter-operate within the Drupal 8 ecosystem.

Thanks!

Edit:

My specific use case

To clarify my question: I'm building a module that provides a method for the site owner to display alerts to their visitors. I've created a new custom Content Entity (cleverly called 'Alert') using Drupal Console and custom code.

I've also followed along with several tutorials that describe how to create a custom plugin type and found this idea exciting, but the gap in my understanding is this: when (or if) there would be a use case for combining a custom Content Entity with a custom plugin type. Does anyone have an example?

Thanks!


texts: Fatal error: Cannot use object of type stdClass Error help!

texts:
When trying to access my image file from my database i get this error:

  Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\drupal-7.25\sites\all\modules\database\database_ex.module on line 99

note: line 99 is $uri = $value['url'];

function database_ex_form_submission($uri) {
  $result = db_query("SELECT myimage FROM example");
  $records = $result->fetchAll();

  $res = $result->execute();

  foreach ($records as $value) {
    $uri = $value['url'];
    $url = file_create_url($uri);
  }
}

What seems to be the problem?


texts: Identifying when ALL displays have been modified in the Views UI

texts:
A question about the visual identification of displays that have been changed within the views admin UI.

If you modify a single display a * gets added to the display's tab. However, if you select 'All Displays' the display on which you are working gets the * added to the tab but other subsequent displays which have been modified do not.

This can lead to problems if a user inadvertantly selects 'All Displays', as they will be making changes to displays that they are unaware of.

Does anyone know if there is a patch or module which exists to alter this functionality such that if a change is made to all displays that it adds the * to all display tabs, not just the tab for the display from which the change was made?

Thanks,
Pablo


texts:
I have seen this Panel on Panopoly distribution where you can add different elements from the left side, add content to them and also have a preview.

I was wondering if this is powered by Panel (or its related contributed modules) or is only available if you install Panopoly?

Many thanks,

Luca


texts: How do I track a publicly downloaded file?

texts:
I am creating a custom module to track the file download time and user id with a file link or path. I have tried multiple modules but the download the file time tracking option is not available.
How I can programmatically track the file download time?
This is the code I am using.
function mymodule_file_download($uri) {
$scheme = \Drupal::service('file_system')->uriScheme($uri);
  if (in_array($scheme, ['private', 'temporary', 'session'])) {
    $permission = "read $scheme files";
    $current_user = \Drupal::currentUser();
    $account = $current_user->getAccount();
    if ($account->hasPermission($permission)) {
      return [
        'Content-Type: text/plain',
      ];
    }

    if (\Drupal::currentUser()->isAnonymous()) {
      throw new NotFoundHttpException();
   }

  }
  elseif (in_array($scheme, ['public'])){
    $current_user = \Drupal::currentUser();
    $account = $current_user->getAccount();
   \Drupal::logger('downloads_tracker1')->notice($account);
  }

}


texts:
I have a menu block composed of menu items with submenu items.
Each menu item is displayed separately in a block.

They are all set to appear on every page, no restrictions. However if I were to access one of the submenu items, the entire menu item (including the submenu items) belonging to it does no longer appear.

I have checked in variables from template_preprocess_page, the region where the menu item block should appear is showing as empty.

How can I make it show up?


texts: How to disable field on register form but keep show in edit profile?

texts:
I need to know how to disable field on register form but keep show in edit profile? because now if I can only enable in both section, edit profile / register.

I need only show username + email field on register, but custom a lot of custom field on edit profile. thanks


texts:
I work on D7, My Sql database name is dbdrupal7 and all table prefix with abc (abc_block, abc_node, ...), website work fine. I create a custom table without prefix abc (custom). I create a module and write to custom code.

$query = db_select('custom', 'c');

$query->fields('c');

$results = $query->execute();

...

...

Show "unexpected Error" when browse.

I not want to change table name custom to abc_custom in database.

My question is how write correct code db_select('custom', 'c'); without prefix.


texts:
I've got troubles with a views sorting. I'm attempting to order the views output by a term's weight. The problem is that each taxonomy sub-term starts with weight 0, no matter what.
Is there a way to get around that, so that the sub-terms are displayed correctly?