I love the new version of Custom Breadcrumbs, it's a lot more flexible and useful that the 1.x line. Great improvements have happened!

However, I do not like the custom breadcrumb section on the node add/edit pages at all. I know it's only when I'm logged in as admin, or someone with permission to configure the breadcrumbs, but it always floats to the top of the node form, and to me is an eyesore that I don't use from there at all, and likely never would want to.

Can we integrate a setting that will allow that to be turned off? I'd even prefer it was turned off by default, but that's just me.

If this is of interest, and would be an accepted feature, I can submit a patch.

Comments

ManyNancy’s picture

Please, I hate it! Thanks.

MGN’s picture

Status: Active » Closed (won't fix)

Thanks for the feedback. This fieldset was added as a feature request sometime ago to make it easier to determine what custom breadcrumb(s) were being assigned for a given node. I think there is more work to be done to improve this form element. Perhaps lower down on the page (near the url/pathauto settings) would be more appropriate. I hesitate to add another global config to control this fieldset because it is easy enough to remove it if you don't like it.

Most sites tend to gather site-specific modifications (hacks) in a simple module. If your mods are in yourmodulename, you can add the following code to remove the custom breadcrumb fieldset from node edit forms:

/**
 * Implementation of hook_form_alter().
 */
function yourmodulename_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
    // Remove the custom breadcrumbs fieldset for node edit forms.
    unset($form['custom_breadcrumbs']);
  }
}

You could take the same approach to just move it lower in the form if you like:

/**
 * Implementation of hook_form_alter().
 */
function yourmodulename_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
    // Modify the position of the custom breadcrumbs fieldset on node edit forms.
    $form['custom_breadcrumbs']['#weight'] = 50;
  }
}

(note that you should give your yourmodulename module a greater weight in the system table than the custom breadcrumbs module (and probably most other modules) since you want your modifications to run after custom breadcrumbs)

This accomplishes the feature request, but with less code and clutter for the custom breadcrumbs module.

I would still appreciate feedback on how to improve the fieldset to it is more useful.

ManyNancy’s picture

Category: feature » bug
Status: Closed (won't fix) » Active

I don't understand this logic, custom breadcrumbs introduced a feature that many people don't need which destroyed the forms but expects users to create ANOTHER module to remove it?

It should be up to this module to make this 'feature' optional.

MGN’s picture

Category: bug » feature

This is not a bug, it is by design. If you would like to add an option to remove it, please submit a patch and I would be happy to review it. I look forward to your contribution.

demian’s picture

Why not just commenting out ?

custom_breadcrumbs.module

  elseif (user_access('administer custom breadcrumbs') && isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
    // Provide a custom breadcrumbs fieldset for node edit forms.
/*    $node = $form['#node'];
    // Load all custom breadcrumbs for this node type.
    $breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs', 'custom_breadcrumb', array('node_type' => $form['type']['#value']));
    foreach (module_implements('cb_node_form_table') as $module) {
      $func = $module .'_cb_node_form_table'; 
      $more = $func($node);
      if (!empty($more)) {
        $breadcrumbs = array_merge($breadcrumbs, $more);
      }
    }

    $output = NULL;
    if (count($breadcrumbs) > 0) {
      $output = '<p>'. t('Custom breadcrumbs have been created for this %type page. Use the <a href="@link">Custom Breadcrumbs Administration Page</a> to add additional breadcrumbs, or follow the links in the table below to edit or delete existing custom breadcrumbs.', array('%type' => $form['type']['#value'], '@link' => url('admin/build/custom_breadcrumbs'))) .'</p>';
    }
    // Show a table of custom breadcrumbs with links to the edit form.
    module_load_include('inc', 'custom_breadcrumbs', 'custom_breadcrumbs.admin');

    $output .= custom_breadcrumbs_simple_breadcrumb_table($breadcrumbs);
    $form['custom_breadcrumbs'] = array(
      '#type'           => 'fieldset',
      '#title'          => t('Custom Breadcrumbs'),
      '#access'         => user_access('administer custom breadcrumbs'),
      '#group'          => 'additional_settings',
      '#collapsible'    => TRUE,
      '#collapsed'      => TRUE,
      '#weight'         => -50,
    );
    $form['custom_breadcrumbs']['breadcrumb_table'] = array('#value' => $output, ); */
  }
}
RedTop’s picture

Enabled, disabled... it's not the real issue here.

Right now it just doesn't behave like every other contrib content field. It would be nice to be able to manage it through the CCK 'manage fields' form. That way everyone can decide for themselves if they want it and, if so, where they want it.

Personally, I would disable it straight away as it doesn't offer anything I would use. I mean, being an admin and having installed the module I know I can find its settings in the administration menu. I don't need another tab taking up space just to provide me with a link to the admin page. So, I'm with himerus and ManyNancy on this one. @Demian: yes, that's a way to do this, but not a clean way. This would mean you have to go in every time you update the module. I can see a developer doing so (reluctantly) but customers just want a site that works the way they expect it to work...

I can only see this being useful if it allows you to edit the custom breadcrumb in the node add/edit form. So many people, so many views, hey? :P

I created a custom module like you suggested for the time being. Thanks for the snippet. :)

hedac’s picture

I would disable it... but at least... I don't want it to be on top of all other fields... at least it would be good to be able to move it down

MGN’s picture

Status: Active » Closed (fixed)

Thanks for the input on this, but again, this is what the theme system is for. For any module, if you personally don't like the way something is laid out, you have the ability to modify it through your theme or a custom module (see #2 above). This is really not difficult to do, and quite a powerful feature of Drupal. All the flexibility you need is already provided, you just need to learn to take advantage of it.

I am closing this issue for now, but if anyone would like to contribute code to improve the UI, I would be happy to review it.

MGN’s picture

Status: Closed (fixed) » Fixed

This feature has now been committed to 6.x-2.x-dev.

You can now set the weight of the custom breadcrumbs fieldset by managing the fields for the node on the content types page (Administer > Content Management > Content Types). If you edit the content type, you'll find a checkbox that will control whether or not the custom breadcrumbs fieldset is displayed on the node edit page. The default behavior is to show the fieldset, so if you want to turn it off for most (or all) of your content types without having to go through and edit each, you can change the default to not show the fieldset. Just edit custom_breadcrumbs.module and change line 10 define('CUSTOM_BREADCRUMBS_SHOW_FORM_TABLE_DEFAULT', 1); - just change the 1 to a 0.

RedTop’s picture

That's fantastic, thank you very much!

[edit]
I immediately upgraded and must say it works beautifully! Great way of implementing this! Allowed me to get rid of some site-specific custom modules. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bartezz’s picture

Thanx for implementing this feature!