You are here

protected function ConfigBit::configExists in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x

Same name and namespace in other branches
  1. 8.8 src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::configExists()

Is this config exists or not yet in the database.

Parameters

string $config_name: The name of the config.

Return value

bool The status of cofnig.

1 call to ConfigBit::configExists()
ConfigBit::applyConfigActionImport in src/Config/ConfigBit.php
Apply Config Action Import.

File

src/Config/ConfigBit.php, line 421

Class

ConfigBit
Class ConfigBit.

Namespace

Drupal\varbase\Config

Code

protected function configExists(string $config_name) {
  $query = $this->database
    ->select('config', 'c');
  $query
    ->condition('c.name', $config_name, '=');
  $query
    ->addExpression('COUNT(*)', 'count');
  $config_count = $query
    ->execute()
    ->fetchField();
  if ($config_count == 1) {
    return TRUE;
  }
  return FALSE;
}