started puissance d'agir
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
name: Où Atterrir Puissance d'agir
|
||||
type: module
|
||||
description: "Où Atterrir puissance d'agire."
|
||||
package: Ouatterrir
|
||||
core: 8.x
|
||||
# dependencies:
|
||||
# - user
|
||||
core_version_requirement: ^8 || ^9
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains admin_menus.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
|
||||
/**
|
||||
* 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_concernement']['#attributes']['style'] = ['display:none;'];
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user