You are here

sticky_edit_actions.module in Sticky Edit Actions 7

File

sticky_edit_actions.module
View source
<?php

/**
 * Implements hook_form_alter().
 */
function sticky_edit_actions_form_alter(&$form, &$form_state, $form_id) {
  $module_filter_state = module_exists('module_filter');
  $admin_path_state = path_is_admin($current_path = current_path());
  if ($admin_path_state && !($module_filter_state && $current_path === 'admin/modules')) {
    $path = drupal_get_path('module', 'sticky_edit_actions');

    // Add CSS.
    $form['#attached']['css'][] = $path . '/css/sticky-edit-actions.css';

    // Add JS.
    $form['#attached']['js'][$path . '/js/waypoints.min.js'] = array(
      'type' => 'file',
      'weight' => 99,
    );
    $form['#attached']['js'][$path . '/js/waypoints-sticky.min.js'] = array(
      'type' => 'file',
      'weight' => 100,
    );
    $form['#attached']['js'][$path . '/js/sticky-edit-actions.js'] = array(
      'type' => 'file',
      'weight' => 101,
    );

    // Add class.
    $form['actions']['#attributes']['class'][] = 'my-sticky-element';
  }
}

/**
 * Implements hook_media_edit_multiple_form_alter().
 */
function sticky_edit_actions_media_edit_multiple_form_alter(&$form) {
  $form['actions'] = $form['buttons'];
  $form['actions']['#type'] = 'actions';
  unset($form['buttons']);
  $form_state = array();
  sticky_edit_actions_form_alter($form, $form_state, 'media_edit_multiple_form');
}

Functions

Namesort descending Description
sticky_edit_actions_form_alter Implements hook_form_alter().
sticky_edit_actions_media_edit_multiple_form_alter Implements hook_media_edit_multiple_form_alter().