You are here

public function EntityUpdateExec::submitFormBasic in Entity Update 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/EntityUpdateExec.php \Drupal\entity_update\Form\EntityUpdateExec::submitFormBasic()

Run updates using basic method.

File

src/Form/EntityUpdateExec.php, line 217

Class

EntityUpdateExec
Class CheckEntityUpdate.

Namespace

Drupal\entity_update\Form

Code

public function submitFormBasic(array &$form, FormStateInterface $form_state) {
  try {
    $force = $form_state
      ->getValue('force');
    $res = EntityUpdate::basicUpdate($force);
    $res_str = $res ? 'SUCCESS' : 'FAIL';
    $status = $res ? 'status' : 'error';
    $this
      ->messenger()
      ->addMessage($this
      ->t("Entity update @res", [
      '@res' => $res_str,
    ]), $status);
  } catch (\Exception $e) {
    $this
      ->messenger()
      ->addMessage($this
      ->t("Entity update Fail"), 'error');
    $this
      ->messenger()
      ->addMessage($e
      ->getMessage(), 'error');
  }
}