texts:
I foolishly did this, when updating a module:

# cd /var/www/drupal7/modules
# mv MODULE MODULE.old
# wget <MODULE_URL> -O - | tar xfvz -

After refreshing the module list, I still get the old module's version because, surprise, it found the MODULE.old subdirectory first. Or last. Or whatever.

I can of course do

# rm -r MODULE.old
# ln -s MODULE MODULE.old

but that's a temporary measure at best.

How do I remove these MODULE.old directories? drush cc also tries to access them and won't run if they're not there!


texts:
I'm essentially trying to recreate the results of this question, but using taxonomy terms instead of nodes.

I have my master view (a list of taxonomy terms from a vocab') item-view, which has the term ID (TID) and I've re-written it to link to the other view item-details/[tid].

On the detail view I have a contextual filter of Taxonomy term: Term ID (to match the field in the other view) and my Argument Input settings match those in the previous answer (namely: 'From Panel Argument' for the list box 'Taxonomy term: Term ID source', then 'First' from Panel argument.)

But on the page (item-page) that holds both views in separate columns, it just links through to the detail view, at item-details/[tid], opening the url in the browser rather than enacting that special drupal magic that makes it appear in the right hand column.

Does this not work with Terms and TIDs? Or have I missed something?


texts:
I created a template file (page-classifieds.tpl.php) for a classified page.  I would like to override variables of this particular page preferably using a preprocess function.
How can I do that?
hook_preprocess_page() overrides variables for all the pages. I don't want that to happen.


texts: Login fails due to loop on localhost. Any ideas why?

texts:
I have git cloned a site and used Backup and Migrate to bring the database over the the local host.

Working on the remote host the login works fine. Not locally. Well not anymore it worked for about an hour I'd say.

  Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

I've cleared all history, tried different browsers, and restarted apache a few times.

Any ideas?

EDIT:

I can install it and after installation I stay logged in for about 60 seconds after migrating the database. I'm then redirected in a loop.

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept
cookies.

I've cleared the browsers cookies and cache
I've cleared drupals cache
restarted apache
tried different browsers

I'm beginning to think it may have something to do with how I'm setting up the site. I'm doing it in a very round-about way I think.

backup database from dev site
git clone site and point httpd.conf and hosts file at it
create database with same name, user and password from settings.php file
install site
go in an enable backup and migrate
import database from backup

site loads. drops after 60 seconds or so with the firefox message from above. I'm not 100% sure where to start troubleshooting.


texts: How do I get the currently logged-in user?

texts:
I have a site running on Drupal 8 with a login module. I want to get the user ID for the currently logged-in user to later execute a database query.
This is the code I am using.
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$uid = $user->get('uid')->value;
echo $uid;

In the controller of a custom module, this code works only between all using and the class controller uses the following code.
namespace Drupal\CoopMatha_adh_apport\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Node\Entity\Node;
use Drupal\CoopMatha_adh_apport\Repository;
use Drupal\matha_tools\Controller\ListeController;
use Drupal\matha_tools\Controller;

$userCurrent = \Drupal::currentUser();
$user = \Drupal\user\Entity\User::load($userCurrent->id());
$uid= $user->get('uid')->value;
echo $uid;

class RapportsController extends ControllerBase {

  // I want the user ID here.
  public function filtrer($firstLetter='', $nbr_ligne='') {
    // …
  }

}

How do I get the currently logged-in user ID in the controller class?


texts:
I am sure this is just by design and not much can be done, but I figured i would ask anyway...

I have a couple views on a dashboard. Each can be sorted, but when I sort one by "Date Submitted" all the others follow suit, which is expected, but not desired.

Is there a way to disconnect the Views, so that query parameters bind to a single view instead of all on screen?

Just curious,
Alex


texts: How to achieve dependent filters programmatically for views exposed form?

texts:
I have a requirement like Category and Sub-category should display as dependent filters. When I choose a Category next related sub-categories should show up in another field. These mapping is done in the backend by using Taxonomy.

I have tried so many options but no success till now.

1) I used Simple Hierarchical Module: As my view is of content-datasource(solr search purpose), I am not getting option of Has Taxonomy Terms(Depth) option also. So this module is not working out for my scenario.

2) I referred some links related to it and tried to do it in mymodule_form_alter but no success.

Link1
Link2

3) Below code I tried:

// Not calling Ajax function itself
    if (isset($form['field_categories'])) {
      $form['field_categories']['widget']['#ajax'] = array(
          'callback' => 'myAjaxCallback',
          'event' => 'change',
          ],
      );
    }

If is there any way I can add Has Taxonomy Term depth in Content-datasource view? I tried to add fields from the search api configuration page but there also that option is no there.

Can anyone help me how I can achieve that?


texts: How to load webform results using EntityFieldQuery

texts:
I have a webform and I need to read its results/submissions using EntityFieldQuery.

I need to load all the results of a specific webform having a field value. ( load all the submissions of webform node where age = 25 )

Can EntityFieldQuery do that ?

Thanks in advance.


texts: Disable vertical tabs by content type or user role

texts:
Some users may only have the ability to edit one of the fieldsets that shows up in vertical tabs on the node edit form. In such a case it looks rather silly to be using vertical tabs since there is only one vertical tab to choose from. See screenshot:

So, is it possible to disable vertical tabs by user role? Or, barring that, disable them altogether for certain content types? For my use case I just want Location to not be displayed in vertical tabs.

I tried Renderable Fields and Field Group together but they managed the form incorrectly (buggy, I think). Arrange Fields can't separate out Vertical Tabs.


texts:
Is there a reasonable upgrade path from drupal 5.3 to the current version or should I just rebuild the site from scratch? It's a pretty small site, but it does have a few custom content types, and use tac_lite for role-based security.

These are the modules I have installed:

tac_lite
filebrowser
private_upload
role_weights
site_user_list
user_import
cck
views
imagefield
imagecache
token
pathauto
path_access
marksmarty
devel
admin_menu


texts: Views related nodes with contextual filters multiple-value handling problem

texts:
I created a related nodes block with views.

Everything seems good but there is one problem that I couldn't find a solution for days.

The views has Content: Has taxonomy term ID (with depth) as contextual filter.

If a node has only one taxonomy term there is no problem and the related views block shows the related nodes tagged with the same taxonomy term.

But if a node has multiple taxonomy terms, the related nodes block shows all the nodes that are tagged with any of the taxonomy terms although I selected the Filter to items that share all terms option.

Is there any way to solve this problem?


texts:
I have a taxonomy reference link appearing on a content type.
I have a view showing all nodes tagged with certain terms in that taxonomy vocabulary.

On the view page I configured an exposed filter (select box), with options to filter the view by taxonomy term.

When I use the exposed filter I get a url like in following example:
../viewpagepath?tid=5

When I manually type a different 'tid' as url parameter the active filter option in the exposed filter changes to the corresponding term name.

I used the Taxonomy display module to change the Taxonomy page to the same view.
However, when I click on the taxonomy reference link on the content type, I can't get the url to look like this ../viewpagepath?tid=5 so that the right filter option is active.

How do I do this?

I see 2 options:

Changing the term reference link on the content type, so I get the same url pattern. (I can't use Pathauto because it doesn't accept a '?' in the pattern).
Changing the exposed filter url to match a pattern set in pathauto.

Wich one is best? Wich hooks or configuration do I use to get the right result?


texts: How to retrieve data from custom table in database?

texts:
I created a custom table in my modules .install file and I am asking for some form input in a custom made configuration file. I am unable to retrieve that data and print it out in a custom callback page that i created for testing. I'm not quite sure what i am doing wrong.

<?php
/* mymodule.install */
function mymodule_schema(){
  $schema['mymodule'] = array(
    'description' => 'Table for testing',
    'fields' => array(
      'pmid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'field_one' => array(
        'description' => 'Field 1',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => ''
      ),
      'primary key' => array('pmid'),
      'unique keys' => array(
        'pmid' => array('pmid'),
      ),
     ),
   );

/* mymodule.module */
function mymodule_form_submit($form, &$form_state){
  db_insert('mymodule')
  ->fields(array(
    'field_one' => $form_state['values']['field_one'],
    'pmid' => 1,
  ))->execute();
}

function mymodule_print_table(){
$result = db_select('mymodule', 'mm')
       ->fields('field_one')
       ->execute()
       ->fetchAll();
var_dump($result);
}

This prints an empty array for me.

EDIT:

I incorrectly assumed form_submit was a hook and didn't add it to my form.

function mymodule_form($form, &$form_state){
$form['field_one'] = array(
    '#type' => 'textfield',
    '#title' => t('Field One'),
    '#default_value' => '',
    '#description' => t('Field One Test'),
    '#required' => true,
  );
//This was missing
$form['#submit'][] = 'mymodule_form_submit';

return system_settings_form($form);
}


texts: Making a Content Type the subpage of a Views page for the sake of Breadcrumbs

texts: I have a Content Type named Cars and a Views page which lists all those cars. Is it possible to put the Cars content type under The Views page so my breadcrumbs would come out as Home > Cars > Sample Car. Cars is the Views page, Sample Car is the Content Type.


texts:
How do I render two links with a pipeline as separator? For example, $edit and $action are links generated using \Drupal::l(). Then, I edited them with the following code.

if ($edit) {
  $action =  $edit . ' | ' .  $action;
}
else {
 $action = $action;
}

