sam13579 Posted November 13, 2021 Share Posted November 13, 2021 This thing might sound weird , but I would like to make a similar class that can make HTML element like this: $inputfield = $modules->get('InputfieldText'); $inputfield->label = 'Your Name'; $inputfield->attr('name', 'your_name'); $inputfield->attr('value', 'Roderigo'); // Add to a $form (InputfieldForm or InputfieldWrapper) $form->add($inputfield); How can I make a class so that I can make simple text input fields with the code. I am not very good at OOP. It would be a great thing to learn. Link to comment Share on other sites More sharing options...
wbmnfktr Posted November 13, 2021 Share Posted November 13, 2021 Maybe my day was already way too long and I don't understand your question and needs here... but... what do you want to accomplish with this and where? In the frontend? In the backend? Within a page, a form, or... Your question and code sample somehow don't match for me. 1 Link to comment Share on other sites More sharing options...
sam13579 Posted November 14, 2021 Author Share Posted November 14, 2021 8 hours ago, wbmnfktr said: Maybe my day was already way too long and I don't understand your question and needs here... but... what do you want to accomplish with this and where? In the frontend? In the backend? Within a page, a form, or... Your question and code sample somehow don't match for me. I want to create this same thing where I can add attributes to the program like the program I gave. I want to do this for frontend text input field. Link to comment Share on other sites More sharing options...
Zeka Posted November 14, 2021 Share Posted November 14, 2021 https://github.com/artyuum/HtmlElement https://davidwalsh.name/create-html-elements-php-htmlelement-class Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now