-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
510e30e
commit 3bc15f9
Showing
11 changed files
with
158 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace studioespresso\exporter\fields; | ||
|
||
use Craft; | ||
|
||
|
||
class MultiOptionsFieldParser extends OptionsFieldParser | ||
{ | ||
public function getValue($element, $field) | ||
{ | ||
$selected = []; | ||
$property = $field['property'] ?? 'value'; | ||
|
||
foreach($element->getFieldValue($field['handle'])->getOptions() as $option) { | ||
if($option->selected) { | ||
$selected[] = $option->$property; | ||
} | ||
} | ||
return $selected; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace studioespresso\exporter\fields; | ||
|
||
use Craft; | ||
|
||
|
||
class OptionsFieldParser extends BaseFieldParser | ||
{ | ||
public function getValue($element, $field) | ||
{ | ||
$property = $field['property'] ?? 'value'; | ||
return $element->getFieldValue($field['handle'])->$property; | ||
} | ||
|
||
public function getOptions(): array | ||
{ | ||
return [ | ||
'label' => 'Label', | ||
'value' => 'Value' | ||
]; | ||
} | ||
|
||
public function getOptionType(): string|bool | ||
{ | ||
return "select"; | ||
} | ||
|
||
public function getOptionLabel(): string|bool | ||
{ | ||
return Craft::t('exporter', 'Select field property'); | ||
|
||
} | ||
|
||
public function getOptionDescription(): string|bool | ||
{ | ||
return Craft::t('exporter', 'Select which property you want to export.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace studioespresso\exporter\fields; | ||
|
||
class TimeParser extends BaseFieldParser | ||
{ | ||
public function getValue($element, array $field) | ||
{ | ||
$value = $element->getFieldValue($field['handle']); | ||
if ($value) { | ||
return $value->format($field['property']); | ||
} | ||
} | ||
|
||
public function getOptionType(): string | ||
{ | ||
return "select"; | ||
} | ||
|
||
|
||
public function getOptionLabel(): string|bool | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
public function getOptionDescription(): string|bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getOptions(): array | ||
{ | ||
return [ | ||
'H:i:s' => 'H:i:s', | ||
'H:i' => 'H:i', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,5 +25,4 @@ public function getSubGroup(): bool|array | |
{ | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters