You are here

function data_get_table in Data 8

Same name and namespace in other branches
  1. 6 data.module \data_get_table()
  2. 7 data.module \data_get_table()

Get a table if it exists.

Parameters

string $name: Unique name of the table.

Return value

\Drupal\data\Entity\TableConfigInterface TableConfig entity, or FALSE in case of failure.

Note: In some circumstances, a table may be defined while it does not exist in the database. In these cases, data_get_table() would still return a valid DataTable object.

1 call to data_get_table()
DataTestCaseAPI::testAPIFunctions in tests/data.test
Test API functions of DataTable and TableFactory.

File

./data.module, line 68
Hooks and API functions for data module.

Code

function data_get_table($name) {
  $table = \Drupal::entityTypeManager()
    ->getStorage('data_table_config')
    ->load($name);
  if ($table && $table
    ->defined()) {
    return $table;
  }
  return FALSE;
}