bug fixe on newsletter templating
This commit is contained in:
parent
f51f22491b
commit
5dcb9b4590
|
@ -17,9 +17,10 @@ function materio_simplenews_form_node_simplenews_issue_form_alter(&$form, &$form
|
|||
if(in_array($news_id, $newsletters)){
|
||||
|
||||
// prepopulate type of news
|
||||
$form['simplenews_issue']['widget']['target_id']['#default_value'] = [$news_id];
|
||||
$form['simplenews_issue']['widget']['target_id']['#default_value'] = $news_id;
|
||||
$form['simplenews_issue']['widget']['target_id']['#disabled'] = true;
|
||||
|
||||
unset($form['simplenews_issue']['widget']['target_id']['#ajax']);
|
||||
|
||||
// change default template regarding type of news
|
||||
$form['body']['widget'][0]['#default_value'] = materio_simplenews_getSimplenewsNodeBodyTemplate($news_id);
|
||||
$form['body']['widget'][0]['#rows'] = 50;
|
||||
|
@ -30,4 +31,10 @@ function materio_simplenews_form_node_simplenews_issue_form_alter(&$form, &$form
|
|||
|
||||
function materio_simplenews_getSimplenewsNodeBodyTemplate($news_id){
|
||||
return file_get_contents(drupal_get_path('module', 'materio_simplenews').'/templates/simplenews_'.$news_id.'_node.html');
|
||||
}
|
||||
|
||||
function materio_simplenews_form_node_simplenews_issue_edit_form_alter(&$form, &$form_state, $form_id) {
|
||||
$default = $form['simplenews_issue']['widget']['target_id']['#default_value'];
|
||||
$form['simplenews_issue']['widget']['target_id']['#default_value'] = $default[0];
|
||||
$form['simplenews_issue']['widget']['target_id']['#disabled'] = true;
|
||||
}
|
Loading…
Reference in New Issue