https://github.com/kgaut/kgaut_tools
Drupal 8 toolbox module
https://github.com/kgaut/kgaut_tools
drupal drupal-8 toolbox
Last synced: about 1 year ago
JSON representation
Drupal 8 toolbox module
- Host: GitHub
- URL: https://github.com/kgaut/kgaut_tools
- Owner: kgaut
- Created: 2016-12-16T10:49:10.000Z (over 9 years ago)
- Default Branch: 2.0.x
- Last Pushed: 2024-09-05T16:01:30.000Z (over 1 year ago)
- Last Synced: 2024-10-12T02:25:34.119Z (over 1 year ago)
- Topics: drupal, drupal-8, toolbox
- Language: PHP
- Homepage:
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Toolbox module for Drupal 8
## Installation
`composer require kgaut/kgaut_tools`
## Features
### CleanString Service
Transliterate and remove special char from a string.
```php
$mystring = "Hello World";
// 'hello-world'
$cleanString = \Drupal::service('kgaut_tools.stringcleaner')->clean($categorie->name);
//'hello_world'
$cleanStringWithoutDash = \Drupal::service('kgaut_tools.stringcleaner')->clean($categorie->name,true);
```
### TranslationImporter Service
Allow to import translation for a given string with a given language.
Usage example :
```
$translationImporter = \Drupal::service('kgaut_tools.translation_importer');
$translationImporter->importTranslation("I love drupal", 'fr', "J'aime drupal");
```
### Create image derivates during upload
Inspired by @flocondetoile's post : http://flocondetoile.fr/blog/generate-programmatically-image-styles-drupal-8
### Add new useful var to all templates :
- basepath : Drupal basepath() value (not always available)
- pathtotheme : path to active theme
- pathtotfiles : path to public files directory
### User templates suggestions :
Add templates suggestions for user entity based on the view mode ie : user--compact.html.twig