class RecursivePlaceholdersTest

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RecursivePlaceholdersTest
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RecursivePlaceholdersTest
  3. 10 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RecursivePlaceholdersTest

Hierarchy

Expanded class hierarchy of RecursivePlaceholdersTest

See also

\Drupal\Tests\Core\Render\RendererPlaceholdersTest::testRecursivePlaceholder()

File

core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php, line 1177

Namespace

Drupal\Tests\Core\Render
View source
class RecursivePlaceholdersTest implements TrustedCallbackInterface {
    
    /**
     * #lazy_builder callback; bubbles another placeholder.
     *
     * @param string $animal
     *   An animal.
     *
     * @return array
     *   A renderable array.
     */
    public static function callback($animal) {
        return [
            'another' => [
                '#create_placeholder' => TRUE,
                '#lazy_builder' => [
                    PlaceholdersTest::class . '::callback',
                    [
                        $animal,
                    ],
                ],
            ],
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public static function trustedCallbacks() {
        return [
            'callback',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
RecursivePlaceholdersTest::callback public static function #lazy_builder callback; bubbles another placeholder.
RecursivePlaceholdersTest::trustedCallbacks public static function Overrides TrustedCallbackInterface::trustedCallbacks
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.

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