Verified Commit d1c993ac 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
parent b73c68de
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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 {

  /**
+27 −0
Original line number Diff line number Diff line
<?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 {
}
+29 −0
Original line number Diff line number Diff line
<?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 {
}
Loading