You are here

function tmgmt_ui_embed_view in Translation Management Tool 7

Embed a view but don't render it if it's empty.

Parameters

string $view: The machine-readable name of the view.

string $display_id: The display id for the view.

array $args: The arguments that should be passed to the view.

Return value

The rendered view or an empty string if the view doesn't exist if it was empty.

2 calls to tmgmt_ui_embed_view()
tmgmt_job_form in ui/includes/tmgmt_ui.pages.inc
Entity API form the job entity.
tmgmt_ui_translation_review_form_defaults in ui/tmgmt_ui.module
Form wrapper callback for the job item review form.

File

ui/tmgmt_ui.module, line 215
Common Translation managment UI.

Code

function tmgmt_ui_embed_view($view, $display_id = NULL, array $args = array()) {
  $view = views_get_view($view);
  if (!empty($view)) {
    $view
      ->init_display();
    $output = $view
      ->preview($display_id, $args);
    if (!empty($view->result)) {
      return $output;
    }
  }
  return '';
}