updated date pathauto addressfield honeypot features modules

This commit is contained in:
Bachir Soussi Chiadmi
2015-10-12 12:03:12 +02:00
parent 0ba0c21bb9
commit eb699f528d
109 changed files with 5363 additions and 2372 deletions

View File

@@ -28,10 +28,14 @@ function date_tools_change_type_form() {
// Get the available date fields.
foreach ($fields as $field_name => $field) {
if ($field['type'] == 'date' || $field['type'] == 'datestamp' || $field['type'] == 'datetime') {
$date_options[$labels[$field['type']]][$field_name] = t('Field @label (@field_name)', array('@label' => $field['widget']['label'], '@field_name' => $field_name, '@type' => $labels[$field['type']]));
$date_options[$labels[$field['type']]][$field_name] = t('Field @label (@field_name)', array(
'@label' => $field['widget']['label'],
'@field_name' => $field_name,
'@type' => $labels[$field['type']]
));
}
}
if (sizeof($date_options) < 1) {
if (count($date_options) < 1) {
drupal_set_message(t('There are no date fields in this database.'));
return $form;
}
@@ -142,26 +146,31 @@ function date_tools_change_type_form_submit($form, &$form_state) {
case 'datestamp':
$new_columns[] = $date_handler->sql_format('U', $db_field) . ' AS ' . $info['column'];
break;
case 'datetime':
$new_columns[] = $date_handler->sql_format('Y-m-d H:i:s', $db_field) . ' AS ' . $info['column'];
break;
}
break;
case 'datestamp':
switch ($new_type) {
case 'date':
$new_columns[] = $date_handler->sql_format('Y-m-d/TH:i:s', $db_field) . ' AS ' . $info['column'];
break;
case 'datetime':
$new_columns[] = $date_handler->sql_format('Y-m-d H:i:s', $db_field) . ' AS ' . $info['column'];
break;
}
break;
case 'datetime':
switch ($new_type) {
case 'date':
$new_columns[] = $date_handler->sql_format('Y-m-d/TH:i:s', $db_field) . ' AS ' . $info['column'];
break;
case 'datestamp':
$new_columns[] = $date_handler->sql_format('U', $db_field) . ' AS ' . $info['column'];
break;
@@ -178,5 +187,9 @@ function date_tools_change_type_form_submit($form, &$form_state) {
db_query($sql);
db_query("DROP TABLE {" . $temp_table . "}");
drupal_set_message(t('The field @field_name has been changed from @old_type to @new_type.', array('@field_name' => $field['widget']['label'], '@old_type' => $labels[$old_type], '@new_type' => $labels[$new_type])));
drupal_set_message(t('The field @field_name has been changed from @old_type to @new_type.', array(
'@field_name' => $field['widget']['label'],
'@old_type' => $labels[$old_type],
'@new_type' => $labels[$new_type]
)));
}

View File

@@ -6,9 +6,9 @@ core = 7.x
configure = admin/config/date/tools
files[] = tests/date_tools.test
; Information added by Drupal.org packaging script on 2014-07-29
version = "7.x-2.8"
; Information added by Drupal.org packaging script on 2015-09-08
version = "7.x-2.9"
core = "7.x"
project = "date"
datestamp = "1406653438"
datestamp = "1441727353"

View File

@@ -31,7 +31,7 @@ function date_tools_help($section, $arg) {
*/
function date_tools_permission() {
return array(
'administer date tools' => array(
'administer date tools' => array(
'title' => t('Administer date tools'),
),
);
@@ -68,6 +68,7 @@ function date_tools_menu() {
'file' => 'date_tools.wizard.inc',
);
// @codingStandardsIgnoreStart
/**
$items['admin/config/date/tools/change'] = array(
'title' => 'Change type',
@@ -79,18 +80,18 @@ function date_tools_menu() {
'file' => 'date_tools.change_type.inc',
);
*/
// @codingStandardsIgnoreEnd
return $items;
}
/**
* Main Date Tools page
* Main Date Tools page.
*/
function date_tools_page() {
$content = '';
$content .= t('Dates and calendars can be complicated to set up. The !date_wizard makes it easy to create a simple date content type and related calendar. ', array('!date_wizard' => l(t('Date wizard'), 'admin/config/date/tools/date_wizard')));
$content .= t('Dates and calendars can be complicated to set up. The !date_wizard makes it easy to create a simple date content type and related calendar.', array('!date_wizard' => l(t('Date wizard'), 'admin/config/date/tools/date_wizard')));
return $content;
}

View File

@@ -6,6 +6,8 @@
*/
/**
* Implements hook_form().
*
* @todo.
*/
function date_tools_wizard_form() {
@@ -59,7 +61,10 @@ function date_tools_wizard_form() {
$form['field']['repeat'] = array(
'#type' => 'select',
'#default_value' => 0,
'#options' => array(0 => t('No'), 1 => t('Yes')),
'#options' => array(
0 => t('No'),
1 => t('Yes'),
),
'#title' => t('Show repeating date options'),
'#access' => module_exists('date_repeat_field'),
);
@@ -72,7 +77,11 @@ function date_tools_wizard_form() {
$form['field']['advanced']['todate'] = array(
'#type' => 'select',
'#default_value' => 'optional',
'#options' => array('' => t('Never'), 'optional' => t('Optional'), 'required' => t('Required')),
'#options' => array(
'' => t('Never'),
'optional' => t('Optional'),
'required' => t('Required'),
),
'#title' => t('End Date'),
'#description' => t("Display a matching second date field as a 'End date'."),
);
@@ -106,7 +115,10 @@ function date_tools_wizard_form() {
$form['calendar'] = array(
'#type' => 'select',
'#default_value' => module_exists('calendar'),
'#options' => array(0 => t('No'), 1 => t('Yes')),
'#options' => array(
0 => t('No'),
1 => t('Yes'),
),
'#title' => t('Create a calendar for this date field'),
'#access' => module_exists('calendar'),
);
@@ -119,13 +131,26 @@ function date_tools_wizard_form() {
}
/**
* Form validate.
*
* @todo.
*/
function date_tools_wizard_form_validate(&$form, &$form_state) {
$bundle = $form_state['values']['bundle'];
$field_name = 'field_' . $form_state['values']['field_name'];
$existing_type = db_query("SELECT type FROM {node_type} WHERE type=:bundle", array(':bundle' => $bundle))->fetchField();
$existing_instance = db_query("SELECT field_name FROM {field_config_instance} WHERE field_name=:field_name AND bundle=:bundle AND entity_type=:entity_type", array(':field_name' => $field_name, ':bundle' => $bundle, ':entity_type' => 'node'))->fetchField();
$args = array(
':field_name' => $field_name,
':bundle' => $bundle,
':entity_type' => 'node',
);
$query = "SELECT type FROM {node_type} WHERE type=:bundle";
$existing_type = db_query($query, array(':bundle' => $args[':bundle']))->fetchField();
$query = "SELECT field_name FROM {field_config_instance} WHERE field_name=:field_name AND bundle=:bundle AND entity_type=:entity_type";
$existing_instance = db_query($query, $args)->fetchField();
if ($existing_type) {
drupal_set_message(t('This content type name already exists, adding new field to existing content type.'));
}
@@ -147,6 +172,8 @@ function date_tools_wizard_form_validate(&$form, &$form_state) {
}
/**
* Form submit.
*
* @todo.
*/
function date_tools_wizard_form_submit(&$form, &$form_state) {
@@ -161,6 +188,8 @@ function date_tools_wizard_form_submit(&$form, &$form_state) {
}
/**
* Wizard build.
*
* @todo.
*/
function date_tools_wizard_build($form_values) {
@@ -201,7 +230,7 @@ function date_tools_wizard_build($form_values) {
'timezone_db' => date_get_timezone_db($tz_handling),
'repeat' => $repeat,
'todate' => !empty($todate) ? $todate : 'optional',
),
),
);
$instance = array(
'entity_type' => 'node',
@@ -275,6 +304,8 @@ function date_tools_wizard_build($form_values) {
}
/**
* Includes handler.
*
* @todo.
*/
function date_tools_wizard_include() {
@@ -285,6 +316,8 @@ function date_tools_wizard_include() {
}
/**
* Implements hook_field_types().
*
* @todo.
*/
function date_tools_wizard_field_types() {
@@ -296,6 +329,7 @@ function date_tools_wizard_field_types() {
}
/**
* Implements hook_widget_types().
* @todo.
*/
function date_tools_wizard_widget_types() {
@@ -309,6 +343,8 @@ function date_tools_wizard_widget_types() {
}
/**
* Tz handler.
*
* @todo.
*/
function date_tools_wizard_tz_handling() {
@@ -317,6 +353,8 @@ function date_tools_wizard_tz_handling() {
}
/**
* Create date tools wizard content type.
*
* @todo.
*/
function date_tools_wizard_create_content_type($name, $bundle, $description, $type_settings = array()) {
@@ -332,8 +370,7 @@ function date_tools_wizard_create_content_type($name, $bundle, $description, $ty
'body_label' => 'Body',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array(
'node_options' => array(
'status' => 1,
'promote' => 1,
'sticky' => 0,
@@ -374,8 +411,10 @@ function date_tools_wizard_create_content_type($name, $bundle, $description, $ty
'weight' => -4,
'module' => 'text',
),
'settings' => array('display_summary' => TRUE),
'display' => array(
'settings' => array(
'display_summary' => TRUE,
),
'display' => array(
'default' => array(
'label' => 'hidden',
'type' => 'text_default',