Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
store.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 
11 <?php if ($websites = $block->getWebsites()): ?>
12 <div class="field field-store-switcher">
13  <label class="label" for="store_switcher"><?= $block->escapeHtml(__('Choose Store View:')) ?></label>
14  <div class="control">
15  <select
16  id="store_switcher"
17  class="admin__control-select"
18  name="store_switcher">
19  <?php foreach ($websites as $website): ?>
20  <?php $showWebsite = false; ?>
21  <?php foreach ($website->getGroups() as $group): ?>
22  <?php $showGroup = false; ?>
23  <?php foreach ($block->getStores($group) as $store): ?>
24  <?php if ($showWebsite == false): ?>
25  <?php $showWebsite = true; ?>
26  <optgroup label="<?= $block->escapeHtmlAttr($website->getName()) ?>"></optgroup>
27  <?php endif; ?>
28  <?php if ($showGroup == false): ?>
29  <?php $showGroup = true; ?>
30  <optgroup label="&nbsp;&nbsp;&nbsp;<?= $block->escapeHtmlAttr($group->getName()) ?>">
31  <?php endif; ?>
32  <option value="<?= $block->escapeHtmlAttr($store->getId()) ?>"<?php if ($block->getStoreId() == $store->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?= $block->escapeHtml($store->getName()) ?></option>
33  <?php endforeach; ?>
34  <?php if ($showGroup): ?>
35  </optgroup>
36  <?php endif; ?>
37  <?php endforeach; ?>
38  <?php endforeach; ?>
39  </select>
40  </div>
41  <?= $block->getHintHtml() ?>
42 </div>
43 <script>
44 require(['prototype'], function(){
45 
46 //<![CDATA[
47 Event.observe($('store_switcher'), 'change', function(event) {
48  var element = Event.element(event);
49  $('preview_store_id').value = element.value;
50 });
51 //]]>
52 
53 });
54 </script>
55 <?php endif; ?>
if( $websites=$block->getWebsites())(__( 'Choose Store View:')) ?></label >< div class $showWebsite
Definition: store.phtml:20
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
$group
Definition: sections.phtml:16
__()
Definition: __.php:13
if($block->getStoreId()==$store->getId()) endforeach
Definition: store.phtml:32
$block
Definition: block.php:8
foreach($website->getGroups() as $group) foreach( $block->getStores( $group) as $store)($showWebsite==false) endif
Definition: store.phtml:26
$_count $_index $_prevOptionId if($block->getOrderOptions()|| $_item->getDescription()) foreach( $items as $_item)( $_item) ?><?php $attributes if( $_item->getOrderItem() ->getParentItem())($_prevOptionId !=$attributes['option_id'])</td >< td > & nbsp
Definition: renderer.phtml:33