SocialSendEmail.php in Open Social 8.6
Same filename in this branch
Same filename and directory in other branches
- 8.9 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 8.5 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 8.7 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 8.8 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 10.3.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 10.0.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 10.1.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
- 10.2.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php
Namespace
Drupal\social_group\Plugin\ActionFile
modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.phpView source
<?php
namespace Drupal\social_group\Plugin\Action;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\group\Entity\GroupContentInterface;
use Drupal\social_user\Plugin\Action\SocialSendEmail as SocialSendEmailBase;
/**
* Send email to group members.
*
* @Action(
* id = "social_group_send_email_action",
* label = @Translation("Send email to group members"),
* type = "group_content",
* confirm = TRUE,
* )
*/
class SocialSendEmail extends SocialSendEmailBase {
/**
* {@inheritdoc}
*/
public function execute($entity = NULL) {
/** @var \Drupal\group\Entity\GroupContentInterface $entity */
parent::execute($entity
->getEntity());
return $this
->t('Send mail');
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
if ($object instanceof GroupContentInterface) {
/** @var \Drupal\group\Entity\GroupContentInterface $object */
return $object
->access('view', $account, $return_as_object);
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
// Add title to the form as well.
if ($form['#title'] !== NULL) {
$selected_count = $this->context['selected_count'];
$subtitle = $this
->formatPlural($selected_count, 'Configure the email you want to send to the one member you have selected.', 'Configure the email you want to send to the @count members you have selected.');
$form['subtitle'] = [
'#type' => 'html_tag',
'#tag' => 'div',
'#attributes' => [
'class' => [
'placeholder',
],
],
'#value' => $subtitle,
];
}
return parent::buildConfigurationForm($form, $form_state);
}
}
Classes
Name | Description |
---|---|
SocialSendEmail | Send email to group members. |