| @@ 489-506 (lines=18) @@ | ||
| 486 | * @author Kaero |
|
| 487 | * @copyright ImageCMS (c) 2012, Kaero <[email protected]> |
|
| 488 | */ |
|
| 489 | public function addCustomFieldValue($name, $value) { |
|
| 490 | if (array_key_exists($name, $this->customFieldsCache)) { |
|
| 491 | $fieldDataArray = $this->customFieldsCache[$name]->getDataArray(); |
|
| 492 | ||
| 493 | if ($fieldDataArray === null) { |
|
| 494 | $fieldDataArray = []; |
|
| 495 | } |
|
| 496 | ||
| 497 | if (!in_array($value, $fieldDataArray)) { |
|
| 498 | array_push($fieldDataArray, $value); |
|
| 499 | $newData = implode("\n", $fieldDataArray); |
|
| 500 | $this->customFieldsCache[$name]->setData($newData); |
|
| 501 | $this->customFieldsCache[$name]->save(); |
|
| 502 | $this->customFieldsCache[$name]->setVirtualColumn('dataArray', $fieldDataArray); |
|
| 503 | $this->customFieldsCache[$name]->setData($newData); |
|
| 504 | } |
|
| 505 | } |
|
| 506 | } |
|
| 507 | ||
| 508 | /** |
|
| 509 | * FROM CategoryImport |
|
| @@ 100-117 (lines=18) @@ | ||
| 97 | * @author Kaero |
|
| 98 | * @copyright ImageCMS (c) 2012, Kaero <[email protected]> |
|
| 99 | */ |
|
| 100 | public function addCustomFieldValue($name, $value) { |
|
| 101 | if (array_key_exists($name, $this->customFieldsCache)) { |
|
| 102 | $fieldDataArray = $this->customFieldsCache[$name]->getDataArray(); |
|
| 103 | ||
| 104 | if ($fieldDataArray === null) { |
|
| 105 | $fieldDataArray = []; |
|
| 106 | } |
|
| 107 | ||
| 108 | if (!in_array($value, $fieldDataArray)) { |
|
| 109 | array_push($fieldDataArray, $value); |
|
| 110 | $newData = implode("\n", $fieldDataArray); |
|
| 111 | $this->customFieldsCache[$name]->setData($newData); |
|
| 112 | $this->customFieldsCache[$name]->save(); |
|
| 113 | $this->customFieldsCache[$name]->setVirtualColumn('dataArray', $fieldDataArray); |
|
| 114 | $this->customFieldsCache[$name]->setData($newData); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Parse Category Name by slashes |
|