View source
<?php
include_once 'bear_necessities.features.inc';
function bear_necessities_form_node_type_form_alter(&$form, &$form_state, $form_id) {
if (empty($form['#node_type']->type)) {
$form['submission']['node_preview']['#default_value'] = DRUPAL_DISABLED;
$form['workflow']['node_options']['#default_value'] = array(
'status',
'revision',
);
$form['display']['node_submitted']['#default_value'] = FALSE;
if (module_exists('comment')) {
$form['comment']['comment']['#default_value'] = COMMENT_NODE_HIDDEN;
}
}
}
function bear_necessities_form_node_form_alter(&$form, &$form_state) {
unset($form['options']['sticky']);
unset($form['options']['promote']);
if (module_exists('workbench_moderation') && isset($form['revision_information']['workbench_moderation_state_new'])) {
return;
}
if (!user_access('view revisions')) {
if (isset($form['revision_information']['#access'])) {
$form['revision_information']['#access'] = FALSE;
}
}
}
function bear_necessities_form_ckeditor_admin_profile_form_alter(&$form, &$form_state) {
if (empty($form['advanced']['js_conf']['#default_value'])) {
$form['advanced']['js_conf']['#default_value'] = 'config.allowedContent = true;';
}
}
function bear_necessities_menu_block_blocks() {
return array(
'bear_necessities-1' => array(
'menu_name' => 'main-menu',
'parent_mlid' => 0,
'title_link' => 0,
'admin_title' => '',
'level' => 1,
'follow' => 0,
'depth' => 0,
'expanded' => 0,
'sort' => 0,
),
);
}
function bear_necessities_library_alter(&$libraries, $module) {
if ($module === 'asset_widget') {
$libraries['asset_widget']['css'][drupal_get_path('module', 'bear_necessities') . '/css/bear-asset-widget.css'] = array(
'weight' => 12,
'group' => CSS_THEME,
);
}
}
function bear_necessities_filter_info() {
$filters = array();
$filters['kill_nbsp'] = array(
'title' => t('Kill Non-Breaking Spaces'),
'description' => t('Remove non-breaking spaces.'),
'process callback' => '_bear_necessities_kill_nbsp',
'tips callback' => '_bear_necessities_kill_nbsp_tips',
);
return $filters;
}
function _bear_necessities_kill_nbsp($text, $filter) {
return preg_replace('/ /', ' ', $text);
}
function _bear_necessities_kill_nbsp_tips($filter, $format, $long = FALSE) {
if (!$long) {
return t('Don\'t use non-breaking spaces. Ever.');
}
else {
return t('Non-breaking spaces are evil and will be eradicated.');
}
}