-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed: code issues #499
fixed: code issues #499
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,13 @@ | |
|
||
namespace acclaro\translations\models; | ||
|
||
use Craft; | ||
use craft\elements\GlobalSet; | ||
use craft\behaviors\DraftBehavior; | ||
use craft\validators\SiteIdValidator; | ||
use craft\validators\DateTimeValidator; | ||
use craft\behaviors\CustomFieldBehavior; | ||
use craft\behaviors\FieldLayoutBehavior; | ||
|
||
use acclaro\translations\Translations; | ||
use acclaro\translations\records\GlobalSetDraftRecord; | ||
|
||
/** | ||
* @author Acclaro | ||
|
@@ -73,39 +70,6 @@ public function getHandle() | |
return $this->getGlobalSet()->handle; | ||
} | ||
|
||
public static function populateModel($attributes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not in use |
||
{ | ||
if ($attributes instanceof GlobalSetDraftRecord) { | ||
$attributes = $attributes->getAttributes(); | ||
} | ||
|
||
$globalSetData = json_decode($attributes['data'], true); | ||
$fieldContent = isset($globalSetData['fields']) ? $globalSetData['fields'] : null; | ||
$attributes['id'] = $attributes['globalSetId']; | ||
|
||
$attributes = array_diff_key($attributes, array_flip(array('data', 'fields', 'globalSetId'))); | ||
|
||
$attributes = array_merge($attributes, $globalSetData); | ||
|
||
$draft = parent::setAttributes($attributes); | ||
|
||
if ($fieldContent) { | ||
$post = array(); | ||
|
||
foreach ($fieldContent as $fieldId => $fieldValue) { | ||
$field = Craft::$app->fields->getFieldById($fieldId); | ||
|
||
if ($field) { | ||
$post[$field->handle] = $fieldValue; | ||
} | ||
} | ||
|
||
$draft->setFieldValues($post); | ||
} | ||
|
||
return $draft; | ||
} | ||
|
||
public function getGlobalSet() | ||
{ | ||
if (is_null($this->globalSetId)) { | ||
|
@@ -140,10 +104,6 @@ public function getCpEditUrl(): ?string | |
public function behaviors(): array | ||
{ | ||
$behaviors = parent::behaviors(); | ||
$behaviors['customFields'] = [ | ||
'class' => CustomFieldBehavior::class, | ||
'hasMethods' => false, | ||
]; | ||
$behaviors['fieldLayout'] = [ | ||
'class' => FieldLayoutBehavior::class, | ||
'elementType' => GlobalSet::class, | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,6 @@ class Factory | |
Entries::class => EntriesFieldTranslator::class, | ||
Matrix::class => MatrixFieldTranslator::class, | ||
MultiSelect::class => MultiSelectFieldTranslator::class, | ||
LinkField::class => LinkFieldTranslator::class, | ||
TypedLinkField::class => TypedLinkFieldTranslator::class, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As link field plugin is one renamed to typed link field so removed old one. |
||
LinkitField::class => LinkitFieldTranslator::class, | ||
NeoField::class => NeoFieldTranslator::class, | ||
|
@@ -91,17 +90,7 @@ public function makeTranslator(Field $field) | |
if (array_key_exists($class, $this->nativeFieldTypes)) { | ||
$translatorClass = $this->nativeFieldTypes[$class]; | ||
|
||
switch ($translatorClass) { | ||
case MultiSelectFieldTranslator::class: | ||
return new MultiSelectFieldTranslator(Craft::$app, Translations::$plugin->wordCounter, Translations::$plugin->translationRepository); | ||
case SingleOptionFieldTranslator::class: | ||
return new SingleOptionFieldTranslator(Craft::$app, Translations::$plugin->wordCounter, Translations::$plugin->translationRepository); | ||
case TagFieldTranslator::class: | ||
return new TagFieldTranslator(Craft::$app, Translations::$plugin->wordCounter, Translations::$plugin->tagRepository, Translations::$plugin->elementCloner); | ||
case CategoryFieldTranslator::class: | ||
return new CategoryFieldTranslator(Craft::$app, Translations::$plugin->wordCounter, Translations::$plugin->categoryRepository); | ||
} | ||
return new $translatorClass(Craft::$app, Translations::$plugin->wordCounter); | ||
return new $translatorClass(); | ||
} | ||
|
||
return null; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,7 @@ private function parseSourceValues($value, $key, $sourceSite) | |
$source[$k] = $option->label; | ||
} | ||
break; | ||
case $value instanceof \fruitstudios\linkit\fields\LinkitField: | ||
case $value instanceof \presseddigital\linkit\fields\LinkitField: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ownership of plugin was changed. |
||
$source[$key] = $value->serializeValue($value)['customText']; | ||
|
||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed due to not being in use.