Drupal 8

Get spam emails from your drupal contact webforms?

Get spam emails from your contact forms?

Mostly you can find the same words in those spam emails, in this module you can set spam words for each fields.
Example for words that common in spam emails: “Eric Jones”, “SEO Ranking”, “Digital marketing”, "SEO" ...etc

I'm sure if you have a contact form, you have already gotten one of his/her/it spam. 

We are receiving daily SPAM from Eric Jones (probably a fake name) from talkwithwebvisitor.com and if you are reading this, probably you are, too.  there are still loads of annoying emails like that which get through. Eric Jones SPAM from talkwithwebvisitor.com

try to Avoid these kind of spam keywords on Drupal webform, Use this module to block using the keywords.

Webform Spam Words in Drupal to Block spam based on keyword strings

Webform Spam Words Drupal (WSW)

Module: https://www.drupal.org/project/webform_spam_words

Avoid Spam words on Webform Drupal
It's a simple module for webform validation with spam keywords. Administrators can provide the access to add spam keywords, Error message and field name.

Installation

  1. Place the module folder in your modules folder or try with composer
  2. Make sure you have the webform module enabled or try with drush en
  3. Activate the module via admin/modules

Usage Steps

Install old version composer / incompatible with composer

ThirstySix

Issue
You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

Solution
You are using Composer 2, some plugins seem to be incompatible with composer

With specific version 1.10.17:
C:\Users\ThirstySix> composer self-update 1.10.17

composer self-update 1.10.17
 or
C:\Users\ThirstySix> composer self-update --1
composer self-update --1

Drupal 7 global variables vs. Drupal 8 services

Several Drupal 7 global values like global $language and global $user are also now accessed via services in Drupal 8 (and not global variables).

Drupal::languageManager()->getCurrentLanguage() and Drupal::currentUser()

Two ways to get the currentUser data:

1) Procedural code
$user = \Drupal::currentUser();
ksm($user->id());

(or)

2) OO code access the @current_user service, via dependency injection (DI)
$service = \Drupal::service('thirstysix.ex');
ksm($service->DisplayUserId());

Services and dependency injection in Drupal 8

Dependency Injection enables us to decouple reusable functionality by injecting it, rather than creating it inside of a class.

Drupal 8 introduces the concept of services to decouple reusable functionality and makes these services pluggable and replaceable by registering them with a service container.

Dependency injection is an alternative to the static \Drupal::service

There are, at least, two widely spread patterns in Drupal 8 in order to inject services into your objects. The first uses a service to inject services. The second uses a factory method that receives Drupal's container.

For Example:

modules/custom/thirstysix/thirstysix.info.yml

How do I add my own custom Javascript in Drupal 8?

 Save your custom script in themes/THEMENAME/js/script.js


 Declare your script in themes/THEMENAME/THEMENAME.libraries.yml:
 ts-corescripts:
   version: VERSION
   js:
     js/script.js: {}


 In THEMENAME.theme
 <?php
      /**
         * Add custom scripts
         */
        function THEMENAME_page_alter(&$page) {
          $page['#attached']['library'][] = 'thirstysix/ts-corescripts';
          //$page['#attached']['library'][] = 'core/jquery';
        }
    ?>


 

Translate a JS string from Drupal interface translations

Translate a JS string from Drupal interface translations

Drupal.t()

Drupal.t("My String");

Clear the Drupal Cache.

This string appear in /admin/config/regional/translate

if not then check your libraries.yml file 
And add the corresponding dependencies THEME.libraries.yml:
dependencies:
  - core/jquery
  - core/drupal

Enjoy :)