protected function AddMailchimpEventWebformHandler::getEventPropertiesById in Mailchimp 2.x
Gets the Mailchimp Event properties, given the entity's ID.
Parameters
int $id: The Mailchimp Event ID.
Return value
array A set of form fields for each property on the entity.
1 call to AddMailchimpEventWebformHandler::getEventPropertiesById()
- AddMailchimpEventWebformHandler::buildConfigurationForm in modules/
mailchimp_events/ src/ Plugin/ WebformHandler/ AddMailchimpEventWebformHandler.php - Form constructor.
File
- modules/
mailchimp_events/ src/ Plugin/ WebformHandler/ AddMailchimpEventWebformHandler.php, line 377
Class
- AddMailchimpEventWebformHandler
- Webform submission Event handler.
Namespace
Drupal\mailchimp_events\Plugin\WebformHandlerCode
protected function getEventPropertiesById($id) {
$property_fields = [];
// Load all the properties of the event name.
$chosen_event = MailchimpEvent::load($id);
// Add a line for each property with a place to enter a value.
$properties = $chosen_event ? $chosen_event
->getProperties() : [];
foreach ($properties as $property) {
$property_fields[$property['value']] = [
'#type' => 'textfield',
'#title' => $property['value'],
'#weight' => '0',
'#default_value' => isset($this->configuration['properties'][$property['value']]) ? $this->configuration['properties'][$property['value']] : '',
];
}
return $property_fields;
}