Commit 95877652 authored by Florent Torregrosa's avatar Florent Torregrosa Committed by Florent Torregrosa
Browse files

Issue #3044732 by Grimreaper, borgenk: Fix pagination.

parent af18bf39
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -427,28 +427,28 @@ class PullForm extends FormBase {
      '#type' => 'actions',
      '#weight' => -10,
    ];
    if (isset($json['links']['first'])) {
    if (isset($json['links']['first']['href'])) {
      $form['channel_wrapper']['entities_wrapper']['pager']['first'] = [
        '#type' => 'submit',
        '#value' => $this->t('First'),
        '#submit' => ['::firstPage'],
      ];
    }
    if (isset($json['links']['prev'])) {
    if (isset($json['links']['prev']['href'])) {
      $form['channel_wrapper']['entities_wrapper']['pager']['prev'] = [
        '#type' => 'submit',
        '#value' => $this->t('Previous'),
        '#submit' => ['::prevPage'],
      ];
    }
    if (isset($json['links']['next'])) {
    if (isset($json['links']['next']['href'])) {
      $form['channel_wrapper']['entities_wrapper']['pager']['next'] = [
        '#type' => 'submit',
        '#value' => $this->t('Next'),
        '#submit' => ['::nextPage'],
      ];
    }
    if (isset($json['links']['last'])) {
    if (isset($json['links']['last']['href'])) {
      $form['channel_wrapper']['entities_wrapper']['pager']['last'] = [
        '#type' => 'submit',
        '#value' => $this->t('Last'),
@@ -555,11 +555,11 @@ class PullForm extends FormBase {
   */
  protected function pagerRedirect(FormStateInterface $form_state, $link_name) {
    $storage = $form_state->getStorage();
    if (isset($storage['links'][$link_name])) {
    if (isset($storage['links'][$link_name]['href'])) {
      $selected_remote = $form_state->getValue('remote');
      $selected_channel = $form_state->getValue('channel');

      $parsed_url = UrlHelper::parse($storage['links'][$link_name]);
      $parsed_url = UrlHelper::parse($storage['links'][$link_name]['href']);
      if (isset($parsed_url['query']['page']) && isset($parsed_url['query']['page']['offset'])) {
        $form_state->setRedirect('entity_share_client.admin_content_pull_form', [], [
          'query' => [
+4 −4
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ class EntityShareClientCliService {

      $io->text($t('@number entities have been imported.', ['@number' => count($imported_entities)]));

      if (isset($json['links']['next'])) {
        $channel_url = $json['links']['next'];
      if (isset($json['links']['next']['href'])) {
        $channel_url = $json['links']['next']['href'];
      }
      else {
        $channel_url = FALSE;
@@ -230,8 +230,8 @@ class EntityShareClientCliService {
        $update_count += count($imported_entities);
      }

      if (isset($revisions_json['links']['next'])) {
        $channel_url = $revisions_json['links']['next'];
      if (isset($revisions_json['links']['next']['href'])) {
        $channel_url = $revisions_json['links']['next']['href'];
      }
      else {
        $channel_url = FALSE;
+2 −2
Original line number Diff line number Diff line
@@ -231,8 +231,8 @@ class JsonapiHelper implements JsonapiHelperInterface {
          $field_values = [];

          // Check that the field has data.
          if ($field_data['data'] != NULL && isset($field_data['links']) && isset($field_data['links']['related'])) {
            $referenced_entities_response = $this->getHttpClient()->get($field_data['links']['related'])
          if ($field_data['data'] != NULL && isset($field_data['links']['related']['href'])) {
            $referenced_entities_response = $this->getHttpClient()->get($field_data['links']['related']['href'])
              ->getBody()
              ->getContents();
            $referenced_entities_json = Json::decode($referenced_entities_response);
+2 −2
Original line number Diff line number Diff line
@@ -58,8 +58,8 @@ function entity_share_client_test_cron() {
            ]);
          }

          if (isset($json['links']['next'])) {
            $url_uuid = $json['links']['next'];
          if (isset($json['links']['next']['href'])) {
            $url_uuid = $json['links']['next']['href'];
          }
          else {
            $url_uuid = FALSE;