pushing node content across, including image styles

master
Marek Isalski 7 years ago
parent a0ea39ecd1
commit ff08a6eb1c

@ -593,20 +593,50 @@ function _fulcrm_campaign_admin_campaign_sync_build( $fcid, $fetch = false, $err
->orderBy( 'fulcrm_campaign_node.weight' );
foreach ( $query->execute() as $row ) {
$node = node_load( $row->nid );
$node_view = node_view( $node, 'full' );
$node_data = array( 'title' => $node->title,
//'date' => $node->date,
//'node_url' => $node->url,
//'submitted' => $submitted,
//'nid' => $node->nid,
//'type' => $node->type,
( 'is_node_type_' . $node->type . '?' ) => true,
);
if ( $node ) {
$uri = entity_uri( 'node', $node );
$node_data = array( ( 'is_node_type_' . $node->type . '?' ) => TRUE,
'node_url' => url( $uri[ 'path' ], $uri[ 'options' ] ),
'node_url_absolute' => url( $uri[ 'path' ], array_merge( $uri[ 'options' ], array( 'absolute' => TRUE ) ) ),
'date' => format_date( $node->created ),
'name' => theme( 'username', array( 'account' => $node ) ),
);
foreach ( get_object_vars( $node ) as $k => $v ) {
switch ( $k ) {
case 'data':
$node_data[ 'data' ] = unserialize( $v );
break;
default:
if ( strpos( $k, 'field_' ) === 0 ) {
$v = _fulcrm_campaign_admin_array_copy( $v );
$v[ 'is_field?' ] = TRUE;
foreach ( $v as $lang => $langitems ) {
$user = $old_user;
for ( $i = 0; $i < count( $langitems ); $i++ ) {
$v[ $lang ][ $i ][ 'is_field_value?' ] = TRUE;
if ( array_key_exists( 'filemime', $langitems[ $i ] ) ) {
if ( strpos( $langitems[ $i ][ 'filemime' ], 'image/' ) === 0 ) {
$v[ 'is_image_field?' ] = TRUE;
$v[ $lang ][ $i ][ 'is_image?' ] = TRUE;
foreach ( image_styles() as $imagestyle => $styledata ) {
$v[ $lang ][ $i ][ 'image_style_' . $imagestyle . '_url' ] = image_style_url( $imagestyle, $v[ $lang ][ $i ][ 'uri' ] );
$v[ $lang ][ $i ][ 'image_style_' . $imagestyle . '_url_absolute' ] = url( $v[ $lang ][ $i ][ 'image_style_' . $imagestyle . '_url' ], array( 'absolute' => TRUE ) );
}
}
}
}
}
}
$node_data[ $k ] = $v;
break;
}
}
$fms_content[ 'node_' . $node->nid ] = $node_data;
$campaign[ $row->name ] = $row->value;
}
}
$campaign[ 'd' ][ 'fms_content' ] = $fms_content;
$campaign[ 'd' ][ 'fms_content_list' ] = array_keys( $fms_content );

Loading…
Cancel
Save