Resolve #3487705 "Refactor banuserform"
3 unresolved threads
Closes #3487705
Merge request reports
Activity
89 89 /** 90 90 * {@inheritdoc} 91 91 */ 92 public function buildForm(array $form, FormStateInterface $form_state, $target_id = NULL): array { 117 '#title' => $this->t('Blocked User'), 118 '#default_value' => $target_id, 119 '#required' => FALSE, 96 '#title' => $this->t('Select User'), 97 '#required' => TRUE, 98 '#type' => 'entity_autocomplete', 99 '#target_type' => 'user', 100 '#tags' => FALSE, 101 '#selection_handler' => 'private_message:not_blocked_user', 102 '#selection_settings' => [ 103 'include_anonymous' => FALSE, 104 ], 120 105 ]; 121 106 122 $submitLabel = $config->get('ban_label'); 123 if ($target_id && $this->privateMessageBanManager->isBanned($target_id)) { 244 241 return $response; 245 242 } 246 243 247 /** 248 * Handler for autocomplete request for banning people. 249 */ 250 public function privateMessageBanMembersAutocomplete(Request $request) { 251 $results = []; 252 253 if ($input = $request->query->get('q')) { 254 $typed_string = Tags::explode($input); 255 $typed_string = mb_strtolower(array_pop($typed_string)); 256 $accounts = $this->privateMessageService->getUsersFromString($typed_string, self::AUTOCOMPLETE_COUNT); 257 258 foreach ($accounts as $account) { 259 if (!$this->privateMessageBanManager->isBanned($account->id())) { - Resolved by Claudiu Cristea
Please register or sign in to reply