backdrop-contrib / node_clone

Allows users to make a copy of an existing node and then edit that copy easily. Has also been used by some to facilitate node templating.
GNU General Public License v2.0
1 stars 5 forks source link

Missing option to disable title prefix #12

Closed yorkshire-pudding closed 3 days ago

yorkshire-pudding commented 2 years ago

When a node is cloned, the title is prefixed with "Clone of "

I wondered if this should be possible so searched the code base for the phrase. Lines 245-247 of clone.pages.inc

  if ($prefix_title) {
    $node->title = t('Clone of !title', array('!title' => $node->title));
  }

Searched for $prefix_title and found where it looks like it should be set: Within function clone_action_clone_form($context) Lines 301-306 of clone.module

 $form['clone_context']['prefix_title'] = array(
    '#title' => t('Prefix title'),
    '#type' => 'checkbox',
    '#description' => t('Should cloned node tiles be prefixed?'),
    '#default_value' => isset($context['clone_context']['prefix_title']) ? $context['clone_context']['prefix_title'] : 1,
  );

Seems to be other stuff in that function that gives the option for substituting strings in title or body. I can't see that function anywhere in the config screens. I could hack the module to remove the prefixing but that doesn't seem a sustainable way forward. Any ideas how to get this form to show up and take effect?

yorkshire-pudding commented 1 year ago

It looks like clone_action_clone_form() in clone.module is not used. However the calls to _clone_node_prepare all seem to set to TRUE anyway. I've added a PR that adds this option into the global settings and then gets the config value where this function is called.

@backdrop-contrib/bug-squad - as there is no maintainer, will you consider this?

@klonos @herbdool - as you've previously been involved in this issue queue I'm tagging you here.