You are here

class SocialSendEmail in Open Social 8.7

Same name in this branch
  1. 8.7 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  2. 8.7 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail
Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  2. 8.5 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  3. 8.6 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  4. 8.8 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  5. 10.3.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  6. 10.0.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  7. 10.1.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail
  8. 10.2.x modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail

Send email to group members.

Plugin annotation


@Action(
  id = "social_group_send_email_action",
  label = @Translation("Send email to group members"),
  type = "group_content",
  confirm = TRUE,
)

Hierarchy

  • class \Drupal\social_user\Plugin\Action\SocialSendEmail extends \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase implements \Drupal\views_bulk_operations\Action\ViewsBulkOperationsPreconfigurationInterface, ContainerFactoryPluginInterface

Expanded class hierarchy of SocialSendEmail

File

modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php, line 20

Namespace

Drupal\social_group\Plugin\Action
View source
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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SocialSendEmail::$allowTextFormat protected property TRUE if the current user can use the "Mail HTML" text format.
SocialSendEmail::$emailValidator protected property The email validator.
SocialSendEmail::$languageManager protected property The language manager.
SocialSendEmail::$logger protected property A logger instance.
SocialSendEmail::$mailManager protected property The mail manager.
SocialSendEmail::$storage protected property The user storage.
SocialSendEmail::$token protected property The token service.
SocialSendEmail::access public function Overrides SocialSendEmail::access
SocialSendEmail::buildConfigurationForm public function Configuration form builder. Overrides SocialSendEmail::buildConfigurationForm
SocialSendEmail::buildPreConfigurationForm public function 1
SocialSendEmail::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 1
SocialSendEmail::execute public function Overrides SocialSendEmail::execute
SocialSendEmail::getEmail public function Returns the email address of this account. 1
SocialSendEmail::submitConfigurationForm public function
SocialSendEmail::__construct public function Constructs a SocialSendEmail object. 1