function state_flow_entity_form_content_type_render in State Machine 7.3
Render the custom content type.
1 string reference to 'state_flow_entity_form_content_type_render'
- state_flow_entity_form.inc in modules/
state_flow_entity/ plugins/ content_types/ state_flow_entity_form.inc
File
- modules/
state_flow_entity/ plugins/ content_types/ state_flow_entity_form.inc, line 68
Code
function state_flow_entity_form_content_type_render($subtype, $conf, $panel_args, $context) {
if (empty($context) || empty($context->data)) {
return;
}
$entity_type = $subtype;
// The form might be for the entity passed into this function or for the
// "active" entity.
if (!empty($conf['entity_to_use']) && $conf['entity_to_use'] == 'active') {
$entity_info = entity_get_info($entity_type);
$revision_key = $entity_info['entity keys']['revision'];
// Get the active revision id.
$machine = state_flow_entity_load_state_machine($context->data, $entity_type);
$active_revision_id = $machine
->get_active_revision();
// Get the active revision object.
$conditions = array(
$revision_key => $active_revision_id,
);
// @todo, can original_argument be trusted as the entity_id?
$entities = entity_load($entity_type, array(
$context->original_argument,
), $conditions);
$entity = array_pop($entities);
// Sometimes original_argument is not available and entity is empty.
if (empty($entity)) {
$entity = $context->data;
}
}
else {
$entity = $context->data;
}
$form_options = array(
'assemble_page_title' => FALSE,
'event_element_type' => 'select',
);
module_load_include('inc', 'state_flow_entity', 'state_flow_entity.forms');
$output = drupal_get_form('state_flow_entity_events_revision', $entity, $entity_type, NULL, $form_options);
// Build the content type block.
$block = new stdClass();
$block->module = 'state_flow_entity';
if ($conf['label'] == 'title' && isset($field_output['#title'])) {
$block->title = '';
}
$block->content = $output;
$block->delta = $ids[0];
return $block;
}