Skip to content

Commit

Permalink
Virtual theme: visual fix all button added
Browse files Browse the repository at this point in the history
  • Loading branch information
rommmka committed Dec 29, 2022
1 parent fa72d61 commit 2927db7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
25 changes: 25 additions & 0 deletions Block/Adminhtml/Config/Form/Field/FixAll.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
namespace Swissup\Core\Block\Adminhtml\Config\Form\Field;

use Magento\Framework\Data\Form\Element\AbstractElement;

class FixAll extends \Magento\Config\Block\System\Config\Form\Field
{

public function render(AbstractElement $element)
{
$buttonText = __("Fix All");
return <<<HTML
<tr>
<td colspan="100">
<div class="button-container">
<button id="fix-all-themes" class="button action-configure" type="button"><span>$buttonText</span></button>
</div>
<script type="text/javascript">
</script>
</td>
</tr>
HTML;
}
}
4 changes: 4 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<label>Preview</label>
<frontend_model>Swissup\Core\Block\Adminhtml\Config\Form\Field\VirtualCheck</frontend_model>
</field>
<field id="fix_all" translate="label" type="text" sortOrder="265" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Fix All</label>
<frontend_model>Swissup\Core\Block\Adminhtml\Config\Form\Field\FixAll</frontend_model>
</field>
</group>

</section>
Expand Down
12 changes: 7 additions & 5 deletions view/adminhtml/templates/config/field/virtual_check.phtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<style>
#row_swissup_core_troubleshooting_virtualcheck .themes-table h4 {padding-left: 0}
#row_swissup_core_troubleshooting_virtualcheck .themes-table table {max-width: 500px}
#row_swissup_core_troubleshooting_virtualcheck .themes-table td { text-align-last: left; }
#row_swissup_core_troubleshooting_virtualcheck .themes-table th { text-align-last: left; }
#swissup_core_troubleshooting .button-container { margin-top: 20px; }

#row_swissup_core_troubleshooting_virtualcheck .themes-table td.virtual::before {
#swissup_core_troubleshooting .themes-table h4 {padding-left: 0}
#swissup_core_troubleshooting .themes-table table {max-width: 500px}
#swissup_core_troubleshooting .themes-table td { text-align-last: left; }
#swissup_core_troubleshooting .themes-table th { text-align-last: left; }
#swissup_core_troubleshooting .themes-table td.virtual::before {
display:inline-block;
content: '';
width: 15px;
Expand Down Expand Up @@ -35,4 +36,5 @@ if (!$block->getVirtualThemes()->getSize()): ?>
<?php endforeach; ?>
</tbody>
</table>

<?php endif; ?>

0 comments on commit 2927db7

Please sign in to comment.