pushing node content across, including image styles

master
Marek Isalski 7 years ago
parent a0ea39ecd1
commit ff08a6eb1c

@ -562,7 +562,7 @@ function _fulcrm_campaign_admin_campaign_sync_build( $fcid, $fetch = false, $err
} }
} }
$query = db_select( 'fulcrm_campaign' )->fields( 'fulcrm_campaign', array( 'fcid', 'name', 'subject') )->condition( 'fulcrm_campaign.fcid', $fcid ); $query = db_select( 'fulcrm_campaign' )->fields( 'fulcrm_campaign', array( 'fcid', 'name', 'subject' ) )->condition( 'fulcrm_campaign.fcid', $fcid );
foreach ( $query->execute() as $row ) { foreach ( $query->execute() as $row ) {
$campaign[ 'name' ] = $row->name; $campaign[ 'name' ] = $row->name;
$campaign[ 'subject' ] = $row->subject; $campaign[ 'subject' ] = $row->subject;
@ -593,20 +593,50 @@ function _fulcrm_campaign_admin_campaign_sync_build( $fcid, $fetch = false, $err
->orderBy( 'fulcrm_campaign_node.weight' ); ->orderBy( 'fulcrm_campaign_node.weight' );
foreach ( $query->execute() as $row ) { foreach ( $query->execute() as $row ) {
$node = node_load( $row->nid ); $node = node_load( $row->nid );
$node_view = node_view( $node, 'full' ); if ( $node ) {
$uri = entity_uri( 'node', $node );
$node_data = array( 'title' => $node->title, $node_data = array( ( 'is_node_type_' . $node->type . '?' ) => TRUE,
//'date' => $node->date, 'node_url' => url( $uri[ 'path' ], $uri[ 'options' ] ),
//'node_url' => $node->url, 'node_url_absolute' => url( $uri[ 'path' ], array_merge( $uri[ 'options' ], array( 'absolute' => TRUE ) ) ),
//'submitted' => $submitted, 'date' => format_date( $node->created ),
//'nid' => $node->nid, 'name' => theme( 'username', array( 'account' => $node ) ),
//'type' => $node->type, );
( 'is_node_type_' . $node->type . '?' ) => true,
); 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; $fms_content[ 'node_' . $node->nid ] = $node_data;
$campaign[ $row->name ] = $row->value; $campaign[ $row->name ] = $row->value;
} }
}
$campaign[ 'd' ][ 'fms_content' ] = $fms_content; $campaign[ 'd' ][ 'fms_content' ] = $fms_content;
$campaign[ 'd' ][ 'fms_content_list' ] = array_keys( $fms_content ); $campaign[ 'd' ][ 'fms_content_list' ] = array_keys( $fms_content );

Loading…
Cancel
Save