Jump to content

How to replicate this methods and classes with PHP class?


sam13579
 Share

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...