-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Swissup\Core\Block\Adminhtml\Config\Form\Field; | ||
|
||
use Magento\Framework\App\ObjectManager; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Theme\Model\ResourceModel\Theme\Collection; | ||
|
||
class VirtualCheck extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
|
||
protected $_template = 'config/field/virtual_check.phtml'; | ||
|
||
public function render(AbstractElement $element) | ||
{ | ||
$this->assign('configElement', $element); | ||
$html = $this->toHtml(); | ||
return $this->_decorateRowHtml($element, "<td class='themes-table' colspan=\"3\">$html</td>"); | ||
} | ||
|
||
public function getVirtualThemes() | ||
{ | ||
return ObjectManager::getInstance()->create(Collection::class) | ||
->addFieldToFilter('type', 1); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Swissup\Core\Model\ResourceModel; | ||
|
||
use Magento\Framework\Model\ResourceModel\Db\AbstractDb; | ||
|
||
class VirtualCheck extends AbstractDb | ||
{ | ||
/** | ||
* Model initialization | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_init('theme', 'theme_title'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Swissup\Core\Model\ResourceModel\VirtualCheck; | ||
|
||
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; | ||
|
||
class Collection extends AbstractCollection | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_idFieldName = 'theme_id'; | ||
|
||
/** | ||
* Define resource model | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_init( | ||
\Swissup\Core\Model\VirtualCheck::class, | ||
\Swissup\Core\Model\ResourceModel\VirtualCheck::class | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<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; } | ||
|
||
#row_swissup_core_troubleshooting_virtualcheck .themes-table td.virtual::before { | ||
display:inline-block; | ||
content: ''; | ||
width: 15px; | ||
height: 15px; | ||
background-color: red; | ||
border-radius: 50%; | ||
margin-right: 10px; | ||
vertical-align: middle; | ||
} | ||
|
||
</style> | ||
|
||
|
||
|
||
<h4>Virtual Theme Check</h4> | ||
|
||
<?php | ||
if ($block->getVirtualThemes()): ?> | ||
<p style="color: green;">No virtual themes found. Check: passed!</p> | ||
<?php else: ?> | ||
<table> | ||
<tbody> | ||
<?php foreach ($block->getVirtualThemes() as $theme): ?> | ||
<tr> | ||
<td scope="row"><?php echo $theme->getThemeTitle(); ?></th> | ||
<td class="virtual">Virtual</th> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> | ||
<?php endif; ?> |