You are here

function AddBannerForm::dynamic_banner_load_banner in Dynamic Banner 8

Fetch a specific banner from the database.

1 call to AddBannerForm::dynamic_banner_load_banner()
AddBannerForm::buildForm in src/forms/AddBannerForm.php
Form constructor.

File

src/forms/AddBannerForm.php, line 408

Class

AddBannerForm

Namespace

Drupal\dynamic_banner\forms

Code

function dynamic_banner_load_banner($dbid) {

  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
  $query = \Drupal::database()
    ->select('dynamic_banner', 'd');
  $query
    ->condition('d.dbid', $dbid, '=')
    ->fields('d');
  $result = $query
    ->execute()
    ->fetchObject();
  if ($result) {
    return $result;
  }
  return NULL;
}