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

Tutorials - Drupal

By editor , 10 February, 2017

Load entity dynamicly by entity type on Drupal 8

Tags

  • Drupal 8
  • Code
  • Entity

Using entity_load function.

Example:
$entity = entity_load($entity_type, $id);

Using Entity Manager

Example:
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);

By editor , 31 January, 2017

Change the states of an element based on another element (field)

Tags

  • Drupal 8
  • Code
  • Field

Note : The tutorial is usins States VISIBLE, but can also use for other html parameters such as : REQUIRED, EXPENDED, CHECKED ...

The selector is an "JQUERY_SELECTOR"

By editor , 18 January, 2017

Use multiple databases on drupal 8

Tags

  • Drupal 8
  • Code
  • Database

Move some tables into another database.

Example:

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 , 13 January, 2017

Create a field in a node entity programmatically on Drupal 8.

Tags

  • Drupal 8
  • Code
  • Field

Example.
Step 1 : Create field storage.
\Drupal\field\Entity\FieldStorageConfig::create(array(
  'field_name' => 'field_text',
  'entity_type' => 'node',
  'type' => 'text',
  'cardinality' => -1,

By editor , 12 January, 2017

CSS Styling tips for Print

Tags

  • Drupal 8
  • Code

Add CSS for Print

Method 1 : Add a specific styling sheet for Print.

On your theme (THEME.info.yml for D8 and THEME.info for D7), Add css file as [print].
Example
stylesheets[print][] = css/print.css

 

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

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

By editor , 10 January, 2017

Get Entity data and metadata

Tags

  • Drupal 8
  • Code
  • Entity

Get entity types list :

$itmes_list= \Drupal::entityTypeManager()->getDefinitions();

Get Entity type (Content / Config)

$itmes_list['node']->getGroup();
$itmes_list['node_type']->getGroup();

By editor , 3 January, 2017

Manage custom package using composer.

Tags

  • Drupal 8
  • Code
  • Composer

Composer can hadle CVS (git, svn ...) and ZIP packages.
To install/Update your custom modules, add a custom repository to the composer.json file, following this example.

1. Add package repositories
Here, youtubeapi and sadb

Pagination

  • First page
  • Previous page
  • …
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Page 10
  • Page 11
  • Page 12
  • …
  • Next page
  • Last page

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