Skip to content

Commit

Permalink
Merge branch 'hotfix/3.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhj committed May 31, 2019
2 parents 56c0fbd + 99aa5de commit 390b12d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,21 +395,26 @@ public function edit($intId=null, $ajaxId=null)
</div>
</div>
</form>
</form>';

// Set the focus if there is an error
if ($this->noReload)
{
$return .= '
<script>
window.addEvent(\'domready\', function() {
Theme.focusInput("'.$this->strTable.'");
Backend.vScrollTo(($(\'' . $this->strTable . '\').getElement(\'label.error\').getPosition().y - 20));
});
</script>';
}

// Begin the form (-> DO NOT CHANGE THIS ORDER -> this way the onsubmit attribute of the form can be changed by a field)
$return = $version . '
<div id="tl_buttons">' . (\Input::get('nb') ? '&nbsp;' : '
<a href="'.$this->getReferer(true).'" class="header_back" title="'.specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']).'" accesskey="b" onclick="Backend.getScrollOffset()">'.$GLOBALS['TL_LANG']['MSC']['backBT'].'</a>') . '
</div>
'.\Message::generate().'
<form action="'.ampersand(\Environment::get('request'), true).'" id="'.$this->strTable.'" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"'.(!empty($this->onsubmit) ? ' onsubmit="'.implode(' ', $this->onsubmit).'"' : '').'>
<form action="'.ampersand(\Environment::get('request'), true).'" id="'.$this->strTable.'" class="tl_form" method="post" enctype="' . ($this->blnUploadable ? 'multipart/form-data' : 'application/x-www-form-urlencoded') . '"'.(!empty($this->onsubmit) ? ' onsubmit="'.implode(' ', $this->onsubmit).'"' : '').' novalidate>
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="'.$this->strTable.'">
<input type="hidden" name="REQUEST_TOKEN" value="'.REQUEST_TOKEN.'">
Expand Down
11 changes: 7 additions & 4 deletions src/Model/Multilingual.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Terminal42\DcMultilingualBundle\Model;

use Contao\Database;
use Doctrine\DBAL\Query\QueryBuilder;
use Terminal42\DcMultilingualBundle\QueryBuilder\MultilingualQueryBuilderFactoryInterface;

Expand Down Expand Up @@ -273,9 +274,10 @@ protected static function getMultilingualQueryBuilder()
*/
protected static function getRegularFields()
{
$extractor = \DcaExtractor::getInstance(static::getTable());
$extractor = \DcaExtractor::getInstance(static::getTable());
$tableColumns = Database::getInstance()->getFieldNames(static::getTable());

return array_keys($extractor->getFields());
return array_intersect($tableColumns, array_keys($extractor->getFields()));
}

/**
Expand All @@ -287,10 +289,11 @@ protected static function getTranslatableFields()
{
static::ensureDataContainerIsLoaded();

$fields = [];
$fields = [];
$tableColumns = Database::getInstance()->getFieldNames(static::getTable());

foreach ($GLOBALS['TL_DCA'][static::getTable()]['fields'] as $field => $data) {
if (!isset($data['eval']['translatableFor'])) {
if (!isset($data['eval']['translatableFor']) || !in_array($field, $tableColumns, true)) {
continue;
}

Expand Down

0 comments on commit 390b12d

Please sign in to comment.