ds.ds_fields_info.inc

  1. cis7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  2. cle7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  3. ecd7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  4. elmsmedia7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  5. harmony7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  6. icor7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  7. meedjum_blog7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
  8. mooc7 sites/all/modules/ulmus/ds/ds.ds_fields_info.inc

Display Suite fields.

Functions

Namesort descending Description
ds_ds_fields_info Implements hook_ds_fields_info().

File

sites/all/modules/ulmus/ds/ds.ds_fields_info.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Display Suite fields.
  5. */
  6. /**
  7. * Implements hook_ds_fields_info().
  8. */
  9. function ds_ds_fields_info($entity_type) {
  10. /* --------------------------------------------------------------
  11. Custom fields.
  12. -------------------------------------------------------------- */
  13. ctools_include('export');
  14. $custom_fields = ctools_export_crud_load_all('ds_fields');
  15. foreach ($custom_fields as $key => $field) {
  16. if (isset($field->entities[$entity_type])) {
  17. $fields[$entity_type][$key] = array(
  18. 'title' => $field->label,
  19. 'field_type' => $field->field_type,
  20. 'properties' => $field->properties,
  21. );
  22. if (!empty($field->ui_limit)) {
  23. $fields[$entity_type][$key]['ui_limit'] = explode("\n", $field->ui_limit);
  24. // Ensure that all strings are trimmed, eg. don't have
  25. // extra spaces, \r chars etc.
  26. foreach ($fields[$entity_type][$key]['ui_limit'] as $k => $v) {
  27. $fields[$entity_type][$key]['ui_limit'][$k] = trim($v);
  28. }
  29. }
  30. }
  31. }
  32. /* --------------------------------------------------------------
  33. General node fields.
  34. -------------------------------------------------------------- */
  35. // Node title.
  36. $fields['node']['title'] = array(
  37. 'title' => t('Title'),
  38. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  39. 'function' => 'ds_render_field',
  40. 'properties' => array(
  41. 'entity_render_key' => 'title',
  42. 'settings' => array(
  43. 'link' => array('type' => 'select', 'options' => array('no', 'yes')),
  44. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  45. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  46. ),
  47. 'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
  48. )
  49. );
  50. // Links.
  51. $fields['node']['links'] = array(
  52. 'title' => t('Links'),
  53. 'field_type' => DS_FIELD_TYPE_IGNORE,
  54. );
  55. // Comments.
  56. if (module_exists('comment')) {
  57. $fields['node']['comments'] = array(
  58. 'title' => t('Comments'),
  59. 'field_type' => DS_FIELD_TYPE_IGNORE,
  60. 'ui_limit' => array(
  61. '*|full', '*|default',
  62. ),
  63. );
  64. }
  65. // Node link.
  66. $fields['node']['node_link'] = array(
  67. 'title' => t('Read more'),
  68. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  69. 'function' => 'ds_render_field',
  70. 'properties' => array(
  71. 'settings' => array(
  72. 'link text' => array('type' => 'textfield'),
  73. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  74. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  75. ),
  76. 'default' => array('link text' => 'Read more', 'wrapper' => '', 'class' => '', 'link' => 1),
  77. )
  78. );
  79. // Author.
  80. $fields['node']['author'] = array(
  81. 'title' => t('Author'),
  82. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  83. 'function' => 'ds_render_author_field',
  84. 'properties' => array(
  85. 'formatters' => array(
  86. 'author' => t('Author'),
  87. 'author_linked' => t('Author linked to profile')
  88. ),
  89. ),
  90. );
  91. // Created time.
  92. $format_types = system_get_date_types();
  93. $date_formatters = array();
  94. foreach ($format_types as $formatter) {
  95. $date_formatters['ds_post_date_' . $formatter['type']] = t($formatter['title']);
  96. }
  97. $fields['node']['post_date'] = array(
  98. 'title' => t('Post date'),
  99. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  100. 'function' => 'ds_render_date_field',
  101. 'properties' => array(
  102. 'formatters' => $date_formatters,
  103. 'entity_render_key' => 'created',
  104. ),
  105. );
  106. // Updated time.
  107. $fields['node']['changed_date'] = array(
  108. 'title' => t('Last modified'),
  109. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  110. 'function' => 'ds_render_date_field',
  111. 'properties' => array(
  112. 'formatters' => $date_formatters,
  113. 'entity_render_key' => 'changed',
  114. ),
  115. );
  116. // "Submitted by"-line. Skip this if the "Submitted By" module is used.
  117. if (!module_exists('submitted_by')) {
  118. $date_formatters = array('ds_time_ago' => t('Time ago')) + $date_formatters;
  119. $fields['node']['submitted_by'] = array(
  120. 'title' => t('Submitted by'),
  121. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  122. 'function' => 'ds_render_submitted_by',
  123. 'properties' => array(
  124. 'formatters' => $date_formatters,
  125. ),
  126. );
  127. }
  128. // User picture
  129. if (variable_get('user_pictures', 0)) {
  130. $key = 'user_picture';
  131. $type = DS_FIELD_TYPE_IGNORE;
  132. $picture_formatters = array();
  133. if (module_exists('image')) {
  134. $key = 'ds_user_picture';
  135. $type = DS_FIELD_TYPE_FUNCTION;
  136. $styles = image_styles();
  137. foreach ($styles as $formatter) {
  138. $picture_formatters['ds_picture_' . $formatter['name']] = drupal_ucfirst(str_replace('_', ' ', $formatter['name']));
  139. }
  140. }
  141. else {
  142. $picture_formatters['default'] = t('Default');
  143. }
  144. $fields['node'][$key] = array(
  145. 'title' => t('User picture'),
  146. 'field_type' => $type,
  147. 'properties' => array(
  148. 'formatters' => $picture_formatters,
  149. ),
  150. );
  151. if ($type == DS_FIELD_TYPE_FUNCTION) {
  152. $fields['node'][$key]['function'] = 'ds_render_user_picture';
  153. }
  154. }
  155. /* --------------------------------------------------------------
  156. Book support.
  157. -------------------------------------------------------------- */
  158. if (module_exists('book')) {
  159. $ui_limit = array();
  160. $types = variable_get('book_allowed_types', array('book'));
  161. foreach ($types as $type) {
  162. $ui_limit[] = $type . '|full';
  163. }
  164. if (!empty($ui_limit)) {
  165. $fields['node']['book_navigation'] = array(
  166. 'title' => t('Book navigation'),
  167. 'field_type' => DS_FIELD_TYPE_IGNORE,
  168. 'ui_limit' => $ui_limit,
  169. );
  170. }
  171. }
  172. /* --------------------------------------------------------------
  173. Comment support.
  174. -------------------------------------------------------------- */
  175. if (module_exists('comment')) {
  176. // Comment Links.
  177. $fields['comment']['links'] = array(
  178. 'title' => t('Links'),
  179. 'field_type' => DS_FIELD_TYPE_IGNORE,
  180. );
  181. // Created time.
  182. $format_types = system_get_date_types();
  183. $date_formatters = array();
  184. foreach ($format_types as $formatter) {
  185. $date_formatters['ds_post_date_' . $formatter['type']] = t($formatter['title']);
  186. }
  187. $fields['comment']['post_date'] = array(
  188. 'title' => t('Post date'),
  189. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  190. 'function' => 'ds_render_date_field',
  191. 'properties' => array(
  192. 'formatters' => $date_formatters,
  193. 'entity_render_key' => 'created',
  194. ),
  195. );
  196. // Permalink.
  197. $fields['comment']['permalink'] = array(
  198. 'title' => t('Permalink'),
  199. 'field_type' => DS_FIELD_TYPE_PREPROCESS,
  200. );
  201. // Submitted.
  202. $fields['comment']['submitted'] = array(
  203. 'title' => t('Submitted'),
  204. 'field_type' => DS_FIELD_TYPE_PREPROCESS,
  205. );
  206. // Title.
  207. $fields['comment']['title'] = array(
  208. 'title' => t('Title'),
  209. 'field_type' => DS_FIELD_TYPE_PREPROCESS,
  210. );
  211. // Author.
  212. $fields['comment']['author'] = array(
  213. 'title' => t('Author'),
  214. 'field_type' => DS_FIELD_TYPE_PREPROCESS,
  215. );
  216. // User signature.
  217. if (variable_get('user_signatures', 0)) {
  218. $fields['comment']['signature'] = array(
  219. 'title' => t('User signature'),
  220. 'field_type' => DS_FIELD_TYPE_PREPROCESS,
  221. );
  222. }
  223. // User picture
  224. if (variable_get('user_pictures', 0)) {
  225. $key = 'picture';
  226. $type = DS_FIELD_TYPE_PREPROCESS;
  227. $picture_formatters = array();
  228. if (module_exists('image')) {
  229. $key = 'ds_user_picture';
  230. $type = DS_FIELD_TYPE_FUNCTION;
  231. $styles = image_styles();
  232. foreach ($styles as $formatter) {
  233. $picture_formatters['ds_picture_' . $formatter['name']] = drupal_ucfirst(str_replace('_', ' ', $formatter['name']));
  234. }
  235. }
  236. else {
  237. $picture_formatters['default'] = t('Default');
  238. }
  239. $fields['comment'][$key] = array(
  240. 'title' => t('User picture'),
  241. 'field_type' => $type,
  242. 'properties' => array(
  243. 'formatters' => $picture_formatters,
  244. ),
  245. );
  246. if ($type == DS_FIELD_TYPE_FUNCTION) {
  247. $fields['comment'][$key]['function'] = 'ds_render_user_picture';
  248. }
  249. }
  250. }
  251. /* --------------------------------------------------------------
  252. User support.
  253. -------------------------------------------------------------- */
  254. // Username
  255. $fields['user']['name'] = array(
  256. 'title' => t('Username'),
  257. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  258. 'function' => 'ds_render_field',
  259. 'properties' => array(
  260. 'entity_render_key' => 'name',
  261. 'settings' => array(
  262. 'link' => array('type' => 'select', 'options' => array('no', 'yes')),
  263. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  264. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  265. ),
  266. 'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
  267. )
  268. );
  269. // User signature
  270. if (variable_get('user_signatures', 0)) {
  271. $fields['user']['user_signature'] = array(
  272. 'title' => t('User signature'),
  273. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  274. 'function' => 'ds_render_markup',
  275. 'properties' => array(
  276. 'key' => 'signature',
  277. 'format' => 'signature_format',
  278. ),
  279. );
  280. }
  281. // User picture
  282. if (variable_get('user_pictures', 0)) {
  283. $key = 'user_picture';
  284. $type = DS_FIELD_TYPE_IGNORE;
  285. $picture_formatters = array();
  286. if (module_exists('image')) {
  287. $key = 'ds_user_picture';
  288. $type = DS_FIELD_TYPE_FUNCTION;
  289. $styles = image_styles();
  290. foreach ($styles as $formatter) {
  291. $picture_formatters['ds_picture_' . $formatter['name']] = drupal_ucfirst(str_replace('_', ' ', $formatter['name']));
  292. }
  293. }
  294. else {
  295. $picture_formatters['default'] = t('Default');
  296. }
  297. $fields['user'][$key] = array(
  298. 'title' => t('User picture'),
  299. 'field_type' => $type,
  300. 'properties' => array(
  301. 'formatters' => $picture_formatters,
  302. ),
  303. );
  304. if ($type == DS_FIELD_TYPE_FUNCTION) {
  305. $fields['user'][$key]['function'] = 'ds_render_user_picture';
  306. }
  307. }
  308. /* --------------------------------------------------------------
  309. Taxonomy support.
  310. -------------------------------------------------------------- */
  311. if (module_exists('taxonomy')) {
  312. // Taxonomy term title.
  313. $fields['taxonomy_term']['title'] = array(
  314. 'title' => t('Title'),
  315. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  316. 'function' => 'ds_render_field',
  317. 'properties' => array(
  318. 'entity_render_key' => 'name',
  319. 'settings' => array(
  320. 'link' => array('type' => 'select', 'options' => array('no', 'yes')),
  321. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  322. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  323. ),
  324. 'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
  325. )
  326. );
  327. // Taxonomy term link.
  328. $fields['taxonomy_term']['more_link'] = array(
  329. 'title' => t('Read more'),
  330. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  331. 'function' => 'ds_render_field',
  332. 'properties' => array(
  333. 'settings' => array(
  334. 'link text' => array('type' => 'textfield'),
  335. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  336. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  337. ),
  338. 'default' => array('link text' => 'Read more', 'wrapper' => '', 'class' => '', 'link' => 1),
  339. )
  340. );
  341. }
  342. // Support for ECK Entity title
  343. if (module_exists('eck')) {
  344. $entity_info = entity_get_info($entity_type);
  345. if (isset($entity_info['module']) && $entity_info['module'] == 'eck') {
  346. $fields[$entity_type]['title'] = array(
  347. 'title' => t('Title'),
  348. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  349. 'function' => 'ds_render_field',
  350. 'properties' => array(
  351. 'entity_render_key' => 'title',
  352. 'settings' => array(
  353. 'link' => array('type' => 'select', 'options' => array('no', 'yes')),
  354. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  355. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  356. ),
  357. 'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
  358. )
  359. );
  360. }
  361. }
  362. // Support for fieldable panels panes.
  363. if (module_exists('fieldable_panels_panes')) {
  364. $fields['fieldable_panels_pane']['title_ds'] = array(
  365. 'title' => t('Display Suite Title'),
  366. 'field_type' => DS_FIELD_TYPE_FUNCTION,
  367. 'function' => 'ds_render_field',
  368. 'properties' => array(
  369. 'entity_render_key' => 'title',
  370. 'settings' => array(
  371. 'link' => array('type' => 'select', 'options' => array('no', 'yes')),
  372. 'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
  373. 'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
  374. ),
  375. 'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
  376. )
  377. );
  378. }
  379. if (isset($fields[$entity_type])) {
  380. return array($entity_type => $fields[$entity_type]);
  381. }
  382. return;
  383. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.