In some cases we want to load a configuration file from optional / install folders. For example to compare it with active config and apply new changes.
To load a configuration from install folder user the next code snippet.
use Drupal\Core\Config\ExtensionInstallStorage;
$field_storage = 'field.storage.group_content.grequest_status';
$install_storage = new ExtensionInstallStorage(
\Drupal::service('config.storage'),
InstallStorage::CONFIG_INSTALL_DIRECTORY,
InstallStorage::DEFAULT_COLLECTION,
TRUE,
NULL
);
From optional folder
use Drupal\Core\Config\ExtensionInstallStorage;
$name = 'views.view.group_pending_members';
$optional_storage = new ExtensionInstallStorage(
\Drupal::service('config.storage'),
InstallStorage::CONFIG_OPTIONAL_DIRECTORY,
InstallStorage::DEFAULT_COLLECTION,
TRUE,
NULL
);
and schema configuration
use Drupal\Core\Config\ExtensionInstallStorage;
$name = 'views.view.group_pending_members';
$optional_storage = new ExtensionInstallStorage(
\Drupal::service('config.storage'),
InstallStorage::CONFIG_SCHEMA_DIRECTORY,
InstallStorage::DEFAULT_COLLECTION,
TRUE,
NULL
);