You are here

class ExportMember in Open Social 8.9

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

Exports a group member accounts to CSV.

Plugin annotation


@Action(
  id = "social_group_members_export_member_action",
  label = @Translation("Export the selected members to CSV"),
  type = "group_content",
  confirm = TRUE,
)

Hierarchy

Expanded class hierarchy of ExportMember

File

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

Namespace

Drupal\social_group_members_export\Plugin\Action
View source
class ExportMember extends ExportUser {

  /**
   * {@inheritdoc}
   */
  public function executeMultiple(array $entities) {

    /** @var \Drupal\group\Entity\GroupContentInterface $entity */
    foreach ($entities as &$entity) {
      $entity = $entity
        ->getEntity();
    }
    parent::executeMultiple($entities);
  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    if ($object instanceof GroupContentInterface && $object
      ->getContentPlugin()
      ->getPluginId() === 'group_membership') {
      $access = $object
        ->getEntity()
        ->access('view', $account, TRUE);
    }
    else {
      $access = AccessResult::forbidden();
    }
    return $return_as_object ? $access : $access
      ->isAllowed();
  }

  /**
   * {@inheritdoc}
   *
   * To make sure the file can be downloaded, the path must be declared in the
   * download pattern of the social user export module.
   *
   * @see social_user_export_file_download()
   */
  protected function generateFilePath() : string {
    $hash = md5(microtime(TRUE));
    return 'export-members-' . substr($hash, 20, 12) . '.csv';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExportMember::access public function Overrides ExportUser::access
ExportMember::executeMultiple public function Overrides ExportUser::executeMultiple
ExportMember::generateFilePath protected function To make sure the file can be downloaded, the path must be declared in the download pattern of the social user export module. Overrides ExportUser::generateFilePath
ExportUser::$config protected property The user export plugin config object.
ExportUser::$currentUser protected property The current user account.
ExportUser::$logger protected property A logger instance.
ExportUser::$pluginDefinitions protected property User export plugin definitions.
ExportUser::$userExportPlugin protected property The User export plugin manager.
ExportUser::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm
ExportUser::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 1
ExportUser::execute public function
ExportUser::getBaseOutputDirectory protected function Returns the directory that forms the base for this exports file output.
ExportUser::getPluginConfiguration public function Gets export plugin's configuration. 1
ExportUser::pluginAccess protected function Check the access of export plugins based on config and permission.
ExportUser::sortDefinitions protected function Order by weight.
ExportUser::__construct public function Constructs a ExportUser object. 1
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18