diff --git a/content_pager.module b/content_pager.module index af808e3..9ea9ada 100644 --- a/content_pager.module +++ b/content_pager.module @@ -43,7 +43,7 @@ function content_pager_help($route_name, RouteMatchInterface $route_match) { */ function content_pager_preprocess_node(&$variables) { - if($node = \Drupal::routeMatch()->getParameter('node')) { + if($node = \Drupal::routeMatch()->getParameter('node')) { $nid = $node->id(); $node = \Drupal\node\Entity\Node::load($nid); $body = $node->body->value; @@ -59,8 +59,8 @@ function content_pager_preprocess_node(&$variables) { ->loadMultiple(); foreach ($contentTypes as $type) { $typeId = $type->id(); - $paging_separator = \Drupal::config('content_pager.separator') - ->get('content_pager.separator'); + /* $paging_separator = \Drupal::config('content_pager.separator') + ->get('content_pager.separator');*/ $paging_pager_Count = \Drupal::config('content_pager.pagerCount') ->get('content_pager.pagerCount'); $paging_enabled = \Drupal::config('content_pager.enabled_' . $typeId) @@ -84,6 +84,7 @@ function content_pager_preprocess_node(&$variables) { // Setting Node Page Count For Pagination & breaks Count For Automatic paging method (Limit By characters) // Load the global separator. + $paging_separator=''; if (!$paging_separator) { $paging_separator = $paging_separator ?: ''; } diff --git a/src/Form/Pagingform.php b/src/Form/Pagingform.php index 0a657a6..f67dbb5 100644 --- a/src/Form/Pagingform.php +++ b/src/Form/Pagingform.php @@ -34,7 +34,7 @@ class Pagingform extends FormBase { // Paging separator string. // @TODO will need an upgrade path. - $form['paging_general']['paging_separator'] = array( + /*$form['paging_general']['paging_separator'] = array( '#type' => 'textfield', '#title' => t('Page separator string'), '#size' => 20, @@ -43,7 +43,7 @@ class Pagingform extends FormBase { paging is not enabled, such as %pagebreak or %hr.'), '#default_value' => \Drupal::config('content_pager.separator') ->get('content_pager.separator') - ); + );*/ $form['paging_general']['paging_pager_count'] = array( '#type' => 'radios', @@ -148,7 +148,7 @@ class Pagingform extends FormBase { '#type' => 'radios', '#title' => t('Automatic paging method'), '#options' => array( - 'disabled' => t('Disabled'), +// 'disabled' => t('Disabled'), 'chars' => t('Limit by characters (recommended)'), 'words' => t('Limit by words') ), @@ -180,8 +180,31 @@ class Pagingform extends FormBase { '4500' => 4500, '5000' => 5000 ); - $word_len = range(100, 1000, 50); - asort($char_len_options); + asort($char_len_options); + + $word_len = array( + '100' => 100, + '150' => 150, + '200' => 200, + '250' => 250, + '300' => 300, + '350' => 350, + '400' => 400, + '450' => 450, + '500' => 500, + '550' => 550, + '600' => 600, + '650' => 650, + '700' => 700, + '750' => 750, + '800' => 800, + '850' => 850, + '900' => 900, + '950' => 950, + '1000' => 1000, + ); + asort($word_len); + // $word_len = range(100, 1000, 50); // Automatic paging method. Select list to choose the number of characters per page. $form[$content_type]['paging_config']['paging_right']['paging_automatic_chars_' . $content_type] = array( @@ -285,10 +308,10 @@ class Pagingform extends FormBase { foreach ($contentTypes as $type) { $typeId = $type->id(); - $pagingSeparator = \Drupal::service('config.factory') + /* $pagingSeparator = \Drupal::service('config.factory') ->getEditable('content_pager.separator') ->set('content_pager.separator', $form_state->getValue('paging_separator')) - ->save(); + ->save();*/ $pagingPagerCount = \Drupal::service('config.factory') ->getEditable('content_pager.pagerCount') @@ -342,7 +365,28 @@ class Pagingform extends FormBase { } //getting the value of the index for word - $word_len = range(100, 1000, 50); +// $word_len = range(100, 1000, 50); + $word_len = array( + '100' => 100, + '150' => 150, + '200' => 200, + '250' => 250, + '300' => 300, + '350' => 350, + '400' => 400, + '450' => 450, + '500' => 500, + '550' => 550, + '600' => 600, + '650' => 650, + '700' => 700, + '750' => 750, + '800' => 800, + '850' => 850, + '900' => 900, + '950' => 950, + '1000' => 1000, + ); $word_arr = array(); $paging_automatic_word = $form_state->getValue('paging_automatic_words_' . $typeId); foreach ($word_len as $key => $value) {