Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Drupal 8

By editor , 7 June, 2017

Drupal 8 Plugin API

Tags

  • Drupal 8
  • Code
  • Plugin

Drupal 8 embedded with a plugin system. In drupal 8, Plugin is a group of PHP classes used for a defined specific usage. You can use any registered  plugins, add new plugins and also create your own plugin type.

By editor , 7 June, 2017

Test modules using drupal "Testing" System.

Tags

  • Drupal 8
  • Code
  • Testing

SimpleTest (Testing) allow to test your drupal systems in a safe way. It's also allow you to check functionaleties, result ... of your module.

First of all you must active Testing module on your envirenement.
#Drush command:
drush en simpletest -y

By editor , 7 June, 2017

Drupal 8 Module Settings and Mapping

Tags

  • Drupal 8
  • Code
  • Module

For the examples, here we use the module simple_analytics as example.
Module name : simple_analytics
Configuration object: simple_analytics.settings

Settings and mapping files structure.

By editor , 7 June, 2017

Drupal Configuration System (Config API)

Tags

  • Drupal 8
  • Code
  • Module

Drupal 8 embedded with a configuration system which allow users to store variables in the database and usable in site wide as variables in drupal 7. Intend of use variable_set variable_get variable_del, in drupal 8 use Configuration API.

By editor , 6 June, 2017

Run JavaScript code via web browser console.

Tags

  • Drupal 8
  • Code
  • JavaScript
  • Features

Note : Following examples are tested on FireFox Version 52.

Open Web browser console. F12

Method 1 . Press F12 and click on "Console"
Method 2 . Press Ctrl + Shift + K

By editor , 5 June, 2017

Views template suggestion files

Tags

  • Drupal 8
  • Code
  • Views
  • Theming

All views templates can be overridden with a variety of names, using the view, the display ID of the view, the display type of the view, or some combination thereof.

By editor , 2 June, 2017

Cron on Drupal 8 and Linux

Tags

  • Drupal 8
  • Code
  • Linux
  • Server

Run cron by drush

drush cron

Add cron hook to a custom module.

/**
 * Implement hook_cron()
 */
function MYMODULE_cron() {
  // Your codes.
}

By editor , 23 May, 2017

Redirect a user after login. Redirection on Drupal 8.

Tags

  • Drupal 8
  • Code
  • Module
  • User

To make a redirection after user login, we can use the hook hook_user_login().
Note : You cannot use $form_state->setRedirectUrl() directly in the form alter, since it will be overwritten by UserForm::submitForm().

By editor , 19 May, 2017

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

Tags

  • Drupal 8
  • Error

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

This is a generic message. To find the problem refer to server log. (For example : /var/log/apache/error.log on apache)

By editor , 15 May, 2017

Git Tags

Tags

  • Drupal 8
  • Code
  • Git

Add remove git tags.

Create a tag

git tag <TAGNAME>

Push tag

git push origin <TAGNAME>
git push --tags

Pull tags

git tag -l
git checkout tags/<TAGNAME>

Pagination

  • Previous page
  • 6
  • Next page
Drupal 8

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer