Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master2 #8

Open
wants to merge 34 commits into
base: 1.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c589b47
Add files via upload
matritix Aug 17, 2018
7b5b9c4
Add files via upload
matritix Aug 17, 2018
8a4e541
Add files via upload
matritix Aug 17, 2018
82f0a53
git push²
matritix Aug 17, 2018
9842609
Update composer.json
matritix Aug 18, 2018
c95b9cc
Update composer.json
matritix Aug 28, 2018
d865a5d
Update composer.json
matritix Aug 28, 2018
75f3f56
Update composer.json
matritix Aug 29, 2018
faff4c5
Update composer.json
matritix Aug 29, 2018
db7df19
Update composer.json
matritix Aug 29, 2018
140ecc3
Update composer.json
matritix Aug 29, 2018
d9066cb
Update composer.json
matritix Aug 29, 2018
1ea9483
Update composer.json
matritix Aug 29, 2018
d404cad
Update composer.json
matritix Aug 29, 2018
dbfcb06
Update composer.json
matritix Aug 29, 2018
a6f178c
Update composer.json
matritix Aug 29, 2018
60fad85
Update composer.json
matritix Aug 29, 2018
20c07dc
Update composer.json
matritix Aug 30, 2018
c587f0c
Update composer.json
matritix Aug 30, 2018
3b7da46
Add files via upload
matritix Jul 30, 2019
15dffc3
Update Block.php
matritix Jul 31, 2019
f5a7b1e
Add files via upload
matritix Jul 31, 2019
c34fe00
Merge pull request #2 from matritix/1.0.1
matritix Jul 31, 2019
a40b19d
Update README.md
tweetyx Oct 10, 2019
e1b0672
update
tweetyx May 9, 2021
b17ba84
Update README.md
tweetyx May 9, 2021
677e9d6
Merge branch 'master' into 1.0.0
matritix May 9, 2021
e2399c1
Merge pull request #5 from tweetyx/1.0.0
matritix May 9, 2021
54cbc23
Delete Plugin/Cms/Block directory
matritix May 9, 2021
38ca401
Delete view/adminhtml/js/form/element directory
matritix May 9, 2021
1f6782f
update
matritix May 9, 2021
0f8c8ef
update
matritix May 9, 2021
c9fa3a5
Update composer.json
matritix May 9, 2021
8327b5c
Add files via upload
matritix May 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 69 additions & 36 deletions Block/Cms/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ protected function _toHtml()
$html = '';
if ($blockId) {
$storeId = $this->_storeManager->getStore()->getId();
/*
*
*
/*
* @var \Magento\Cms\Model\Block $block
*/
$block = $this->_blockFactory->create();
Expand All @@ -47,29 +45,23 @@ protected function _toHtml()
$orderpage = 0;
$htmlContentPass = false;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
if ($serializer = $objectManager->create(\Magento\Framework\Serialize\SerializerInterface::class)) {
$allContent = $serializer->unserialize($block->getMatritixAdvancedform());
} else {
$jsonHelper = $objectManager->get('Magento\Framework\Json\Helper\Data');
$allContent = $jsonHelper->jsonDecode($block->getMatritixAdvancedform());
}
$jsonHelper = $objectManager->get('Magento\Framework\Json\Helper\Data');
$allContent = $jsonHelper->jsonDecode($block->getMatritixAdvancedform());


$allContent = $this->aasort($allContent, "matritix_position");
$allContent = $this->aasort($allContent, "position");

if ($htmlContentPass == false && !$block->getSortOrder()) {
$html .= $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent());
$htmlContentPass = true;
} else {
$orderpage = $block->getSortOrder();
}

/*
var_dump($allContent);
var_dump($orderpage);
exit(); */
}
$matritix_level_sorter = 0;

