- Issue created by @scrypter
- 🇮🇳India zartab farooquee
Creating a migrate_skip_fields/src/MigrateSkipFieldsByName.php
namespace Drupal\migrate_skip_fields;
use Drupal\Core\Config\ConfigFactoryInterface;
class MigrateSkipFieldsByName {
protected $settings;public function __construct(ConfigFactoryInterface $config_factory) {
$this->settings = $config_factory->get('migrate_skip_fields.settings')->get('skip_fields');
}
}Then i created migrate_skip_fields/config/install/migrate_skip_fields.settings.yml
migrate_skip_fields.settings:
type: config_object
label: 'Migrate Skip Fields Settings'
mapping:
skip_fields:
type: string
label: 'Skip Fields'
description: 'Comma-separated list of fields to skip during migration.'We access settings using ConfigFactoryInterface in the class. The schema file helps validate the settings, and managing everything in a custom module keeps it clean and modular.
- Status changed to Postponed: needs info
11 days ago 5:48pm 11 November 2024 - 🇳🇮Nicaragua dinarcon
I think the original question is related to where the settings used by the module should be placed. That would be
sites/default/settings.php
or another file included there. The module providedmigrate_skip_fields.settings.php
file is meant to serve only as a reference of how to set the values, but the settings themselves would live in the standard location.@scrypter you can instruct
sites/default/settings.php
to readmigrate_skip_fields.settings.php
from a custom module, but that would not be standard. Alternatively, you can copy the file into thesites/default/
folder and include it by adding this tosites/default/settings.php
:if (file_exists($app_root . '/' . $site_path . '/migrate_skip_fields.settings.php')) { include $app_root . '/' . $site_path . '/migrate_skip_fields.settings.php'; }
The module does not use the configuration management API nor makes use of configuration scheme.
@zartab farooquee I am not clear what you are suggesting nor how the code is related the module's functionality.
Updating status. Please change back to active and add more context if I have not addressed the questions.