Image galleries is hardcoded as one level of the breadcrumb in the following line of image_gallery.pages.inc.
$breadcrumb[] = l(t('Image galleries'), 'image');

I changed the line to the following and the breadcrumb works nicely.

$vocabulary = taxonomy_vocabulary_load($gallery->vid);
$breadcrumb[] = l(t($vocabulary->name), 'image');

Now for that Image galleries page title.
Image_gallery.admin.inc:
image_gallery_admin_settings():

  $form['gallery']['image_image_gallery_page_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title for the page listing the galleries'),
    '#default_value' => variable_get('image_image_gallery_page_title', 'Image galleries'),
    '#size' => 50,
    '#description' => t('Sets the title for the page listing the galleries.'),
  );

Image_gallery.module:
image_gallery_menu():
Replace:
'title' => 'Image galleries',
with:
'title' => variable_get('image_image_gallery_page_title', 'Image galleries'),

CommentFileSizeAuthor
#4 change_title.patch973 bytespeterx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Needs work

Using the vocab name instead of a hardcoded string seems a good idea.

But your changes aren't consistent -- if you're using the vocab name in the breadcrumb, why then use a new admin setting for the page title?

And on top of that, I'd rather we didn't add any more variables, especially in this case when there's already a nice place to store it.

You'd need to add a menu cache clear to the submit handler for the image galleries content admin form, so that when you save the vocab name the menu is rebuilt.

Also, please note that changes to code should be posted as a patch file -- the documentation section on this site has details on how to make one.

peterx’s picture

@joachim I put the changes up more for discussion than a final patch. Your feedback made me think about why I made the changes that way. I guess the code would need documentation.

In my one implementation, the galleries page is the top level in the menu and there is only one gallery, not much room for testing. I might attempt a patch after I have some more implementations and a wider range of testing.

The breadcrumb kicks in after we select a gallery, which means we know the vocabulary. I think this should always work and could go straight to a patch.

The image galleries page displays a list of galleries, which means a list of vocabularies. My site with only one gallery happens to have the same name for the page as the name of the first vocabulary. There would be a problem when you have several vocabularies. The vocabulary name could work if you can make the list of galleries as one vocabulary and have each gallery as a child vocabulary. I have not looked into all the options for this part. Perhaps I should make a patch for the breadcrumb and submit a different issue for the page title.

peterx’s picture

Title: Replace Image galleries with vocabulary name. » Replace Image gallery title with vocabulary name.

I separated out the Image gallery page title discussion to http://drupal.org/node/957386.

peterx’s picture

FileSize
973 bytes

Here is the patch for using the vocab name as a title.