class ViewsTestDataController

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/src/Controller/ViewsTestDataController.php \Drupal\views_test_data\Controller\ViewsTestDataController
  2. 8.9.x core/modules/views/tests/modules/views_test_data/src/Controller/ViewsTestDataController.php \Drupal\views_test_data\Controller\ViewsTestDataController
  3. 10 core/modules/views/tests/modules/views_test_data/src/Controller/ViewsTestDataController.php \Drupal\views_test_data\Controller\ViewsTestDataController

Controller class for views_test_data callbacks.

Hierarchy

Expanded class hierarchy of ViewsTestDataController

File

core/modules/views/tests/modules/views_test_data/src/Controller/ViewsTestDataController.php, line 10

Namespace

Drupal\views_test_data\Controller
View source
class ViewsTestDataController implements TrustedCallbackInterface {
    
    /**
     * Renders an error form page.
     *
     * This contains a form that will contain an error and an embedded view with
     * an exposed form.
     */
    public function errorFormPage() {
        $build = [];
        $build['view'] = [
            '#type' => 'view',
            '#name' => 'test_exposed_form_buttons',
        ];
        $build['error_form'] = \Drupal::formBuilder()->getForm('Drupal\\views_test_data\\Form\\ViewsTestDataErrorForm');
        return $build;
    }
    
    /**
     * #lazy_builder callback; for testing purposes only.
     */
    public static function placeholderLazyBuilder() {
        // No-op.
        return [];
    }
    
    /**
     * Tests pre_render function.
     *
     * @param array $element
     *   A render array.
     *
     * @return array
     *   The changed render array.
     */
    public static function preRender($element) {
        $element['#markup'] = '\\Drupal\\views_test_data\\Controller\\ViewsTestDataController::preRender executed';
        return $element;
    }
    
    /**
     * {@inheritdoc}
     */
    public static function trustedCallbacks() {
        return [
            'placeholderLazyBuilder',
            'preRender',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
ViewsTestDataController::errorFormPage public function Renders an error form page.
ViewsTestDataController::placeholderLazyBuilder public static function #lazy_builder callback; for testing purposes only.
ViewsTestDataController::preRender public static function Tests pre_render function.
ViewsTestDataController::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks

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