Skip to content

Commit

Permalink
phpmdエラー修正
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nakajima committed Aug 24, 2016
1 parent 9b97377 commit 24048d0
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 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,21 +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') ||
! Current::permission('block_editable')) {
return $html;
if (! $isSetting || ! Current::read('Block.id')) {
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 24048d0

Please sign in to comment.