You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.
This isn't actually an issue but more of a comment. I modified ExportService.php to get the URL of images. I'll leave it here and perhaps it will help someone else. Thanks for the code, bro.
public function parseFieldData($handle, $data)
{
// Do we have any data at all
if (!is_null($data)) {
// Get field info
$field = craft()->fields->getFieldByHandle($handle);
// If it's a field ofcourse
if (!is_null($field)) {
// For some fieldtypes the're special rules
switch ($field->type) {
case ExportModel::FieldTypeAssets:
// Show names
if( $data instanceof ElementCriteriaModel)
{
//$imgSettings = array("mode"=> 'crop',
//"width" => "1600",
//"height"=> "230",
//"position" => "center-center");
$firstImage = $data->first();
if(isset($firstImage)){
$image =$firstImage->getUrl();
$data =$image;
}
}
break;
case ExportModel::FieldTypeEntries:
case ExportModel::FieldTypeCategories:
case ExportModel::FieldTypeUsers:
case ExportModel::FieldTypeTags:
// Show names
$data = $data instanceof ElementCriteriaModel ? implode(', ', $data->find()) : $data;
break;
case ExportModel::FieldTypeLightswitch:
// Make data human readable
switch ($data) {
case '0':
$data = Craft::t('No');
break;
case '1':
$data = Craft::t('Yes');
break;
}
break;
case ExportModel::FieldTypeTable:
// Parse table checkboxes
$table = array();
if (is_array($data)) {
foreach ($data as $row) {
// Keep track of column #
$i = 1;
// Loop through columns
foreach ($row as $column => $value) {
// Get column
$column = isset($field->settings['columns'][$column]) ? $field->settings['columns'][$column] : (isset($field->settings['columns']['col'.$i]) ? $field->settings['columns']['col'.$i] : array('type' => 'dummy'));
// Keep track of column #
++$i;
// Parse
$table[] = $column['type'] == 'checkbox' ? ($value == 1 ? Craft::t('Yes') : Craft::t('No')) : $value;
}
}
}
// Return parsed data as array
$data = $table;
break;
case ExportModel::FieldTypeRichText:
case ExportModel::FieldTypeDate:
case ExportModel::FieldTypeRadioButtons:
case ExportModel::FieldTypeDropdown:
// Resolve to string
$data = (string) $data;
break;
case ExportModel::FieldTypeCheckboxes:
case ExportModel::FieldTypeMultiSelect:
// Parse multi select values
$multi = array();
if (is_array($data)) {
foreach ($data as $row) {
$multi[] = $row->value;
}
}
// Return parsed data as array
$data = $multi;
break;
}
}
// Get other operations
craft()->plugins->call('registerExportOperation', array(&$data, $handle));
} else {
// Don't return null, return empty
$data = '';
}
// If it's an object or an array, make it a string
if (is_array($data)) {
$data = StringHelper::arrayToString(ArrayHelper::filterEmptyStringsFromArray(ArrayHelper::flattenArray($data)), ', ');
}
// If it's an object, make it a string
if (is_object($data)) {
$data = StringHelper::arrayToString(ArrayHelper::filterEmptyStringsFromArray(ArrayHelper::flattenArray(get_object_vars($data))), ', ');
}
return $data;
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This isn't actually an issue but more of a comment. I modified ExportService.php to get the URL of images. I'll leave it here and perhaps it will help someone else. Thanks for the code, bro.
public function parseFieldData($handle, $data)
{
The text was updated successfully, but these errors were encountered: