UserLogin.php in Business Rules 8
File
src/Plugin/BusinessRulesReactsOn/UserLogin.php
View source
<?php
namespace Drupal\business_rules\Plugin\BusinessRulesReactsOn;
use Drupal\business_rules\Plugin\BusinessRulesReactsOnPlugin;
use Drupal\Core\Form\FormStateInterface;
class UserLogin extends BusinessRulesReactsOnPlugin {
public function processForm(array &$form, FormStateInterface $form_state) {
parent::processForm($form, $form_state);
$form['entity']['context']['target_entity_type']['#required'] = FALSE;
$form['entity']['context']['target_entity_type']['#value'] = 'user';
$form['entity']['context']['target_entity_type']['#disabled'] = TRUE;
$form['entity']['context']['target_entity_type']['#options'] = [
'user' => $form['entity']['context']['target_entity_type']['#options']['user'],
];
$form['entity']['context']['target_bundle']['#options'] = [
'user' => t('User'),
];
$form['entity']['context']['target_bundle']['#required'] = FALSE;
$form['entity']['context']['target_bundle']['#value'] = 'user';
$form['entity']['context']['target_bundle']['#disabled'] = TRUE;
}
}