Skip to content

Commit

Permalink
Load the types form when the data is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Apr 26, 2016
1 parent 7394178 commit aeac2e9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions administrator/components/com_fields/models/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,19 @@ protected function preprocessForm (JForm $form, $data, $group = 'content')
{
$component = $parts[0];

if (isset($data->type))
$dataObject = $data;
if (is_array($dataObject))
{
$this->loadTypeForms($form, $data->type, $component);
$dataObject = (object) $dataObject;
}
if (isset($dataObject->type))
{
$this->loadTypeForms($form, $dataObject->type, $component);

$form->setFieldAttribute('type', 'component', $component);

// Not alowed to change the type of an existing record
if ($data->id)
if ($dataObject->id)
{
$form->setFieldAttribute('type', 'readonly', 'true');
}
Expand Down

0 comments on commit aeac2e9

Please sign in to comment.