Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Обработка ошибок

09/05/2020, by maria

API базы данных генерирует исключения при ошибке, которая может быть обнаружена путем переноса операций базы данных в блоки try {} catch() {}, как показано в этом примере:

// 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.