Skip to content

Instantly share code, notes, and snippets.

@flocondetoile
Created October 18, 2017 22:36
Show Gist options
  • Save flocondetoile/54c7eccf7776759262e548310dd22947 to your computer and use it in GitHub Desktop.
Save flocondetoile/54c7eccf7776759262e548310dd22947 to your computer and use it in GitHub Desktop.
$build['quickview'] = [
'#type' => 'link',
'#url' => Url::fromRoute('mymodule.product_quickview', ['commerce_product' => $entity->id()]),
'#title' => $this->t('Quick view'),
'#attributes' => [
'class' => ['use-ajax', 'button', 'button--small', 'button--check-stock'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'dialogClass' => 'ui-dialog--wide ui-dialog--centered-title ui-dialog--product-stock-levels',
'width' => 1000,
]),
],
];
mymodule.product_quickview:
path: '/product/quick-view/{commerce_product}
defaults:
_entity_view: commerce_product.quickview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment