/[drupal]/contributions/modules/ds/ds.module
ViewVC logotype

Diff of /contributions/modules/ds/ds.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.2, Tue Oct 20 16:31:20 2009 UTC revision 1.1.2.3, Tue Oct 20 18:41:47 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: ds.module,v 1.1.2.1 2009/10/18 18:26:37 swentel Exp $  // $Id: ds.module,v 1.1.2.2 2009/10/20 16:31:20 swentel Exp $
3    
4  /**  /**
5   * Core functions for the Display Suite module.   * Core functions for the Display Suite module.
# Line 83  function ds_default_value($settings, $bu Line 83  function ds_default_value($settings, $bu
83  /**  /**
84   * API function to get fields.   * API function to get fields.
85   *   *
86   * @param string $module The name of the module.   * @param string $module The name of the module.
87   * @param string $type_name The name of object (ie, page or story for node types, profile for users)   * @param string $type_name The name of object (ie, page or story for node types, profile for users)
88   * @param string $build_mode The build mode.   * @param string $build_mode The build mode.
89   * @param array $extra Extra properties we might want to check on (ie has_body property).   * @param array $extra Extra properties we might want to check on (ie has_body property).
# Line 91  function ds_default_value($settings, $bu Line 91  function ds_default_value($settings, $bu
91   */   */
92  function ds_get_fields($module, $type_name, $build_mode, $extra = array()) {  function ds_get_fields($module, $type_name, $build_mode, $extra = array()) {
93    static $static_fields = array();    static $static_fields = array();
94    if (!isset($static_fields[$type_name][$build_mode])) {    if (!isset($static_fields[$module][$type_name][$build_mode])) {
95    
96      // Fields in code.      // Fields in code.
97      $fields = module_invoke_all('ds_fields', $type_name, $build_mode, $extra);      $fields = module_invoke_all('ds_fields', $type_name, $build_mode, $extra);
# Line 113  function ds_get_fields($module, $type_na Line 113  function ds_get_fields($module, $type_na
113      }      }
114    
115      // Give modules a change to alter fields.      // Give modules a change to alter fields.
116      drupal_alter($module .'_fields', $fields);      drupal_alter('ds_fields', $fields);
117    
118      $static_fields[$module][$type_name][$build_mode] = $fields;      $static_fields[$module][$type_name][$build_mode] = $fields;
119    }    }
120    return $static_fields[$type_name][$build_mode];    return $static_fields[$module][$type_name][$build_mode];
121  }  }
122    
123  /**  /**
# Line 148  function ds_get_build_modes($module = NU Line 148  function ds_get_build_modes($module = NU
148   * Process plugins.   * Process plugins.
149   *   *
150   * @param string $module The module to process for.   * @param string $module The module to process for.
151     * @param string $object_type The type of object (node, user, comment).
152   * @param array $display_settings Display settings.   * @param array $display_settings Display settings.
153   * @param array $vars The variables currently processed.   * @param array $vars The variables currently processed.
154   * @param stdClass $display Collection of arrays with object data.   * @param stdClass $display Collection of arrays with object data.
155   */   */
156  function ds_plugins_process($module, $display_settings, &$vars, &$display) {  function ds_plugins_process($module, $object_type, $display_settings, &$vars, &$display) {
157    $plugins = variable_get($module .'_plugin_settings', array());    $plugins = variable_get($module .'_plugin_settings', array());
158    if (!empty($plugins)) {    if (!empty($plugins)) {
159      foreach ($plugins as $key => $plugin) {      foreach ($plugins as $key => $plugin) {
# Line 160  function ds_plugins_process($module, $di Line 161  function ds_plugins_process($module, $di
161          require_once($plugin['filename']);          require_once($plugin['filename']);
162        }        }
163        $function = $plugin['process_callback'];        $function = $plugin['process_callback'];
164        $function($vars, $display, $display_settings);        $function($vars, $display, $display_settings, $type_name);
165      }      }
166    }    }
167  }  }
# Line 170  function ds_plugins_process($module, $di Line 171  function ds_plugins_process($module, $di
171   *   *
172   * @param string $key The name of the key to create.   * @param string $key The name of the key to create.
173   * @param array $value The field array.   * @param array $value The field array.
  * @param string $object_type Type of object for token support.  
174   * @param stdClass $object The object.   * @param stdClass $object The object.
175     * @param string $object_type Type of object for token support.
176   */   */
177  function ds_eval_code($key, $field, $object_type, &$object) {  function ds_eval_code($key, $field, &$object, $object_type) {
178    if (isset($field['code'])) {    if (isset($field['code'])) {
179      $key = $key .'_rendered';      $key = $key .'_rendered';
180      $value = ds_eval($field['code'], $object);      $value = ds_eval($field['code'], $object);
# Line 266  function ds_eval($code, $object) { Line 267  function ds_eval($code, $object) {
267   * @return array $regions Collection of regions.   * @return array $regions Collection of regions.
268   */   */
269  function ds_regions($regions = 'all') {  function ds_regions($regions = 'all') {
270      $regions = 'all';
271    if ($regions == 'all') {    if ($regions == 'all') {
272      return array(      return array(
273        'header' => t('Header'),        'header' => t('Header'),

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

  ViewVC Help
Powered by ViewVC 1.1.2