class Ajax

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Render/Element/Ajax.php \Drupal\Core\Render\Element\Ajax
  2. 8.9.x core/lib/Drupal/Core/Render/Element/Ajax.php \Drupal\Core\Render\Element\Ajax
  3. 11.x core/lib/Drupal/Core/Render/Element/Ajax.php \Drupal\Core\Render\Element\Ajax

Provides a render element for adding Ajax to a render element.

Holds an array whose values control the Ajax behavior of the element.

Attributes

#[RenderElement('ajax')]

Hierarchy

Expanded class hierarchy of Ajax

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Return an \Drupal\Core\Ajax\AjaxResponse instead.

See also

https://www.drupal.org/node/3068104

Related topics

15 string references to 'Ajax'
AjaxRenderer::renderResponse in core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php
Renders the main content render array into a response.
DisplayPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Provide a form to edit options for this plugin.
EntitySerializationTest::testSerialize in core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php
Tests entity serialization for core's formats by a registered Serializer.
ExposedFormPluginBase::renderExposedForm in core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
Renders the exposed form.
FormBuilderTest::testGetAjaxRequest in core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@covers ::buildForm[[api-linebreak]]

... See full list

File

core/lib/Drupal/Core/Render/Element/Ajax.php, line 19

Namespace

Drupal\Core\Render\Element
View source
class Ajax extends RenderElementBase {
  
  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    @trigger_error('\\Drupal\\Core\\Render\\Element\\Ajax is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Return an \\Drupal\\Core\\Ajax\\AjaxResponse instead. See https://www.drupal.org/node/3068104', E_USER_DEPRECATED);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    // By default, we don't want Ajax commands being rendered in the context of
    // an HTML page, so we don't provide defaults for #theme or #theme_wrappers.
    // However, modules can set these properties (for example, to provide an
    // HTML debugging page that displays rather than executes Ajax commands).
    return [
      '#header' => TRUE,
      '#commands' => [],
      '#error' => NULL,
    ];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Ajax::getInfo public function Returns the element properties for this element. Overrides ElementInterface::getInfo
Ajax::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function #[\ReturnTypeWillChange] 2
MessengerTrait::$messenger protected property The messenger. 25
MessengerTrait::messenger public function Gets the messenger. 25
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin ID.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin ID of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
RenderElementBase::preRenderAjaxForm public static function Adds Ajax information about an element to communicate with JavaScript. 2
RenderElementBase::preRenderGroup public static function Adds members of this group as actual elements for rendering. 2
RenderElementBase::processAjaxForm public static function Form element processing handler for the #ajax form property. 3
RenderElementBase::processGroup public static function Arranges elements into groups. 2
RenderElementBase::setAttributes public static function Sets a form element's class attribute. Overrides ElementInterface::setAttributes 2
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

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