You are here

public static function RocketChatSettingsForm::altSubmitForm in Rocket.Chat 8.2

Alternative submit handler for Button Precces that do not safe.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

File

src/Form/RocketChatSettingsForm.php, line 326
Contains \Drupal\rocket_chat\Form\RocketChatSettingsForm.

Class

RocketChatSettingsForm
Class RocketChatSettingsForm.

Namespace

Drupal\rocket_chat\Form

Code

public static function altSubmitForm(array &$form, FormStateInterface $form_state) {

  /** @var RocketChatSettingsForm  $formObject */
  $formObject = $form_state
    ->getFormObject();
  $apiConfig = new Drupal8Config($formObject
    ->configFactory(), $formObject->moduleHandler, $formObject->state, $formObject->messenger);
  $apiClient = new ApiClient($apiConfig);
  if ($apiConfig
    ->isReady()) {
    $RocketChatState = new Drupal8State($formObject->state);
    $Channels = new Channels($RocketChatState, $apiClient);
    $Channels
      ->refreshCache(TRUE);
    $Groups = new Groups($RocketChatState, $apiClient);
    $Groups
      ->refreshCache(TRUE);
    $Users = new Users($RocketChatState, $apiClient);
    $Users
      ->refreshCache(TRUE);
  }
}