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

Df ejercicio rules #16

Open
wants to merge 2 commits into
base: master
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
2 changes: 2 additions & 0 deletions hola.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hola!!!

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/**
* @file
* drupal_formacion_rules.features.field_base.inc
*/

/**
* Implements hook_field_default_field_bases().
*/
function drupal_formacion_rules_field_default_field_bases() {
$field_bases = array();

// Exported field_base: 'body'
$field_bases['body'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(
0 => 'node',
),
'field_name' => 'body',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => 0,
'module' => 'text',
'settings' => array(),
'translatable' => 0,
'type' => 'text_with_summary',
);

// Exported field_base: 'field_estado'
$field_bases['field_estado'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_estado',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 0,
'module' => 'list',
'settings' => array(
'allowed_values' => array(
1 => 'Aprobado',
2 => 'Rechazado',
3 => 'Seleccionado',
),
'allowed_values_function' => '',
),
'translatable' => 0,
'type' => 'list_integer',
);

return $field_bases;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/**
* @file
* drupal_formacion_rules.features.field_instance.inc
*/

/**
* Implements hook_field_default_field_instances().
*/
function drupal_formacion_rules_field_default_field_instances() {
$field_instances = array();

// Exported field_instance: 'node-rules_exercise-body'
$field_instances['node-rules_exercise-body'] = array(
'bundle' => 'rules_exercise',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 0,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(
'trim_length' => 600,
),
'type' => 'text_summary_or_trimmed',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'body',
'label' => 'Body',
'required' => FALSE,
'settings' => array(
'display_summary' => TRUE,
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'module' => 'text',
'settings' => array(
'rows' => 20,
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
'weight' => -4,
),
);

// Exported field_instance: 'node-rules_exercise-field_estado'
$field_instances['node-rules_exercise-field_estado'] = array(
'bundle' => 'rules_exercise',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_estado',
'label' => 'Estado',
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => -3,
),
);

// Translatables
// Included for use with string extractors like potx.
t('Body');
t('Estado');

return $field_instances;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* @file
* drupal_formacion_rules.features.inc
*/

/**
* Implements hook_node_info().
*/
function drupal_formacion_rules_node_info() {
$items = array(
'rules_exercise' => array(
'name' => t('Rules exercise'),
'base' => 'node_content',
'description' => '',
'has_title' => '1',
'title_label' => t('Title'),
'help' => '',
),
);
return $items;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* @file
* drupal_formacion_rules.features.user_role.inc
*/

/**
* Implements hook_user_default_roles().
*/
function drupal_formacion_rules_user_default_roles() {
$roles = array();

// Exported role: Administrador de contenidos.
$roles['Administrador de contenidos'] = array(
'name' => 'Administrador de contenidos',
'weight' => 3,
);

return $roles;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name = Drupal Formacion Rules
description = See exercise description
core = 7.x
package = Features
version = 7.x-1.0
project = drupal_formacion_rules
dependencies[] = entity
dependencies[] = features
dependencies[] = list
dependencies[] = options
dependencies[] = rules
dependencies[] = text
features[features_api][] = api:2
features[field_base][] = body
features[field_base][] = field_estado
features[field_instance][] = node-rules_exercise-body
features[field_instance][] = node-rules_exercise-field_estado
features[node][] = rules_exercise
features[rules_config][] = rules_email_content_admin
features[rules_config][] = rules_unpublish_rejected_content
features[user_role][] = Administrador de contenidos
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Drupal Formacion Rules feature.
*/

include_once 'drupal_formacion_rules.features.inc';
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @file
* drupal_formacion_rules.rules_defaults.inc
*/

/**
* Implements hook_default_rules_configuration().
*/
function drupal_formacion_rules_default_rules_configuration() {
$items = array();
$items['rules_email_content_admin'] = entity_import('rules_config', '{ "rules_email_content_admin" : {
"LABEL" : "email content admin",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "email" ],
"REQUIRES" : [ "rules" ],
"ON" : {
"node_insert--rules_exercise" : { "bundle" : "rules_exercise" },
"node_delete--rules_exercise" : { "bundle" : "rules_exercise" }
},
"DO" : [
{ "mail_to_users_of_role" : {
"roles" : { "value" : { "4" : "4" } },
"subject" : "[node:type] has been created\\/deleted",
"message" : "Activity log for site: [site:name] ([site:url]).\\r\\n[node:nid] - [node:titile]\\r\\nCreated: [node:is-new]"
}
}
]
}
}');
$items['rules_unpublish_rejected_content'] = entity_import('rules_config', '{ "rules_unpublish_rejected_content" : {
"LABEL" : "unpublish rejected content",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "publish" ],
"REQUIRES" : [ "rules" ],
"ON" : {
"node_update--rules_exercise" : { "bundle" : "rules_exercise" },
"node_insert--rules_exercise" : { "bundle" : "rules_exercise" }
},
"IF" : [
{ "data_is" : { "data" : [ "node:status" ], "value" : "1" } },
{ "data_is" : { "data" : [ "node:field-estado" ], "value" : "2" } }
],
"DO" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
}
}');
return $items;
}