You are here

public function ExtraFieldDisplayManagerTest::fieldInfoProvider in Extra Field 8

Data provider for testFieldInfo.

Return value

array Data structure:

  • definitions
  • bundles
  • results

File

tests/src/Kernel/ExtraFieldDisplayManagerTest.php, line 109

Class

ExtraFieldDisplayManagerTest
@coversDefaultClass \Drupal\extra_field\Plugin\ExtraFieldDisplayManager

Namespace

Drupal\Tests\extra_field\Kernel

Code

public function fieldInfoProvider() {
  $info[] = [
    // Definitions.
    [
      'test' => [
        'id' => 'test',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display node article',
        'weight' => 0,
        'visible' => FALSE,
      ],
    ],
    // Bundles.
    [],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test' => [
              'label' => 'test display node article',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
    ],
  ];
  $info[] = [
    // Definitions.
    [
      'test' => [
        'id' => 'test',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display node article',
        'weight' => 88,
        'visible' => TRUE,
      ],
    ],
    // Bundles.
    [],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test' => [
              'label' => 'test display node article',
              'weight' => 88,
              'visible' => TRUE,
            ],
          ],
        ],
      ],
    ],
  ];
  $info[] = [
    // Definitions.
    [
      'test1' => [
        'id' => 'test1',
        'bundles' => [
          'node.*',
          'come.*',
        ],
        'label' => 'test display 1',
        'weight' => 0,
        'visible' => FALSE,
      ],
      'test2' => [
        'id' => 'test2',
        'bundles' => [
          'node.article',
        ],
        'label' => 'test display 2',
        'weight' => 2,
        'visible' => TRUE,
      ],
    ],
    // Bundles.
    [
      [
        'node',
        [
          'article',
          'story',
          'blog',
        ],
      ],
      [
        'come',
        [
          'rain',
          'shine',
        ],
      ],
    ],
    // Results.
    [
      'node' => [
        'article' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
            'extra_field_test2' => [
              'label' => 'test display 2',
              'weight' => 2,
              'visible' => TRUE,
            ],
          ],
        ],
        'story' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
        'blog' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
      'come' => [
        'rain' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
        'shine' => [
          'display' => [
            'extra_field_test1' => [
              'label' => 'test display 1',
              'weight' => 0,
              'visible' => FALSE,
            ],
          ],
        ],
      ],
    ],
  ];
  return $info;
}