You are here

function theme_features_lock_link in Features 7.2

Themes a lock link.

Parameters

array $vars: Variables for this theme hook.

Return value

string Rendered HTML.

3 theme calls to theme_features_lock_link()
features_admin_components in ./features.admin.inc
Form builder for 'admin/structure/features/%feature'.
features_admin_lock in ./features.admin.inc
Page callback to lock or unlock a component.
template_preprocess_features_admin_components in theme/theme.inc
Display feature component info.

File

theme/theme.inc, line 146
Theme functions and (pre)processors for 'features' module.

Code

function theme_features_lock_link($vars) {
  drupal_add_library('system', 'ui');
  drupal_add_library('system', 'drupal.ajax');
  $component = $vars['component'] ? $vars['component'] : '';
  if ($component && features_component_is_locked($component)) {
    return l(t('Component locked'), 'admin/structure/features/settings', array(
      'attributes' => array(
        'class' => 'features-lock-icon ui-icon ui-icon-locked',
        'title' => t('This component is locked on a global level.'),
      ),
      'fragment' => 'edit-lock-components',
    ));
  }
  $feature = $vars['feature'];
  $is_locked = features_feature_is_locked($feature, $component);
  $options = array(
    'attributes' => array(
      'class' => array(
        'use-ajax features-lock-icon ui-icon ' . ($is_locked ? ' ui-icon-locked' : ' ui-icon-unlocked'),
      ),
      'id' => 'features-lock-link-' . $feature . ($component ? '-' . $component : ''),
      'title' => $is_locked ? t('This item is locked and features will not be rebuilt or reverted.') : t('This item is unlocked and will be rebuilt/reverted as normal.'),
    ),
    'query' => array(
      'token' => drupal_get_token('features/' . $feature . '/' . $component),
    ),
  );
  $path = "admin/structure/features/" . $feature . "/lock/nojs" . ($component ? '/' . $component : '');
  return l($is_locked ? t('UnLock') : t('Lock'), $path, $options);
}