forked from drupalcommerce/commerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommerce.pages.inc
34 lines (29 loc) · 968 Bytes
/
commerce.pages.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @file
* Callbacks for store add pages.
*/
use Drupal\Component\Utility\Xss;
use Drupal\Core\Url;
/**
* Prepares variables for list of available store type templates.
*
* Default template: commerce-store-add-list.html.twig.
*
* @param array $variables
* An associative array containing:
* - content: An array of store types.
*/
function template_preprocess_commerce_store_add_list(&$variables) {
$variables['types'] = array();
if (!empty($variables['content'])) {
foreach ($variables['content'] as $commerce_store_type) {
$url = Url::fromRoute('entity.commerce_store.add_form', array('commerce_store_type' => $commerce_store_type->id()));
$variables['types'][$commerce_store_type->id()] = array(
'type' => $commerce_store_type->id(),
'add_link' => \Drupal::l($commerce_store_type->label(), $url),
'description' => Xss::filterAdmin($commerce_store_type->getDescription()),
);
}
}
}