function ElementTest::providerVisibleChildren

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest::providerVisibleChildren()
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest::providerVisibleChildren()
  3. 11.x core/tests/Drupal/Tests/Core/Render/ElementTest.php \Drupal\Tests\Core\Render\ElementTest::providerVisibleChildren()

Data provider for testVisibleChildren.

Return value

array

File

core/tests/Drupal/Tests/Core/Render/ElementTest.php, line 145

Class

ElementTest
@coversDefaultClass \Drupal\Core\Render\Element @group Render

Namespace

Drupal\Tests\Core\Render

Code

public static function providerVisibleChildren() {
    return [
        [
            [
                '#property1' => '',
                '#property2' => [],
            ],
            [],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
            ],
            [
                'child1',
            ],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#access' => TRUE,
                ],
            ],
            [
                'child1',
                'child2',
            ],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#access' => FALSE,
                ],
            ],
            [
                'child1',
            ],
        ],
        'access_result_object_allowed' => [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#access' => AccessResult::allowed(),
                ],
            ],
            [
                'child1',
                'child2',
            ],
        ],
        'access_result_object_forbidden' => [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#access' => AccessResult::forbidden(),
                ],
            ],
            [
                'child1',
            ],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#type' => 'textfield',
                ],
            ],
            [
                'child1',
                'child2',
            ],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#type' => 'value',
                ],
            ],
            [
                'child1',
            ],
        ],
        [
            [
                '#property1' => '',
                'child1' => [],
                'child2' => [
                    '#type' => 'hidden',
                ],
            ],
            [
                'child1',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.