<?php /** * @file * Contains materio_sapi.module. */ use Drupal\Core\Routing\RouteMatchInterface; use Solarium\QueryType\Select\Query\Query; use Drupal\search_api\Query\QueryInterface; use Drupal\Core\Template\Attribute; function materio_samples_form_node_materiau_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){ // get current user $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); if(!$user->hasPermission('materio_samples_edit_materiaux_titles')){ $form['title']['#access'] = false; } }