Skip to content
Snippets Groups Projects

Issue #3367477: Compatibility with version 2.x of dependencies and SDC in Core

Issue #3367477: Compatibility with version 2.x of dependencies and SDC in Core

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
127 121 'current_input' => $current_input,
128 122 'form' => $form,
129 123 ]);
130 $element = $this->formGenerator->transform($schema, $context);
124 // @todo investigate why the new components schema is failing in the
125 // validation when using the transform method, doing doTransform directly.
126 $element = $this->formGenerator->doTransform($schema, $context);
  • 89 if (isset($filters_statuses) && is_array($filters_statuses)) {
    90 $statuses = array_keys(array_filter($form_state->getValue(['filters', 'statuses'])));
    91 }
    92
    93 $forbidden = [];
    94 $filters_refine_forbidden = $form_state->getValue(['filters', 'refine', 'forbidden']);
    95 if (isset($filters_refine_forbidden) && is_array($filters_refine_forbidden)) {
    96 $forbidden = array_keys(array_filter($form_state->getValue(['filters', 'refine', 'forbidden'])));
    97 }
    98
    99 $allowed = [];
    100 $filters_refine_allowed = $form_state->getValue(['filters', 'refine', 'allowed']);
    101 if (isset($filters_refine_allowed) && is_array($filters_refine_allowed)) {
    102 $allowed = array_keys(array_filter($form_state->getValue(['filters', 'refine', 'allowed'])));
    103 }
    104
  • 42 $components = $this->componentManager->getFilteredComponentTypes(
    42 $components = $this->componentManager->getFilteredComponents(
    43 43 $settings->get('allowed'),
    44 44 $settings->get('forbidden'),
    45 $settings->get('types'),
    46 45 $settings->get('statuses'),
    47 46 );
    48 47 $this->derivatives = \array_reduce(
    49 48 $components,
    50 49 function (array $carry, Component $component) use ($base_plugin_definition) {
    51 $carry[$component->getId()] = array_merge($base_plugin_definition, [
    52 'admin_label' => $component->getMetadata()->getName(),
    53 'category' => $this->t('CL Components'),
    50 $carry[$component->getPluginId()] = array_merge($base_plugin_definition, [
    51 'admin_label' => $component->metadata->name,
    52 'category' => $this->t('CL Block'),
  • 25 25 * weight = 100,
    26 26 * settings = {
    27 27 * "filters" = {
    28 * "types" = {Drupal\cl_components\Component\ComponentMetadata::COMPONENT_TYPE_ORGANISM},
    29 28 * "statuses" = {
    30 * Drupal\cl_components\Component\ComponentMetadata::COMPONENT_STATUS_READY,
    31 * Drupal\cl_components\Component\ComponentMetadata::COMPONENT_STATUS_BETA,
    29 * Drupal\Core\Extension\ExtensionLifecycle::STABLE,
    • Comment on lines -30 to +29
      Suggested change
      29 * Drupal\Core\Extension\ExtensionLifecycle::STABLE,
      29 * Drupal\Core\Extension\ExtensionLifecycle::STABLE,
      30 * Drupal\Core\Extension\ExtensionLifecycle::EXPERIMENTAL,
    • Please register or sign in to reply
  • 20 20 * @Filter(
    21 21 * id = "cl_block",
    22 22 * title = @Translation("Embed CL Components"),
    23 23 * description = @Translation("Embeds CL Components using data attributes: data-component-id, data-component-variant and data-component-settings. Should usually run as the last filter, since it does not contain user input."),
  • 221 *
    222 * @return array
    223 * The slots as render arrays.
    224 */
    225 private function getSlotsRender($twig_blocks) {
    226 $slots = [];
    227 foreach ($twig_blocks as $id => $config) {
    228 $slots[$id] = [
    229 '#type' => 'processed_text',
    230 '#text' => $config['value'],
    231 '#format' => $config['format'],
    232 ];
    233 }
    234 return $slots;
    235 }
    236
    • Comment on lines +216 to +236
      Suggested change
      216 /**
      217 * Get slot render elements.
      218 *
      219 * @param array $twig_blocks
      220 * The array of twig block.
      221 *
      222 * @return array
      223 * The slots as render arrays.
      224 */
      225 private function getSlotsRender($twig_blocks) {
      226 $slots = [];
      227 foreach ($twig_blocks as $id => $config) {
      228 $slots[$id] = [
      229 '#type' => 'processed_text',
      230 '#text' => $config['value'],
      231 '#format' => $config['format'],
      232 ];
      233 }
      234 return $slots;
      235 }
      236
    • Please register or sign in to reply
  • 120 117 ->token
    121 118 ->replace($data['value'], $token_data, $token_options, $bubbleable_metadata);
    122 119 return [
    123 '#type' => 'cl_component',
    124 '#component' => $component->getId(),
    125 '#variant' => $variant,
    126 '#twig_blocks' => $twig_blocks,
    127 '#context' => $context,
    120 '#type' => 'component',
    121 '#component' => $component->getPluginId(),
    122 '#slots' => $this->getSlotsRender($twig_blocks),
    • Suggested change
      122 '#slots' => $this->getSlotsRender($twig_blocks),
      122 '#slots' => array_map(fn ($twig_block) => [
      123 '#type' => 'processed_text',
      124 '#text' => $twig_block['value'],
      125 '#format' => $twig_block['format'],
      126 ], $twig_blocks),
    • I think it's actually helpful to have separate methods when processing like this needs to happen. Maybe it's a preference thing?

    • Please register or sign in to reply
  • 1 1 cl_block.registry_tab:
    2 2 title: Blocks
    3 description: Configure how blocks are generated from CL Components
    3 description: Configure how blocks are generated from Components
  • Dave Reid
  • 25 25 * label = @Translation("Node")),
    26 26 * "user" = @ContextDefinition("entity:user", required = FALSE,
    27 27 * label = @Translation("User Context"), constraints = { "NotNull" = {} },
    28 28 * ),
    • Comment on lines 23 to 28

      Why does every block have these contexts by default? Shouldn't they be required via plugin definition? It was really odd to see three extra select fields for a component that doesn't require them.

    • Please register or sign in to reply
  • Dave Reid added 1 commit

    added 1 commit

    • 3c9f8517 - Updating for MR review feedback.

    Compare with previous version

  • Please register or sign in to reply
    Loading