Install old version composer / incompatible with composer


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.

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
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();


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

How to index data in the database for search?

- Indexing is an important feature of MySQL. It supports different type of indexes like primary key index, unique index, normal index and full-text index. Indexes help to speed up the retrieval of data from MySQL database server.

- Drupal's search engine indexes the text content of the nodes on your site

- The search engine indexes at intervals you choose by setting "cron runs."  Cron is not a part of Drupal. It's a scheduler that resides on your server and runs tasks at intervals, which you specify. 

how does search works in drupal?

Site-wide Boolean keyword search of Nodes and User names

- Indexing isn't instant in the drupal search
- Your new content will not be indexed instantly after it has been added to the site.
- Go to Configuration > Search settings click the "Re-index site" button.
- The correct way to get your site's content indexed is to go to Configuration > Cron. Drupal's Search module requires a cron job to run correctly.

Search Query Types
- AND Searches
- OR Searches

How does memcache store data?

  Memcached's APIs provide a giant hash table distributed across multiple machines. When the table is full, subsequent inserts cause older data to be purged in least recently used (LRU) order.

  The servers keep the values in RAM; if a server runs out of RAM, it discards the oldest values. Therefore, clients must treat Memcached as a transitory cache; they cannot assume that data stored in Memcached is still there when they need it.

Difference between memcache and varnish?

  Memcached can be used as an in-memory, distributed back-end for your application cache.
  Varnish can be used as a reverse proxy to externally cache HTTP requests.

  It seems to me that Varnish is behind the web server, caching web pages and doesn't require change in code, just configuration.
  On the other side, Memcached is general purpose caching system and mostly used to cache result from database and does require change in get method (first cache lookup).

Creating custom hooks in Drupal?

1) Alter hooks
   a common way to edit the contents of a particular object or variable by settings     variables in the hook by reference, typically by using drupal_alter()

2) Intercepting hooks
  Allowing external modules to perform actions during the execution, cannot get variables by reference, typically by using module_invoke_all(), module_invoke()

a) Simple invoking:
module_invoke_all() => Calling all modules implementing the hook

Drupal Template Structure

|->  HTML Head
|->  Page
      |-> Node
              |-> Field
              |-> Field
              |->Node Links
              |->Comment Wrapper
                    |-> Comment
                    |-> Comment
                    |-> Comment
      |-> Region
            |-> Block
            |-> Block

Preprocess Functions (theme_hook) Drupal

Allow one module to alter the variable used by another module when it call a theme hook.

  -> Process variables for node.tpl.php

   -> Process variables for page.tpl.php

[module]_preprocess_[theme hookname]  (&$variables)

multi-hook preprocess functions
[module]_preprocess (&$variables, $hook)

Order of preprocess execution
All Preprocess functions run before all process functions