class YamlContentCommands in YAML Content 8
YAML Content commands class for Drush 9.0.0-beta5 and above.
Hierarchy
- class \Drupal\yaml_content\Commands\YamlContentCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of YamlContentCommands
1 string reference to 'YamlContentCommands'
1 service uses YamlContentCommands
File
- src/
Commands/ YamlContentCommands.php, line 10
Namespace
Drupal\yaml_content\CommandsView source
class YamlContentCommands extends DrushCommands {
/**
* Content Loader.
*
* @var \Drupal\yaml_content\ContentLoader\ContentLoaderInterface
*/
protected $loader;
/**
* ContentLoader constructor.
*
* @param \Drupal\yaml_content\Service\LoadHelper $loader
* YAML Content loader service.
*/
public function __construct(LoadHelper $loader) {
$this->loader = $loader;
}
/**
* Import yaml content from a module.
*
* @param string $module
* The machine name of a module to be searched for content.
* @param string $file
* (Optional) The name of a content file to be imported.
* @param array $options
* An associative array of options whose values come from cli, aliases,
* config, etc.
*
* @command yaml_content:import:module
* @option create-new
* Set this to create content even if it is already in the system.
* @aliases ycim,yaml-content-import-module
*/
public function contentImportModule($module, $file = NULL, array $options = [
'create-new' => NULL,
]) {
$this->loader
->importModule($module, $file);
}
/**
* Import yaml content.
*
* @param string $directory
* The directory path where content files may be found.
* @param string $file
* (Optional) The name of a content file to be imported.
* @param array $options
* An associative array of options whose values come from cli, aliases,
* config, etc.
*
* @command yaml_content:import
* @option create-new
* Set this to create content even if it is already in the system.
* @aliases yci,yaml-content-import
*/
public function contentImport($directory, $file = NULL, array $options = [
'create-new' => NULL,
]) {
$this->loader
->importDirectory($directory, $file);
}
/**
* Import yaml content from a profile.
*
* @param string $profile
* The machine name of a profile to be searched for content.
* @param string $file
* (Optional) The name of a content file to be imported.
* @param array $options
* An associative array of options whose values come from cli, aliases,
* config, etc.
*
* @command yaml_content:import:profile
* @option create-new
* Set this to create content even if it is already in the system.
* @aliases ycip,yaml-content-import-profile
*/
public function contentImportProfile($profile, $file = NULL, array $options = [
'create-new' => NULL,
]) {
$this->loader
->importProfile($profile, $file);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
YamlContentCommands:: |
protected | property | Content Loader. | |
YamlContentCommands:: |
public | function | Import yaml content. | |
YamlContentCommands:: |
public | function | Import yaml content from a module. | |
YamlContentCommands:: |
public | function | Import yaml content from a profile. | |
YamlContentCommands:: |
public | function | ContentLoader constructor. |