public function SocialAddToCalendarBase::getEventDescription in Open Social 8.9
Same name and namespace in other branches
- 10.3.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendarBase.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendarBase::getEventDescription()
- 10.0.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendarBase.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendarBase::getEventDescription()
- 10.1.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendarBase.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendarBase::getEventDescription()
- 10.2.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendarBase.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendarBase::getEventDescription()
Returns the event description for calendar.
Parameters
\Drupal\node\NodeInterface $node: The node entity.
Return value
string Event description.
Overrides SocialAddToCalendarInterface::getEventDescription
1 call to SocialAddToCalendarBase::getEventDescription()
- SocialAddToCalendarBase::generateSettings in modules/
social_features/ social_event/ modules/ social_event_addtocal/ src/ Plugin/ SocialAddToCalendarBase.php - Returns array of event settings for url options.
File
- modules/
social_features/ social_event/ modules/ social_event_addtocal/ src/ Plugin/ SocialAddToCalendarBase.php, line 92
Class
- SocialAddToCalendarBase
- Base class for Social add to calendar plugins.
Namespace
Drupal\social_event_addtocal\PluginCode
public function getEventDescription(NodeInterface $node) {
// Get event description.
$description = $node->body->value;
// Strings for replace.
$replace_strings = [
' ' => '',
'<br />' => '',
PHP_EOL => '',
];
// Replace node supported strings.
foreach ($replace_strings as $search => $replace) {
$description = str_replace($search, $replace, $description);
}
return Unicode::truncate(strip_tags($description), 1000, TRUE, TRUE);
}