public function Select2Test::providerTestPreRenderSelect in Select 2 8
Data provider for testPreRenderSelect().
File
- tests/
src/ Unit/ Element/ Select2Test.php, line 89
Class
- Select2Test
- @coversDefaultClass \Drupal\select2\Element\Select2 @group select2
Namespace
Drupal\Tests\select2\Unit\ElementCode
public function providerTestPreRenderSelect() {
$data = [];
$data[] = [
TRUE,
TRUE,
[],
[
'multiple' => 'multiple',
'name' => 'field_foo[]',
'data-select2-config' => Json::encode([
'multiple' => TRUE,
'placeholder' => [
'id' => '',
'text' => '',
],
'allowClear' => FALSE,
'dir' => 'rtl',
'language' => 'en',
'tags' => FALSE,
'theme' => 'seven',
'maximumSelectionLength' => 0,
'tokenSeparators' => [],
'selectOnClose' => FALSE,
'width' => '100%',
]),
],
];
$data[] = [
FALSE,
TRUE,
[],
[
'name' => 'field_foo',
'data-select2-config' => Json::encode([
'multiple' => FALSE,
'placeholder' => [
'id' => '',
'text' => '',
],
'allowClear' => FALSE,
'dir' => 'rtl',
'language' => 'en',
'tags' => FALSE,
'theme' => 'seven',
'maximumSelectionLength' => 0,
'tokenSeparators' => [],
'selectOnClose' => FALSE,
'width' => '100%',
]),
],
];
$data[] = [
TRUE,
FALSE,
[],
[
'multiple' => 'multiple',
'name' => 'field_foo[]',
'data-select2-config' => Json::encode([
'multiple' => TRUE,
'placeholder' => [
'id' => '',
'text' => '',
],
'allowClear' => FALSE,
'dir' => 'rtl',
'language' => 'en',
'tags' => FALSE,
'theme' => 'seven',
'maximumSelectionLength' => 0,
'tokenSeparators' => [],
'selectOnClose' => FALSE,
'width' => '100%',
]),
],
];
$data[] = [
FALSE,
FALSE,
[],
[
'name' => 'field_foo',
'data-select2-config' => Json::encode([
'multiple' => FALSE,
'placeholder' => [
'id' => '',
'text' => '',
],
'allowClear' => TRUE,
'dir' => 'rtl',
'language' => 'en',
'tags' => FALSE,
'theme' => 'seven',
'maximumSelectionLength' => 0,
'tokenSeparators' => [],
'selectOnClose' => FALSE,
'width' => '100%',
]),
],
];
// Test overwriting of the default setting.
$data[] = [
FALSE,
FALSE,
[
'allowClear' => FALSE,
'multiple' => TRUE,
],
[
'name' => 'field_foo',
'data-select2-config' => Json::encode([
'multiple' => TRUE,
'placeholder' => [
'id' => '',
'text' => '',
],
'allowClear' => FALSE,
'dir' => 'rtl',
'language' => 'en',
'tags' => FALSE,
'theme' => 'seven',
'maximumSelectionLength' => 0,
'tokenSeparators' => [],
'selectOnClose' => FALSE,
'width' => '100%',
]),
],
];
return $data;
}