Commit 9e51e1e7 authored by Pierre Dureau's avatar Pierre Dureau
Browse files

Issue #3535958 by mogtofu33, lauriii, penyaskito, pdureau, kristen pol,...

Issue #3535958 by mogtofu33, lauriii, penyaskito, pdureau, kristen pol, effulgentsia: Allow SDCs to be marked to be excluded from UI
parent 09d0566e
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -177,6 +177,11 @@
        "obsolete"
      ]
    },
    "noUi": {
      "type": "boolean",
      "title": "Exclude from UI",
      "description": "Use this property to exclude a component from the UI."
    },
    "props": {
      "$ref": "#/$defs/propDefinition"
    },
+5 −0
Original line number Diff line number Diff line
@@ -225,6 +225,11 @@
        "obsolete"
      ]
    },
    "noUi": {
      "type": "boolean",
      "title": "Exclude from UI",
      "description": "Use this property to exclude a component from the UI."
    },
    "props": {
      "$ref": "#/$defs/propDefinition"
    },
+6 −0
Original line number Diff line number Diff line
@@ -102,6 +102,11 @@ class ComponentMetadata {
   */
  public readonly array $variants;

  /**
   * Internal component, hidden in ui.
   */
  public readonly bool $noUi;

  /**
   * ComponentMetadata constructor.
   *
@@ -140,6 +145,7 @@ public function __construct(array $metadata_info, string $app_root, bool $enforc
    $this->schema = $this->parseSchemaInfo($metadata_info);
    $this->slots = $metadata_info['slots'] ?? [];
    $this->variants = $metadata_info['variants'] ?? [];
    $this->noUi = $metadata_info['noUi'] ?? FALSE;
  }

  /**
+10 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ public function testMetadata(array $metadata_info, array $expectations): void {
    $this->assertSame($expectations['status'], $metadata->status);
    $this->assertSame($expectations['thumbnail'], $metadata->getThumbnailPath());
    $this->assertEquals($expectations['props'], $metadata->schema);
    $this->assertEquals($expectations['noUi'] ?? TRUE, $metadata->noUi);
  }

  /**
@@ -62,12 +63,14 @@ public static function dataProviderMetadata(): array {
          'libraryOverrides' => ['dependencies' => ['core/drupal']],
          'group' => 'my-group',
          'description' => 'My description',
          'noUi' => TRUE,
        ],
        [
          'path' => 'bar/component-name',
          'status' => 'stable',
          'thumbnail' => '',
          'props' => NULL,
          'noUi' => TRUE,
        ],
        TRUE,
      ],
@@ -81,6 +84,7 @@ public static function dataProviderMetadata(): array {
          'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
          'libraryOverrides' => ['dependencies' => ['core/drupal']],
          'group' => 'my-group',
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -110,6 +114,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -185,6 +190,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -248,6 +254,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -316,6 +323,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -392,6 +400,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],
@@ -467,6 +476,7 @@ public static function dataProviderMetadata(): array {
          'thumbnail' => '',
          'group' => 'my-group',
          'additionalProperties' => FALSE,
          'noUi' => FALSE,
          'props' => [
            'type' => 'object',
            'required' => ['text'],