#include <libzakcgi/libzakcgi.h>
#include "formelement.h"
-#include "formelementcheck.h"
-#include "formelementradio.h"
enum
{
g_hash_table_insert (priv->ht_attrs, (gpointer)"readonly", (gpointer)"readonly");
}
- if ((ZAK_FORM_CGI_IS_FORM_ELEMENT_CHECK (element)
- || ZAK_FORM_CGI_IS_FORM_ELEMENT_RADIO (element))
- && g_strcmp0 (zak_form_cgi_form_element_get_bootstrap_version (element), "4") == 0)
- {
- g_string_append (str, "<div class=\"form-check");
- if ((ZAK_FORM_CGI_IS_FORM_ELEMENT_CHECK (element)
- && zak_form_cgi_form_element_check_get_in_line (ZAK_FORM_CGI_FORM_ELEMENT_CHECK (element)))
- || (ZAK_FORM_CGI_IS_FORM_ELEMENT_RADIO (element)
- && zak_form_cgi_form_element_radio_get_in_line (ZAK_FORM_CGI_FORM_ELEMENT_RADIO (element))))
- {
- g_string_append (str, " form-check-inline");
- }
- g_string_append (str, "\">\n");
- }
-
g_string_append (str, ZAK_FORM_CGI_FORM_ELEMENT_GET_CLASS (element)->render (element));
}
}
}
- if ((ZAK_FORM_CGI_IS_FORM_ELEMENT_CHECK (element)
- || ZAK_FORM_CGI_IS_FORM_ELEMENT_RADIO (element))
- && g_strcmp0 (zak_form_cgi_form_element_get_bootstrap_version (element), "4") == 0)
- {
- g_string_append (str, "</div>\n");
- }
-
g_string_append (str, "\n</div>\n");
ret = g_strdup (str->str);
{
g_hash_table_insert (ht_attrs, "class", g_strdup_printf ("%s form-check-input", g_hash_table_lookup (ht_attrs, "class")));
- g_string_append_printf (str, "\n%s<label class=\"form-check-label\" for=\"%s\">%s</label>",
+ g_string_append_printf (str, "\n<div class=\"form-check%s\">\n%s<label class=\"form-check-label\" for=\"%s\">%s</label>\n</div>",
+ priv->in_line ? " form-check-inline" : "",
zak_cgi_tag_tag_ht ("input", zak_form_cgi_form_element_get_id (element), ht_attrs),
zak_form_cgi_form_element_get_id (element),
zak_form_cgi_form_element_check_get_text (ZAK_FORM_CGI_FORM_ELEMENT_CHECK (element)));
guint i;
GHashTable *ht_attrs;
- GHashTable *ht_label_attrs;
GHashTable *ht_attrs_option;
gchar *attr_class;
klass = (ZakFormCgiFormElementClass *)g_type_class_peek_parent (ZAK_FORM_CGI_FORM_ELEMENT_RADIO_GET_CLASS (ZAK_FORM_CGI_FORM_ELEMENT_RADIO (element)));
ht_attrs = klass->get_ht_attrs (element);
- ht_label_attrs = klass->get_ht_label_attrs (element);
- if (ht_label_attrs != NULL)
- {
- ret = g_string_new ("<br/>\n");
- }
- else
- {
- ret = g_string_new ("");
- }
+ ret = g_string_new ("");
element_value = zak_form_element_get_value (ZAK_FORM_ELEMENT (element));
{
/* g_hash_table_insert (ht_attrs_option, "class", g_strdup_printf ("%s form-check-input", g_hash_table_lookup (ht_attrs_option, "class"))); */
- g_string_append_printf (ret, "\n%s<label class=\"form-check-label\" for=\"%s_%d\"> %s</label>",
+ g_string_append_printf (ret, "\n<div class=\"form-check%s\">\n%s<label class=\"form-check-label\" for=\"%s_%d\"> %s</label>\n</div>",
+ priv->in_line ? " form-check-inline" : "",
zak_cgi_tag_tag_ht ("input",
g_strdup_printf ("%s_%d",
zak_form_cgi_form_element_get_id (element),
gchar *ret_value;
GString *ret;
+ GHashTable *ht_label_attrs;
+
guint i;
+ ZakFormCgiFormElementClass *klass;
+
ZakFormCgiFormElementRadioPrivate *priv = ZAK_FORM_CGI_FORM_ELEMENT_RADIO_GET_PRIVATE (element);
- ret = g_string_new ("");
+ klass = (ZakFormCgiFormElementClass *)g_type_class_peek_parent (ZAK_FORM_CGI_FORM_ELEMENT_RADIO_GET_CLASS (ZAK_FORM_CGI_FORM_ELEMENT_RADIO (element)));
+ ht_label_attrs = klass->get_ht_label_attrs (element);
+
+ if (ht_label_attrs != NULL)
+ {
+ ret = g_string_new ("<br/>\n");
+ }
+ else
+ {
+ ret = g_string_new ("");
+ }
for (i = 0; i < priv->ar_options->len; i++)
{