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

Module

By editor , 13 June, 2017

Alter table structure on Drupal 8

Tags

  • Drupal 8
  • Code
  • Database
  • Module

To update a table you must create a custom module. Example , Here we use mymodule.

By editor , 10 June, 2017

PHP : Get Class Name

Tags

  • Module
  • Code
  • PHP

The structure of the examples are like:
namespace Drupal\mymodule\Tools;
class MyTools extends MyToolsBase {
...
}
...
class MyToolsBase {
  public function showClass() {
    $class_name = ....

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 , 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 , 29 March, 2017

Few Tips to create a custom module

Tags

  • Drupal 8
  • Code
  • Module

 

Check module exist

if (\Drupal::moduleHandler()->moduleExists('my_module')) {
    $message = 'Module exist.';
}
else {
    $message = 'Not exists.';
}

 

By editor , 3 March, 2017

Create a View Plugin Without using Database field

Tags

  • Drupal 8
  • Code
  • Module
  • Views

Step 1. Create a custom module and add the HOOK hook_views_data_alter(&$data). Here module : mymodule

Step 2.

By editor , 10 February, 2017

Render a Render array to HTML code.

Tags

  • Drupal 8
  • Code
  • Module

Example :

$result =  array(
  '#markup' => 'Hello. This is my First Page',
);
$renderer = \Drupal::service('renderer');
$html = $renderer->render($result);

 

By editor , 18 January, 2017

Create an advances Search system for Drupal 8 with Search API.

Tags

  • Drupal 8
  • Search
  • Module

Search API and Database Search server.

1. Uninstall drupal basic Search
2. Install search_api and search_api_db
  NOTE : You can also use another database configures on settings.php
3. Add a Search Server (/admin/config/search/search-api/add-server).

By editor , 11 January, 2017

Make Some operations Programmatically - Hook Update Deploy Tools

Tags

  • Drupal 8
  • Code
  • Drupal 7
  • Module

Hook Update Deploy Tools is a great contrib module help to make most of site deploy operations programmatically.
Link : https://www.drupal.org/project/hook_update_deploy_tools

Pagination

  • Previous page
  • 2
  • Next page
Module

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