Skip to content

Commit

Permalink
Use the first category as field filter when creating an article
Browse files Browse the repository at this point in the history
Closes joomla#144
  • Loading branch information
laoneo committed Jun 21, 2016
1 parent 3d883e6 commit c896a70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions administrator/components/com_fields/helpers/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ public static function prepareForm ($context, JForm $form, $data)

$assignedCatids = isset($data->catid) ? $data->catid : (isset($data->fieldscatid) ? $data->fieldscatid : null);

if (! $assignedCatids && $form->getField('assigned_cat_ids'))
if (! $assignedCatids && $form->getField('catid'))
{
// Choose the first category available
$xml = new DOMDocument;
$xml->loadHTML($form->getField('assigned_cat_ids')->__get('input'));
$xml->loadHTML($form->getField('catid')->__get('input'));
$options = $xml->getElementsByTagName('option');

if ($firstChoice = $options->item(0))
Expand Down

0 comments on commit c896a70

Please sign in to comment.