Пример кода, который позволяет убрать ссылку "Show/Hide row weights".
Шаг 1. Альтерим форму, для того, что бы добавить свой js файл:
/**
* Implements hook_form_FORM_ID_alter().
*/
function custom_form_node_form_alter(&$form, &$form_state) {
$form['#attached']['js'][] = array(
'data' => drupal_get_path('module', custom') . '/js/custom-tabledrag.js',
'weight' => -2,
);
}
Шаг 2. Убираем ссылку в js файле:
// Namespace.
var customTableDrag = customTableDrag || {};
(function($) {
Drupal.behaviors.customTableDrag = {
attach: function(context, settings) {
customTableDrag.hideShowRowWeights();
}
};
/**
* Remove "Hide/Show row weights" toggle in tabledrag.
*/
customTableDrag.hideShowRowWeights = function() {
// Копируем оригинальный метод initColumns().
var initColumns = Drupal.tableDrag.prototype.initColumns;
Drupal.tableDrag.prototype.initColumns = function() {
// Вызываем оригинальный метод initColumns().
initColumns.call(this);
// Убираем ссылку "Hide/Show row weights".
$('a.tabledrag-toggle-weight').unbind('click')
.parents('div.tabledrag-toggle-weight-wrapper')
.remove();
};
};
})(jQuery);