The new way to render an attribute form in a single page
Permalink
I have a single page in backend which display form elements based on the page attribute:
As I just checked the render method is labeled 'deprecated' in
\concrete\src\Entity\Attribute\Key\Key.php: line 262
Is there a better way to do such a thing in the newer versions of concrete5?
$attribute_key = 'product_description'; $akt = CollectionAttributeKey::getByHandle($attribute_key); echo $akt->render('form', 'Default Value', true);
As I just checked the render method is labeled 'deprecated' in
\concrete\src\Entity\Attribute\Key\Key.php: line 262
Is there a better way to do such a thing in the newer versions of concrete5?
Thank you.
While on this, is it possible to change the layout? What I would rather do is in some cases using inline form formatting or adding a few lines of guideline.
While on this, is it possible to change the layout? What I would rather do is in some cases using inline form formatting or adding a few lines of guideline.
For that you'll be entering a whole world of pain. There's a whole bunch of tutorials in the Dev docs to show you how to customize Express forms. The principle is the same here. You have to customize the context. If you noticed I'm using a context class in the code to generate the attribute input.
Here's one tutorial that will put you in the right directionhttps://documentation.concrete5.org/developers/express/express-forms...
If your needs are mostly design-related, I strongly suggest you try to d what you want with CSS only without trying to modify the markup by modifying the whole context thing.
Here's one tutorial that will put you in the right directionhttps://documentation.concrete5.org/developers/express/express-forms...
If your needs are mostly design-related, I strongly suggest you try to d what you want with CSS only without trying to modify the markup by modifying the whole context thing.
it did get a little more complex which is unfortunate.
Here's how to do it
This will give you the input with the attribute name as label and will populate it with any existing value