class PlatformBrandingColors in Open Social 10.2.x
The brand colors for this platform.
Plugin annotation
@DataProducer(
id = "platform_branding_colors",
name = @Translation("Platform Branding Colors"),
description = @Translation("The brand colors for this platform."),
produces = @ContextDefinition("any",
label = @Translation("Platform Branding Colors")
),
consumes = {
"platformBranding" = @ContextDefinition("any",
label = @Translation("Platform Branding"),
required = TRUE
)
}
)
Hierarchy
- class \Drupal\social_branding\Plugin\GraphQL\DataProducer\PlatformBrandingColors extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase implements ContainerFactoryPluginInterface
Expanded class hierarchy of PlatformBrandingColors
File
- modules/
social_features/ social_branding/ src/ Plugin/ GraphQL/ DataProducer/ PlatformBrandingColors.php, line 29
Namespace
Drupal\social_branding\Plugin\GraphQL\DataProducerView source
class PlatformBrandingColors extends DataProducerPluginBase implements ContainerFactoryPluginInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $config;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory'));
}
/**
* PlatformBrandingLogoUrl constructor.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(array $configuration, string $plugin_id, array $plugin_definition, ConfigFactoryInterface $config_factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->config = $config_factory;
}
/**
* Returns platform branding colors.
*
* @param \Drupal\Core\Config\ImmutableConfig $platform_branding
* The platform branding.
*
* @return \Drupal\Core\Config\ImmutableConfig|null
* The platform branding colors.
*/
public function resolve(ImmutableConfig $platform_branding) : ?ImmutableConfig {
if ($platform_branding
->get('default') === 'socialblue') {
if ($this->config
->get('color.theme.socialblue')
->get('palette.brand-primary')) {
return $this->config
->get('color.theme.socialblue');
}
return $this->config
->get('socialblue.settings');
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PlatformBrandingColors:: |
protected | property | The config factory. | |
PlatformBrandingColors:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
PlatformBrandingColors:: |
public | function | Returns platform branding colors. | |
PlatformBrandingColors:: |
public | function | PlatformBrandingLogoUrl constructor. |