You are here

public static function TypeSettingsStorage::delete in Node Accessibility 8

Delete an entry from the database.

Parameters

array $entry: An array containing at least the person identifier 'pid' element of the entry to delete.

Return value

bool TRUE on success, FALSE otherwise.

File

src/TypeSettingsStorage.php, line 333

Class

TypeSettingsStorage
Class TypeSettingsStorage.

Namespace

Drupal\node_accessibility

Code

public static function delete(string $nodeType) {
  if (empty($nodeType)) {
    return FALSE;
  }
  try {
    \Drupal::database()
      ->delete('node_accessibility_type_settings')
      ->condition('node_type', $nodeType)
      ->execute();
  } catch (Exception $e) {
    \Drupal::logger('node_accessibility')
      ->error("Failed to delete on {node_accessibility_type_settings} table, exception: @exception.", [
      '@exception' => $e
        ->getMessage(),
    ]);
    return FALSE;
  } catch (Error $e) {
    \Drupal::logger('node_accessibility')
      ->error("Failed to delete on {node_accessibility_type_settings} table, exception: @exception.", [
      '@exception' => $e
        ->getMessage(),
    ]);
    return FALSE;
  }
  return TRUE;
}