Skip to content

Instantly share code, notes, and snippets.

@markhalliwell
Last active December 20, 2015 02:49
Show Gist options
  • Select an option

  • Save markhalliwell/6059539 to your computer and use it in GitHub Desktop.

Select an option

Save markhalliwell/6059539 to your computer and use it in GitHub Desktop.
<?php
function MODULE_form_alter(&$form, $form_state, $form_id) {
if (!empty($form['#node'] && !empty($form['#node_edit_form'])) {
$node = $form['#node'];
$action = in_array('add', args()) ? t('Create new') : t('Edit existing');
switch ($node->type) {
case 'article': drupal_set_title(t('!action basic article', array('!action' => $action))); break;
case 'blog': drupal_set_title(t('!action blog article', array('!action' => $action))); break;
case 'audio': drupal_set_title(t('!action audio conent', array('!action' => $action))); break;
case 'whitepaper': drupal_set_title(t('!action white-paper', array('!action' => $action))); break;
case 'video': drupal_set_title(t('!action video content', array('!action' => $action))); break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment