Skip to content
Snippets Groups Projects
project_browser.install 1.8 KiB
Newer Older
/**
 * @file
 * Contains install and update functions for Project Browser.
 */

 * Populates the project_browser_projects using a fixture with PHP serialized
  if (class_exists(Recipe::class)) {
    $config = \Drupal::configFactory()
      ->getEditable('project_browser.admin_settings');
    $enabled_sources = $config->get('enabled_sources');
    $enabled_sources[] = 'recipes';
    $config->set('enabled_sources', $enabled_sources)->save();
  }
function project_browser_update_last_removed() {
  return 9017;
  $config_factory = \Drupal::configFactory();
  $config_factory->getEditable('project_browser.admin_settings')
 * Remove the Drupal.org(Mock API) setting and tables.
function project_browser_update_9019() {
  // Remove the mock from the enabled_sources, if present.
  $config = \Drupal::configFactory()->getEditable('project_browser.admin_settings');
  $enabled_sources = $config->get('enabled_sources');
  if (($key = array_search('drupalorg_mockapi', $enabled_sources)) !== FALSE) {
    unset($enabled_sources[$key]);
    $enabled_sources = array_values($enabled_sources);
    $config->set('enabled_sources', $enabled_sources)->save();
  }
  // And remove the tables.
  $schema = \Drupal::database()->schema();
  $tables_to_drop = ['project_browser_projects', 'project_browser_categories'];
  foreach ($tables_to_drop as $table) {
    if ($schema->tableExists($table)) {
      $schema->dropTable($table);
    }
  }