Skip to content

Commit

Permalink
Basic money field support
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Dec 17, 2023
1 parent 07ce7e6 commit 56f8a01
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/fields/MoneyFieldParser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace studioespresso\exporter\fields;

class MoneyFieldParser extends BaseFieldParser
{
public function getValue($element, $field)
{
$field = $element->getFieldValue($field['handle']);
return $field->getAmount();
}

public function getOptions(): array
{
return [];
}

public function getOptionType(): string|bool
{
return false;
}

protected function getOptionLabel(): string|bool
{
// TODO: Implement getOptionLabel() method.
}

protected function getOptionDescription(): string|bool
{
// TODO: Implement getOptionDescription() method.
}
}
5 changes: 4 additions & 1 deletion src/helpers/FieldTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use studioespresso\exporter\fields\BaseFieldParser;
use studioespresso\exporter\fields\DateTimeParser;
use studioespresso\exporter\fields\LightswitchParser;
use studioespresso\exporter\fields\MoneyFieldParser;
use studioespresso\exporter\fields\MultiOptionsFieldParser;
use studioespresso\exporter\fields\OptionsFieldParser;
use studioespresso\exporter\fields\PlainTextParser;
Expand Down Expand Up @@ -57,13 +58,15 @@ class FieldTypeHelper
MultiSelect::class,
Checkboxes::class,
],
MoneyFieldParser::class => [
Money::class,
],
PlainTextParser::class => [
PlainText::class,
Number::class,
Email::class,
Color::class,
Url::class,
Money::class,
Lightswitch::class,
],
];
Expand Down

0 comments on commit 56f8a01

Please sign in to comment.