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,5 @@
div.fieldgroup .content {
padding-left:0;
padding-right:1em;
}

View file

@ -0,0 +1,32 @@
<?php
/**
* @file fieldgroup-simple.tpl.php
* Default theme implementation to display the a 'simple-styled' fieldgroup.
*
* Available variables:
* - $group_name - The group name
* - $group_name_css - The css-compatible group name.
* - $label - The group label
* - $description - The group description
* - $content - The group content
*
* @see template_preprocess_fieldgroup_simple()
*/
?>
<?php if ($content) : ?>
<div class="fieldgroup <?php print $group_name_css; ?>">
<?php if ($label): ?>
<h2><?php print $label; ?></h2>
<?php if ($description): ?>
<div class="description"><?php print $description; ?></div>
<?php endif; ?>
<?php endif; ?>
<div class="content"><?php print $content; ?></div>
</div>
<?php endif; ?>

View file

@ -0,0 +1,7 @@
div.fieldgroup {
margin:.5em 0 1em 0;
}
div.fieldgroup .content {
padding-left:1em;/*LTR*/
}

View file

@ -0,0 +1,11 @@
name = Fieldgroup
description = Create display groups for CCK fields.
dependencies[] = content
package = CCK
core = 6.x
; Information added by Drupal.org packaging script on 2015-06-25
version = "6.x-3.0-alpha4"
core = "6.x"
project = "cck"
datestamp = "1435195385"

View file

