You are here

public function EntityUpdateExec::submitFormBasic in Entity Update 8

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

Run updates using basic method.

File

src/Form/EntityUpdateExec.php, line 213

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';
    drupal_set_message($this
      ->t("Entity update @res", [
      '@res' => $res_str,
    ]), $status);
  } catch (\Exception $e) {
    drupal_set_message($this
      ->t("Entity update Fail"), 'error');
    drupal_set_message($e
      ->getMessage(), 'error');
  }
}