You are here

function hosting_task_set_title in Hosting 7.3

Same name and namespace in other branches
  1. 5 task/hosting_task.module \hosting_task_set_title()
  2. 6.2 task/hosting_task.module \hosting_task_set_title()
  3. 7.4 task/hosting_task.module \hosting_task_set_title()

Set the title of tasks automatically and in a consistent way.

Tasks should always be named 'task_type node_title'.

2 calls to hosting_task_set_title()
hosting_task_insert in task/hosting_task.module
Implements hook_insert().
hosting_task_update in task/hosting_task.module
Implements hook_update().

File

task/hosting_task.module, line 704
Web server node type is defined here.

Code

function hosting_task_set_title(&$node) {
  $ref = node_load($node->rid);
  $tasks = hosting_available_tasks($ref->type);
  $ref_title = $ref->type == 'site' ? hosting_site_canonical_url($ref) : $ref->title;
  $node->title = drupal_ucfirst($tasks[$node->task_type]['title']) . ': ' . $ref_title;
  db_update('node')
    ->fields(array(
    'title' => $node->title,
  ))
    ->condition('nid', $node->nid)
    ->execute();
  db_update('node_revision')
    ->fields(array(
    'title' => $node->title,
  ))
    ->condition('vid', $node->vid)
    ->execute();
}