75 lines
2.5 KiB
PHP
75 lines
2.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Contains admin_menus.module.
|
|
*/
|
|
|
|
use Drupal\Core\Routing\RouteMatchInterface;
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
|
|
/**
|
|
* Implements hook_help().
|
|
*/
|
|
function ouatt_puissanceagir_help($route_name, RouteMatchInterface $route_match) {
|
|
switch ($route_name) {
|
|
// Main module help for the editors_menus module.
|
|
case 'help.page.ouatt_puissanceagir':
|
|
$output = '';
|
|
$output .= '<h3>' . t('About') . '</h3>';
|
|
$output .= '<p>' . t("Où Atterrir puissance d'agir custom module") . '</p>';
|
|
return $output;
|
|
|
|
default:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Implements hook_form_FORM_ID_alter().
|
|
*/
|
|
// function ouatt_puissanceagir_form_user_register_form_alter(&$form, $form_state, $form_id) {
|
|
// function ouatt_puissanceagir_form_node_edit_form__node_besoin_form_alter(&$form, $form_state, $form_id) {
|
|
// function ouatt_puissanceagir_form_node_edit_form__node_besoin_alter(&$form, $form_state, $form_id) {
|
|
// function ouatt_puissanceagir_form_alter(&$form, $form_state, $form_id) {
|
|
// $t="t";
|
|
// }
|
|
|
|
// function ouatt_puissanceagir_field_widget_form_alter(&$element, &$form_state, $context) {
|
|
|
|
// // Add a css class to widget form elements for all fields of type mytype.
|
|
// if ($context['field']['type'] == 'mytype') {
|
|
|
|
// // Be sure not to overwrite existing attributes.
|
|
// $element['#attributes']['class'][] = 'myclass';
|
|
// }
|
|
// }
|
|
|
|
function ouatt_puissanceagir_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
|
|
if ($entity_form['#entity_type'] === 'node' && $entity_form['#bundle'] === 'besoin') {
|
|
// prefile concernement entity reference field on besoin
|
|
// usefull for automatic entity label and for reciproque references
|
|
if (!$entity_form['field_concernement']['widget'][0]['target_id']['#default_value']) {
|
|
$parent_node = \Drupal::routeMatch()->getParameter('node');
|
|
$entity_form['field_concernement']['widget'][0]['target_id']['#default_value'] = $parent_node;
|
|
$entity_form['field_index']['widget'][0]['value']['#default_value'] = $entity_form['#ief_row_delta'];
|
|
}
|
|
$entity_form['field_concernement']['#attributes']['style'] = ['display:none;'];
|
|
|
|
|
|
}
|
|
}
|
|
|
|
function ouatt_puissanceagir_inline_entity_form_table_fields_alter(&$fields, $context) {
|
|
$t="t";
|
|
}
|
|
|
|
/**
|
|
* Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
|
|
*
|
|
*/
|
|
function ouatt_puissanceagir_form_node_reponse_form_alter(&$form, FormStateInterface $form_state) {
|
|
$t="t";
|
|
// $form['field_besoin_on_response']['widget']['#disabled'] = true;
|
|
}
|