[TASK] Formstyle

This commit is contained in:
Christian Seyfferth 2020-05-20 17:34:25 +02:00
parent 327b33a92e
commit f5f43b2173
3 changed files with 56 additions and 51 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* p01-contact - A simple contact forms manager.
*
@ -214,18 +215,13 @@ class P01contactField
$placeholder = $this->placeholder ? ' placeholder="' . $this->placeholder . '"' : '';
$is_single_option = is_array($this->value) && 1 == count($this->value) ? 'inline' : '';
$html = "<div class=\"row field {$is_single_option} {$type} {$orig} {$required}\">";
$html = "<div class=\"col s12 input-field {$is_single_option} {$type} {$orig} {$required}\">";
$html .= '<div class="col-sm-12 col-md-3">';
if ('' === $is_single_option) {
$html .= $this->htmlLabel($id);
}
$html .= '</div>';
$html .= '<div class="col-sm-12 col-md">';
switch ($type) {
case 'textarea':
$html .= '<textarea id="' . $id . '" rows="10" ';
$html .= 'class="materialize-textarea" ';
$html .= 'name="' . $name . '"' . $disabled . $required . $placeholder;
$html .= '>' . $value . '</textarea>';
@ -248,11 +244,11 @@ class P01contactField
foreach ($this->value as $i => $v) {
$selected = $this->isSelected($i) ? ' checked' : '';
$v = !empty($v) ? $v : 'Default';
$html .= '<label class="option col-sm-12">';
$html .= '<p><label class="option col s12">';
$html .= "<input id=\"{$id}_option{$i}\"";
$html .= " type=\"{$type}\" class=\"{$type}\" name=\"{$name}\"";
$html .= " value=\"{$i}\"{$disabled}{$required}{$selected} />{$v}";
$html .= '</label>';
$html .= " value=\"{$i}\"{$disabled}{$required}{$selected} /><span>{$v}</span>";
$html .= '</label></p>';
}
$html .= '</div>';
@ -275,8 +271,9 @@ class P01contactField
break;
}
$html .= '</div>';
if ('' === $is_single_option) {
$html .= $this->htmlLabel($id);
}
$html .= '</div>';
return $html;
@ -371,7 +368,7 @@ class P01contactField
*/
private function htmlLabel($for)
{
$html .= '<label for="'.$for.'" class="doc">';
$html .= '<label for="' . $for . '" class="doc validate">';
if ($this->title) {
$html .= $this->title;
} else {

View File

@ -1,4 +1,5 @@
<?php
/**
* p01-contact - A simple contact forms manager.
*
@ -88,8 +89,10 @@ class P01contactForm
*/
public function post()
{
if (empty($_POST['p01-contact_form'])
|| $_POST['p01-contact_form']['id'] != $this->id) {
if (
empty($_POST['p01-contact_form'])
|| $_POST['p01-contact_form']['id'] != $this->id
) {
return;
}
@ -163,6 +166,7 @@ class P01contactForm
$html .= '<form action="' . PAGEURL . '#p01-contact' . $this->id . '" autocomplete="off" ';
$html .= 'id="p01-contact' . $this->id . '" class="p01-contact" method="post">';
$html .= "<div class=\"row\">";
if ($this->status) {
$html .= $this->htmlStatus();
}
@ -177,6 +181,8 @@ class P01contactForm
$html .= '<input name="p01-contact_form[token]" type="hidden" value="' . $this->getToken() . '" />';
$html .= '<input class="submit" type="submit" value="' . $this->lang('send') . '" /></div>';
}
$html .= '</div>';
$html .= '</form>';
$html .= '</div>';

View File

@ -1,3 +1,4 @@
/*
.p01-contact * {
box-sizing: border-box;
}
@ -98,3 +99,4 @@ textarea:invalid {
border-color: #ebccd1;
}
*/