$action  = $action . "";`

Instead of links, the page is displaying HTML markup as plain text, but no links.

Edit | Archive

Can anyone suggest me how to achieve this?


texts: in private message: also match last names in auto-complete of To-field

texts:
I am using the private message module and I do understand that one can use realname integration in the "To"-field to send a message. The auto complete feature helps finding the name.

Suppose I want to write to "John Smith". When I start typing "Jo.." it auto completes to "John Smith", but when I start typing "Smi.." auto completion fails. For my website it would be very nice to have that feature, since sometimes people don't know other peoples first names, but the last names.

How could I alter private message in the easiest way? Do you think other people would be interested in a more comprehensive auto completion?


texts: Ubuntu crontab is not triggering when site is in maintenance mode and also revert to online

texts:
I am using the Ultimate cron module and I have set the main Drupal cron task in crontab to run every 5 minutes.

I have put my site in maintenance mode. Drupal cron tasks are not running when site is in maintenance mode, and it is not resuming its operation when I changed the site back to online.

Please suggest.


texts: How to resolve Webform Warning 'Invalid argument supplied for foreach'?

texts:
I'm getting this warning after upgrading the Webform module to version 7.x-4.9: (I'm using Drupal 7.38)

  Warning: Invalid argument supplied for foreach() in
  _webform_select_options_to_text() (line 1034 of /home/user/www/tryouts/survey_test/sites/all/modules/contrib/webform/components/select.inc).

Here are some code samples related to the warning.

$extra['options'] = _webform_select_options_to_text(array(t('poor'), t('average'), t('good'), t('excellent')));
$extra['questions'] = _webform_select_options_to_text(array(t('question one'), t('question two'), t('question three')));

$component['extra']['options_source'] = $source_name;
if ($source_name && isset($info[$source_name])) {
$options = _webform_select_options_to_text(_webform_select_options($component, FALSE, FALSE));
}
else {
  $options = '';
}

/**
 * Convert an array of options into text.
 */
function _webform_select_options_to_text($options) {
  $output = '';
  $previous_key = FALSE;

  foreach ($options as $key => $value) {

Any suggestions about what I can do to fix this?


texts:
So I am learning the ways of the jedi Drupal, but I have come across a part of a problem in what I am doing.  I am currently trying to make a basic select list with two options.
So far I have something like this.

function form_ee_form($form, &$form_state) {

  $form['select_list'] = array(
    '#type' => 'select',
    '#title' => 'Select One for Data Rundown',
    '#value' => t('Okay'),
  );


texts:
I set the private file system to /system/files/export , I create a file in private directory programmatically and it not belong to any field ,and show link to user , I implement Hook_file_download , I want check some condition in it but when user click on link to download the file created in private path it return me Forbidden and mymodule_file_download not tirggered ( I put some code to it , even die but never called).
I clear cache but noting changes,
the link that showed for user is http://localhost/mytestdrupal/system/files/export/Export-couponcards-1393307265.csv
where is problem?

Part of my code to create file in submit

function mymodule_export_form_submit($form, $form_state) {
    $temp1 = variable_get('file_private_path');
    if (!file_prepare_directory($temp1, FILE_CREATE_DIRECTORY)) {
        drupal_set_message(t('Problem in write file in directory'), 'error');
        return;
    }
    $filename = 'Export-file'. '.csv';
    $filepath = $temp1 . '/' . $filename;
    $df = fopen($filepath, 'w');
    if (!$df) {
        drupal_set_message(t('Can not write file in') . $filepath, 'error');
        return;
    }
            fputcsv($df, array('code', 'name'));
            fputcsv($df, array('test','test'));

    fclose($df);
    $path = file_create_url($filepath);
    drupal_set_message(t('Export done. ') . '' . t('Download export file') . '');
}


texts: Token to get the last component of [node:url]

texts:
I'm using [node:url:relative] but my path has multiple parts /content-type/node-title . I would like to get only the node-title part.

Alternatively, a token that give me the node title transliterate would be fine.


texts:
I tried following the directions drupal provides for upgrading a site, but something went wrong. Now I can't log into the admin page (and the site is in maintenance mode). I'm getting the following errors:

Notice: Undefined index: bluemarine in drupal_theme_initialize() (line 100 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Trying to get property of non-object in _drupal_theme_initialize() (line 145 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Trying to get property of non-object in _theme_load_registry() (line 283 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Undefined index: bluemarine in theme_get_setting() (line 1166 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Undefined index: bluemarine in template_preprocess_maintenance_page() (line 2433 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Trying to get property of non-object in template_preprocess_maintenance_page() (line 2433 of /home1/osuskite/public_html/includes/theme.inc).
Warning: array_keys() [function.array-keys]: The first argument should be an array in template_preprocess_maintenance_page() (line 2436 of /home1/osuskite/public_html/includes/theme.inc).
Warning: Invalid argument supplied for foreach() in template_preprocess_maintenance_page() (line 2436 of /home1/osuskite/public_html/includes/theme.inc).

And then a second error:

Warning: Cannot modify header information - headers already sent by (output started at /home1/osuskite/public_html/includes/common.inc:2567) in drupal_send_headers() (line 1018 of /home1/osuskite/public_html/includes/bootstrap.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'osuskite_drupal.cache_token' doesn't exist: DELETE FROM {cache_token} WHERE (expire <> :db_condition_placeholder_0) AND (expire < :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => 1316109148 ) in cache_clear_all() (line 169 of /home1/osuskite/public_html/includes/cache.inc).
Notice: Undefined index: bluemarine in template_preprocess_maintenance_page() (line 2433 of /home1/osuskite/public_html/includes/theme.inc).
Notice: Trying to get property of non-object in template_preprocess_maintenance_page() (line 2433 of /home1/osuskite/public_html/includes/theme.inc).
Warning: array_keys() [function.array-keys]: The first argument should be an array in template_preprocess_maintenance_page() (line 2436 of /home1/osuskite/public_html/includes/theme.inc).
Warning: Invalid argument supplied for foreach() in template_preprocess_maintenance_page() (line 2436 of /home1/osuskite/public_html/includes/theme.inc).

From what I could surmise, there error is being caused by Acquia Marina. I have downloaded the latest version and put it into the themes directory, but the error didn't change.

Any help would be appreciated. Googling this issue only pointed me to hundreds of other sites with the error instead of a solution.

EDIT: Truncating the SQL caches did nothing.


texts: I would like to know how to embed a Google map on a page, so that the the "directions" icon is showing. I had previously used the Simple Gmap module, but it doesn't provide the icon which I need.


texts:
I have a paragraph with a boolean field.

content type
-paragraph entity reference
left hand side paragraph
checkbox
image
title

All the other fields have their own field-paragraph-field-checkbox.html.twig files and there's nothing to be checked, just adding a class around the image and title {{ item.content }} value.

However, I need to check if the checkbox field value is 1 or 0 in field-paragraph-field-checkbox.html.twig, and add a class if it's 1, or do nothing if it's 0.

When I tried printing the value with {{ content.field_checkbox.value }} nothing prints. I also tried with {{ node.field_checkbox.value }}, but I don't get any value.

How do I check the value of a Boolean field in a template file?


texts:
Is is possible to define a PHP variable using a field?

eg. In the field a contributor would enter [ABC]

which would translate to: <?php $VARIABLE = '[ABC]'; ?>

which would be repeatedly used in the node as:

<img src="http://www.example.com/<?php echo "$VARIABLE"; ?>/image_01.jpg/>
<img src="http://www.example.com/<?php echo "$VARIABLE"; ?>/image_02.jpg/>

etc


texts:
The latest Drupal Ckeditor Module 1.14 loads the Ckeditor library via CDN.
The table on http://ckeditor.com/presets-all shows the 5 possible packages to be used via CDN.
I am using the Full-all package.
This package has a lot of optional plugins.

How can I activate these optional Ckeditor plugins in Drupal ????


texts:
I've inherited a Drupal 7 site that was built in 2014. We've noticed that the body field (on any content type) has a summary textarea, but it does not save data upon submission.

Also, in comparing with other D7 sites that we have, I find it odd that on this site the Body field is assigned a 'Long text' field type whereas normally the body field uses a 'Long text and summary' field type.

Also of note, the 'Summary input' check-box on the content type setting page (/admin/structure/types/manage/page/fields/body) does not exist.

Any ideas on how to debug this issue?


texts: Conversion tracking code immediately after body tag?

texts:
I'm fairly new to Drupal, so bare with me. I need to add some tracking code immediately after the body tag on the checkout complete page. I'm guessing I need to add it to the html.tpl.php or $page_top variables or maybe a checkout pane. My question is:

Which way is the best way to do it?
If I need to add it in the html.tpl.php, how would I do that for just the checkout complete page?
If I need to add it in the $page_top variable for only the checkout complete page, how would I do that?
If I need to do it in a checkout pane, how would I keeping in mind is needs to be immediately after the body tag?

Using the Drupal Commerce module.


texts: Changing a form value or input field value during the submit handler

texts:
I am trying to change the value of a text area field at the end of my submit handler. I have tried using form_set_value and $form['form_id']['#value'] = 'something'; to accomplish this but after clicking the submit button the field never changes. Also the submit button that I am trying to change the field with comes from the file managed form. I also included $form_state['rebuild'] = true; after I set the field's value. Here is my code

function my_module_my_form_submit($form,&$form_state) {

//do something with then file code
...

then

$form_set_value($form['value_to_change'], 'update the value, $form_state);

//I also tried

$form['value_to_change']['#value'] = 'update the value';

$form_state['rebuild'] =TRUE
}

In the form my code is

$form['value_to_change'] = array(
'#type' = 'text area',
'#value' => 'this will change',
);


texts:
I'm using drush on D6 websites and i would to create and manage my features via drush.So i patched the 1.2 version like in this post :

Then i get an error when i try to create a feature for content types : https://www.drupal.org/node/2283617

  $ drush @sitebl fe --d --destination="sites/all/modules/_features"  briselames_content_type  node:page_lycee
....
Unknown option: --destination

Have you any idea about this ?

thanks

EDIT1

when i try whithout quotes (or single quotes '') this give an error

$ drush @sitebl fe --d -destination=sites/all/modules/_features  briselames_content_type  node:page_lycee
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
Bootstrap to phase 0. [0 sec, 3.81 MB]                               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 4.01 MB] [bootstrap]
Loaded alias @sitebl from file /home/xxx/.drush/aliases.drushrc.php [0.16 sec, 4.02 MB]                                             [notice]
Cache SET cid: 6.6-dev-alias-path--e9a42ca79125c2d266c093da6a27d238 [0.25 sec, 4.02 MB]                                                             [debug]
Cache HIT cid: 6.6-dev-commandfiles-0-29f4f0296708390047a2c57582fb56a8 [0.27 sec, 4.03 MB]                                                          [debug]
Bootstrap to phase 0. [1.9 sec, 9.59 MB]                                                                                [bootstrap]
Bootstrap to phase 5. [1.94 sec, 9.59 MB]                                                                                [bootstrap]
The drush command 'fe briselames_content_type node:page_lycee' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache[error]
if you have installed new extensions. [1.94 sec, 9.59 MB]
The directory 1 does not contain a valid Drupal installation [1.94 sec, 9.59 MB]                                                                [error]


texts: How to show/hide textfield according to the change in drop down using jquery?

texts:
$(".form-select").change(function () {
  if (this.value == "1") {
    $('.form-item-example').stop(true,true).show(700);
  }
  else{
    $('.form-item-example').stop(true,true).hide(700);
  }
});

This is what i have used in my js file but it is hiding the text fields when any of the drop down in the form is changed, I'm having 3 drop downs in the form.


texts:
I'd like to add a Best of Houzz badge on our site.  I have the code, but don't know where to put it.

Is it Admin --> structure --> ... then what?

Since the site was built by someone else and now I'm maintaining it, I really don' want to mess anything up by poking around and "experimenting."


texts:
I have installed drupal print module(latest stable version) and working fine with loads of config unless a big problem that the full content(A view of sets of views) are displaying in one page only,if the content exceeds the current page it displaying on the above of the page. CSS are also working fine.More than one page is not generating.

Any bug or needs config..?


texts: Get webform submissions filtered by data value

texts:
I have 2 webforms set up, one form collects the user email address and emails the user some info, the second form collects their email address again and needs to select the previous form's submitted data from the database and forward this onto a selected user.

Is there an efficient method for selecting webform data filtered by a field, rather than nid or sid, (in my case it would be an email address)?


texts: How do I enable and limit field permission to a specific user?

texts:
I have created a content type that contains 8 fields.

Users can view the content as a table from search filter in views.

The next step is that I would like to:

Enable specific users of a particular role to edit only 1 of the 8 fields.
They can only edit the field once.

Is there a way to do this with minimal PHP Coding? i.e. use of modules such as field permission etc. or rules?


texts: How to create programmatically ubercart orders with attributes

texts:
How to create programmatically ubercart 3 orders with attributes and credit card payment information? I want to create custom ubercart 3 orders with products attributes and I am using authorized.net payment gateway in credit card then I want to this payment gateway use for programmatically ubercart 3 order creationg.

Please help.

Thanks


texts: Site not responding while flushing cache

texts:
I have a Drupal 7 site which requires flushing the cache from time to time. The problem is that whenever I flush the cache (~30 seconds) the site is non-responsive until the flush is over.

What could be the cause and how do I debug this?
Thanks


texts: Cache max-age doesn't correctly expire at midnight

texts:
I've got a node which cache should expire every day at midnight. Additionally I've a block showing the same node in another display mode, that also should expire every day at midnight. I thought this would be pretty easy by calculating max-age

page_cache is already disabled - dynamic_page_cache is enabled

.module file

function wt_lunch_preprocess_node(array &$variables) {
  $node = $variables['node'];
  if ($node->bundle() == 'wt_lunch') {
    $maxAge = strtotime('tomorrow') - strtotime('now');
    $variables['#cache']['max-age'] = $maxAge;
    $today = strtolower(date('l'));
    $variables['max_age'] = $maxAge; // this line is just for debugging
  }
}

src/Plugin/Block/MyBlock.php

...
  public function build() {
    $maxAge = strtotime('tomorrow') - strtotime('now');
    $emptyResult = [
      '#markup' => '',
      '#cache' => ['max-age' => $maxAge]
    ];

    $node = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->loadByProperties(['type' => 'wt_lunch']);

    if (!$node = reset($node)) {
      return $emptyResult;
    }

    $build = \Drupal::entityTypeManager()->getViewBuilder('node')->view($node, 'special');
    $build['#cache']['max-age'] = $maxAge;
    $build['#attached']['library'][] = 'wt_lunch/daily';
    $build['#attached']['drupalSettings']['wt']['lunch']['timer'] = $node->get('field_lunch_daily_timer')->value;
    $build['#attached']['drupalSettings']['wt']['lunch']['from'] = $node->get('field_lunch_daily_from')->value;
    $build['#attached']['drupalSettings']['wt']['lunch']['until'] = $node->get('field_lunch_daily_until')->value;
    $build['#attributes']['class'][] = 'lunch--daily';
    return $build;
  }
...

This works almost every day. Almost. Every 10-15 days the cache does not expire properly and keeps rendering the block from yesterday.

Today the block didn't expire correctly again. I've previously added hidden debug comments in my Twig template, showing cache infos in the rendered HTML:

{{ date().timestamp }} ==> 1543194778 (roundabout 1am yesterday)
{{ max_age }} ==>  78422 (see $maxAge in code above, about 23 hours)

So I can verify that $build['#cache']['max-age'] definitly was correctly calculated, yet I did get the outdated block today at 11am.

Can anybody give me a clue why the max-age of the block sometimes does not work?


texts: How to pass multiple IDs to a Views exposed filter?

texts:
Is there any way to pass multiple IDs to a Views exposed filter?

We need to pass an array of IDs to the filter.

Notes:

There we can see operator "=" but it not taken 1,2 etc.
We have tried regular expressions to, but it also not working.
We are not using contextual filters.


texts: Adding class to the webform submit button

texts:
By default, the web form is displayed with <?php print drupal_render($form['submitted']); ?> .

I need to make a small edit and add class="btn" to the submit button.

I can change its value with $form['actions']['submit']['#value'] = "click to become a member";

But I couldnt find a way to add the class.

Please help!

Thank you


texts:
I have my collapsing working, but I'd like each collapsing title to have a bullet. When I try, my bullets are on a line by themselves, one line higher than the title.  I thought I could accomplish this through CSS but can't figure out how.

Thanks so much!


texts: Is there a Drupal.org issue queues module? Which module does Drupal.org use?

texts:
Does Drupal.org use a module for its project issues tracking? I would like to implement it on our D7 site.

Does this exist as a module or is this something proprietary to drupal.org? If it is not a module, what is the closest I can get for Drupal 7?


texts: Microbloging Module that saves as a node

texts:
Does anyone have advice on a module that will save a user's posting as a Content Node Type? I would like to use something like Facebook-like status or Microblog but I'd like the user's post to be saved as a content node (and thus show up under the Organic Group's home tab). The other micro-bloging modules save to their own tables or to activity_log.

We're using Commons 2.10.


texts: How to add extra arguments/parameters to ajax callback function?

texts:
I am using drupal 7. I need to add extra arguments to my ajax callback function. I have five fieldsets in my form, and in all of them same there are same elements, just their IDs are different. For example; group-1, group-2... I need to include that 1,2,3.. part in the callback function as arguments. Otherwise, it will be too complicated to build a logic to predict which fieldset element need to change.

For example, is such a an implementation possible?

function mymodule_form($form, $form_state) {
    $group = 1;

    // Some form elements...

    $form['button'] = array(
        '#type' => 'button',
        '#ajax' => array(
            'callback' => 'my_callback_function',
            'wrapper' => 'my_target_area',
            'arguments' => array($group1, ...) // Is such a thing possible or another way?
        ),
    );
}

function my_callback_function($args, $form, $form_state) {
    $arguments = $args;
    return $form['my_target_area'];
}

This question as already been asked here. But I those answers don't fit my needs mentioned above. Thank you.


texts:
Problem

I just tried to revert to a recent backup and got a very strange error.

Wiped database.
Deleted drupal base folder.
Copied in new Drupal folder (from backup).
Ran install.php

Re-installing was successful (except for the failure to send an email), but on loading the site I got the following error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite2.languages' doesn't exist: SELECT * FROM {languages} ORDER BY weight ASC, name ASC; Array ( ) in language_list() (line 2727 of /srv/www/mysite2/public/includes/bootstrap.inc).

Any idea what could've caused this?

My Thoughts

I've not restored the the database yet so I don't quite understand what could cause this? None of the modules that I have in my build should begin enabled after a basic install.

But it does seem as if some part of my folders or modules are interfering with a basic drupal install, calling something which doesn't exist yet and blocking me. Even though they shouldn't be enabled.


texts: d7: to be inserted ID, is there a cleaner way?

texts:
I need to know the 'to be inserted ID'

I wrote the following function, it works, however, I'm sure this is not the way to do it.

 function insert_node_style($style) {
  // get latest id
  $id = db_query("SELECT MAX(nid) FROM {node}")->fetchCol('nid');
  $id = array_shift(array_values($id));
  $new_nid = $id + '1';
  // insert nid, vid and style
  db_insert('nodestyle_node') ->fields(array(
    'nid' => $new_nid,
    'vid' => '1',
    'style' => $style,
  ))
  ->execute();
}

Is there are cleaner/drupal way to achieve the same result?


texts: Pass data from a hook to (be used in another hook)

texts:
So in a hook hook_commerce_cart_order_refresh() I make some calculations that I would later like to use in a different hook hook_form_alter, how can I pass these data/object and use later on?

In that first hook, I have a EntityMetadataWrapper but it seems I can only give it data that actually is persisted, and mine should only exist for the request.

Again, I could use $_SESSION but that storage is used for persistent storage through multiple requests. And I'm not looking for that.

Any suggestions?


texts: How do I get the path for the private filesystem?

texts:
I just trying to get the real path of my private filesystem but I just obtain an empty string if I use:

\Drupal::service('file_system')->realpath("private://");

There one user in Get the public path directory that says that this is the correct way, but this is not working for me.

My private filesystem is configured as:

$settings['file_private_path'] = '/User/adriancid/private-drupal-folder';

If I use file_default_scheme() I see:

  private


texts: Display Exposed Filter value of selected exposed filter

texts:
I work on drupal 7, and create a page from views used 4 exposed filter. I want to display exposed selected values., and also close button in exposed selected values

I try to selected data in field and excluded it and  used  in header Global: Unfiltered text. But not work properly.


texts:
In the section called Manage fields within a content type, there is an option called Add an existing field. How this field is activated?

Some time ago I installed Drupal 7.38 and I worked with such option. This option was there. I never knew how it appeared there.

Now, I have two new Drupal installations (7.38 and 7.40). None of them shows by default the option called "Add an existing field".

Does the option "Add an existing field" belong to Drupal core or to some contributed module?


texts: I want to change default product variation machine name?

texts:
I am working in Drupal Commerce kickstart. It's have default content types like hats,bags_cases,tops and all. I want to change the machine name also.Is it possible?

I am going to change structure->content types -> edit

But I can't change it...


texts: Programatically change autocomplete views exposed filter by a select list

texts:
I have a view which has a filter by users that created de nodes. This filter is exposed, in order to select an user and filter the results by this user. I would like to change the default autocomplete filter by a select list of user, and in this list I want to show only some users.
I followed this tutorial but without success. Although I change "uid" form field, It does anything.
How could I do it? Thanks

UPDATE: my code.

function my_module_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {

$pos = stripos($form['#id'], 'views-exposed-form-my-form');
if ($pos !== false) {

    $opcusuarios = array();
    $query = \Drupal::entityQuery('user');
    ... some conditions ...
    $entity_ids = $query->execute();
    $usuarios = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple($entity_ids);
    foreach($usuarios as $user) {
        $opcusuarios[$user->id()] = $user->getAccountName();
    }

    // Change the input
    $form['uid']['#type'] = 'select';
    $form['uid']['#multiple'] = FALSE;

    // Add the $options from above to our select list
    $form['uid']['#options'] = $opcusuarios;
    unset($form['uid']['#size']);
}

}


texts: Unable to change the author of content using views/action

texts:
I want to change the author of multiple nodes. I have set up a new action by going to /admin/config/system/actions and then selecting "CREATE AN ADVANCED ACTION" and then "Change the author of content..."

In my view of the content type I have added the "Node operations bulk form" field.

My problem is that when I try to update any content using this method I get the error "No access to execute Change the author on the Content [TITLE]'. The user has a role giving permission to edit the content.

I have looked at the code that generates this error - it is in core/modules/system/src/Plugin/views/field/BulkForm.php

        // Skip execution if the user did not have access.
    if (!$action->getPlugin()->access($entity, $this->view->getUser())) {
      $this->drupalSetMessage($this->t('No access to execute %action on the @entity_type_label %entity_label.', [
        '%action' => $action->label(),
        '@entity_type_label' => $entity->getEntityType()->getLabel(),
        '%entity_label' => $entity->label()
      ]), 'error');
      continue;
    }

Anyone any idea what I can do to get this to work? I need to change the author of thousands of nodes, so I need to work this out.


texts: Drupal Views: Contextual Filters for certain fields

texts:
I'm having a little trouble understanding contextual filters on Drupal Views and was wondering if I could have a hand solving this problem.

I've got a content type and which allows me to add a Title, Body and a Featured Image. I want this featured image to be displayed through a Drupal View, but only when it matches the current node. If I view the Product 1 node, I only want to show the Featured Image for Product 1 and not all the other products too.

I've got a Featured Image view set up as a Block and I can successfully display this block for my allocated content type. It reads the Content: Title and the Content: Featured Image fields where the Title field is excluded from display.

How do I configure the contextual filter to restrict the Featured Image only where the currently viewed node matches the Title. Is this possible?


texts: I'm brand new to Drupal and have just installed Drupal 7. When I was configuring it, I originally selected "Stark" as my Admin theme, thinking I would create my own CSS later. In trying to learn Drupal and add content, I have decided that I would like to change my Admin theme. I went to the Admin tool bar (across the top) and clicked "Appearance" and changed my theme there, I even disabled the "Stark" theme, but my Admin theme is still defaulting to the Stark theme. How do I change this?


texts: Find users who have not uploaded certain contents in last 30 days

texts:
I need to find users who have not uploaded certain contents in last 30 days. I have tried this query it is not working. Can anyone help me?

  select uid, max(created) as max_created from node where
  node.type in ('page','story') AND
  max_created < UNIX_TIMESTAMP()-2592000

I am getting error in phpmyadmin:

  1054 - Unknown column 'max_created' in 'where clause'


texts: How to create and display user content submission form and display it in a block?

texts: I want to build a user feedback form to create a content type which can be outputted as a view page. What I discover is that, i can create a new content type in which anonymous user can add contents, but I need that form to be in a block on a sidebar.


texts: Rules to create an autoresponder for a Webform submission?

texts:
I need to create a Rule to create a autoresponder email for a Webform submission.

This is: the webform has only the "email" field. When the form is submitted the rule should fetch the the 'email account' entered in the email form field and send an email to that account. That's all.

I already enabled the Webform Rules module but I see to way to fetch the email value from the rule I created.

What am I missing here?


texts: How can I stop Drupal from sending e-mails of any kind?

texts:
I have a dev, staging, and live server workflow set up on Pantheon.  My site has a lot of rules that cause members to be e-mailed for various reasons.  I sometimes need to work on these on my dev/staging sites but I've realized that, since they have the live data, sometimes users will receive additional or duplicate e-mails when I'm working on something.

Is there any easy way to turn off all e-mailing capability (preferably automatically to prevent me from forgetting) on a dev/staging server?  Ideally, I'd like to disable e-mail via a custom module, since I already have steps in place for making sure a custom module is enabled on dev/staging.


texts: Clearing the cache breaks the installation

texts:
I just moved my Drupal 7 installation to another server. All the domain names are exactly the same. Everything seems to work fine until I click on clear caches. That results in a HTTP 500 error which I am unable to debug since the host does not display the errors.

I have sql dump for my db that is right before I hit the clear caches so whenever I fully restore the db in that state the site is back up again. That tells me that it is a database issues but I cannot figure out what it may be.

Any ideas?


texts:
I usually download the latest Drupal 7 using drush dl drupal --select, but but Drupal 8 doesn't get listed.

What are some nice and quick ways of download the latest version of Drupal 8, even though it is still in alpha stage?


texts: How to programmatically add / remove a value for an unlimited multivalue field?

texts:
I was looking at http://php.net/manual/en/function.array-push.php but it seems one cannot use it as multi value fields are associate arrays. Any built in functions perhaps?
Here is an example array

$myfield["und"][0]["value"] = 23424;
$myfield["und"][1]["value"] = 76786;


texts:
I am trying to update a node in a hook_cron() function. I am using Drupal 6.
Here is my code:
function offers_cron() {
  $query= db_query("SELECT * FROM {node} WHERE type = 'product'");
  while($allnodes = db_fetch_object($query)){
    $node_id=$allnodes->nid;
    $node=node_load($node_id);

    $node = new stdClass();
    $node->nid = $node_id;

    $node->type = 'product';
    $node->language = 'en';
    $node->uid=1;
    $node->status = 1;
    $node->created = time();
    $node->changed = $node->created;
    $node->comment=0;
    $node->promote = 0;
    $node->sticky = 0;
    $node->format = 2;
    $node->title='test';
    $node->field_price[0]['value']='120';

    if ($node = node_submit($node)) {
      node_save($node);
      drupal_set_message(t("Node ".$node->title." added correctly"));
    } else {
      drupal_set_message(t("Node ".$node->title." added incorrectly"), "error");
    }
  }
}

Now it shows it has updated all nodes. Here is screen shot for this :

Now when I click any node the update does not show.
Please take a look:

Does anybody have any ideas about this?
I have even tried clearing the cache.
Thanks


texts: Show either a node or a blocks page at frontpage

texts:
At the path "/" - the frontpage of my site, I want to show either

For anonymous users, the content of a particular node, which is normally available at "/somepath".
For authenticated users, a series of blocks.

How do I do this?

I think the most elegant answer involves using page manager to take control of the "/" route. With this it is easy to show a series of blocks as one variant, but I don't see how to show a particular node.

I have tried setting the "Default front page" at admin/config/system/site-information to "/somepath". But when I do this my panel page defined in page manager does not show up, either when it targets "/" or "/somepath".

As a fallback, I can probably achieve the same result without page manager at all, by choosing to hide the "content" block on the home page and show only the blocks I want. But I worry this gets messy fast, even using the block visibility groups module to avoid repeating the conditions.


texts: Rule to redirect to registration page after adding new product to cart. I am using ubercart module for this and working with drupal 7


texts: Drupal 8 how to show entity reference field in views exposed filter as select list?

texts:
I have content types as Leaves and Branch. and I have an Branch ER field in Leaves.
How to show Branch as select list in views exposed filter Drupal 8?

I really need a solution asap.

Thanks.


texts: How to show an alert when user navigates to another page without filling the form?

texts:
I have a form created by a custom module. Now I want to show an alert like ("Please fil the complete form before navigating otherwise lost all the data") if the user navigate to another page without filling all required fields.

How can I do so?


texts: Pasting into CKEditor creates divs instead of paragraphs

texts:
I'm working with content owners who think it's a good idea to compose their content in Microsoft Word.  Although I've created a detailed guide for them on how to make this less painful (describing how to format things in meaningful ways in Word, like using header styles instead of just bolding your text to make it look like a header--things that are obvious to anyone who cares about semantic HTML, and that should be obvious to a user of Word who actually cares about quality and precision instead of just spewing words all over the page), they pretty much ignore it and create poorly formatted content, which of course means it just gets worse when copied and pasted into a rich text editor in Drupal.

Since they don't know HTML, and so can't easily fix this horrible formatting in the rich text editor, I've suggested copying it into a text editor (probably Notepad for them) and then pasting it in, and adding the formatting again in the rich text editor.

The problem I'm running into here is that the WYSIWYG module, or else CKEditor itself, creates  elements for each paragraph instead of  elements.  I'm not sure why this is, but it is of course a very bad thing from the points of view of semantic HTML, CSS styling, and any other point of view I can think of.

How can I fix this?  How can I set things up so that plain text which is pasted into the WYSIWYG editor will give me  elements for each paragraph instead of  elements?


texts: How do I check if the user is watching the front page or the user is logged in?

texts:
I like to have the same result in a template if the user is logged-in or is on the front page.

So if the user is not logged-in nor on the front page, it should be the same result as if the user is logged in and not on the front page.

I got

<?php if ($logged_in): ?>

Do something

  <?php else: ?>

Do Something Other

<?php endif; ?>

How to extend this to force drupal to do the same on front as for the logged in user if the user is not logged in but viewing the front page

In other words how to get if drupal_is_ _on_front OR  $logged_in

elseif

I am a php newbee

thank you for an explanation


texts: How to do an embedded select (with count()) with the Drupal 7 database api?

texts:
Another day, another challenge with the Drupal 7 database API.  I'm trying to do something like this:

select n.nid,
     (select count(*) as count
          from {node_cnt} nc where nc.nid = n.nid) as node_count
from {node} n

That is, I want to get back a set of node id's and the number of times that each id appears in the table node_cnt.  I'm going to be laying in some other conditions and pager stuff, so I think I need to do this with db_select.  This should be simple, I suppose, but I just haven't figured out the right way to think about this stuff yet.  Any advice out there?  Thanks!


texts:
I got this:

As you see I already aligned label and input field inline with CSS, because they are both inside same container, but the button is outside. I was wondering if I could somehow move the button inside the container? So then I could format all elements into one line.


texts: How to avoid Exif data rotating images automatically during approval selection?

texts:
I've been doing some digging, but so far with no results. I'm currently looking for a way of forcing or letting the admin to dictate the orientation of an image. I came across an issue where some user uploaded content looked correct upon initial upload, but when the admin began the approval process, the files hidden orientation data changed it from a vertical to a horizontal orientation. Now mind you I know that I could simply re-save that file, pull down the submitted post data and re-upload with the correct image, but I'm trying to be as efficient as possible in the event someone outside myself is administrating the content one day.

Has anyone come across a module that could help force orientation away from EXIF content or other data?

Thanks in advance!


texts: Programmatically get input format in field template

texts:
We change some output in our field.tpl-files for body fields, depending on the input format that was used on the node (which itself depends on the user being able to modify it).

Now this worked by drilling down to $element['#object']->body["und"][0]["format"] but that's hardly best practice as illustrated by helpful articles.

But – what is the correct way to get a reliable, language-agnostic variable like $ouptut['format']?

Thanks for any infos on that!


texts: Custom prefix for each value of a multi-value field

texts:
I have a number field where a user needs to enter two values. Each value should have a custom prefix but that isn't possible within the field settings.

Does anybody know how this can be done? Thanks.


texts: Are HTTP headers and cookies validated against malicious input?

texts:
I'm developing a Drupal site for a government organisation and am required to fill in a security assessment form. The form asks for confirmation that the "application" (Drupal in this case) takes steps to mitigate against threats and attacks that can exist as a result of inadequate data validation and encoding, including form field manipulation, cookie manipulation, and HTTP header manipulation.

The specific questions asked are:

Are cookies validated?
Are HTTP headers (e.g. Referer and User-Agent) validated?

I can answer from the point of view of my own application (it uses and validates a couple of cookies, does no validation of HTTP headers). How should I answer in terms of what Drupal core does?


texts: Does the cron using Drush must be setup locally or on the server for the production website

texts:
I have been reading about the Drush cron and explanation that mentions in this documentation. Wondering do we add that crontab entry for drush locally or on the server where the website is for the production site? This confusion is because the article mentions drush aliases.

This is the crontab entry suggested

  10 * * * * /usr/bin/env
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  COLUMNS=72 /usr/local/drush/drush --root=/path/to/your/drupalroot
  --uri=your.drupalsite.org --quiet cron

Here is the part that is confusing

  Specifying the Drupal site to run

  There are many ways to tell Drush which Drupal site to select for the
  active command, and any may be used here. The example uses the --root
  and --uri flags, but you could also use an alias record if you defined
  it in a global location, such as /etc/Drush/aliases.Drushrc.php.

Does it refer to aliases on my local or possible aliases on the server which may have dev, qa and other related sites.


texts:
I found this code to create a node programmatically. It creates the node but the "title" field is not populated.

    $body_text = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.';

  $node = new stdClass();
  $node->type = 'flats';
  node_object_prepare($node);

  $node->title    = 'Node Created on ' . date('c');
  $node->language = 'en';

  $node->body[$node->language][0]['value']   = $body_text;
  $node->body[$node->language][0]['summary'] = text_summary($body_text);
  $node->body[$node->language][0]['format']  = 'filtered_html';

  $path = 'content/my-lipsum-' . date('YmdHis');
  $node->path = array('alias' => $path);

  node_save($node);

The machine name of my Title is "title_field", but using this neither works:

  $node->title_field    = 'Node Created on ' . date('c');


texts: What does the "Views: Filter by an entity reference view" reference method do?

texts:
I was just creating a reference type and noticed that there is a reference method called Views: Filter by an entity reference view. What does this do, and how does it differ from the Default method?
I tried selecting it but received the following message:

No eligible views were found. Create a view with an Entity Reference display, or add such a display to an existing view.

I tried creating a view but couldn't see any Entity Reference display options. I also couldn't find any documentation about what this reference method (or the default one, for that matter) do.


texts: How to assign twig templates dynamically on basis of field value of custom block?

texts: I have a list box in my custom block with different theme options. On basis of the List box field value I would like to assign the specific twig template dynamically. What will be the best approach to do it and how ? If possible please provide a code snippet for the same.


texts: Getting the token tree to appear contextually

texts:
I'm writing my own file formatter which is supposed to be Token-compatible. As it will be also used on taxonomy term pages, it should accept taxonomy term token. What am I doing wrong in hook_field_formatter_settings_form by saying:

'#token_types' => array('node', 'taxonomy_term')

so that I don't get term-related tokens at all? Cleared cache many a time.
Preferably, I would like the tokens to appear contextually: taxonomy term - when managing display of taxonomy term page, node - when managing display of a node page. Can this be done?


texts: Update imported feeds to only get one taxonomy term per node

texts:
I have used feeds to import some nodes with taxonomy term reference.

The source XML is the following one.

<items>
  <item>
    <title>Test 1</title>
    <body>Test body 1</body>
    <term>My_term_foo</term>
    </item>
</items>

First import is OK. I edited <term>My_term_bar</term>, and started importing a second feed.
After the second time, the node has both "My_term_foo" and "My_term_bar," but I need only "My_term_bar" from the second import.

Is there any hook_feeds_node_item_presave() I can use to alter the values being imported?

EDIT:

My final code of hook_nodeapi inpired by sel_space:

switch ($op) {
      case 'presave':
        if ($old_node = node_load($node->nid)) {
          $taxonomy = array_diff_assoc((array) $node->taxonomy, (array) $old_node->taxonomy);
          if (!empty($taxonomy)) {
            $node->taxonomy = $taxonomy;
          }
        }
        break;
    }


texts: Passing Settings from page.tpl to Javascript: Uncaught TypeError: Cannot read property

texts:
I want to pass this to my js file :
in page.tpl

<?php
$my_settings = array(
    'message' => $message,
);

drupal_add_js(
    drupal_get_path('theme', 'sizin') .'/js/anim.js',
    array('my_settings' => $my_settings),

    'setting');
?>

in anim.js

var message = Drupal.settings.my_settings.message;

i got this error from chrome:

Uncaught TypeError: Cannot read property 'message' of undefined

Any Help/Idea ?

and i've read this : Retrive $message variables in javascript file


texts: Argument 1 passed to EntityViewBuilder must implement interface, null given

texts:
In my Drupal project I have this error:

Recoverable fatal error: Argument 1 passed to Drupal\Core\Entity\EntityViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Users/team1/workspace/ga_p/modules/field_collection/src/Plugin/Field/FieldFormatter/FieldCollectionItemsFormatter.php on line 33 and defined in Drupal\Core\Entity\EntityViewBuilder->view() (line 110 of core/lib/Drupal/Core/Entity/EntityViewBuilder.php).

I do not know if it's from having created multiple fields (fieldCollections)

But I do not know how to remove this error.

Drupal Version: 8.3.4


texts: I need to send to specific persons one-time registration email links, in order to create users with specific roles. The "normal" registration should be available as well.


texts: How is composer including a dependent module?

texts:
I have a composer managed Drupal project based on drupal/recommended-project.
I'm installing a contrib module, domain_group, and I'm seeing that composer is auto-including a required dependency, even though it's not listed in the module's composer.json. (I'm checking some other contrib modules and it seems that this is not specific to this module, but a consistent pattern across many modules.)
I run:
composer require drupal/domain_group

and it installs domain_group and domain_site_settings.
Then when I run:
composer why drupal/domain_site_settings

and it tells me that drupal/domain_group requires it.
While the dependency is not listed in domain_group/composer.json, I do see that it is listed in domain_group.info.yml.
Is composer somehow looking to the .info.yml to check for dependencies? Is this some kind of Drupal magic? What causes this? How does it work?
Update:
It seems that it's not checking the .info.yml, at least not locally. From @Clive, in the comments:

[composer why still lists the dependency] even when [the reference to domain_site_settings] is not in domain_group's local composer.json, composer.lock is deleted, the require line in domain_group.info.yml is commented out and composer cache is cleared (just checked). Where is it getting the reference?

I'm now wondering if composer why checks the remote repositories, e.g. https://packages.drupal.org/8, and if there's something special about the d.o repository that compiles extra package dependencies from .info.yml files.
domain_group/composer.json
{
    "name": "drupal/domain_group",
    "type": "drupal-module",
    "description": "This module provides integration between Domain and Group modules",
    "homepage": "http://drupal.org/project/domain_group",
    "authors": [], // etc...
    "support": {}, // etc...
    "license": "GPL-2.0+",
    "minimum-stability": "dev",
    "require": {
        "drupal/core": "^8.8 || ^9",
        "drupal/group": "~1.0",
        "drupal/domain": "~1.0"
    }
}

domain_group/domain_group.info.yml
name: 'Domain Group'
type: module
description: 'This module provides integration between Domain and Group modules.'
core: 8.x
core_version_requirement: ^8 || ^9
package: 'Domain'
dependencies:
  - group:group
  - domain:domain
  - domain_site_settings:domain_site_settings # Is composer somehow respecting this?


texts:
I have such a situation:

I have 4 content types:

city (name)
cinema (name, city_ref, hall_count)
movie (name, description)
session (movie_ref, cinema_ref, hall_number, date_time)

city_ref, movie_ref, cinema_ref are connecting content types with Node Reference module.

After that with Views and EVA I can aggregate some movie listings, etc.

What I want to do is to make site content manager register multiple sessions while entering a movie description, i.e.:

there are number of cities and cinemas created and fixed. But the number of movies may change and content creator opens the form and enters name of the movie, description and then has something like multiple sessions: in the same form content admin can enter session, which automatically has reference to this movie, add reference to the cinema, hall number, date AND (if needed) he could ADD additional session with the same duplicated info, but maybe different hall number/cinema and date.

How could it be solved? Is there any way to connect those content types to make it a bit easier to enter all the data and still have all the relations working?


texts: How can I serve js and css from Drupal 7

texts:
I'm very new to Drupal and I have a bunch of sites to manage that are in different cms's like wordpress, sharepoint and others. My goal is to merge all the content into drupal over time.

I want to manage a master menu in Drupal and when items are added or removed generate a html code snippet representing the menu that the other sites can pick up from the local file system or via a url if they are not.

How can I serve content from a url without the themes and drupal html being applied?

eg

have this url serve a css file

http://localhost/css/global.css

or get a js file from

http://localhost/js/app.js

or from a url like this

 http://localhost/globalmenu.html

get this html snippet ONLY

Menu Item 1

Menu Item 2

Menu Item 3

* EDIT *
The answer about the menu hook is really close to what i want, but I think i may have confused things by mentioning menus at all.

So I apologise as I didn't make what I am after very clear. Ill try and reword it.

For an arbitrary url I want to return content of any kind from the drupal 7 cms.

Which 'hook' takes the url, matches it to a pattern, and then allows me to send anything back on the response stream, and how do I change the mime types.


texts: How to move fields into secondary region where Menu Settings are located?

texts:
We have a need to move the language selector field to right column in the same section as the Menu Setting (see screenshot). Using Twig Debugging, we found that the template node-edit-form.html.twig can be used, but we could not find a way to selectively move select fields such as the language selector. We did notice a Secondary Region in the twig template, but could not see a way to selectively move the field so that if the field exists on the content type.

Goal:

Add language selector to the secondary region.
No additional styling is needed, just move the field.

How do we move the fields to the secondary region on the node-edit page??


texts: What is the purpose of the Version Control API module?

texts:
We are relatively new to Drupal development and are investigating various tools that can assist us with some upcoming projects.

The Version Control API module seems interesting, especially since it's semi-official.  I think we have some confusion regarding it's actual purpose, however.

See the link here: http://drupal.org/project/versioncontrol

Assuming we get this configured properly with a git backend, how does this change our workflow while developing with Drupal?  Will resources that we add to the website (such as graphics and html) be added to git source control automatically?  Does this git source control replace the existing Drupal "revision" feature?

Any additional information or real-world examples of how to use this module would be appreciated.


texts: How to insert fields into a link field in twig?

texts:
We have several fields on our Article content type, one of which is a Link field. In a twig template we would like to display a
 such that all of it is clickable with different fields inside of it.

Current node--article.html.twig

  {{ label }}

{{ content.body }}

{{ content.field_subtitle }}

{{ content.field_category }}

Modified node--article.html.twig template to make entire
 clickable (desired output).

{{ content.body }}

{{ content.field_subtitle }}

{{ content.field_category }}

Is there another way I should be doing this?

I was looking for something similar to below. It would output what is under the Modified node--article.html.twig (above)

{{ link(label, url)|insert(content.body, content.field_subtitle, content.field_category) }}


texts: How to print all Drupal commerce order variables available inside the template?

texts:
I'm struggling to understand how to print out all order information at the order view link, including the order author.

I mean printing it out at  /admin/commerce/orders/XXX/view

I've manage to get the page--admin--commerce--orders.tpl.php working, but how do I find all the variables?

I've tried with dpm($account), and dpm($content), with no luck.

ie. How may I print out the author of the order?


texts: Can't programmatically fill address field on taxonomy term creation

texts:
I'm creating some taxonomy terms inside of an update hook and they have a coordinates field and an address field containing only zipcode and locality.

The Vocabulary is called cities, the address field is called field_cities_zip_city and the coordinates are called field_cities_coordinates.

//the exact data that fails
$city = [
  'zip' => 1000,
  'name' => 'Lausanne',
  'lat' => '47.3879577',
  'lng' => '8.044136',
];

$term = Term::create([
  'name' => $city['zip'].' '.$city['name'],
  'vid' => 'cities',
  'field_cities_zip_city' => [
    'postal_code' => $city['zip'],
    'locality' => $city['name'],
  ],
  'field_cities_coordinates' => [
    'lat' => $city['lat'],
    'lng' => $city['lng'],
  ],
]);
$term->save();

What happens is, the term gets created, the coordinates get filled in properly, but the address remains empty despite even being required fields.

Trying like this did not change anything:

//the exact data that fails
$city = [
  'zip' => 1000,
  'name' => 'Lausanne',
  'lat' => '47.3879577',
  'lng' => '8.044136',
];

$term = Term::create([
  'name' => $city['zip'].' '.$city['name'],
  'vid' => 'cities',
  'field_cities_zip_city' => [
    'postal_code' => $city['zip'],
    'locality' => $city['name'],
  ],
  'field_cities_coordinates' => [
    'lat' => $city['lat'],
    'lng' => $city['lng'],
  ],
]);

//set the fields again manually, but this has no effect
$term->field_cities_zip_city->postal_code = $city['zip'];
$term->field_cities_zip_city->locality = $city['name'];

$term->save();

The address fields are still empty. What am I missing??
Thanks in advance for any help!


texts:
Assume I have a content type with a  list field (float) that can contain the following values: a, b, c.
I created three nodes (A, B, C) with those field values.

Creating a new node, is there a way to auto clear/remove already existing values in older nodes?

For example, if I choose a in a new node, I want that in node A that value is removed.

The Unique Field module does the job of preventing duplicated values, but it doesn't allow to remove values from other nodes.


texts: Get a list of custom form subclasses in a namespace

texts:
I have a D8 site with custom forms in a module. In the module there's a base class that extends FormBase, then subclass forms which extend my custom form base class. How can I obtain dynamically a list of the subclasses that extend my base class please?

Also, is this a good idea or an anti-pattern?

Thanks!


texts: How do I keep the trail for the breadcrumbs till the specific nodes?

texts:
When I create a new node and I assign a tag to it, I can view it from the corresponding taxonomy page. The breadcrumbs seem to follow the trail normally

Home>>category>>subcategory

until the very leaf node, at which point it indicates only

Home>>node

Why so? How do I keep the breadcrumb trail from collapsing?


texts:
I have created a custom text filter plugin by extending FilterBase class. The process() function looks like

 public function process($text, $langcode) {
    // Get the current node to determine if it has the glossary field and if
    // that field is enabled.
    $node = \Drupal::routeMatch()->getParameter('node');
    if ($node && $node->hasField('field_glossary') && $node->field_glossary->value) {

      // Get all the terms in the Glossary vocabulary.
      $terms = $this->getTerms('glossary');

      // Make all the replacements.
      $new_text = $this->doReplace($text, $terms);

      // Create a filtered text object with the updated text.
      $result = new FilterProcessResult($new_text);
      return $result;
    }
    else {
      // Don't do the replacement.
      $result = new FilterProcessResult($text);
      return $result;
    }
  }

I am letting editor to choose to turn off/on text filtering via plugin by creating a flag field as used in code $node->field_glossary->value. The problem comes when I need to check the field value on non-node page, as on node page I can get the node object and check the value but for other entites like blocks how can I get the source entity for text?


texts: How to pass a db_query as an array instead of a string?

texts:
I am having a bit of trouble converting my module db_query argument to pass as an array as oppose to a string. The module is D6 and I am trying to port it D7. Here is the snippet:

$result = db_query("SELECT nfi.field_name, nfi.label
  FROM {field_config_instance()} nfi
    INNER JOIN {field_config()} nf ON nfi.field_name = nf.field_name
  WHERE nfi.type_name = '%s' AND nf.active = 1 AND nf.locked = 0", $type_name);

And here the updated version as suggested below, but I am still getting a PDOException error:

$result = db_query("SELECT nfi.field_name, nfi.label
  FROM {field_config_instance()} nfi
    INNER JOIN {field_config()} nf ON nfi.field_name = nf.field_name
  WHERE nfi.type_name = ':type_name'  AND nf.active = 1 AND nf.locked = 0", array(':type_name'=>$type_name));

The full error is as below, line 49 is the line starting "WHERE" or the entire bottom line basically:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() nfi INNER JOIN field_config() nf ON nfi.field_name = nf.field_name ' at line 2: SELECT nfi.field_name, nfi.label FROM {field_config_instance()} nfi INNER JOIN {field_config()} nf ON nfi.field_name = nf.field_name WHERE nfi.type_name = ':type_name' AND nf.active = 1 AND nf.locked = 0; Array ( [:type_name] => page ) in cck_private_fields_get_content_private_fields() (line 49 of C:|... common.inc).

Any suggestions welcome. When I manage to finish this module I'll be submitting it to Drupal.org so everyone can use it.


texts: bootstrap_barrio subtheme breaks ckeditor's media insert in custom block

texts:
I'm facing this problem (seems to be producible) in a contrib theme that breaks the ckeditor media insert button on custom blocks in the layout builder of individual nodes...
The javascript error says it's typically caused by the theme neglecting to include proper html attributes for that entity type, but the theme's block.html.twig is identical to that template in Bartik.  This is a custom subtheme of bootstrap_barrio created with the shell script provided by bootstrap_sass (Barrio highly recommends subtheming that way).  Error has been repeated on new D8 and D9 installations, and the full message on page load is:
Uncaught Error: Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="block_content/1/body/en/full"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="block_content/1"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.

and while editing a block in the layout builder, clicking ckeditor's media insert button results in the following error (and the media dialog never opens, the "Loading..." message appears but nothing loads):
Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /media-library?media_library_opener_id=media_library.opener.editor&media_library_allowed_types%5B0%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfilter_format_id%5D=basic_html&hash=Ul_KDXiNyg8Mw95OeXpaIZUYieACO4FlRCUQkle_TCs\nStatusText: Internal Server Error\nResponseText: The website encountered an unexpected error. Please try again later.", name: "AjaxError", stack: "@https://atn.ddev.site/core/misc/ajax.js?v=8.9.3:100:32\n@https://atn.ddev.site/core/misc/ajax.js?v=8.9.3:643:3\n" }

I was very excited about the bootstrap_barrio's subtheme with sass, gulp, browsersync all configured with bootstrap, but maybe I should switch to radix?  I'd much prefer to solve this error though, if anyone has any insight?  I don't know where to begin with javascript debugging :(


texts: How to export complete products data to csv file

texts:
We have a Drupal Commerce site, and need to dump all the products data into another CMS. I checked the question, How to export drupal commerce products?

After trying the Views Data Export module, I didn't find any option for CSV, Excel in the display.

What am I doing wrong?  I would like to export data to a CSV file or any other document so that I can easily import those products into Magento.


texts: Is block weight ignored when setting content in hook_block_list_alter()?

texts:
I am using hook_block_list_alter and hook_block_view_alter to force caching upon a block provided by nice_menus, which has bad performance when used with my HUGE taxonomy menu. Here is an abstract of my code:

/**
 * Performance hack for nice_menus
 * Force the nice menu blocks to be cached globally.
 * Note that the same menu will be displayed for all users on all pages where the block is enabled.
 */
function mymodule_block_view_alter(&$data, $block) {
  $deltas = variable_get('mymodule_nice_menus_performance_hack_deltas',array());

  if ($block->module == 'nice_menus' && in_array($block->delta,$deltas)) {
    // if we are here, then the block has been rendered. set the cache.
    cache_set('mymodule_nice_menu_'.$block->delta.'_data', $data, 'cache_block', CACHE_TEMPORARY);
    cache_set('mymodule_nice_menu_'.$block->delta.'_block', $block, 'cache_block', CACHE_TEMPORARY);
  }
}

function mymodule_block_list_alter(&$blocks) {
  $deltas = variable_get('mymodule_nice_menus_performance_hack_deltas',array());

  foreach($blocks as &$block) {
    if ($block->module == 'nice_menus' && in_array($block->delta,$deltas)) {
      $cached_data = cache_get('mymodule_nice_menu_'.$block->delta.'_data', 'cache_block');
      $cached_block = cache_get('mymodule_nice_menu_'.$block->delta.'_block', 'cache_block');
      if (!empty($cached_data) && !empty($cached_block)) {
        $block = $cached_block->data;
        $block->content = $cached_data->data['content'];
        $block->subject = $cached_data->data['subject'];
      } // else just don't set anything, and nice_menus will recreate it!
    }
  }
  dpm($blocks);
}

Now my problem is, that whenever $block->content is set, the block's weight is ignored, and it is rendered as the first block in the region, even though $block->weight was set to the correct value.

What causes this, and how does one enforce the weight?


texts: View inside display suite block field - contextual filter

texts:
using display suite's block field, which i chose a view block.. so when i have view page ('parent' view) it list many nodes. each node has a field for block view ('child' view).

how do i get child view to filter its results by the node id it is being displayed with in parent view?  like a contextual filter, but not getting nid from url, but the node the block field is part of.

i like using display suite layouts, but need to rewrite the author field link. so i figure id make view to show the author and rewrite, then insert it into the node view mode as field. but i cant filter the child field how id like.


texts: How to delete content type menu item in .install file on module uninstall /disable

texts: I have a module that adds a content type in the .install file. When I disable the module how do I remove the content type entry from the menu?


texts: How can I get pathauto to generate language-inspecific rules?

texts:
I have created a new pattern for a specific content type, and did not select any language at the /admin/config/search/path/patterns/XYZ page so that it would apply to nodes in any language.

What I want is for this pattern to be available in every site language. However, when I create new content the alias created has language set to English, and if I navigate to /fr/new-alias it gives 404. I need to manually edit the created URL Alias and set language to "None" for it to work.

I don't see a way to specify this in the pathauto rule. Is it possible or is their a hook I can use in a custom module to force this somehow?


texts: Using File (Field) Paths with token value from Entity Reference field

texts: I am using Drupal 8.3.1 and using the module File (Field) Paths to define the path and filename.  I want to use the value of a taxonomy field (Entity reference in CCK) in the same content type as part of the filename.  The machine name of the field is field_organization and doing [node:field_organization] produces an href link where I want is just the name of the single value it contains.  How do I get only the term's name instead?


texts: How to prevent html conversion of the default value translation of a field?

texts:
I have a node field which text format is set to markdown. When I translate the default value with the 18n field module using the markdown syntax, the default value is converted to html in the node add form.

How can I prevent this? I want to have the markdown syntax in the node add form.


texts: How to download a file from private file system

texts:
I need a function in my module for users to download a file from a private filesystem.

$file : "private://sample.csv"

Which function should be used, file_download(), or  file_transfer()?

function file_download_page() {
  $file = "private://sample.csv";
  //code for downloading $file
}

Please provide sample code.


texts: Linking Page manager & views using taxonomy terms

texts:
Here is what I have done:

I created a taxonomy term called "section" with several terms 'section 1, section 2, etc...'.
I modified the standard 'Article' type to include a field using a taxonomy term list and generated test articles with the taxonomy terms included.
I created a view with a content pane. The title, body, node id and taxonomy term field are included in the field list. The pane is set as follows:Link to view: No; Use Panel path: No; Argument input: from context and set to the taxonomy term name.  A contextual filter is set to 'Content: section (field_section)' with a validation set to the taxonomy name from the 'section' vocabulary using the term id with the term name converted to term id.  When I enter a term name in the preview, it displays the correct content.
I created a custom page in page manager set to the path /sections/%section. It contains a rule that the type must be an article.  It contains a variant called 'section layout' with a contexts relationship for a 'Taxonomy term from Node (on Node: section)'. The Summary of Contexts includes argument 1 with all of the node fields and an additional set of fields for 'Taxonomy term from Node (on Node: section)'.
In the panel section I identified a two column layout with the view content pane described above in column one, and 'who's online' in column two so that the layout will show two columns when I use it.

When  I pick one of my articles from content, it calls up the article with the the url set to '/sections/section-1/article_name, but the page view is not implemented (the two column format is not displayed).

Here is what I think should be happening:

When I select an article for display, the url should be intercepted by the custom page '/sections/%section' and the fields from the article covered in the summary of contexts should be available to the view.
The view should be obtaining the taxonomy term from the 'section' field in the article through the context filter and returning articles with the same value to the panel.
The panel should create the two column format with the articles displayed in the first column and the 'who's online" in the second.

Instead, I get the original article.

Questions:

Do I have how the information is passed correct?  (page manager intercepts the url to handle it, It passes the info to the view selected by the panel, the gets the data through the argument input and selects the correct articles using the taxonomy term it finds in the arguments, the view is then rendered through the panel content layout.)
Am I missing any other required setting? (Do I have everything set correctly and have I included everything?  Are more settings required than I mention here?)
I assume that the panel is not getting results of the view and is passing the url back to the core and that is why it renders as a standard article. Is this correct?
Any suggestions as to why the view is not handled by page manager?

Any assistance is deeply appreciated.  I have been wrestling with passing taxonomy terms int o a view through the url and through page manager unsuccessfully for quite a while.


texts: Integrating html code into existing Drupal 6 webform

texts:
I was provided some custom html code by my client’s email provider in order to automate getting the submissions into the client’s email system instead of the client having to enter them manually.  The code provided looks like this:

    <form method='get' accept-charset='UTF-8' name='oi_form' action='http://suivi.lnk01.com/xyz'>
    Email: <input type='text' name='email'/>

    First Name: <input type='text' name='firstname' />

    Last Name: <input type='text' name='lastname' />

    <input type='hidden' name='Source' value='Newsletter Website' />

    <input type='hidden' name='goto' value='' />
    <input type='hidden' name='iehack' value='&#9760;' />
    <input type='submit' value='Subscribe' />
    </form>

I originally tried adding components (one for the first line and another for the 3 input lines after the fields) to the existing webform but it would not create a submission.

I then installed the webform remote post module, entered the target url value for the form, entered some data on the form, and submitted.  It created a submission but on the client’s side, the first name, last name, and source fields are all blank.  Has anyone had this same experience before ??


texts: What is the value of "Drupal user" in Drush status for? Suddenly, one of my websites lists the Drupal user as "anonymous" instead of blank, like the other environments. I noticed the change after pulling in code from the repo and the data from production, but it may have always been like that.


texts: How to show a field from the current node in quicktabs

texts: I have a quicktabs block on the node page which will have several tabs with different views/content related to the current node. How can I show a field from that node in a separate tab?


texts:
I would like to create a number of entity query methods/functions that I can have easy access to from my entity handlers and controllers.

With Doctrine 2/Symfony 2 you can just attach such methods to the object/entity repository, and then you can call this repository from elsewhere in your code.  Should I follow this recipe in D8, and if so, how?

I see 4 options for where to put the queries:

Put the methods in my custom entity class.  However, out of the box the entity.query service doesn't seem to be available in Drupal\Core\Entity\ContentEntityBase, nor is the service container.  I can use \Drupal::entityQuery('myentity') in a method, but according to the documentation \Drupal:: should only be used in global functions.  I suppose I can override the constructor and inject this class myself, but I would have thought this kind of functionality would be there already.
Put the methods in my custom entity storage handler.  However, if my understanding is correct, this is the place for special queries that aren't well handled by the entity query services.
Inject the querySelector wherever I need it.  See \Drupal\node\Form\NodeTypeDeleteConfirm in Beta 9 for an example.  This is not an appealing option.
Use global functions in my .module file.  That way I can just use \Drupal::entityQuery and be done with it.  See node.module for many sample implementations.  However, this goes against the D8 documentation and against the goal of putting as much as possible into classes.

Any thoughts or references to emerging best practice would not go amiss :)


texts: Commerce: Hide "Save and Add Another" button when saving new product

texts:
I'm trying to hide the "Save and Add Another" button on the form used to save new products.

I can access the "Save" button in the $form array at $form['actions']['submit']. However, I'm not seeing the "Save and Continue" button in $form.

I looked in commerce_product_ui.module and found the place where this form element is being added. It's called $form['actions']['save_continue']. I would expect to see it in the $form array, but again - it just doesn't seem to be there.

Thanks for your help.


texts:
I have 2 node types: Authors and books. Authors has node reference to book node type. Created view:

Relationships - i have used reference field, in arguments i have used Node: nid (content id from node URL).

In fields i have used my noderef relationship.

in a node.tpl.php:

print views_embed_view('video', 'block_4', $node->nid);

But it shows nothing. (i have created 1 node author, and 2 nodes book)

Views 2, Drupal 6. What i am doing wrong? Thanks


texts:
I have below content entity:

/**
 * @ContentEntityType(
 *   id = "test_entity",
 *   label = @Translation("label"),
 *   bundle_label = @Translation("Testing entity type"),
 *   handlers = {
 *     "storage" = "Drupal\test_entity\TestEntityStorage",
 *     "storage_schema" = "Drupal\test_entity\TestEntityStorageSchema",
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 *     "access" = "Drupal\test_entity\TestEntityAccessControlHandler",
 *     "form" = {
 *       "default" = "Drupal\test_entity\TestEntityForm",
 *       "edit" = "Drupal\test_entity\TestEntityForm",
 *       "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm"
 *     },
 *     "route_provider" = { "html" = "Drupal\test_entity\Entity\TestEntityRouteProvider" },
 *     "list_builder" = "Drupal\test_entity\TestEntityListBuilder",
 *   },
 *   translatable = FALSE,
 *   entity_keys = { "id" = "id", "bundle" = "type", "label" = "test", "uuid" = "uuid" },
 *   bundle_entity_type = "test_entity_type",
 *   field_ui_base_route = "entity.test_entity_type.edit_form",
 *   common_reference_target = TRUE,
 *   permission_granularity = "bundle",
 *   links = {
 *     "canonical" = "/admin/testing/my-entity/{test_entity}",
 *     "delete-form" = "/admin/testing/my-entity/{test_entity}/delete",
 *     "edit-form" = "/admin/testing/my-entity/{test_entity}/edit",
 *     "collection" = "/admin/testing/my-entity",
 *   }
 * )
 */

and i encounter Access denied for my links below:

 /*   links = {
 *     "canonical" = "/admin/testing/my-entity/{test_entity}",
 *     "delete-form" = "/admin/testing/my-entity/{test_entity}/delete",
 *     "edit-form" = "/admin/testing/my-entity/{test_entity}/edit",
 *     "collection" = "/admin/testing/my-entity",
 */   }

where i should start to take a look to troubleshoot this?


texts: Require specific access for certain pages with only one input field

texts:
For certain pages i have to require a login first (custom form with 1 input field).

When you try to reach the URL of one of those pages you are
redirected to a login-page
They have to fill-in a number of 11 digits. If the filled in field
contains 11 digits they are redirected to the protected page(s).

It's not an age gate. It's for doctors the have to fill in a 11-digit code. If the code contains 11 digital characters they can see the protected page(s).

How (which modules) are best practices to built this functionality?


texts: Add additional fields in Drupal 8 node edit form

texts: With the functionality of core drupal 8 module I could view, edit nodes. But what I need is that I need to add some extra fields to the node edit  form. Is there any method to do this ? Any help?


texts: How to avoid clearing of the form state?

texts:
I want to add form field based on data provided in submit handler. I am using $form_state for the job. I have done similar in the past but now it's just not work

Form code:

function module_form($form_state) {
 if (isset($form_state['module']['data'])) {
   //add field
 }
}

function module_form_submit($form, &$form_state) {
  $form_state['no_redirect'] = TRUE;
  $form_state['rebuild'] = TRUE;
  unset($form_state['redirect']);
  $form_state['module']['data'] = module_get_data($some_value);
}

Inside module_form $form_state is always empty...


texts: Thumbnail: i need to have a fixed width and variable height (in proportion)

texts: I need to fix the width of the thumbnail at 200px, while the height has to be resized proportionally; i've seen that i can fix the width x height for thumbnails, but need to set only one dimension....how can i do it?


texts: How to stop using Hindi number in Arabic translation of products

texts:
When using English version of website, price is shown in Arabic number (common one). But when using Arabic version of website, price is shown in Hindi number.

I don't want price to be shown in Hindi Numbers.

English view of products (Arabic Numbers)

Arabic view of products (Hindi Numbers)

How to force using Arabic Numbers in both versions.


texts: How do you use forms to populate content type fields?

texts:
Drupal 7. Custom module.
I have a content type 'RFI' with a handful of fields I created with Drupal UI. I want a user to: fill out a form & click submit while drupal: saves fields to database, creates a new node of 'RFI' and populates the fields of the node with the content provided by the form's corresponding fields.

From what I understand:

Build a form with fields (taking from the 'DBTNG examples' module just for clarity):

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

$form['add'] = array(
'#type'  => 'fieldset',
'#title' => t('Add a person entry'),
);
$form['add']['name'] = array(
'#type'  => 'textfield',
'#title' => t('Name'),
'#size'  => 15,
);
$form['add']['surname'] = array(
'#type'  => 'textfield',
'#title' => t('Surname'),
'#size'  => 15,
);
$form['add']['age'] = array(
'#type'  => 'textfield',
'#title' => t('Age'),
'#size'  => 5,
'#description' => t("Values greater than 127 will cause an exception. Try it - it's a    great example why exception handling is needed with DTBNG."),
);
$form['add']['submit'] = array(
'#type'  => 'submit',
'#value' => t('Add'),
);
return $form;
}

Here the form fields are saved to database with database API.

function rfi_build_submit($form, &$form_state) {
global $user;

// Save the submitted entry.
$entry = array(
'name'    => $form_state['values']['name'],
'surname' => $form_state['values']['surname'],
'age'     => $form_state['values']['age'],
'uid'     => $user->uid,
);
$return = dbtng_example_entry_insert($entry);
if ($return) {
drupal_set_message(t("Created entry @entry", array('@entry' => print_r($entry, TRUE))));
}
}

Now here is how I know how to create a node of RFI type. How do I take the values of the fields above [name], [surname], [age] and have them related to corresponding fields in my content type?

function rfi_build_type($form, &$form_state){
$node = new stdClass();
$node->type = 'rfi';
$node->name = '';
$node->surname = '';
$node->age = '';
$node->language = 'en';
$node->uid = 1;
node_save($node);
}

I was thinking that since the fields have been saved already, that I could use a database query to get these values, but intuition tells me I'm overlooking something.

Thank you!


texts: Add taxonomy field to a bundle programmatically

texts:
I'm currently developing a module which provides a content type called "Structural machinery" . This type should also provide a taxonomy term based on different manufacturers providing the machine (eg CAT or Komatsu) , I know how to create a taxonomy vocabulary programmatically but the question is how to attach a taxonomy field to my bundle.

this is the code used to implement the taxonomy term :

$term = new stdClass();
$term -> name = $t('Manufacture');
$term -> machine_name = 'manufacture';
$term -> description = $t('Description');
$term -> hierarchy = 2;
$term -> module = 'construction_machinery';
$term -> weight = 1;
taxonomy_vocabulary_save($term);


texts: Is it possible to have 2 sources for migration?

texts:
I have a tid (taxonomy ID) and a csv file (which is  a  list of terms to remove during migration with columns : tid, name, delete ).  The tid and CSV file are my sources for the migration.
How can I access (and process) values from both sources in my migration?
The tid is giving me the terms used as tags and the CSV file  is to verify if the terms are listed on the CSV as term to be ignored (not added) during migration on the newly created node.

Something like :

process:
#create temporary field to call plugin that gets the taxonomy
  _prepare_TaxonomyIssues:
    plugin: sub_process
    source: field_issues_ref
    process:
      target_id:
        -
         plugin: mm_taxonomy_tag_issues_plugin
         source: #tid
           - tid
           - plugin: csv
           path: public://allTagsDec6CleanedUpdated.csv
           header_row_count: 1
           keys:
             - tid
             - name
             - delete
           column_names:
             -
               tid: tid
             -
               name: name
             -
               delete: delete

I am getting an error:

TypeError: Argument 2 passed to Drupal\Component\Utility\NestedArray::getValue() must be of the type array, null given, called in /var/www/mm/docroot/core/modules/migrate/src/Row.php on line 158 in /var/www/mm/docroot/core/lib/Drupal/Component/Utility/NestedArray.php on line 69 #0 /var/www/mm/docroot/core/modules/migrate/src/Row.php(158): Drupal\Component\Utility\NestedArray::getValue(Array, NULL, NULL)

Is it possible to have 2 different sources?
Is there another way to do it?


texts:
We have a lot of spammers (which are logged in users) creating content on our site. They are creating photo nodes without photos (which I have recently allowed as a way to catch them and ignore them, sort of a honeypot). I have also added the honeypot module but the 10 second delay doesn't seem to be working too well...

Is there a way to catch these nodes that don't have photos and block them from ever actually being created? I was thinking that it could be done in the presave hook, but unsetting the node didn't seem to work.

Edit

I could make the image required, but the bot is filling out all of the required fields so far, and it isn't hard to upload an image using a script.

I have implemented what I put in my answer and it seems to work, and I am giving the spammers 10 tries/day before they get banned. This may or may not be too lenient.

So far I have caught and banned 14 spam accounts (~1 hour of it being live).


texts: Views get total row count in views-view.html.twig

texts:
I need to get the total rows count in views-view.html.twig file. So that I can loop through it and create the indicators required for my bootstrap carousel view block.

I tried the solution provided in this thread Drupal 8 Views get total row count in views-view-fields.html.twig but nothing seems to be working.

Can any one please guide me how its possible.


texts:
I made a module to upload file in form, below is my code snippet, I am able to save file in proper folder but I want to get name of file uploaded so I can save it in database and make reference for it, I tried lots of thing but was not able to do it.

class MyForm extends FormBase {
  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'my_forms';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['resume'] = array(
        '#type' => 'managed_file',
        '#title' => t('File'),
        '#required' => TRUE,
        '#upload_validators'  => array(
            'file_validate_extensions' => array('pdf doc docx'),
            'file_validate_size' => array(25600000),
        ),
        '#upload_location' => 'public://myfile/',
    );

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => $this->t('Submit'),
        '#button_type' => 'primary',
    );

    return $form;
  }

  /**
   * {@inheritdoc}
   */
    public function validateForm(array &$form, FormStateInterface $form_state) {

    }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    drupal_set_message($this->t('@can_name ,Your application is being submitted!', array('@can_name' => $form_state->getValue('name'))));
    // echo file name here
   }
}


texts: Twig template for two different instances of the system branding block

texts:
On the block layout page, I added the "Site Branding" block twice, once for normal use (all nodes except content type landing page) and once for landing page use (all nodes of content type landing page).

I themed the block using the twig template block--system-branding-block.html.twig, but this modifies both blocks.

Is there a way to get more specific and create a twig template for each block, or should I re-create the landing page block some other way so that I can use a different template?

EDIT: My goal is to actually change the HTML of the block, so I can't use a pure CSS approach.