Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NetCommons3/Blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
akagane99 committed Aug 26, 2016
2 parents 460122b + 0e23878 commit 0d74e41
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions View/Helper/BlocksHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public function blockTitle($text = '', $titleIcon = null, $options = array()) {
$text = $this->NetCommonsHtml->titleIcon($titleIcon) . ' ' . $text;
}

$text = $this->getBlockStatus(true) . ' ' . $text;

$output .= $this->Html->tag('h1', $text, $options);
return $output;
}
Expand All @@ -86,20 +84,41 @@ public function blockTitle($text = '', $titleIcon = null, $options = array()) {
* @return string HTML
*/
public function getBlockStatus($isSetting = null) {
$html = '';
if (! Current::permission('block_editable')) {
return '';
}

if (! isset($isSetting)) {
$isSetting = Current::isSettingMode();
}

if (! $isSetting || ! Current::read('Block.id')) {
return $html;
return '';
}

$block = Current::read('Block', array());

$publicType = Hash::get($block, 'public_type');
if ($publicType === Block::TYPE_PUBLIC) {
return '';
}

$html = $this->__getBlockStatus();
return $html;
}

/**
* ブロックのステータスラベルを表示
*
* @return string HTML
*/
private function __getBlockStatus() {
$html = '';

$block = Current::read('Block', array());

$publicType = Hash::get($block, 'public_type', false);
if ($publicType === false || $publicType === Block::TYPE_PUBLIC) {
return $html;
}

Expand Down

0 comments on commit 0d74e41

Please sign in to comment.