details_left.php rendered not to expectation. Fields missing after compile. #108

Closed
opened 2017-08-06 13:17:28 +00:00 by Houtsmatisering · 5 comments
Houtsmatisering commented 2017-08-06 13:17:28 +00:00 (Migrated from github.com)

THe fields did not have a edit order (all 0) then you only get 2 ($size) fields in the details_left.php.

	$this->tabCounter[$viewName][1] = 'Details';
		if (isset($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']]))
		{
			$size = count($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']]) + 1;
			$this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][$size] = $name;
		}
		else
		{
			$this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']] = $name;
		}
		// check if publishing fields were over written
		if (in_array($name, $this->defaultFields))
		{
			// just to eliminate
			$this->movedPublishingFields[$viewName][$name] = $name;
		}
THe fields did not have a edit order (all 0) then you only get 2 ($size) fields in the details_left.php. $this->tabCounter[$viewName][1] = 'Details'; if (isset($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) { $size = count($this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']]) + 1; $this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][$size] = $name; } else { $this->layoutBuilder[$viewName]['Details'][(int) $field['alignment']][(int) $field['order_edit']] = $name; } // check if publishing fields were over written if (in_array($name, $this->defaultFields)) { // just to eliminate $this->movedPublishingFields[$viewName][$name] = $name; }

Give me a recommended fix :)

How do you think should we handle the build if all is 0...

We could use the line order of the fields in the modal instead, and dump the order_edit altogether... since we added it before the option to move fields around, like it is now, was ready in Joomla.

Further the reality to convert all modal repeatable fields to subform fields are very tempting indeed. I mean the subform field type is new to Joomla and works just like repeatable fields, just not in a modal, and it seems more stable to me.

Well I don't have the time right now to do this... so a quick fix for the mentioned problem should have to do for now... please share what you think will best work.

Give me a recommended fix :) How do you think should we handle the build if all is 0... We could use the line order of the fields in the modal instead, and dump the order_edit altogether... since we added it before the option to move fields around, like it is now, was ready in Joomla. Further the reality to convert all modal repeatable fields to subform fields are very tempting indeed. I mean the subform field type is new to Joomla and works just like repeatable fields, just not in a modal, and it seems more stable to me. Well I don't have the time right now to do this... so a quick fix for the mentioned problem should have to do for now... please share what you think will best work.
Houtsmatisering commented 2017-08-10 07:40:27 +00:00 (Migrated from github.com)

I like the order setting and perhaps you want them in combination with the tabs. My problem was the items did not appear and I had to debug to find out why.
I think a (dirty) fix could be if the items exists add it to the end by giving it a high edit order 999 + the layout item count.
The user will then see the fields and can go to the edit order.

Better fix but not quick is renumber the duplicates in edit order before adding to the layout builder.

I like the order setting and perhaps you want them in combination with the tabs. My problem was the items did not appear and I had to debug to find out why. I think a (dirty) fix could be if the items exists add it to the end by giving it a high edit order 999 + the layout item count. The user will then see the fields and can go to the edit order. Better fix but not quick is renumber the duplicates in edit order before adding to the layout builder.

@Houtsmatisering please test the fix. Watch this video for more info.

@Houtsmatisering please test the fix. Watch [this video](https://youtu.be/cxryVA5Cni8) for more info.

This is basically the fix:

// first fix the zero order
// to insure it lands before all the other fields
// as zero is expected to behave
if ($field['order_edit'] == 0)
{
	if (!isset($this->zeroOrderFix[$viewName]))
	{
		$this->zeroOrderFix[$viewName] = array();
	}
	if (!isset($this->zeroOrderFix[$viewName][(int) $field['tab']]))
	{
		$this->zeroOrderFix[$viewName][(int) $field['tab']] = -999;
	}
	else
	{
		$this->zeroOrderFix[$viewName][(int) $field['tab']]++;
	}
	$field['order_edit'] = $this->zeroOrderFix[$viewName][(int) $field['tab']];
}
This is basically the fix: ``` // first fix the zero order // to insure it lands before all the other fields // as zero is expected to behave if ($field['order_edit'] == 0) { if (!isset($this->zeroOrderFix[$viewName])) { $this->zeroOrderFix[$viewName] = array(); } if (!isset($this->zeroOrderFix[$viewName][(int) $field['tab']])) { $this->zeroOrderFix[$viewName][(int) $field['tab']] = -999; } else { $this->zeroOrderFix[$viewName][(int) $field['tab']]++; } $field['order_edit'] = $this->zeroOrderFix[$viewName][(int) $field['tab']]; } ```
Houtsmatisering commented 2017-08-13 09:39:31 +00:00 (Migrated from github.com)

Hi llewellyn,
I placed the snipped at the start of the method and it works for me with only zeroes and also with a sequence starting with zero.
So thanks for the fix.
Jeroen

Hi llewellyn, I placed the snipped at the start of the method and it works for me with only zeroes and also with a sequence starting with zero. So thanks for the fix. Jeroen
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#108
No description provided.