Problem/Motivation

#2326891: Convert system_element_info() to Element classes converted half of ajax.inc, but left the other behind for some reason.

Proposed resolution

Move the remaining function to RenderElement where it belongs, and move the @defgroup to core.api.php

Remaining tasks

User interface changes

None

API changes

ajax_process_form() removed
ajax_pre_render_element() removed

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Assigned: larowlan » Unassigned
Status: Active » Needs review
FileSize
35.68 KB

Turns out we didn't have support for #process callbacks as services, so added it whilst I was at it.

jibran’s picture

  1. +++ b/core/lib/Drupal/Core/Ajax/AjaxFormProcessor.php
    @@ -0,0 +1,208 @@
    +namespace Drupal\Core\Ajax;
    +use Drupal\Core\Form\FormStateInterface;
    

    missing space.

  2. +++ b/core/lib/Drupal/Core/Ajax/AjaxFormProcessor.php
    @@ -0,0 +1,208 @@
    +      // @todo Legacy support. Remove in Drupal 8.
    

    When?

kim.pepper’s picture

+++ b/core/lib/Drupal/Core/Ajax/AjaxFormProcessor.php
@@ -0,0 +1,208 @@
+class AjaxFormProcessor {

Can we have an interface for this service?

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Ajax/AjaxFormProcessor.php
    @@ -0,0 +1,208 @@
    +   *   - #ajax['event']
    +   *   - #ajax['prevent']
    +   *   - #ajax['path']
    +   *   - #ajax['options']
    +   *   - #ajax['wrapper']
    +   *   - #ajax['parameters']
    +   *   - #ajax['effect']
    +   *   - #ajax['accepts']
    

    We could point to @group ajax and its excellent documentation at the beginning of ajax.inc

  2. +++ b/core/lib/Drupal/Core/Form/FormBuilder.php
    @@ -116,12 +124,13 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS
    +   * @param \Drupal\
    

    One \Drupal to include them all

  3. +++ b/core/lib/Drupal/Core/Form/FormBuilder.php
    @@ -753,7 +763,17 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state
    +        if (is_string($process) && strpos($process, '::') === FALSE) {
    +          $callable = $this->controllerResolver->getControllerFromDefinition($process);
    +        }
    +        else {
    +          $callable = $process;
    +        }
    

    Can't the controller resolver handle that automatically internally?

dawehner’s picture

Status: Needs review » Needs work

.

Xano’s picture

Instead of using ControllerResolver, we should probably use #2320491: Add a callable resolver.

tim.plunkett’s picture

Title: Convert ajax.inc to a service » Remove ajax.inc
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -JavaScript
Parent issue: » #2311393: Remove hook_element_info() and all references to it

Updated the issue summary now that we have #2311393: Remove hook_element_info() and all references to it

tim.plunkett’s picture

FileSize
34.31 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

Wim Leers’s picture

OMG OMG OMG OMG AWESOME! At last :) Bye bye, ajax.inc!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

This should have a change record or be attached to an existing one.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs change record

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 2319487-ajax-8.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
34.31 KB

Conflicted with #2329703: [meta] Spellchecking Drupal, of all things.

Wim Leers’s picture

#15: ROFL :D

star-szr’s picture

FileSize
35.26 KB
964 bytes

Found a reference to ajax_process_form(), didn't fully re-wrap the docblock, I wanted a minimal diff. Still RTBC, just a minor docs update.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

Nice one to see green.

  • catch committed 669ba7b on 8.0.x
    Issue #2319487 by tim.plunkett, Cottser, larowlan: Remove ajax.inc.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

publish change record