Use template for displayFieldsetBottom

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-11-10 15:08:28 -02:00
parent e7900a82cb
commit 72bcc1336f
2 changed files with 20 additions and 20 deletions

View File

@ -413,30 +413,16 @@ class FormDisplayTemplate
/**
* Displays bottom part of a fieldset
*
* @param bool $show_buttons whether show submit and reset button
* @param bool $showButtons Whether show submit and reset button
*
* @return string
*/
public static function displayFieldsetBottom($show_buttons = true)
public static function displayFieldsetBottom($showButtons = true)
{
$colspan = 2;
if ($GLOBALS['PMA_Config']->get('is_setup')) {
$colspan++;
}
$htmlOutput = '';
if ($show_buttons) {
$htmlOutput .= '<tr>';
$htmlOutput .= '<td colspan="' . $colspan . '" class="lastrow">';
$htmlOutput .= '<input type="submit" name="submit_save" value="'
. __('Apply') . '" class="green" />';
$htmlOutput .= '<input type="button" name="submit_reset" value="'
. __('Reset') . '" />';
$htmlOutput .= '</td>';
$htmlOutput .= '</tr>';
}
$htmlOutput .= '</table>';
$htmlOutput .= '</fieldset>';
return $htmlOutput;
return Template::get('config/form_display/fieldset_bottom')->render([
'show_buttons' => $showButtons,
'is_setup' => $GLOBALS['PMA_Config']->get('is_setup'),
]);
}
/**

View File

@ -0,0 +1,14 @@
{% set colspan = 2 %}
{% if is_setup %}
{% set colspan = colspan + 1 %}
{% endif %}
{% if show_buttons %}
<tr>
<td colspan="{{ colspan }}" class="lastrow">
<input type="submit" name="submit_save" value="{% trans 'Apply' %}" class="green" />
<input type="button" name="submit_reset" value="{% trans 'Reset' %}" />
</td>
</tr>
{% endif %}
</table>
</fieldset>