Skip to content

Commit

Permalink
ユニットオブジェクトのimageとtableとファイルと本文に対応
Browse files Browse the repository at this point in the history
  • Loading branch information
1000-x-t30 committed Nov 21, 2024
1 parent e2206f1 commit 5a02f48
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ protected function buildEntry(&$model, $entry)
foreach ($entry->units as $new) {
$clid = $new->clid;
foreach ($model->units as $i => $current) {
var_dump($current->getId(), $clid);
if (is_array($current) && $current['clid'] === $clid) {
$type = detectUnitTypeSpecifier($new->type);
switch ($type) {
Expand All @@ -121,22 +120,21 @@ protected function buildEntry(&$model, $entry)
$model->units[$i] = $current;
break;
} elseif (is_object($current) && $current->getId() === $clid) {
var_dump($new->text);
$type = detectUnitTypeSpecifier($new->type);
switch ($type) {
case 'text':
$current->setField1($new->text);
break;
case 'table':
$current->setTable($new->table);
$current->setField1($new->table);
break;
case 'media':
case 'image':
$current->setCaption($new->caption);
$current->setAlt($new->alt);
$current->setField1($new->caption);
$current->setField4($new->alt);
break;
case 'file':
$current->setCaption($new->caption);
$current->setField1($new->caption);
break;
}
$newId = $current->generateNewIdTrait();
Expand All @@ -148,8 +146,6 @@ protected function buildEntry(&$model, $entry)
}
}

// var_dump($model);

// field
if (property_exists($entry, 'fields') && is_array($entry->fields)) {
foreach ($entry->fields as $field) {
Expand Down

0 comments on commit 5a02f48

Please sign in to comment.