Skip to content

Commit

Permalink
Fix control-label width for a spacer field
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed May 6, 2017
1 parent e5af23c commit bf01cf0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
Expand Up @@ -78,7 +78,10 @@
</div>
<?php endif; ?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<?php $dataShowOn = ''; ?>
<?php
$dataShowOn = '';
$groupClass = $field->type === 'Spacer' ? ' field-spacer' : '';
?>
<?php if ($field->showon) : ?>
<?php JHtml::_('jquery.framework'); ?>
<?php JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); ?>
Expand All @@ -87,7 +90,7 @@
<?php if ($field->hidden) : ?>
<?php echo $field->input; ?>
<?php else : ?>
<div class="control-group"<?php echo $dataShowOn; ?>>
<div class="control-group<?php echo $groupClass; ?>"<?php echo $dataShowOn; ?>>
<?php if ($name != 'permissions') : ?>
<div class="control-label">
<?php echo $field->label; ?>
Expand Down
3 changes: 3 additions & 0 deletions administrator/templates/isis/css/template-rtl.css
Expand Up @@ -7300,6 +7300,9 @@ h6 {
width: 220px;
}
}
.form-horizontal .field-spacer>.control-label {
width: auto;
}
.form-horizontal #jform_catid_chzn {
vertical-align: middle;
}
Expand Down
3 changes: 3 additions & 0 deletions administrator/templates/isis/css/template.css
Expand Up @@ -7300,6 +7300,9 @@ h6 {
width: 220px;
}
}
.form-horizontal .field-spacer>.control-label {
width: auto;
}
.form-horizontal #jform_catid_chzn {
vertical-align: middle;
}
Expand Down
3 changes: 3 additions & 0 deletions administrator/templates/isis/less/blocks/_forms.less
Expand Up @@ -17,6 +17,9 @@
}
}
}
.field-spacer>.control-label{
width: auto;
}
#jform_catid_chzn {
vertical-align: middle;
}
Expand Down
16 changes: 16 additions & 0 deletions libraries/joomla/form/fields/spacer.php
Expand Up @@ -104,4 +104,20 @@ protected function getTitle()
{
return $this->getLabel();
}

/**
* Method to get a control group with label and input.
*
* @param array $options Options to be passed into the rendering of the field
*
* @return string A string containing the html for the control group
*
* @since __DEPLOY_VERSION__
*/
public function renderField($options = array())
{
$options['class'] = empty($options['class']) ? 'field-spacer' : $options['class'] . ' field-spacer';

return parent::renderField($options);
}
}

0 comments on commit bf01cf0

Please sign in to comment.