diff options
-rw-r--r-- | includes/theme.inc | 4 | ||||
-rw-r--r-- | modules/book/book.module | 8 | ||||
-rw-r--r-- | modules/translation/translation.module | 2 | ||||
-rw-r--r-- | modules/translation/translation.test | 7 |
4 files changed, 14 insertions, 7 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 9bd706209..3ae50006a 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -985,7 +985,7 @@ function drupal_find_theme_functions($cache, $prefixes) { // start with. The default is the name of the hook followed by '__'. An // 'base hook' key is added to each entry made for a found suggestion, // so that common functionality can be implemented for all suggestions of - // the same base hook. To keep things simple, deep heirarchy of + // the same base hook. To keep things simple, deep hierarchy of // suggestions is not supported: each suggestion's 'base hook' key // refers to a base hook, not to another suggestion, and all suggestions // are found using the base hook's pattern, not a pattern from an @@ -995,7 +995,7 @@ function drupal_find_theme_functions($cache, $prefixes) { $matches = preg_grep('/^' . $prefix . '_' . $pattern . '/', $functions['user']); if ($matches) { foreach ($matches as $match) { - $new_hook = str_replace($prefix . '_', '', $match); + $new_hook = substr($match, strlen($prefix) + 1); $arg_name = isset($info['variables']) ? 'variables' : 'render element'; $implementations[$new_hook] = array( 'function' => $match, diff --git a/modules/book/book.module b/modules/book/book.module index 82d38f713..de9561fec 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -279,10 +279,10 @@ function book_block_view($delta = '') { } elseif ($current_bid) { // Only display this block when the user is browsing a book. - $select = db_select('node'); - $select->addField('node', 'title'); - $select->condition('nid', $node->book['bid']); - $select->addTag('node_access'); + $select = db_select('node', 'n') + ->fields('n', array('title')) + ->condition('nid', $node->book['bid']) + ->addTag('node_access'); $title = $select->execute()->fetchField(); // Only show the block if the user has view access for the top-level node. if ($title) { diff --git a/modules/translation/translation.module b/modules/translation/translation.module index 1fd12a5ee..697929f66 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -133,7 +133,7 @@ function translation_form_node_form_alter(&$form, &$form_state) { // might need to distinguish between enabled and disabled languages, hence // we divide them in two option groups. if ($translator_widget) { - $options = array(); + $options = array($groups[1] => array(LANGUAGE_NONE => t('Language neutral'))); $language_list = locale_language_list('name', TRUE); foreach (array(1, 0) as $status) { $group = $groups[$status]; diff --git a/modules/translation/translation.test b/modules/translation/translation.test index c4a04c4cf..fa8c6b63f 100644 --- a/modules/translation/translation.test +++ b/modules/translation/translation.test @@ -125,6 +125,13 @@ class TranslationTestCase extends DrupalWebTestCase { $translation_it = $this->createTranslation($node, $this->randomName(), $this->randomName(), 'it'); $this->assertRaw($translation_it->body['it'][0]['value'], t('Content created in Italian (disabled).')); + // Confirm that language neutral is an option for translators when there are + // disabled languages. + $this->drupalGet('node/add/page'); + $this->assertFieldByXPath('//select[@name="language"]//option', LANGUAGE_NONE, t('Language neutral is available in language selection with disabled languages.')); + $node2 = $this->createPage($this->randomName(), $this->randomName(), LANGUAGE_NONE); + $this->assertRaw($node2->body[LANGUAGE_NONE][0]['value'], t('Language neutral content created with disabled languages available.')); + // Leave just one language enabled and check that the translation overview // page is still accessible. $this->drupalLogin($this->admin_user); |