Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

more documentation

  • Loading branch information...
commit 1d38bdded4d8778d019c4c028e80f406bc8348d4 1 parent 919819a
Martin Wittmann dawitti authored
5 README.markdown
Source Rendered
@@ -9,10 +9,9 @@ TODOS:
9 9 - kommentieren
10 10 noticeme.module [DONE]
11 11 noticeme.admin.inc [DONE]
12   - noticeme.blocks.inc
13 12 noticeme.fields.inc
14   - noticeme.forms.inc
15   - noticeme.install
  13 + noticeme.forms.inc [DONE]
  14 + noticeme.install [DONE]
16 15 noticeme.theme.inc
17 16 js/noticeme.js
18 17 js/noticeme_forms.js
5 noticeme.admin.inc
... ... @@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 3 * @file
4   - *
  4 + * Admin interface for sitewide graph metadata configuration
5 5 */
6 6
7 7 /**
@@ -23,6 +23,7 @@ function noticeme_admin_settings($form, &$form_state) {
23 23 'form' => _noticeme_settings_form($values),
24 24 );
25 25
  26 + //TODO add global default image
26 27 unset($form['metadata']['form']['image']);
27 28
28 29 $form['configuration'] = array(
@@ -46,7 +47,7 @@ function noticeme_admin_settings($form, &$form_state) {
46 47
47 48 // Allow the admin to set different languages for fb, twitter and google,
48 49 // depending on the current users language.
49   - foreach (_noticeme_language_list as $id => $label) {
  50 + foreach (_noticeme_language_list() as $id => $label) {
50 51 $row = array(
51 52 'system' => array('#markup' => $label),
52 53 'noticeme_' . $id . '_facebook' => array(
20 noticeme.field.inc
... ... @@ -1,4 +1,8 @@
1 1 <?php
  2 +/**
  3 + * @file
  4 + * Field definition hooks four the noticeme field.
  5 + */
2 6
3 7 /**
4 8 * Implements hook_field_info().
@@ -38,17 +42,22 @@ function noticeme_field_formatter_info() {
38 42 );
39 43 }
40 44
  45 +/**
  46 + * Implements hook_field_formatter_settings_form().
  47 + */
41 48 function noticeme_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
42   - $display = $instance['display'][$view_mode];
43   - $settings = $display['settings'];
44   - $element = _noticeme_configuration_form($settings);
  49 + $element = _noticeme_configuration_form($instance['display'][$view_mode]['settings']);
45 50 $element['#element_validate'] = array('_noticeme_field_formatter_settings_validate');
46 51 return $element;
47 52 }
48 53
49   -function _noticeme_field_formatter_settings_validate(&$form, &$form_state, &$entity) {
  54 +/**
  55 + * Validate handler for noticeme_field_formatter_settings_form().
  56 + */
  57 +function _noticeme_field_formatter_settings_validate($element, &$form_state, $form) {
50 58 $field = $form_state['formatter_settings_edit'];
51 59 $values = &$form_state['values']['fields'][$field]['settings_edit_form']['settings'];
  60 + // where are those values used?
52 61 foreach ($values as $network => $settings) {
53 62 foreach ($settings as $key => $value) {
54 63 $values[$network . '_' . $key] = $value;
@@ -56,6 +65,9 @@ function _noticeme_field_formatter_settings_validate(&$form, &$form_state, &$ent
56 65 }
57 66 }
58 67
  68 +/**
  69 + * Implements hook_field_formatter_settings_summary().
  70 + */
59 71 function noticeme_field_formatter_settings_summary($field, $instance, $view_mode) {
60 72 $summary = array();
61 73 $settings = $instance['display'][$view_mode]['settings'];
20 noticeme.forms.inc
... ... @@ -1,5 +1,16 @@
1 1 <?php
  2 +/**
  3 + *@file
  4 + * Form definitions for
  5 + * and .
  6 + */
2 7
  8 +/**
  9 + * Form definition for noticeme settings (admin/config/search/noticeme)
  10 + *
  11 + * @return
  12 + * A form definition array.
  13 + */
3 14 function _noticeme_settings_form($values) {
4 15 $form = array();
5 16 $form['title'] = array(
@@ -31,6 +42,13 @@ function _noticeme_settings_form($values) {
31 42 return $form;
32 43 }
33 44
  45 +/**
  46 + * Configuration form for social media buttons which will be displayed in the
  47 + * display settings of attached fields.
  48 + *
  49 + * @return
  50 + * A form definition array.
  51 + */
34 52 function _noticeme_configuration_form($values) {
35 53 $form['facebook'] = array(
36 54 '#title' => 'Facebook Like',
@@ -78,7 +96,7 @@ function _noticeme_configuration_form($values) {
78 96 ),
79 97 'font' => array(
80 98 '#type' => 'select',
81   - '#title' => t('font'),
  99 + '#title' => t('Font'),
82 100 '#options' => array(
83 101 'arial' => 'arial',
84 102 'lucida grande' => 'lucida grande',
5 noticeme.install
... ... @@ -1,5 +1,10 @@
1 1 <?php
  2 +
  3 +/**
  4 + * Implements hook_field_schema().
  5 + */
2 6 function noticeme_field_schema($field) {
  7 + // As we define only one field we can be sure that $field is our noticeme field.
3 8 return array(
4 9 'columns' => array(
5 10 'title' => array(
8 noticeme.module
@@ -6,8 +6,9 @@
6 6 * to the html header.
7 7 */
8 8
9   -module_load_include('inc', 'noticeme', '/noticeme.field');
10   -module_load_include('inc', 'noticeme', '/noticeme.forms');
  9 +$path = DRUPAL_ROOT.'/'.drupal_get_path('module','noticeme');
  10 +require_once($path.'/noticeme.field.inc');
  11 +require_once($path.'/noticeme.forms.inc');
11 12
12 13 /**
13 14 * Implements hook_init().
@@ -274,7 +275,8 @@ function noticeme_get_metadata_from_predefined_entity_data($entity_type, $entity
274 275 break;
275 276
276 277 case 'user':
277   - $metadata['title'] = $account->name;
  278 + global $user;
  279 + $metadata['title'] = $user->name;
278 280 $metadata['og_type'] = 'website';
279 281 $metadata['schema_type'] = 'Person';
280 282 break;
2  noticeme.theme.inc
... ... @@ -1,4 +1,6 @@
1 1 <?php
  2 +
  3 +
2 4 function theme_facebook_like($variables) {
3 5 $element = array(
4 6 '#theme' => 'html_tag',

0 comments on commit 1d38bdd

Please sign in to comment.
Something went wrong with that request. Please try again.