Feature Small PR-5.1-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
13 Jan 2024

Pull Request for Issue # .

Summary of Changes

FormField class allow get/set the rendering layouts: $field->renderLayout and $field->renderLabelLayout
As for now it only possible to change $field->layout.

Testing Instructions

Add following code somewhere, and run:

$t = new \Joomla\CMS\Form\Field\TextField();
$t->setup(new SimpleXMLElement('<field name="foobar" />'), '');
$t->renderLayout = 'foo';
$t->renderLabelLayout = 'bar';
var_dump($t->renderLayout, $t->renderLabelLayout);

Actual result BEFORE applying this Pull Request

Outputs:

joomla.form.renderfield
joomla.form.renderlabel

Expected result AFTER applying this Pull Request

Outputs:

foo
bar

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: TBD
  • No documentation changes for manual.joomla.org needed
avatar Fedik Fedik - open - 13 Jan 2024
avatar Fedik Fedik - change - 13 Jan 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Jan 2024
Category Libraries
avatar Fedik Fedik - change - 13 Jan 2024
Title
[5.1] FormField class allow get/set the rendering layouts
[5.1] FormField class allow to get/set the rendering layouts
avatar Fedik Fedik - edited - 13 Jan 2024
avatar wilsonge
wilsonge - comment - 16 Jan 2024

Honestly not sure I'm a fan of this. I think it's probably a bad idea that plugins would be able to override the output this directly. The field is supposed to determine how it renders data (the layout is strictly there to enable the field to get template overrides - typically for yootheme and other non-bootstrap based template clubs)

avatar Fedik
Fedik - comment - 23 Jan 2024

hm, and @wilsonge what do you think about passing renderLayout as option in to renderField:

public function renderField($options = [])

It sometimes need to have a custom layout for "special form" while keeping default forms in default layout.
Only solution curently is to render it manualy with $field->input and $field->label. That is ignoring all features provided by renderField() method.

avatar Fedik
Fedik - comment - 24 Jan 2024

I closing this for now, will re-do this later with renderField(['renderLayout' => 'foobar'])

avatar Fedik Fedik - change - 24 Jan 2024
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2024-01-24 09:13:34
Closed_By Fedik
Labels Added: Feature Small PR-5.1-dev
avatar Fedik Fedik - close - 24 Jan 2024

Add a Comment

Login with GitHub to post a comment