ViewDuplicatorTest.php in Views Templates 8
File
tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/ViewDuplicatorTest.php
View source
<?php
namespace Drupal\views_templates_builder_test\Plugin\ViewsTemplateBuilder;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views_templates\Plugin\ViewsDuplicateBuilderBase;
class ViewDuplicatorTest extends ViewsDuplicateBuilderBase {
public function alterViewTemplateAfterCreation(array &$view_template, $options = NULL) {
parent::alterViewTemplateAfterCreation($view_template, $options);
$view_template['display']['default']['display_options']['pager']['options']['items_per_page'] = $options['pager_count'];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$config_form['pager_count'] = [
'#type' => 'textfield',
'#title' => $this
->t('Pager Count'),
'#default_value' => '10',
];
return $config_form;
}
}