Search the Community
Showing results for tags 'attribute'.
-
Okay, so I'm making some modifications to Ryan's LoginRegister module. Currently, I'm attempting to add a couple html attributes to the form. (Specifically "data-abide" - see Zurb Foundation). On line 515 of LoginRegister.module, I saw $form->attr('id', 'LoginRegisterForm'); so I attempted doing the same thing with my attribute, but it didn't work. $form->attr('data-abide', ''); Upon searching, it looks like the cause of the removal of attributes with no values is the getAttributesString() function in wire/core/inputfield.php, specifically line 1135 // skip over empty attributes if(!is_array($value) && !strlen("$value") && (!$value = $this->attr($attr))) continue; Now, I realize that I could just comment out that line and it works perfectly fine if I do. However, that doesn't really seem ideal since it'll break on updates. My question is: how should I go about doing this? Just comment out the line and hope Ryan removes it in the future? Or another way I hadn't thought of?
-
Hi all, I do have a form in the 'backend' of my website which has a fieldtype of ASMSelect. I gave all the options of that field a custom attribute with a value: foreach ($feature_group['features'] as $feature_id => $feature) { $field->addOption($feature_id, $feature['name'], array('data-feature_group' => $feature_group_id)); } How can I read out the value of that custom attribute named data-feature group? I've tried it with $selected_feature_groups = $form->get($category_id)->getAttribute('data-feature_group'); //AND selected_feature_groups = $form->get($category_id)->feature_group; but that doesn't work. How can I get this to work? ~Harmen