Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
visual.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
11 $stores = $block->getStoresSortedBySortOrder();
12 ?>
13 <fieldset class="admin__fieldset fieldset">
14  <legend class="legend">
15  <span><?= $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')) ?></span>
16  </legend><br />
17  <div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
18  <table class="data-table clearfix" cellspacing="0">
19  <thead>
20  <tr id="swatch-visual-options-table">
21  <th class="col-draggable"></th>
22  <th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
23  <th><span><?= $block->escapeHtml(__('Swatch')) ?></span></th>
24  <?php foreach ($stores as $_store): ?>
25  <th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>>
26  <span><?= $block->escapeHtml($_store->getName()) ?></span>
27  </th>
28  <?php endforeach;
29  $colTotal = count($stores) * 2 + 3;
30  ?>
31  <th class="col-delete">&nbsp;</th>
32  </tr>
33  </thead>
34  <tbody data-role="swatch-visual-options-container" class="ignore-validate"></tbody>
35  <tfoot>
36  <tr>
37  <th colspan="<?= (int)$colTotal ?>">
38  <input type="hidden" class="required-visual-swatch-entry" name="visual_swatch_validation"/>
39  <input type="hidden" class="required-visual-swatch-unique" name="visual_swatch_validation_unique"/>
40  </th>
41  </tr>
42  <tr>
43  <th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
44  <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
45  <button id="add_new_swatch_visual_option_button"
46  title="<?= $block->escapeHtml(__('Add Swatch')) ?>"
47  type="button" class="action- scalable add">
48  <span><?= $block->escapeHtml(__('Add Swatch')) ?></span>
49  </button>
50  <?php endif; ?>
51  </th>
52  </tr>
53  </tfoot>
54  </table>
55  <input type="hidden" id="swatch-visual-option-count-check" value="" />
56  </div>
57  <script id="swatch-visual-row-template" type="text/x-magento-template">
58  <tr>
59  <td class="col-draggable">
60  <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
61  <div data-role="draggable-handle" class="draggable-handle"
62  title="<?= $block->escapeHtml(__('Sort Option')) ?>"></div>
63  <?php endif; ?>
64  <input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
65  </td>
66  <td class="col-default">
67  <input class="input-radio" type="<%- data.intype %>" name="defaultvisual[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
68  </td>
69  <td class="swatches-visual-col col-default <%- data.empty_class %>">
70  <?php //@todo add logic getting swatch value from db */ ?>
71  <input id="swatch_visual_value_<%- data.id %>" type="hidden" name="swatchvisual[value][<%- data.id %>]" value="<%- data.defaultswatch0 %>" />
72  <div class="swatch_window" id="swatch_window_option_<%- data.id %>" style="<%- data.swatch0 %>"></div>
73  <div class="swatch_sub-menu_container" id="swatch_container_option_<%- data.id %>">
74  <div class="swatch_row position-relative">
75  <div class="swatch_row_name colorpicker_handler">
76  <p><?= $block->escapeHtml(__('Choose a color')) ?></p>
77  </div>
78  </div>
79  <div class="swatch_row">
80  <div class="swatch_row_name btn_choose_file_upload" id="swatch_choose_file_option_<%- data.id %>">
81  <p><?= $block->escapeHtml(__('Upload a file')) ?></p>
82  </div>
83  </div>
84  <div class="swatch_row">
85  <div class="swatch_row_name btn_remove_swatch">
86  <p><?= $block->escapeHtml(__('Clear')) ?></p>
87  </div>
88  </div>
89  </div>
90  </td>
91  <?php foreach ($stores as $_store): ?>
92  <td class="swatch-col-<%- data.id %>">
93  <input name="optionvisual[value][<%- data.id %>][<?= (int)$_store->getId() ?>]"
94  value="<%- data.store<?= (int) $_store->getId() ?> %>"
95  class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>"
96  type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
97  </td>
98  <?php endforeach; ?>
99  <td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
100  <input type="hidden" class="delete-flag" name="optionvisual[delete][<%- data.id %>]" value="" />
101  <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
102  <button title="<?= $block->escapeHtml(__('Delete')) ?>" type="button"
103  class="action- scalable delete delete-option">
104  <span><?= $block->escapeHtml(__('Delete')) ?></span>
105  </button>
106  <?php endif;?>
107  </td>
108  </tr>
109  </script>
110  <script type="text/x-magento-init">
111  {
112  "*": {
113  "Magento_Swatches/js/visual": <?= /* @noEscape */ $block->getJsonConfig() ?> ,
114  "Magento_Catalog/catalog/product/attribute/unique-validate": {
115  "element": "required-visual-swatch-unique",
116  "message": "<?= $block->escapeHtml(__("The value of Admin must be unique.")) ?>"
117  }
118  }
119  }
120  </script>
121 </fieldset>
$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
__()
Definition: __.php:13
foreach( $stores as $_store)($_store->getId()==\Magento\Store\Model\Store::DEFAULT_STORE_ID) endforeach
Definition: visual.phtml:26
$block
Definition: block.php:8
if(! $block->getReadOnly() &&! $block->canManageOptionDefaultOnly())(__( 'Add Swatch')) ?>" type endif
Definition: visual.phtml:44
$_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
$colTotal
Definition: visual.phtml:29
$stores
Definition: visual.phtml:11