本文整理汇总了PHP中Drupal\Core\Config\Config::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getName方法的具体用法?PHP Config::getName怎么用?PHP Config::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Config
的用法示例。
在下文中一共展示了Config::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRename
/**
* @covers ::rename
*/
public function testRename()
{
$old = new Config($this->randomMachineName(), $this->storage, $this->eventDispatcher, $this->typedConfig);
$new = new Config($this->randomMachineName(), $this->storage, $this->eventDispatcher, $this->typedConfig);
$this->storage->expects($this->exactly(2))->method('readMultiple')->willReturnMap([[[$old->getName()], $old->getRawData()], [[$new->getName()], $new->getRawData()]]);
$this->cacheTagsInvalidator->expects($this->once())->method('invalidateTags')->with($old->getCacheTags());
$this->storage->expects($this->once())->method('rename')->with($old->getName(), $new->getName());
$this->configFactory->rename($old->getName(), $new->getName());
}
示例2: writeBackConfig
/**
* write configuration back to files.
*
* @param \Drupal\Core\Config\Config $config
* The config object.
* @param array $file_names
* The file names to which the configuration should be written.
*/
public function writeBackConfig(Config $config, array $file_names)
{
if ($file_names) {
$data = $config->get();
$config_name = $config->getName();
if ($entity_type_id = $this->configManager->getEntityTypeIdByName($config_name)) {
unset($data['uuid']);
}
foreach ($file_names as $file_name) {
try {
file_put_contents($file_name, (new InstallStorage())->encode($data));
} catch (DumpException $e) {
// Do nothing. What could we do?
}
}
}
}
示例3: testGetCacheTags
/**
* @covers ::getCacheTags
*/
public function testGetCacheTags()
{
$this->assertSame(['config:' . $this->config->getName()], $this->config->getCacheTags());
}
示例4: calculateDependencies
/**
* {@inheritdoc}
*/
public function calculateDependencies()
{
$provider = explode('.', $this->config->getName(), 2)[0];
$this->addDependency('module', $provider);
return $this->dependencies;
}