Permalink
Browse files

more documentation

  • Loading branch information...
1 parent 919819a commit 1d38bdded4d8778d019c4c028e80f406bc8348d4 @dawitti dawitti committed Mar 12, 2012
Showing with 52 additions and 13 deletions.
  1. +2 −3 README.markdown
  2. +3 −2 noticeme.admin.inc
  3. +16 −4 noticeme.field.inc
  4. +19 −1 noticeme.forms.inc
  5. +5 −0 noticeme.install
  6. +5 −3 noticeme.module
  7. +2 −0 noticeme.theme.inc
View
5 README.markdown
@@ -9,10 +9,9 @@ TODOS:
- kommentieren
noticeme.module [DONE]
noticeme.admin.inc [DONE]
- noticeme.blocks.inc
noticeme.fields.inc
- noticeme.forms.inc
- noticeme.install
+ noticeme.forms.inc [DONE]
+ noticeme.install [DONE]
noticeme.theme.inc
js/noticeme.js
js/noticeme_forms.js
View
5 noticeme.admin.inc
@@ -1,7 +1,7 @@
<?php
/**
* @file
- *
+ * Admin interface for sitewide graph metadata configuration
*/
/**
@@ -23,6 +23,7 @@ function noticeme_admin_settings($form, &$form_state) {
'form' => _noticeme_settings_form($values),
);
+ //TODO add global default image
unset($form['metadata']['form']['image']);
$form['configuration'] = array(
@@ -46,7 +47,7 @@ function noticeme_admin_settings($form, &$form_state) {
// Allow the admin to set different languages for fb, twitter and google,
// depending on the current users language.
- foreach (_noticeme_language_list as $id => $label) {
+ foreach (_noticeme_language_list() as $id => $label) {
$row = array(
'system' => array('#markup' => $label),
'noticeme_' . $id . '_facebook' => array(
View
20 noticeme.field.inc
@@ -1,4 +1,8 @@
<?php
+/**
+ * @file
+ * Field definition hooks four the noticeme field.
+ */
/**
* Implements hook_field_info().
@@ -38,24 +42,32 @@ function noticeme_field_formatter_info() {
);
}
+/**
+ * Implements hook_field_formatter_settings_form().
+ */
function noticeme_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
- $display = $instance['display'][$view_mode];
- $settings = $display['settings'];
- $element = _noticeme_configuration_form($settings);
+ $element = _noticeme_configuration_form($instance['display'][$view_mode]['settings']);
$element['#element_validate'] = array('_noticeme_field_formatter_settings_validate');
return $element;
}
-function _noticeme_field_formatter_settings_validate(&$form, &$form_state, &$entity) {
+/**
+ * Validate handler for noticeme_field_formatter_settings_form().
+ */
+function _noticeme_field_formatter_settings_validate($element, &$form_state, $form) {
$field = $form_state['formatter_settings_edit'];
$values = &$form_state['values']['fields'][$field]['settings_edit_form']['settings'];
+ // where are those values used?
foreach ($values as $network => $settings) {
foreach ($settings as $key => $value) {
$values[$network . '_' . $key] = $value;
}
}
}
+/**
+ * Implements hook_field_formatter_settings_summary().
+ */
function noticeme_field_formatter_settings_summary($field, $instance, $view_mode) {
$summary = array();
$settings = $instance['display'][$view_mode]['settings'];
View
20 noticeme.forms.inc
@@ -1,5 +1,16 @@
<?php
+/**
+ *@file
+ * Form definitions for
+ * and .
+ */
+/**
+ * Form definition for noticeme settings (admin/config/search/noticeme)
+ *
+ * @return
+ * A form definition array.
+ */
function _noticeme_settings_form($values) {
$form = array();
$form['title'] = array(
@@ -31,6 +42,13 @@ function _noticeme_settings_form($values) {
return $form;
}
+/**
+ * Configuration form for social media buttons which will be displayed in the
+ * display settings of attached fields.
+ *
+ * @return
+ * A form definition array.
+ */
function _noticeme_configuration_form($values) {
$form['facebook'] = array(
'#title' => 'Facebook Like',
@@ -78,7 +96,7 @@ function _noticeme_configuration_form($values) {
),
'font' => array(
'#type' => 'select',
- '#title' => t('font'),
+ '#title' => t('Font'),
'#options' => array(
'arial' => 'arial',
'lucida grande' => 'lucida grande',
View
5 noticeme.install
@@ -1,5 +1,10 @@
<?php
+
+/**
+ * Implements hook_field_schema().
+ */
function noticeme_field_schema($field) {
+ // As we define only one field we can be sure that $field is our noticeme field.
return array(
'columns' => array(
'title' => array(
View
8 noticeme.module
@@ -6,8 +6,9 @@
* to the html header.
*/
-module_load_include('inc', 'noticeme', '/noticeme.field');
-module_load_include('inc', 'noticeme', '/noticeme.forms');
+$path = DRUPAL_ROOT.'/'.drupal_get_path('module','noticeme');
+require_once($path.'/noticeme.field.inc');
+require_once($path.'/noticeme.forms.inc');
/**
* Implements hook_init().
@@ -274,7 +275,8 @@ function noticeme_get_metadata_from_predefined_entity_data($entity_type, $entity
break;
case 'user':
- $metadata['title'] = $account->name;
+ global $user;
+ $metadata['title'] = $user->name;
$metadata['og_type'] = 'website';
$metadata['schema_type'] = 'Person';
break;
View
2 noticeme.theme.inc
@@ -1,4 +1,6 @@
<?php
+
+
function theme_facebook_like($variables) {
$element = array(
'#theme' => 'html_tag',

0 comments on commit 1d38bdd

Please sign in to comment.