public function showMembers() {
    $entityView = $this->entityTypeManager->getStorage('view')->load('campaign_members');
    /** @var \Drupal\views\ViewExecutable $view */
    $view = $this->viewsExecutableFactory->get($entityView);
    $view->setDisplay('members_list_block');

    $campaigns = $this->campaignMenuService->getActiveCampaigns();
    if (empty($view->getExposedInput()) && !empty($campaigns)) {
      $defaultCampaign = current($campaigns);
      $view->setExposedInput(['campaign' => $defaultCampaign->id()]);
    }

    $build = [
      'link' => [
        '#type' => 'link',
        '#title' => $this->t('Registration Portal >>>'),
        '#url' => Url::fromRoute('openy_campaign.member-registration-portal'),
        '#attributes' => [
          'class' => [
            'align-right',
          ],
        ],
        '#prefix' => '<div class="row">',
        '#suffix' => '</div>',
      ],
      'view' => $view->render(),
    ];

    return $build;
  }
public function showMembers() {
    $entityView = $this->entityTypeManager->getStorage('view')->load('campaign_members');
    /** @var \Drupal\views\ViewExecutable $view */
    $view = $this->viewsExecutableFactory->get($entityView);
    $view->setDisplay('members_list_block');

    $campaigns = $this->campaignMenuService->getActiveCampaigns();
    if (empty($view->getExposedInput()) && !empty($campaigns)) {
      $defaultCampaign = current($campaigns);
      $view->setExposedInput(['campaign' => $defaultCampaign->id()]);
    }

    $build = [
      'link' => [
        '#type' => 'link',
        '#title' => $this->t('Registration Portal >>>'),
        '#url' => Url::fromRoute('openy_campaign.member-registration-portal'),
        '#attributes' => [
          'class' => [
            'align-right',
          ],
        ],
        '#prefix' => '<div class="row">',
        '#suffix' => '</div>',
      ],
      'view' => $view->render(),
    ];

    return $build;
  }
public function showMembers ( ) { $ entityView = $ this -> entityTypeManager -> getStorage ( 'view' ) -> load ( 'campaign_members' ) ; /** @var \Drupal\views\ViewExecutable $view */ $ view = $ this -> viewsExecutableFactory -> get ( $ entityView ) ; $ view -> setDisplay ( 'members_list_block' ) ; $ campaigns = $ this -> campaignMenuService -> getActiveCampaigns ( ) ; if ( empty ( $ view -> getExposedInput ( ) ) && ! empty ( $ campaigns ) ) { $ defaultCampaign = current ( $ campaigns ) ; $ view -> setExposedInput ( [ 'campaign' => $ defaultCampaign -> id ( ) ] ) ; } $ build = [ 'link' => [ '#type' => 'link' , '#title' => $ this -> t ( 'Registration Portal >>>' ) , '#url' => Url :: fromRoute ( 'openy_campaign.member-registration-portal' ) , '#attributes' => [ 'class' => [ 'align-right' , ] , ] , '#prefix' => '<div class="row">' , '#suffix' => '</div>' , ] , 'view' => $ view -> render ( ) , ] ; return $ build ; }
Render view block to show all members table.

@return array Render array
Render view block to show all members table .