Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to disable sticky and promote to the front page in node creation #197

Open
wants to merge 2 commits into
base: 7.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dkan_dataset.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ function dkan_dataset_form_settings() {
to create new datasets if this is enabled.'),
'#default_value' => variable_get('dkan_dataset_form_group_validation', 0),
);
$form['dkan_dataset_form_remove_promoted_sticky'] = array(
'#type' => 'checkbox',
'#title' => t('Remove "Promoted to Front page" and remove "Sticky at the top of lists"'),
'#default_value' => variable_get('dkan_dataset_form_remove_promoted_sticky', 0),
);

return system_settings_form($form);
}
Expand Down
4 changes: 4 additions & 0 deletions dkan_dataset.forms.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function dkan_dataset_get_group_options() {
* Implements hook_form_FORM_ID_alter().
*/
function dkan_dataset_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id, '_node_form') !== FALSE && variable_get('dkan_dataset_form_remove_promoted_sticky', 0)) {
$form['options']['sticky']['#access'] = FALSE;
$form['options']['promote']['#access'] = FALSE;
}

if ($form_id == 'dataset_node_form') {

Expand Down