Skip to content

Commit

Permalink
Fixing code sniffer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubos Remplik committed Aug 12, 2016
1 parent d460b60 commit 3dc6ad9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/Listener/ViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ protected function _normalizeActions($actions)
$normalized[$config] = [];
}
}


return $normalized;
}

Expand Down Expand Up @@ -553,6 +555,8 @@ protected function _deriveFieldFromContext($field)
protected function _getViewBlocks()
{
$action = $this->_action();


return $action->config('scaffold.viewblocks') ?: [];
}

Expand All @@ -564,6 +568,8 @@ protected function _getViewBlocks()
protected function _getBulkActions()
{
$action = $this->_action();


return $action->config('scaffold.bulk_actions') ?: [];
}

Expand All @@ -575,6 +581,8 @@ protected function _getBulkActions()
protected function _getFormUrl()
{
$action = $this->_action();


return $action->config('scaffold.form_action') ?: null;
}

Expand All @@ -586,6 +594,8 @@ protected function _getFormUrl()
protected function _getDisableExtraButtons()
{
$action = $this->_action();


return $action->config('scaffold.disable_extra_buttons') ?: false;
}

Expand All @@ -597,6 +607,8 @@ protected function _getDisableExtraButtons()
protected function _getDisableSidebar()
{
$action = $this->_action();


return $action->config('scaffold.disable_sidebar') ?: false;
}

Expand All @@ -608,6 +620,8 @@ protected function _getDisableSidebar()
protected function _getExtraButtonsBlacklist()
{
$action = $this->_action();


return $action->config('scaffold.extra_buttons_blacklist') ?: [];
}

Expand All @@ -619,6 +633,8 @@ protected function _getExtraButtonsBlacklist()
protected function _getEnableDirtyCheck()
{
$action = $this->_action();


return $action->config('scaffold.enable_dirty_check') ?: false;
}

Expand All @@ -636,6 +652,8 @@ protected function _getActionGroups()

// add "primary" actions (primary should rendered as separate buttons)
$groups['primary'] = array_diff(array_keys($this->_getAllowedActions()), $groupedActions);


return $groups;
}
}
2 changes: 2 additions & 0 deletions src/Listener/ViewSearchListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ protected function _deriveFields()

$fields[$field] = $input;
}


return $fields;
}
}
14 changes: 13 additions & 1 deletion src/View/CrudView.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected function _loadAssets()
$this->AssetCompress->css('CrudView.crudview', ['block' => true]);
$this->AssetCompress->script('CrudView.crudview_head', ['block' => 'headjs']);
$this->AssetCompress->script('CrudView.crudview', ['block' => true]);


return;
}

Expand Down Expand Up @@ -136,6 +138,8 @@ public function fetch($name, $default = '')
}

$internal = $this->Blocks->get($name, $default);


return $internal . $viewblock;
}

Expand All @@ -149,13 +153,17 @@ public function fetch($name, $default = '')
public function exists($name)
{
$viewblocks = $this->get('viewblocks', []);


return !empty($viewblocks[$name]) || $this->Blocks->exists($name);
}

/**
* Constructs a ViewBlock from an array of configured data
*
* @return void
* @param array $data ViewBlock data
*
* @return string
*/
protected function _createViewblock($data)
{
Expand All @@ -171,6 +179,8 @@ protected function _createViewblock($data)
$output .= $key;
}
}


return $output;
}

Expand All @@ -191,6 +201,8 @@ protected function _getViewFileName($name = null)
} catch (MissingTemplateException $exception) {
$this->subDir = null;
$this->templatePath = 'Scaffold';


return parent::_getViewFileName($this->template);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/View/Helper/CrudViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public function process($field, Entity $data, array $options = [])

if ($options['formatter'] === 'element') {
$context = $this->getContext();


return $this->_View->element($options['element'], compact('context', 'field', 'value', 'options'));
}

Expand Down Expand Up @@ -189,6 +191,8 @@ public function formatDate($field, $value, array $options)
if ($value === null) {
return $this->Html->label(__d('crud', 'N/A'), 'info');
}


return $this->Time->timeAgoInWords($value, $options);
}

Expand All @@ -206,6 +210,8 @@ public function formatTime($field, $value, array $options)
return $this->Html->label(__d('crud', 'N/A'), 'info');
}
$format = isset($options['format']) ? $options['format'] : null;


return $this->Time->nice($value, $format);
}

Expand Down Expand Up @@ -262,6 +268,8 @@ public function relation($field)
}

$entity = $data->$entityName;


return [
'alias' => $alias,
'output' => $this->Html->link($entity->{$details['displayField']}, [
Expand Down
4 changes: 4 additions & 0 deletions src/View/Widget/DateTimeWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class="form-control"
</label>
</div>
html;


return $widget;
}

Expand Down Expand Up @@ -132,6 +134,8 @@ protected function _convertPHPToMomentFormat($format)
'U' => 'X',
];
$momentFormat = strtr($format, $replacements);


return $momentFormat;
}
}

0 comments on commit 3dc6ad9

Please sign in to comment.