@ -0,0 +1,328 @@
<?php
/**
* @file
* Implementation of hook_install().
*/
function fieldgroup_install() {
drupal_load('module', 'content');
db_query("UPDATE {system} SET weight = 9 WHERE name = 'fieldgroup'");
drupal_install_schema('fieldgroup');
content_notify('install', 'fieldgroup');
variable_set('fieldgroup_schema_version', 6000);
}
/**
* Implementation of hook_uninstall().
*/
function fieldgroup_uninstall() {
drupal_load('module', 'content');
drupal_uninstall_schema('fieldgroup');
content_notify('uninstall', 'fieldgroup');
}
/**
* Implementation of hook_enable().
*
* Notify content module when this module is enabled.
*/
function fieldgroup_enable() {
drupal_load('module', 'content');
content_notify('enable', 'fieldgroup');
}
/**
* Implementation of hook_disable().
*
* Notify content module when this module is disabled.
*/
function fieldgroup_disable() {
drupal_load('module', 'content');
content_notify('disable', 'fieldgroup');
}
/**
* Implementation of hook_schema.
*/
function fieldgroup_schema() {
$schema['content_group'] = array(
'fields' => array(
'group_type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => 'standard'),
'type_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'group_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'parent' => array('type' => 'varchar', 'length' => 32, 'not null' => FALSE, 'default' => ''),
'label' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'settings' => array('type' => 'text', 'size' => 'medium', 'not null' => TRUE),
'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
),
'primary key' => array('type_name', 'group_name'),
);
$schema['content_group_fields'] = array(
'fields' => array(
'type_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'group_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'field_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
),
'primary key' => array('type_name', 'group_name', 'field_name'),
);
return $schema;
}
/**
* rename groups form "group-*" to "group_*"
*/
function fieldgroup_update_1() {
$ret = array();
if (!db_table_exists('node_group')) {
return $ret;
}
switch ($GLOBALS['db_type']) {
case 'pgsql':
$ret[] = update_sql("UPDATE {node_group} SET group_name = 'group_'||SUBSTRING(group_name FROM 7)");
$ret[] = update_sql("UPDATE {node_group_fields} SET group_name = 'group_'||SUBSTRING(group_name FROM 7)");
break;
case 'mysql':
case 'mysqli':
$ret[] = update_sql("UPDATE {node_group} SET group_name = CONCAT('group_', SUBSTRING(group_name FROM 7))");
$ret[] = update_sql("UPDATE {node_group_fields} SET group_name = CONCAT('group_', SUBSTRING(group_name FROM 7))");
break;
}
return $ret;
}
/**
* add display settings for the group
*/
function fieldgroup_update_2() {
$ret = array();
if (!db_table_exists('node_group')) {
return $ret;
}
// set settings column to accept larger values
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql('ALTER TABLE {node_group} CHANGE settings settings mediumtext NOT NULL');
break;
case 'pgsql':
db_change_column($ret, 'node_group', 'settings', 'settings', 'text', array('not null' => TRUE));
break;
}
// move description into the settings array, and add new settings
$result = db_query("SELECT * FROM {node_group}");
while ($group = db_fetch_array($result)) {
$settings = array();
$settings['form'] = unserialize($group['settings']);
$settings['form']['description'] = $group['description'];
$settings['display'] = array('collapsible' => 0, 'collapsed' => 0, 'description' => '');
$ret[] = update_sql("UPDATE {node_group} SET settings = '". db_escape_string(serialize($settings)) ."', description = '' WHERE group_name = '". $group['group_name'] ."'");
}
// drop description column
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql('ALTER TABLE {node_group} DROP description');
break;
case 'pgsql':
// Postgres only supports dropping of columns since 7.4
break;
}
return $ret;
}
/**
* converts group settings collapsible/collapsed => style
*/
function fieldgroup_update_3() {
$ret = array();
if (!db_table_exists('node_group')) {
return $ret;
}
$result = db_query("SELECT * FROM {node_group}");
while ($group = db_fetch_array($result)) {
$group['settings'] = unserialize($group['settings']);
if (!isset($group['settings']['form']['style'])) {
foreach (array('form', 'display') as $context) {
if (isset($group['settings'][$context]['collapsible']) && $group['settings'][$context]['collapsible']) {
if (isset($group['settings'][$context]['collapsed']) && $group['settings'][$context]['collapsed']) {
$group['settings'][$context]['style'] = 'fieldset_collapsed';
}
else {
$group['settings'][$context]['style'] = 'fieldset_collapsible';
}
}
else {
$group['settings'][$context]['style'] = 'fieldset';
}
}
$ret[] = update_sql("UPDATE {node_group} SET settings = '". db_escape_string(serialize($group['settings'])) ."' WHERE group_name = '". $group['group_name'] ."'");
}
}
return $ret;
}
/*
* Increases module weight, so that other modules can form_alter() cck forms before the fields
* are moved in groups
*/
function fieldgroup_update_4() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = 9 WHERE name = 'fieldgroup'");
return $ret;
}
/**
* Start D6 upgrades
*/
/**
* Move fieldgroup tables to the content_* namespace.
*/
function fieldgroup_update_6000() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
db_rename_table($ret, 'node_group', 'content_group');
db_rename_table($ret, 'node_group_fields', 'content_group_fields');
variable_set('fieldgroup_schema_version', 6000);
return $ret;
}
/*
* Increases module weight, so that other modules can form_alter() cck forms before the fields
* are moved in groups.
*
* Sites upgraded from D5 should have this already set.
* New D6 installs earlier than RC5 need this, as it was missing in fieldgroup_install.
*/
function fieldgroup_update_6001() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = 9 WHERE name = 'fieldgroup'");
return $ret;
}
/**
* Same as 6000 : Move fieldgroup tables to the content_* namespace.
* This was missing in D6 releases earlier than RC5. Ensure we don't run this twice.
*/
function fieldgroup_update_6002() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
if (db_table_exists('node_group')) {
db_rename_table($ret, 'node_group', 'content_group');
db_rename_table($ret, 'node_group_fields', 'content_group_fields');
variable_set('fieldgroup_schema_version', 6000);
}
return $ret;
}
/**
* Remove tinyint (127) limitation on group weights.
*/
function fieldgroup_update_6003() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
db_change_field($ret, 'content_group', 'weight', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
return $ret;
}
/**
* Add 'type' property for fieldgroups.
*/
function fieldgroup_update_6004() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
db_add_field($ret, 'content_group', 'group_type', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => 'standard'));
$ret[] = update_sql("DELETE FROM {cache_content} WHERE cid='fieldgroup_data'");
return $ret;
}
/**
* Add the 'exclude from $content' display setting to all existing groups.
*/
function fieldgroup_update_6005() {
$ret = array();
$result = db_query("SELECT * FROM {content_group}");
while ($type = db_fetch_array($result)) {
$new_settings = array();
$settings = unserialize($type['settings']);
$new_settings = $settings;
$display_settings = !empty($settings['display']) ? $settings['display'] : array();
if (!empty($display_settings)) {
foreach ($display_settings as $key => $val) {
$new_settings['display'][$key] = $val;
if ($key !== 'label' && is_array($val)) {
$new_settings['display'][$key]['exclude'] = 0;
}
}
}
else {
$new_settings['display'] = array(
'label' => array('format' => 'above'),
'full' => array('format' => 'default', 'exclude' => 0),
'teaser' => array('format' => 'default', 'exclude' => 0),
);
}
db_query("UPDATE {content_group} SET settings='%s' WHERE group_name='%s' AND type_name='%s'", serialize($new_settings), $type['group_name'], $type['type_name']);
}
return $ret;
}
/**
* Removed a previous version of "Remove orphaned fields" (6007), broken for db prefixes.
*/
function fieldgroup_update_6006() {
return array();
}
/**
* Remove orphaned fields (see http://drupal.org/node/339537).
*/
function fieldgroup_update_6007() {
$ret = array();
$ret[] = update_sql("DELETE FROM {content_group_fields} WHERE (field_name, type_name) NOT IN (SELECT field_name, type_name FROM {content_node_field_instance})");
return $ret;
}
/**
* allow for nesting of fieldgroups
*/
function fieldgroup_update_6008() {
if ($abort = content_check_update('fieldgroup')) {
return $abort;
}
$ret = array();
db_add_field($ret, 'content_group', 'parent', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE, 'default' => ''));
return $ret;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,163 @@
<?php
/**
* @file
* This file provides a CTools content type for fieldgroups.
*/
/**
* Callback function to supply a list of content types.
*/
function fieldgroup_content_fieldgroup_ctools_content_types() {
return array(
'title' => t('Content fieldgroup'),
'defaults' => array('label' => 'hidden', 'format' => 'simple', 'empty' => ''),
);
}
/**
* Return all fieldgroup content types available.
*/
function fieldgroup_content_fieldgroup_content_type_content_types() {
// This will hold all the individual fieldgroup content types.
$types = array();
// The outer loop goes through each node type with groups.
foreach (fieldgroup_groups() as $node_type_groups) {
// The inner loop gives us each fieldgroup on each node type with groups.
foreach ($node_type_groups as $group) {
// Skip field groups that are not of standard type.
if ($group['group_type'] != 'standard') {
continue;
}
// Name the content type a combination of fieldgroup and node type names.
$content_type_name = $group['type_name'] . ':' . $group['group_name'];
// Assemble the information about the content type.
$info = array(
'category' => t('Node'),
'icon' => 'icon_cck_field_group.png',
'title' => t('Field group: @group in @type', array(
'@group' => t($group['label']),
'@type' => node_get_types('name', $group['type_name']),
)),
'description' => t('All fields from this field group on the referenced node.'),
'required context' => new ctools_context_required(t('Node'), 'node', array('type' => array($group['type_name']))),
);
$types[$content_type_name] = $info;
}
}
return $types;
}
/**
* Output function for the 'fieldgroup' content type.
*/
function fieldgroup_content_fieldgroup_content_type_render($subtype, $conf, $panel_args, $context) {
if (!isset($context->data)) {
return;
}
$node = drupal_clone($context->data);
// Make sure old data doesn't cause problems:
if (empty($conf['label'])) {
$conf['label'] = 'hidden';
}
if (empty($conf['format'])) {
$conf['format'] = 'simple';
}
// Extract the node type and fieldgroup name from the subtype.
list($node_type, $group_name) = explode(':', $subtype, 2);
// Get a list of all fieldgroups for this node type.
$groups = fieldgroup_groups($node_type);
if (!isset($groups[$group_name])) {
return;
}
$group = $groups[$group_name];
// Render the field group.
$node->build_mode = NODE_BUILD_NORMAL;
$group['settings']['display']['label'] = $conf['label'] == 'normal' || !empty($conf['override_title']) ? 'hidden' : $conf['label'];
$group['settings']['display']['full']['format'] = $conf['format'];
$group['settings']['display']['full']['exclude'] = 0;
$output = fieldgroup_view_group($group, $node);
$block = new stdClass();
if ($conf['label'] == 'normal') {
$block->title = t($group['label']);
}
$block->content = !empty($output) ? $output : $conf['empty'];
return $block;
}
/**
* Returns a settings form for the custom type.
*/
function fieldgroup_content_fieldgroup_content_type_edit_form(&$form, &$form_state) {
$conf = $form_state['conf'];
$label_options = array(
'normal' => t('Block title'),
'above' => t('Above'),
);
$form['label'] = array(
'#type' => 'select',
'#title' => t('Field group label'),
'#default_value' => !empty($conf['label']) && isset($label_options[$conf['label']]) ? $conf['label'] : 'hidden',
'#options' => $label_options,
'#description' => t('Configure how the field group label is going to be displayed. This option takes no effect when "Override title" option is enabled, the specified block title is displayed instead.'),
);
$format_options = array(
'simple' => t('Simple'),
'fieldset' => t('Fieldset'),
'fieldset_collapsible' => t('Fieldset - Collapsible'),
'fieldset_collapsed' => t('Fieldset - Collapsed'),
);
$form['format'] = array(
'#type' => 'select',
'#title' => t('Field group format'),
'#default_value' => !empty($conf['format']) && isset($format_options[$conf['format']]) ? $conf['format'] : 'simple',
'#options' => $format_options,
'#description' => t('This option allows you to configure the field group format.'),
);
$form['empty'] = array(
'#type' => 'textarea',
'#title' => t('Empty text'),
'#description' => t('Text to display if group has no data. Note that title will not display unless overridden.'),
'#rows' => 5,
'#default_value' => $conf['empty'],
);
}
function fieldgroup_content_fieldgroup_content_type_edit_form_submit(&$form, &$form_state) {
// Copy everything from our defaults.
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
$form_state['conf'][$key] = $form_state['values'][$key];
}
}
/**
* Admin title for fieldgroup content type.
*/
function fieldgroup_content_fieldgroup_content_type_admin_title($subtype, $conf, $context) {
// Extract the node type and fieldgroup name from the subtype.
list($node_type, $group_name) = explode(':', $subtype, 2);
// Get information about this field group for this node type.
$groups = fieldgroup_groups($node_type);
$group = $groups[$group_name];
return t('"@s" field group: @group in @type', array(
'@s' => $context->identifier,
'@group' => t($group['label']),
'@type' => node_get_types('name', $node_type),
));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B