This project is not covered by Drupal’s security advisory policy.

Drupal Helper is a Pack for Usual Functions to help Drupal 8 Developer Beginner. MORE SIMPLE TO USE

My best function : Availaible in 8.x-2.9 version

This function will create automatically the image style if it is not exist using Scale and crop Effect . If Image style is already exist then it will use it .

In Php :


  $helper = \Drupal::service('drupal.helper')->helper;
  $mid = 12 ; //media id  
  $media_object = \Drupal::entityTypeManager()->getStorage('media')->load($mid);
  $url_image = $helper->image($media_object,'123x300'); // width : 123px , height : 300px ;

In Twig template :

{% set image = image(media_object,'123x300') %}
<img src="{{image}}" />

My best function : Availaible in 8.x-1.4 version


  $drupal_helper = new \Drupal\drupal_helper\DrupalHepler();
  $para_type = 'PARAGRAPH-TYPE';
  $para_id = 'PARAGRAPH-ID'; // can be null

  //Form
  $drupal_helper->form->render_form_paragraph($para_type, $para_id);
  $drupal_helper->form->render_form_node($node_type, $nid);

  //Block
  $drupal_helper->helper->block_custom_load_by_type('BLOCK-CUSTOM-TYPE');

   //Views
  $drupal_helper->views->render_view_exposed_form('VIEWS-NAME');
 
  //Taxonomy
  $drupal_helper->helper->taxonomy_first_level_by_vid('VID');
  $drupal_helper->helper->taxonomy_getparent('TID');
  $drupal_helper->helper->taxonomy_children_all('TID');
  $drupal_helper->helper->taxonomy_children('VID','TID');
  $drupal_helper->helper->taxonomy_url_alias('TID') ; 
     
   //Theme
  $drupal_helper->helper->get_current_path_theme();
  $drupal_helper->helper->redirectTo('YOUR-URL');

Sponsorship

This project is sponsored by Davyin. We provide specialist consulting services in Enterprise Drupal, Visit us at www.davyin.com.

Project information

Releases