Дополнительные типы блоков (EBT) — новый опыт конструктора страниц❗

Дополнительные типы блоков (EBT) — стилизованные, настраиваемые типы блоков: слайдшоу, вкладки, карточки, аккордеоны и многие другие. Встроенные настройки для фона, DOM Box, плагины Javascript.

Демо EBT модули Скачать EBT модули

❗Дополнительные типы параграфов (EPT) — новый опыт работы с параграфами

Дополнительные типы параграфов (EPT) — набор модулей, основанный на аналогичных параграфах.

Демо EPT модули Скачать EPT модули

Scroll
09/05/2020, by maria

The Database API throws exceptions on error, which can be caught by wrapping database operations in try {} catch() {} blocks, as shown in this example:

// The transaction opens here.
$txn = $connection->startTransaction();
try {
  $id = $connection->insert('example')
    ->fields([
      'field1' => 'mystring',
      'field2' => 5,
    ])
    ->execute();

  my_other_function($id);

  return $id;
}
catch (Exception $e) {
  // Something went wrong somewhere, so roll back now.
  $txn->rollBack();
  // Log the exception to watchdog.
  \Drupal::logger('type')->error($e->getMessage());
}

 

Source URL:

Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.