Describe your bug or feature request.

I've got a requirement where a cart block has to be rendered differently depending on if dropdown is to be displayed or not.
Block config already exists for this, all is required to expose this as a variable on block render.

Code to be updated

Add 'dropdown' variable to theme:

commerce_card.module

/**
 * Implements hook_theme().
 */
function commerce_cart_theme($existing, $type, $theme, $path) {
  return [
    'commerce_cart_block' => [
      'variables' => [
...
        'dropdown' => FALSE,
...
      ],
    ],

Add '#dropdown' and value to render array:
CartBlock.php

return [
...
      '#dropdown' => $this->configuration['dropdown'],
...
    ];
CommentFileSizeAuthor
#4 commerce-cart-drop.png98.06 KBvladimiraus

Issue fork commerce-3440396

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jannakha created an issue. See original summary.

jannakha’s picture

Status: Active » Needs review

MR 246 for review

vladimiraus’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new98.06 KB

Applies and works in both configuration and display.

Commerce cart change

  • jsacksick committed ca5081a0 on 8.x-2.x authored by jannakha
    Issue #3440396: Cart block: Expose "dropdown" block config setting in...

  • jsacksick committed fe78bfdc on 3.0.x authored by jannakha
    Issue #3440396: Cart block: Expose "dropdown" block config setting in...
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed
jannakha’s picture

Status: Fixed » Closed (fixed)

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