Skip to content
Snippets Groups Projects
Verified Commit f6a07d86 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3421439 by godotislate, sorlov, quietone, smustgrave, alexpott,...

Issue #3421439 by godotislate, sorlov, quietone, smustgrave, alexpott, larowlan, longwave, andypost: Convert form and render element plugin discovery to attributes

(cherry picked from commit d1c993ac)
parent 4869fb9a
No related branches found
No related tags found
24 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #130320 passed
Showing
with 119 additions and 47 deletions
......@@ -7,14 +7,14 @@
use Drupal\Core\Datetime\DateHelper;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Security\DoTrustedCallbackTrait;
use Drupal\Core\Security\StaticTrustedCallbackHelper;
/**
* Provides a datelist element.
*
* @FormElement("datelist")
*/
#[FormElement('datelist')]
class Datelist extends DateElementBase {
use DoTrustedCallbackTrait;
......
......@@ -7,14 +7,14 @@
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Security\DoTrustedCallbackTrait;
use Drupal\Core\Security\StaticTrustedCallbackHelper;
/**
* Provides a datetime element.
*
* @FormElement("datetime")
*/
#[FormElement('datetime')]
class Datetime extends DateElementBase {
use DoTrustedCallbackTrait;
......
......@@ -8,6 +8,7 @@
use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface;
use Drupal\Core\Entity\EntityReferenceSelection\SelectionWithAutocreateInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element\Textfield;
use Drupal\Core\Site\Settings;
......@@ -62,9 +63,8 @@
* @endcode
*
* @see \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection
*
* @FormElement("entity_autocomplete")
*/
#[FormElement('entity_autocomplete')]
class EntityAutocomplete extends Textfield {
/**
......
<?php
declare(strict_types = 1);
namespace Drupal\Core\Render\Attribute;
/**
* Defines a form element plugin attribute object.
*
* See \Drupal\Core\Render\Element\FormElementInterface for more information
* about form element plugins.
*
* Plugin Namespace: Element
*
* For a working example, see \Drupal\Core\Render\Element\Textfield.
*
* @see \Drupal\Core\Render\ElementInfoManager
* @see \Drupal\Core\Render\Element\FormElementInterface
* @see \Drupal\Core\Render\Element\FormElement
* @see \Drupal\Core\Render\Attribute\RenderElement
* @see plugin_api
*
* @ingroup theme_render
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class FormElement extends RenderElement {
}
<?php
declare(strict_types = 1);
namespace Drupal\Core\Render\Attribute;
use Drupal\Component\Plugin\Attribute\Plugin;
/**
* Defines a Render element plugin attribute object.
*
* See \Drupal\Core\Render\Element\ElementInterface for more information
* about render element plugins.
*
* Plugin Namespace: Element
*
* For a working example, see \Drupal\Core\Render\Element\Link.
*
* @see \Drupal\Core\Render\ElementInfoManager
* @see \Drupal\Core\Render\Element\ElementInterface
* @see \Drupal\Core\Render\Element\RenderElement
* @see \Drupal\Core\Render\Attribute\FormElement
* @see plugin_api
*
* @ingroup theme_render
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class RenderElement extends Plugin {
}
......@@ -3,6 +3,7 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\Element;
......@@ -21,9 +22,8 @@
* '#value' => $this->t('Save'),
* );
* @endcode
*
* @RenderElement("actions")
*/
#[RenderElement('actions')]
class Actions extends Container {
/**
......
......@@ -2,6 +2,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
/**
* Provides a render element for adding Ajax to a render element.
*
......@@ -9,14 +12,13 @@
*
* @ingroup ajax
*
* @RenderElement("ajax")
*
* @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
*/
class Ajax extends RenderElement {
#[RenderElement('ajax')]
class Ajax extends RenderElementBase {
/**
* {@inheritdoc}
......
......@@ -3,7 +3,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides an action button form element.
......@@ -27,10 +29,9 @@
* @endcode
*
* @see \Drupal\Core\Render\Element\Submit
*
* @FormElement("button")
*/
class Button extends FormElement {
#[FormElement('button')]
class Button extends FormElementBase {
/**
* {@inheritdoc}
......
......@@ -3,7 +3,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides a form element for a single checkbox.
......@@ -20,10 +22,9 @@
* @endcode
*
* @see \Drupal\Core\Render\Element\Checkboxes
*
* @FormElement("checkbox")
*/
class Checkbox extends FormElement {
#[FormElement('checkbox')]
class Checkbox extends FormElementBase {
/**
* {@inheritdoc}
......
......@@ -3,6 +3,8 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides a form element for a set of checkboxes.
......@@ -31,10 +33,9 @@
*
* @see \Drupal\Core\Render\Element\Radios
* @see \Drupal\Core\Render\Element\Checkbox
*
* @FormElement("checkboxes")
*/
class Checkboxes extends FormElement {
#[FormElement('checkboxes')]
class Checkboxes extends FormElementBase {
use CompositeFormElementTrait;
......
......@@ -3,7 +3,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
use Drupal\Component\Utility\Color as ColorUtility;
/**
......@@ -20,10 +22,9 @@
* '#default_value' => '#ffffff',
* );
* @endcode
*
* @FormElement("color")
*/
class Color extends FormElement {
#[FormElement('color')]
class Color extends FormElementBase {
/**
* {@inheritdoc}
......
......@@ -4,7 +4,9 @@
use Drupal\Component\Utility\Html as HtmlUtility;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
/**
* Provides a render element that wraps child elements in a container.
......@@ -40,10 +42,9 @@
* '#title' => $this->t('Dietary Restrictions'),
* ];
* @endcode
*
* @RenderElement("container")
*/
class Container extends RenderElement {
#[RenderElement('container')]
class Container extends RenderElementBase {
/**
* {@inheritdoc}
......
......@@ -2,7 +2,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides a form element for date selection.
......@@ -18,10 +20,9 @@
* '#default_value' => '2020-02-05',
* ];
* @endcode
*
* @FormElement("date")
*/
class Date extends FormElement {
#[FormElement('date')]
class Date extends FormElementBase {
/**
* {@inheritdoc}
......
......@@ -2,7 +2,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
/**
* Provides a render element for a details element, similar to a fieldset.
......@@ -33,10 +35,9 @@
*
* @see \Drupal\Core\Render\Element\Fieldset
* @see \Drupal]Core\Render\Element\VerticalTabs
*
* @RenderElement("details")
*/
class Details extends RenderElement {
#[RenderElement('details')]
class Details extends RenderElementBase {
/**
* {@inheritdoc}
......
......@@ -2,6 +2,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
/**
* Provides a render element for a set of links rendered as a drop-down button.
*
......@@ -39,10 +42,9 @@
* @endcode
*
* @see \Drupal\Core\Render\Element\Operations
*
* @RenderElement("dropbutton")
*/
class Dropbutton extends RenderElement {
#[RenderElement('dropbutton')]
class Dropbutton extends RenderElementBase {
/**
* {@inheritdoc}
......
......@@ -21,7 +21,7 @@
* render elements process raw user input.
*
* @see \Drupal\Core\Render\ElementInfoManager
* @see \Drupal\Core\Render\Annotation\RenderElement
* @see \Drupal\Core\Render\Attribute\RenderElement
* @see \Drupal\Core\Render\Element\RenderElement
* @see plugin_api
*
......
......@@ -3,7 +3,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides a form input element for entering an email address.
......@@ -23,10 +25,9 @@
* @endcode
*
* @see \Drupal\Core\Render\Element\Textfield
*
* @FormElement("email")
*/
class Email extends FormElement {
#[FormElement('email')]
class Email extends FormElementBase {
/**
* Defines the max length for an email address.
......
......@@ -2,6 +2,8 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\RenderElement;
/**
* Provides a render element for a group of form elements.
*
......@@ -13,9 +15,8 @@
*
* @see \Drupal\Core\Render\Element\Fieldset
* @see \Drupal\Core\Render\Element\Details
*
* @RenderElement("fieldgroup")
*/
#[RenderElement('fieldgroup')]
class Fieldgroup extends Fieldset {
public function getInfo() {
......
......@@ -2,6 +2,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
/**
* Provides a render element for a group of form elements.
*
......@@ -20,10 +23,9 @@
*
* @see \Drupal\Core\Render\Element\Fieldgroup
* @see \Drupal\Core\Render\Element\Details
*
* @RenderElement("fieldset")
*/
class Fieldset extends RenderElement {
#[RenderElement('fieldset')]
class Fieldset extends RenderElementBase {
/**
* {@inheritdoc}
......
......@@ -3,7 +3,9 @@
namespace Drupal\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement as FormElementBase;
/**
* Provides a form element for uploading a file.
......@@ -18,10 +20,9 @@
* The value of this form element will always be an array of
* \Symfony\Component\HttpFoundation\File\UploadedFile objects, regardless of
* whether #multiple is TRUE or FALSE
*
* @FormElement("file")
*/
class File extends FormElement {
#[FormElement('file')]
class File extends FormElementBase {
/**
* {@inheritdoc}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment