Parcourir la source

[enh] Export 'page' configuration with features.

opi il y a 8 ans
Parent
commit
e78f138014

+ 58 - 0
sites/all/modules/custom/ffdn_common/ffdn_common.features.field_base.inc

@@ -0,0 +1,58 @@
+<?php
+/**
+ * @file
+ * ffdn_common.features.field_base.inc
+ */
+
+/**
+ * Implements hook_field_default_field_bases().
+ */
+function ffdn_common_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',
+    'indexes' => array(
+      'format' => array(
+        0 => 'format',
+      ),
+    ),
+    'locked' => 0,
+    'module' => 'text',
+    'settings' => array(),
+    'translatable' => 0,
+    'type' => 'text_with_summary',
+  );
+
+  // Exported field_base: 'field_attachment'.
+  $field_bases['field_attachment'] = array(
+    'active' => 1,
+    'cardinality' => -1,
+    'deleted' => 0,
+    'entity_types' => array(),
+    'field_name' => 'field_attachment',
+    'indexes' => array(
+      'fid' => array(
+        0 => 'fid',
+      ),
+    ),
+    'locked' => 0,
+    'module' => 'file',
+    'settings' => array(
+      'display_default' => 0,
+      'display_field' => 0,
+      'uri_scheme' => 'public',
+    ),
+    'translatable' => 0,
+    'type' => 'file',
+  );
+
+  return $field_bases;
+}

+ 105 - 0
sites/all/modules/custom/ffdn_common/ffdn_common.features.field_instance.inc

@@ -0,0 +1,105 @@
+<?php
+/**
+ * @file
+ * ffdn_common.features.field_instance.inc
+ */
+
+/**
+ * Implements hook_field_default_field_instances().
+ */
+function ffdn_common_field_default_field_instances() {
+  $field_instances = array();
+
+  // Exported field_instance: 'node-page-body'.
+  $field_instances['node-page-body'] = array(
+    'bundle' => 'page',
+    '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-page-field_attachment'.
+  $field_instances['node-page-field_attachment'] = array(
+    'bundle' => 'page',
+    'deleted' => 0,
+    'description' => 'Vous pouvez joindre des fichiers à la page, si nécessaire.',
+    'display' => array(
+      'default' => array(
+        'label' => 'above',
+        'settings' => array(),
+        'type' => 'hidden',
+        'weight' => 2,
+      ),
+      'teaser' => array(
+        'label' => 'above',
+        'settings' => array(),
+        'type' => 'hidden',
+        'weight' => 0,
+      ),
+    ),
+    'entity_type' => 'node',
+    'field_name' => 'field_attachment',
+    'label' => 'Pièces jointes',
+    'required' => 0,
+    'settings' => array(
+      'description_field' => 1,
+      'file_directory' => 'files',
+      'file_extensions' => 'txt pdf odt odf ods doc xls png jpeg jpg gif mp3 mp4 mkv ogg ogv avi',
+      'max_filesize' => '',
+      'user_register_form' => FALSE,
+    ),
+    'widget' => array(
+      'active' => 1,
+      'module' => 'file',
+      'settings' => array(
+        'progress_indicator' => 'throbber',
+      ),
+      'type' => 'file_generic',
+      'weight' => 31,
+    ),
+  );
+
+  // Translatables
+  // Included for use with string extractors like potx.
+  t('Body');
+  t('Pièces jointes');
+  t('Vous pouvez joindre des fichiers à la page, si nécessaire.');
+
+  return $field_instances;
+}

+ 23 - 0
sites/all/modules/custom/ffdn_common/ffdn_common.features.inc

@@ -0,0 +1,23 @@
+<?php
+/**
+ * @file
+ * ffdn_common.features.inc
+ */
+
+/**
+ * Implements hook_node_info().
+ */
+function ffdn_common_node_info() {
+  $items = array(
+    'page' => array(
+      'name' => t('Page de base'),
+      'base' => 'node_content',
+      'description' => t('Utilisez les <em>pages de base</em> pour votre contenu statique, tel que la page \'Qui sommes-nous\'.'),
+      'has_title' => '1',
+      'title_label' => t('Title'),
+      'help' => '',
+    ),
+  );
+  drupal_alter('node_info', $items);
+  return $items;
+}

+ 12 - 3
sites/all/modules/custom/ffdn_common/ffdn_common.info

@@ -1,5 +1,14 @@
-name = FFDN Common module
+name = ffdn_common
 description = Common module for ffdn.org website
+core = 7.x
 package = Custom
-;dependencies[] = captcha
-core = 7.x
+dependencies[] = features
+dependencies[] = file
+dependencies[] = node
+dependencies[] = text
+features[features_api][] = api:2
+features[field_base][] = body
+features[field_base][] = field_attachment
+features[field_instance][] = node-page-body
+features[field_instance][] = node-page-field_attachment
+features[node][] = page

+ 6 - 0
sites/all/modules/custom/ffdn_common/ffdn_common.module

@@ -1,4 +1,10 @@
 <?php
+/**
+ * @file
+ * Code for the ffdn_common feature.
+ */
+
+include_once 'ffdn_common.features.inc';