Skip to content

Commit

Permalink
Updating Display Suite to 7.x-2.16
Browse files Browse the repository at this point in the history
  • Loading branch information
mwanberg committed Dec 4, 2018
1 parent ac75a6f commit 64ca0f6
Show file tree
Hide file tree
Showing 36 changed files with 1,782 additions and 609 deletions.
13 changes: 12 additions & 1 deletion sites/all/modules/contrib/ds/css/ds.admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
margin-bottom: 1em;
}

#field-display-overview .field-formatter-settings-edit-form .ft-group {
border-top: 1px solid #aaa;
padding: 5px 0;
overflow: auto;
}

#field-display-overview .field-formatter-settings-edit-form .ft-group.lb {
border-top: none;
}

#field-display-overview .field-formatter-settings-edit-form .ft-group .form-item {
margin: 0;
white-space: normal;
}

.ds-layout-preview-title {
Expand Down Expand Up @@ -164,7 +175,7 @@ a.section-link {
.vertical-tabs fieldset#edit-additional-settings-ds-page-title-options-page-option-contexts {
margin: 1em 0;
padding: 2.5em 0 0;
border: 1px solid #CCCCCC;
border: 1px solid #ccc;
}

#edit-additional-settings-ds-page-title-options-page-option-contexts legend {
Expand Down
64 changes: 59 additions & 5 deletions sites/all/modules/contrib/ds/ds.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@ function hook_ds_fields_info($entity_type) {
'use_token' => TRUE, // or FALSE,

// block: the module and delta of the block, only for block fields.
'block' => 'user-menu',
//
// @note: Display Suite uses a "|" token to split the module from
// the delta.
'block' => 'user|menu',

// block_render: block render type, only for block fields.
// - DS_BLOCK_CONTENT : render through block template file.
// - DS_BLOCK_TEMPLATE : render through block template file.
// - DS_BLOCK_TITLE_CONTENT : render only title and content.
// - DS_BLOCK_CONTENT : render only content.
'block_render' => DS_BLOCK_CONTENT,
Expand Down Expand Up @@ -238,7 +241,7 @@ function hook_ds_custom_fields_info() {
);
$ds_field->properties = array(
'code' => array(
'value' => '<? print "this is a custom field"; ?>',
'value' => '<?php print "this is a custom field"; ?>',
'format' => 'ds_code',
),
'use_token' => 0,
Expand Down Expand Up @@ -268,7 +271,9 @@ function hook_ds_vd_info() {
}

/**
* Alter fields defined by Display Suite
* Alter fields defined by Display Suite.
*
* This function is called for each entity type.
*
* @param $fields
* An array with fields which can be altered just before they get cached.
Expand Down Expand Up @@ -420,9 +425,12 @@ function hook_ds_layout_info() {
* - entity_type
* - bundle
* - view_mode
* @param array $vars
* All variables available for render. You can use this to add css classes.
*/
function hook_ds_pre_render_alter(&$layout_render_array, $context) {
function hook_ds_pre_render_alter(&$layout_render_array, $context, &$vars) {
$layout_render_array['left'][] = array('#markup' => 'cool!', '#weight' => 20);
$vars['attributes_array']['class'][] = 'custom';
}

/**
Expand Down Expand Up @@ -552,6 +560,28 @@ function ds_views_row_adv_VIEWS_NAME(&$vars, $view_mode) {
$vars['object'] = 'This is what I want for christmas.';
}

/**
* Modify the entity render array in the context of a view.
*
* @param array $content
* By reference. An entity view render array.
* @param array $context
* By reference. An associative array containing:
* - row: The current active row object being rendered.
* - view: By reference. The current view object.
* - view_mode: The view mode which is set in the Views' options.
* - load_comments: The same param passed to each row function.
*
* @see ds_views_row_render_entity()
*/
function hook_ds_views_row_render_entity_alter(&$content, &$context) {
if ($context['view_mode'] == 'my_mode') {
// Modify the view, or the content render array in the context of a view.
$view = &$context['view'];
$element = &drupal_array_get_nested_value($content, array('field_example', 0));
}
}

/**
* Alter the strings used to separate taxonomy terms.
*/
Expand All @@ -562,6 +592,30 @@ function hook_ds_taxonomy_term_separators(&$separators) {
$separators[' | '] = t('pipe');
}

/**
* Allow modules to provide additional classes for regions and layouts.
*/
function hook_ds_classes_alter(&$classes, $name) {
if ('ds_classes_regions' === $name) {
$classes['css-class-name'] = t('Custom Styling');
}
}

/**
* Alter the field template settings form
*
* @param array $form
* The form containing the field settings
* @param array $field_settings
* The settings of the field
*/
function hook_ds_field_theme_functions_settings_alter(&$form, $field_settings) {
$form['something'] = array(
'#type' => 'textfield',
'#title' => 'test',
);
}

/*
* @} End of "addtogroup hooks".
*/
70 changes: 63 additions & 7 deletions sites/all/modules/contrib/ds/ds.ds_fields_info.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function ds_ds_fields_info($entity_type) {
'properties' => $field->properties,
);
if (!empty($field->ui_limit)) {
$fields[$entity_type][$key]['ui_limit'] = explode("\n", $field->ui_limit);
$lines = explode("\n", $field->ui_limit);
$fields[$entity_type][$key]['ui_limit'] = $lines;
}
}
}
Expand Down Expand Up @@ -74,10 +75,11 @@ function ds_ds_fields_info($entity_type) {
'properties' => array(
'settings' => array(
'link text' => array('type' => 'textfield'),
'link class' => array('type' => 'textfield', 'description' => t('Put a class on the link. Eg: btn btn-default')),
'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
),
'default' => array('link text' => 'Read more', 'wrapper' => '', 'class' => '', 'link' => 1),
'default' => array('link text' => 'Read more', 'link class' => '', 'wrapper' => '', 'class' => '', 'link' => 1),
)
);

Expand Down Expand Up @@ -106,20 +108,34 @@ function ds_ds_fields_info($entity_type) {
'function' => 'ds_render_date_field',
'properties' => array(
'formatters' => $date_formatters,
'entity_render_key' => 'created',
),
);

// "Submitted by"-line.
$date_formatters = array('ds_time_ago' => t('Time ago')) + $date_formatters;
$fields['node']['submitted_by'] = array(
'title' => t('Submitted by'),
// Updated time.
$fields['node']['changed_date'] = array(
'title' => t('Last modified'),
'field_type' => DS_FIELD_TYPE_FUNCTION,
'function' => 'ds_render_submitted_by',
'function' => 'ds_render_date_field',
'properties' => array(
'formatters' => $date_formatters,
'entity_render_key' => 'changed',
),
);

// "Submitted by"-line. Skip this if the "Submitted By" module is used.
if (!module_exists('submitted_by')) {
$date_formatters = array('ds_time_ago' => t('Time ago')) + $date_formatters;
$fields['node']['submitted_by'] = array(
'title' => t('Submitted by'),
'field_type' => DS_FIELD_TYPE_FUNCTION,
'function' => 'ds_render_submitted_by',
'properties' => array(
'formatters' => $date_formatters,
),
);
}

// User picture
if (variable_get('user_pictures', 0)) {
$key = 'user_picture';
Expand Down Expand Up @@ -193,6 +209,7 @@ function ds_ds_fields_info($entity_type) {
'function' => 'ds_render_date_field',
'properties' => array(
'formatters' => $date_formatters,
'entity_render_key' => 'created',
),
);

Expand Down Expand Up @@ -355,6 +372,45 @@ function ds_ds_fields_info($entity_type) {
);
}

// Support for ECK Entity title
if (module_exists('eck')) {
$entity_info = entity_get_info($entity_type);
if (isset($entity_info['module']) && $entity_info['module'] == 'eck') {
$fields[$entity_type]['title'] = array(
'title' => t('Title'),
'field_type' => DS_FIELD_TYPE_FUNCTION,
'function' => 'ds_render_field',
'properties' => array(
'entity_render_key' => 'title',
'settings' => array(
'link' => array('type' => 'select', 'options' => array('no', 'yes')),
'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
),
'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
)
);
}
}

// Support for fieldable panels panes.
if (module_exists('fieldable_panels_panes')) {
$fields['fieldable_panels_pane']['title_ds'] = array(
'title' => t('Display Suite Title'),
'field_type' => DS_FIELD_TYPE_FUNCTION,
'function' => 'ds_render_field',
'properties' => array(
'entity_render_key' => 'title',
'settings' => array(
'link' => array('type' => 'select', 'options' => array('no', 'yes')),
'wrapper' => array('type' => 'textfield', 'description' => t('Eg: h1, h2, p')),
'class' => array('type' => 'textfield', 'description' => t('Put a class on the wrapper. Eg: block-title')),
),
'default' => array('wrapper' => 'h2', 'link' => 0, 'class' => ''),
)
);
}

if (isset($fields[$entity_type])) {
return array($entity_type => $fields[$entity_type]);
}
Expand Down
7 changes: 3 additions & 4 deletions sites/all/modules/contrib/ds/ds.info
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ files[] = tests/ds.views.test
files[] = tests/ds.forms.test
configure = admin/structure/ds

; Information added by drupal.org packaging script on 2012-10-05
version = "7.x-2.0"
; Information added by Drupal.org packaging script on 2018-07-03
version = "7.x-2.16"
core = "7.x"
project = "ds"
datestamp = "1349439417"

datestamp = "1530614326"
61 changes: 56 additions & 5 deletions sites/all/modules/contrib/ds/ds.install
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ function ds_install() {
*/
function ds_uninstall() {
variable_del('ds_classes_regions');
variable_del('ds_disable');
variable_del('ds_extras_region_blocks');
variable_del('menu_rebuild_needed');
}

/**
Expand Down Expand Up @@ -69,7 +72,7 @@ function ds_schema() {
'view_mode' => array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 32,
'length' => 64,
'not null' => TRUE,
'default' => '',
),
Expand Down Expand Up @@ -131,7 +134,7 @@ function ds_schema() {
'view_mode' => array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 32,
'length' => 64,
'not null' => TRUE,
'default' => '',
),
Expand Down Expand Up @@ -179,7 +182,7 @@ function ds_schema() {
'view_mode' => array(
'description' => 'The machine name of the view mode.',
'type' => 'varchar',
'length' => 32,
'length' => 64,
'not null' => TRUE,
'default' => '',
),
Expand Down Expand Up @@ -229,7 +232,7 @@ function ds_schema() {
'label' => array(
'description' => 'The label of the field.',
'type' => 'varchar',
'length' => 32,
'length' => 128,
'not null' => TRUE,
'default' => '',
),
Expand Down Expand Up @@ -276,4 +279,52 @@ function ds_update_7201() {
if (!db_field_exists('ds_fields', 'ui_limit')) {
db_add_field('ds_fields', 'ui_limit', $schema['ds_fields']['fields']['ui_limit']);
}
}
}

/**
* Increase the label storage length to 128.
*/
function ds_update_7202() {
db_change_field('ds_fields', 'label', 'label',
array(
'description' => 'The label of the field.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
));
}


/**
* Increase the view_mode storage length to 64
*/
function ds_update_7203() {
db_change_field('ds_field_settings', 'view_mode', 'view_mode',
array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
db_change_field('ds_layout_settings', 'view_mode', 'view_mode',
array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
db_change_field('ds_view_modes', 'view_mode', 'view_mode',
array(
'description' => 'The machine name of the view mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
}
Loading

0 comments on commit 64ca0f6

Please sign in to comment.