class EventMaxEnrollOverride in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 8.5 modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 8.6 modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 8.7 modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 10.3.x modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 10.0.x modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 10.1.x modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
- 10.2.x modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php \Drupal\social_event_max_enroll\EventMaxEnrollOverride
Class EventMaxEnrollOverride.
Override event form.
@package Drupal\social_event_max_enroll
Hierarchy
- class \Drupal\social_event_max_enroll\EventMaxEnrollOverride implements ConfigFactoryOverrideInterface
Expanded class hierarchy of EventMaxEnrollOverride
2 string references to 'EventMaxEnrollOverride'
- EventMaxEnrollOverride::getCacheSuffix in modules/
social_features/ social_event/ modules/ social_event_max_enroll/ src/ EventMaxEnrollOverride.php - The string to append to the configuration static cache name.
- social_event_max_enroll.services.yml in modules/
social_features/ social_event/ modules/ social_event_max_enroll/ social_event_max_enroll.services.yml - modules/social_features/social_event/modules/social_event_max_enroll/social_event_max_enroll.services.yml
1 service uses EventMaxEnrollOverride
- social_event_max_enroll.overrider in modules/
social_features/ social_event/ modules/ social_event_max_enroll/ social_event_max_enroll.services.yml - Drupal\social_event_max_enroll\EventMaxEnrollOverride
File
- modules/
social_features/ social_event/ modules/ social_event_max_enroll/ src/ EventMaxEnrollOverride.php, line 18
Namespace
Drupal\social_event_max_enrollView source
class EventMaxEnrollOverride implements ConfigFactoryOverrideInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The Social Event AN Enroll config overrider.
*
* @var \Drupal\social_event_an_enroll\EventAnEnrollOverride|null
*/
protected $socialEventAnEnrollOverrider;
/**
* Constructs the configuration override.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The Drupal configuration factory.
* @param \Drupal\social_event_an_enroll\EventAnEnrollOverride|null $social_event_an_enroll_overrider
* The Social Event AN Enroll config overrider.
*/
public function __construct(ConfigFactoryInterface $config_factory, EventAnEnrollOverride $social_event_an_enroll_overrider = NULL) {
$this->configFactory = $config_factory;
$this->socialEventAnEnrollOverrider = $social_event_an_enroll_overrider;
}
/**
* Returns config overrides.
*/
public function loadOverrides($names) {
$overrides = [];
// Add field_event_max_enroll to event form.
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
if ($this->socialEventAnEnrollOverrider instanceof ConfigFactoryOverrideInterface) {
$parent_overrides = $this->socialEventAnEnrollOverrider
->loadOverrides([
$config_name,
]);
$children = $parent_overrides[$config_name]['third_party_settings']['field_group']['group_enrollment']['children'];
$content = $parent_overrides[$config_name]['content'];
}
else {
$config = $this->configFactory
->getEditable($config_name);
$children = $config
->get('third_party_settings.field_group.group_enrollment.children');
$content = $config
->get('content');
}
// Add a field group.
$children[] = 'field_event_max_enroll';
$children[] = 'field_event_max_enroll_num';
// Add the field to the content.
$content['field_event_max_enroll'] = [
'weight' => 100,
'settings' => [
'placeholder' => '',
],
'third_party_settings' => [],
'type' => 'number',
'region' => 'content',
];
$content['field_event_max_enroll_num'] = [
'weight' => 101,
'settings' => [
'display_label' => TRUE,
],
'third_party_settings' => [],
'type' => 'boolean_checkbox',
'region' => 'content',
];
$overrides[$config_name] = [
'third_party_settings' => [
'field_group' => [
'group_enrollment' => [
'children' => $children,
],
],
],
'content' => $content,
];
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'EventMaxEnrollOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}