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

:( #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

:( #13

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
Binary file not shown.
5 changes: 5 additions & 0 deletions sites/all/modules/main/node_train_list/node_train_list.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = Node Listing
description = List all the nodes of a node type
dependencies[] = entity
package = Emergya
core = 7.x
76 changes: 76 additions & 0 deletions sites/all/modules/main/node_train_list/node_train_list.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ file

/**
* Implements form alter().
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implements hook_form_FORM_ID_alter().

*/

function node_train_list_form_node_type_form_alter(&$form, &$form_state, $form_id) {

$form['listing']=array(
'#type' => 'fieldset',
'#title' => 'Node type listing',
'#group' => 'additional_settings'
);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 espacio solo


$form['listing']['checkbox']=array(
'#type' => 'checkbox',
'#title' => t('Añadir nodos a un listado de este tipo de contenido'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t('Always in English , please'),

'#default_value' => variable_get('node_train_list_form_node_type_form_submit', 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quiero que me guardes un solo valor, deberia guardar un array con los tipos de contenido que tengan marcado. Por ejemplo:
$settings = variable_get('node_train_list_form_node_type_form_submit', array());
// $settings es de la forma :
/**

  • $settings = array(
    'tipo_contentido_1' => 'tipo_contentido_1',
    'tipo_contentido_2' => 'tipo_contentido_1',
    ...);
    *
    '#default_value' => Si esta el tipo de contenido pongo 1, si no pongo 0,

);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comentario porfi!

$form['#submit'][] = 'node_train_list_form_node_type_form_submit';

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quitame enters al final! porfi


}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comentario porfi

function node_train_list_form_node_type_form_submit($form, &$form_state) {
variable_set('node_train_list_form_node_type_form_submit', $form_state['values']['checkbox']);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Me traigo la variable
// Mirar en $form_state si esta marcado el check. Si lo está añado al array, sino tengo que quitar eltipo de contendio del array .
// Meto el resultado en la variable.
Ejemplo:
$settings = variable_get('node_train_list_form_node_type_form_submit');
if(En $form_state esta marcado) {
$settings['$form_state['']'] = $form_state[''];
}
else {
unset($settings[$form_state['']]);
}

variable_set('jdksjdksjdkjkds', $settings);

}
/**
* Implements hook_menu()
*/

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

juntico please

function node_train_list_menu() {
$items = array (
'node-type-form' => array (
'page callback' => 'node_train_list_callback',
'page arguments' => array('node_train_list_node_type_form'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No te hace falta.

'access callback' => 'user_access',
'access arguments' => array('access to node listing'),

),
);
return $items;
}

/**
* Implements hook permission
*/

function node_train_list_permission() {
return array(
'access to node listing' => array(
'title' => t('Administer Node Listing'),
'description' => t('Administer the permission to Node Train List'),
),
);
}

/**
* Define my callback
*/

function node_train_list_callback($variables) {
$header = array('Cell 1', 'Cell 2');
$rows = array(
array('A', 'B'),
array('C', 'D')
);
$output = theme('table',
array('header' => $header,
'rows' => $rows ));
return $output;
}