pino-8.x-1.2-no-core/modules/member/member.module

modules/member/member.module
<?php

/**
 * @file
 * Contains member.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function member_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the member module.
    case 'help.page.member':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Member Entity') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_theme().
 */
function member_theme() {
  return [
    'member' => [
      'render element' => 'children',
    ],
  ];
}

/**
 * Implements hook_form_alter().
 */
function member_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  if($form_id == 'member_edit_form' || $form_id == 'member_add_form' && isset($form['field_resignation_date'])) {

    // Hide the resignation date field if member is active

    $form['field_resignation_date']['#states'] = [
      'visible' => [
        'input[name="field_is_active[value]"]' => ['checked' => false]
      ]
    ];

  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc