Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Implementation of hook_diff() for node.module (body and title).
*/
/**
* Implementation of hook_diff() for node.module (body and title).
*/
function node_diff($old_node, $new_node) {
$result = array();
$type = node_get_types('type', $new_node);
$result['title'] = array(
'#name' => $type->title_label,
'#old' => array($old_node->title),
'#new' => array($new_node->title),
'#weight' => -5,
'#format' => array(
'show_header' => FALSE,
)
);
if ($type->has_body) {
$result['body'] = array(
'#name' => $type->body_label,
'#old' => explode("\n", $old_node->body),
'#new' => explode("\n", $new_node->body),
);
}
return $result;
}

View file

@ -0,0 +1,66 @@
<?php
/**
* @file
* Implementation of hook_diff() for taxonomy.
*/
/**
* Implementation of hook_diff() for taxonomy.
*/
function taxonomy_diff($old_node, $new_node) {
$result = array();
// TODO: make taxonomy by category not only by whole taxonomy?
$old_taxonomy = array();
$new_taxonomy = array();
if (isset($old_node->taxonomy) && $old_node->taxonomy) {
foreach ($old_node->taxonomy as $term) {
$old_taxonomy[] = $term->name;
}
}
if (isset($new_node->taxonomy) && $new_node->taxonomy) {
foreach ($new_node->taxonomy as $id => $entry) {
if (is_array($entry)) {
// During editing the taxonomy is built up as a list of vocabulary ids as keys
// and a list of term ids per array entry.
if (is_numeric($id)) {
foreach ($entry as $tid) {
$term = taxonomy_get_term($tid);
$new_taxonomy[] = $term->name;
}
}
else {
// If the id is not numeric than it has to be 'tags' which denotes freetagging
// vocabularies. These are stored as an array which map the vocabulary id to
// a string of terms.
foreach ($entry as $taglist) {
// The regular expression is taken from taxonomy.module.
preg_match_all('%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x', $taglist, $matches);
foreach ($matches[1] as $term) {
$new_taxonomy[] = $term;
}
}
}
}
elseif (is_numeric($entry)) {
// During editing, taxonomy is a single id.
$term = taxonomy_get_term($entry);
$new_taxonomy[] = $term->name;
}
else {
// Not during editing the taxonomy list is a list of terms.
$new_taxonomy[] = $entry->name;
}
}
}
$result['taxonomy'] = array(
'#name' => t('Taxonomy'),
'#old' => $old_taxonomy,
'#new' => $new_taxonomy,
'#weight' => -3,
'#format' => array(
'show_header' => FALSE,
)
);
return $result;
}

View file

@ -0,0 +1,47 @@
<?php
/**
* @file
* Implementation of hook_diff() for file attachments.
*/
/**
* Implementation of hook_diff() for file attachments.
*/
function upload_diff($old_node, $new_node) {
$result = array();
$old_files = array();
if (isset($old_node->files)) {
foreach ($old_node->files as $file) {
$old_files[] = $file->filename;
}
}
$new_files = array();
if (isset($new_node->files)) {
foreach ($new_node->files as $key => $file) {
if (is_array($file)) {
// During editing the files are stored as arrays, not objects.
if ($file['remove']) {
// It looks better if a blank line is inserted for removed files.
$new_files[] = '';
}
else {
$new_files[] = $file['filename'];
}
}
else {
$new_files[] = $file->filename;
}
}
}
$result['attachments'] = array(
'#name' => t('Attachments'),
'#old' => $old_files,
'#new' => $new_files,
'#weight' => 30,
'#format' => array(
'show_header' => FALSE,
)
);
return $result;
}