foreach ($allContent as $singleContent) {
$classesContent = 'class="matritix_block_field"';
$classesContent = '';
$matritix_text = '';
$matritix_textarea = '';
$matritix_image = '';
Expand All @@ -79,9 +71,18 @@ protected function _toHtml()
$matritix_link_href = '';
$matritix_link_text = '';
$matritix_position = 0;
$matritix_tag = '';
$classesContentTag = '';
$matritix_level = 0;

if (isset($singleContent['matritix_level'])) {
$matritix_level = $singleContent['matritix_level'];
}

if (isset($singleContent['matritix_class'])) {
$classesContent = 'class="matritix_block_field '.$singleContent['matritix_class'].'"';
$classesSimple = $singleContent['matritix_class'];
$classesContent = 'class="'.$singleContent['matritix_class'].'"';
$classesContentTag = 'class="tag '.$singleContent['matritix_class'].'"';
}

if (isset($singleContent['matritix_text'])) {
Expand Down Expand Up @@ -116,33 +117,65 @@ protected function _toHtml()
$matritix_link_text = $singleContent['matritix_link_text'];
}

if (isset($singleContent['matritix_position'])) {
$matritix_position = $singleContent['matritix_position'];
if (isset($singleContent['position'])) {
$matritix_position = $singleContent['position'];
}

if ($htmlContentPass == false && $orderpage <= $matritix_position) {
$html .= $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent());
$htmlContentPass = true;
}


for ($i = $matritix_level_sorter; $i < $matritix_level; $i++) {
$levelnumber = $i+1;
$html .= '<div class="level'.$levelnumber.' '.$classesSimple.'">';
}
for ($i = $matritix_level; $i < $matritix_level_sorter; $i++) {
$html .= '</div>';
}

if (isset($singleContent['matritix_tag'])) {
$html .= '<'.$singleContent['matritix_tag'].' '.$classesContentTag.' >';
}
else{
if($singleContent['matritix_selecttype'] == 1 || $singleContent['matritix_selecttype'] ==2){
$html .= '<div '.$classesContent.' >';
}
}

switch ($singleContent['matritix_selecttype']) {
case 0:
$html .= '<div '.$classesContent.' >'.$matritix_text.'</div>';
break;
case 1:
$html .= '<div '.$classesContent.' >'.$matritix_textarea.'</div>';
break;
case 2:
$html .= '<a '.$classesContent.' href="'.$matritix_link_href.'" target="_blank" title="'.$matritix_link_text.'">'.$matritix_link_text.'</a>';
break;
case 3:
$html .= '<img '.$classesContent.' alt="'.$matritix_image_text.'" src="'.$matritix_image.'" />';
break;
case 4:
$html .= '<a '.$classesContent.' href="'.$matritix_file.'" target="_blank" title="'.$matritix_file_text.'">'.$matritix_file_text.'</a>';
break;
case 0:
$html .= $matritix_text;
break;
case 1:
$html .= $matritix_textarea;
break;
case 2:
$html .= '<a '.$classesContent.' href="'.$matritix_link_href.'" target="_blank" title="'.$matritix_link_text.'">'.$matritix_link_text.'</a>';
break;
case 3:
$html .= '<img '.$classesContent.' alt="'.$matritix_image_text.'" src="'.$matritix_image.'" />';
break;
case 4:
$html .= '<a '.$classesContent.' href="'.$matritix_file.'" target="_blank" title="'.$matritix_file_text.'">'.$matritix_file_text.'</a>';
break;
}
if (isset($singleContent['matritix_tag'])) {
$html .= '</'.$singleContent['matritix_tag'].'>';
}
else{
if($singleContent['matritix_selecttype'] == 1 || $singleContent['matritix_selecttype'] ==2){
$html .= '</div>';
}
}


$matritix_level_sorter = $matritix_level;
}//end foreach

for ($i = 0; $i < $matritix_level_sorter; $i++) {
$html .= '</div>';
}

if ($htmlContentPass == false) {
$html .= $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent());
Expand Down
Loading