summaryrefslogtreecommitdiff
path: root/modules/field_ui/field_ui.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-19 13:31:14 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-19 13:31:14 +0000
commite998857eb8a5ef4d2ebe381a57c19b1b355fe4ef (patch)
tree88517c7981c03300ea0dc575f72719c8d3468027 /modules/field_ui/field_ui.api.php
parent24289301aba2666edb5909edf63cdb6cdedf994e (diff)
downloadbrdo-e998857eb8a5ef4d2ebe381a57c19b1b355fe4ef.tar.gz
brdo-e998857eb8a5ef4d2ebe381a57c19b1b355fe4ef.tar.bz2
#516138 by yched, KarenS, quicksketch, bangpound, et al.: CC-FREAKING-K IN CORE! OH YEAH! :D
Diffstat (limited to 'modules/field_ui/field_ui.api.php')
-rw-r--r--modules/field_ui/field_ui.api.php135
1 files changed, 135 insertions, 0 deletions
diff --git a/modules/field_ui/field_ui.api.php b/modules/field_ui/field_ui.api.php
new file mode 100644
index 000000000..4c53faa39
--- /dev/null
+++ b/modules/field_ui/field_ui.api.php
@@ -0,0 +1,135 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Hooks provided by the Field UI module.
+ */
+
+/**
+ * @ingroup field_ui_field_type
+ * @{
+ */
+
+/**
+ * Field settings form.
+ *
+ * @param $field
+ * The field structure being configured.
+ * @param $instance
+ * The instance structure being configured.
+ * @return
+ * The form definition for the field settings.
+ */
+function hook_field_settings_form($field, $instance) {
+ $settings = $field['settings'];
+ $form['max_length'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Maximum length'),
+ '#default_value' => $settings['max_length'],
+ '#required' => FALSE,
+ '#element_validate' => array('_element_validate_integer_positive'),
+ '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'),
+ );
+ return $form;
+}
+
+/**
+ * Instance settings form.
+ *
+ * @param $field
+ * The field structure being configured.
+ * @param $instance
+ * The instance structure being configured.
+ * @return
+ * The form definition for the field instance settings.
+ */
+function hook_field_instance_settings_form($field, $instance) {
+ $settings = $instance['settings'];
+
+ $form['text_processing'] = array(
+ '#type' => 'radios',
+ '#title' => t('Text processing'),
+ '#default_value' => $settings['text_processing'],
+ '#options' => array(
+ t('Plain text'),
+ t('Filtered text (user selects input format)'),
+ ),
+ );
+ if ($field['type'] == 'text_with_summary') {
+ $form['display_summary'] = array(
+ '#type' => 'select',
+ '#title' => t('Display summary'),
+ '#options' => array(
+ t('No'),
+ t('Yes'),
+ ),
+ '#description' => t('Display the summary to allow the user to input a summary value. Hide the summary to automatically fill it with a trimmed portion from the main post. '),
+ '#default_value' => !empty($settings['display_summary']) ? $settings['display_summary'] : 0,
+ );
+ }
+
+ return $form;
+}
+
+/**
+ * Widget settings form.
+ *
+ * @param $field
+ * The field structure being configured.
+ * @param $instance
+ * The instance structure being configured.
+ * @return
+ * The form definition for the widget settings.
+ */
+function hook_field_widget_settings_form($field, $instance) {
+ $widget = $instance['widget'];
+ $settings = $widget['settings'];
+ $form = array();
+
+ if ($widget['type'] == 'text_textfield') {
+ $form['size'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Size of textfield'),
+ '#default_value' => $settings['size'],
+ '#element_validate' => array('_element_validate_integer_positive'),
+ '#required' => TRUE,
+ );
+ }
+ else {
+ $form['rows'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Rows'),
+ '#default_value' => $settings['rows'],
+ '#element_validate' => array('_element_validate_integer_positive'),
+ '#required' => TRUE,
+ );
+ }
+
+ return $form;
+}
+
+/**
+ * Formatter settings form.
+ *
+ * @todo Not implemented yet. The signature below is only prospective, but
+ * providing $instance is not enough, since one $instance holds several display
+ * settings.
+ *
+ * @param $formatter
+ * The type of the formatter being configured.
+ * @param $settings
+ * The current values of the formatter settings.
+ * @param $field
+ * The field structure being configured.
+ * @param $instance
+ * The instance structure being configured.
+ * @return
+ * The form definition for the formatter settings.
+ */
+function hook_field_formatter_settings_form($formatter, $settings, $field, $instance) {
+}
+
+/**
+ * @} End of "ingroup field_ui_field_type"
+ */