I assume you performed the steps similar to what is documented in my answer to "How to send out email based on matching taxonomy terms in user profiles?". And while doing so, you probably used a field name like body-from-view
in the "Rules" display of your view. I'm not sure if it is the only way to get it to work, but below is a possible solution to answer your question ...
Part 1 - Getting it to work
Define the body field 3 times in your view
When adding the "body" as a field in your view, add that field 3 times. And when configuring these Views fields, make sure to use these field formatters:
- Default (for the 1st "body" field).
- Trimmed (for the 2nd "body" field).
- Summary or trimmed (for the 3rd "body" field).
Select the 3 body fields 3 times in your view
When you edit the Rules settings of your view (by using the link that says "edit field info"), use 3 separate variables for each of the 3 body fields, e.g using machine names that look something like so:
- body-default
- body-trimmed
- body-summary-or-trimmed
I'm not sure (yet) about the most appropriate "data type" to use for these 3 variables, but in my case I just used "text".
Create your Rules Component using appropriate tokens
- Within the Rules Actions of your Rules Component, use the link that says
Add view loop
to add a Views loop, and select the "Rules" display created in the previous step.
Within that Views loop add whatever Rules Action that fits your needs. E.g. to get started, just perform "Show a message on the site". At that point, you should have access to these token values that you're looking for (if you use the same machine names as suggested above):
[body-default:value]
[body-trimmed:value]
[body-summary-or-trimmed:value]
Part 2 - Showtime
Here is an example of the execution of a rules component, in which I implemented what's mentioned in "Part 1", using a Rules Action to show a message on the site, and which looks like so:
<hr />
Details about node with id = [node-nid:value] and title = [node-title:value]:<br /><br />
- <strong>body-summary-or-trimmed</strong> = [body-summary-or-trimmed:value]<br />
- <strong>body-trimmed</strong> = [body-trimmed:value]<br />
- <strong>body-default</strong> = [body-default:value]<br />
<br /><hr />
After executing it, and with 3 nodes that were included in my Views result, the result looks like so:
Details about node with id = 163 and title = Node with summary and separator line:
- body-summary-or-trimmed = <p>This is the summary of this node ... and there is really nothing else after this (in this summary) ...</p>
- body-trimmed = <p>This is the body of this node, which <strong>does have a summary also</strong> ...</p> <p>It has multiple lines, and the separator line is inserted right here ...</p>
- body-default = <p>This is the body of this node, which <strong>does have a summary also</strong> ...</p> <p>It has multiple lines, and the separator line is inserted right here ...</p> <p>And from here on there is even more content (after the separator line ...)</p> <p>Some more lines (1).</p> <p>Some more lines (2).</p> <p>Some more lines (3).</p> <p>Some more lines (4).</p>
Details about node with id = 162 and title = Node without a summary but with a separator line:
- body-summary-or-trimmed = <p>This is the body of a node which <strong>does not have a summary</strong> ...</p> <p>It has multiple lines, and the separator line is inserted right here ...</p>
- body-trimmed = <p>This is the body of a node which <strong>does not have a summary</strong> ...</p> <p>It has multiple lines, and the separator line is inserted right here ...</p>
- body-default = <p>This is the body of a node which <strong>does not have a summary</strong> ...</p> <p>It has multiple lines, and the separator line is inserted right here ...</p> <p>And from here on there is even more content (after the separator line ...)</p> <p>Some more lines (1).</p> <p>Some more lines (2).</p> <p>Some more lines (3).</p> <p>Some more lines (4).</p>
Details about node with id = 161 and title = Node without a summary and without a separator line :
- body-summary-or-trimmed = <p>This is the body of this node, which <strong>does NOT have a summary</strong> ...</p> <p>It has multiple lines, <strong>but no separator line</strong> ...</p>
- body-trimmed = <p>This is the body of this node, which <strong>does NOT have a summary</strong> ...</p> <p>It has multiple lines, <strong>but no separator line</strong> ...</p>
- body-default = <p>This is the body of this node, which <strong>does NOT have a summary</strong> ...</p> <p>It has multiple lines, <strong>but no separator line</strong> ...</p> <p>And there is even more content ...</p> <p>Some more lines (1).</p> <p>Some more lines (2).</p> <p>Some more lines (3).</p> <p>Some more lines (4).</p>
Component rule: Views Rules demonstration has been executed.
Part 3 - Pieces of the puzzle
Exported View
Here is an export of the view I created (use the Views UI to import it in your own site, adapt the filter criteria to fit your needs):
$view = new view();
$view->name = 'details_about_nodes';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Details about nodes';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Details about nodes';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'title' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
/* Field: Content: Body */
$handler->display->display_options['fields']['body_1']['id'] = 'body_1';
$handler->display->display_options['fields']['body_1']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body_1']['field'] = 'body';
$handler->display->display_options['fields']['body_1']['label'] = 'Body - Summary or trimmed';
$handler->display->display_options['fields']['body_1']['type'] = 'text_summary_or_trimmed';
$handler->display->display_options['fields']['body_1']['settings'] = array(
'trim_length' => '200',
);
/* Field: Content: Body */
$handler->display->display_options['fields']['body_2']['id'] = 'body_2';
$handler->display->display_options['fields']['body_2']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body_2']['field'] = 'body';
$handler->display->display_options['fields']['body_2']['label'] = 'Body - Trimmed';
$handler->display->display_options['fields']['body_2']['type'] = 'text_trimmed';
$handler->display->display_options['fields']['body_2']['settings'] = array(
'trim_length' => '200',
);
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = 'Body - Default';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'page' => 'page',
);
/* Filter criterion: Content: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['operator'] = '>';
$handler->display->display_options['filters']['nid']['value']['value'] = '10';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'details-about-nodes';
/* Display: ListToCreateRulesLoop */
$handler = $view->new_display('views_rules', 'ListToCreateRulesLoop', 'views_rules_1');
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['rules_variables'] = array(
'title' => array(
'enabled' => 1,
'rendered' => 0,
'type' => 'text',
'label' => 'Content: Title',
'name' => 'node_title',
),
'nid' => array(
'enabled' => 1,
'rendered' => 0,
'type' => 'integer',
'label' => 'Nid',
'name' => 'node_nid',
),
'body_1' => array(
'enabled' => 1,
'rendered' => 1,
'type' => 'text',
'label' => 'Body - Summary or trimmed',
'name' => 'body_summary_or_trimmed',
),
'body_2' => array(
'enabled' => 1,
'rendered' => 1,
'type' => 'text',
'label' => 'Body - Trimmed',
'name' => 'body_trimmed',
),
'body' => array(
'enabled' => 1,
'rendered' => 1,
'type' => 'text',
'label' => 'Body - Default',
'name' => 'body_default',
),
);
Exported Rules Component
Here is an export of the Rules Component I created (use the Rules UI to import it in your own site, adapt the Rules Conditions to fit your needs):
{ "rules_views_rules_demonstration" : {
"LABEL" : "Views Rules demonstration",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"IF" : [
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "3" : "3" } }
}
}
],
"DO" : [
{ "VIEW LOOP" : {
"VIEW" : "details_about_nodes",
"DISPLAY" : "views_rules_1",
"ROW VARIABLES" : {
"node_title" : { "node_title" : "Content: Title" },
"node_nid" : { "node_nid" : "Nid" },
"body_summary_or_trimmed" : { "body_summary_or_trimmed" : "Body - Summary or trimmed" },
"body_trimmed" : { "body_trimmed" : "Body - Trimmed" },
"body_default" : { "body_default" : "Body - Default" }
},
"DO" : [
{ "drupal_message" : { "message" : "\u003Chr \/\u003E\r\nDetails about node with id = [node-nid:value] and title = [node-title:value]:\u003Cbr \/\u003E\u003Cbr \/\u003E\r\n- \u003Cstrong\u003Ebody-summary-or-trimmed\u003C\/strong\u003E = [body-summary-or-trimmed:value]\u003Cbr \/\u003E\r\n- \u003Cstrong\u003Ebody-trimmed\u003C\/strong\u003E = [body-trimmed:value]\u003Cbr \/\u003E\r\n- \u003Cstrong\u003Ebody-default\u003C\/strong\u003E = [body-default:value]\u003Cbr \/\u003E\r\n\u003Cbr \/\u003E\u003Chr \/\u003E" } }
]
}
}
]
}
}