$name, 'name' => 'Concept SKOS', 'base' => 'node_content', 'title_label' => 'Libellé', 'description' => 'Un concept est une représentation générale et abstraite d\'un objet. Par exemple, dans SKOS un concept permet de designer un mot et son sens (un mot ne permet pas de définir à lui seul un concept à cause du risque d\'homonymie', 'custom' => TRUE, ); $content_type = node_type_set_defaults($concept); node_add_body_field($content_type, 'Définition'); node_type_save($content_type); variable_set('additional_settings__active_tab_' . $name, 'edit-menu'); variable_set('node_preview_' . $name, 2); variable_set('node_options_' . $name, array(0 => 'status', 1 => 'promote')); variable_set('node_submitted_' . $name, 0); variable_set('menu_options_' . $name, array()); variable_set('menu_parent_' . $name, 'main-menu:0'); foreach (_concept_installed_fields() as $field) { field_create_field($field); } foreach (_concept_installed_instances() as $instance) { $instance['entity_type'] = 'node'; $instance['bundle'] = $concept['type']; field_create_instance($instance); } } /** * Structure type de contenu "Concept SKOS". */ function _concept_installed_fields() { return array( 'field_concept_libelle_alt' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'max_length' => '255', ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_libelle_alt' => array( 'value' => 'field_concept_libelle_alt_value', 'format' => 'field_concept_libelle_alt_format', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_libelle_alt' => array( 'value' => 'field_concept_libelle_alt_value', 'format' => 'field_concept_libelle_alt_format', ), ), ), ), ), 'foreign keys' => array( 'format' => array( 'table' => 'filter_format', 'columns' => array( 'format' => 'format', ), ), ), 'indexes' => array( 'format' => array( 'format', ), ), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_libelle_alt', 'type' => 'text', 'module' => 'text', 'active' => '1', 'locked' => '0', 'cardinality' => '-1', 'deleted' => '0', 'columns' => array( 'value' => array( 'type' => 'varchar', 'length' => '255', 'not null' => FALSE, ), 'format' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ), 'field_concept_sigle' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'max_length' => '255', ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_sigle' => array( 'value' => 'field_concept_sigle_value', 'format' => 'field_concept_sigle_format', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_sigle' => array( 'value' => 'field_concept_sigle_value', 'format' => 'field_concept_sigle_format', ), ), ), ), ), 'foreign keys' => array( 'format' => array( 'table' => 'filter_format', 'columns' => array( 'format' => 'format', ), ), ), 'indexes' => array( 'format' => array( 'format', ), ), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_sigle', 'type' => 'text', 'module' => 'text', 'active' => '1', 'locked' => '0', 'cardinality' => '-1', 'deleted' => '0', 'columns' => array( 'value' => array( 'type' => 'varchar', 'length' => '255', 'not null' => FALSE, ), 'format' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ), 'field_concept_illustration' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'attributes' => array( 'target' => 'default', 'class' => '', 'rel' => '', ), 'url' => 0, 'title' => 'optional', 'title_value' => '', 'title_maxlength' => 128, 'enable_tokens' => 1, 'display' => array( 'url_cutoff' => 80, ), ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_illustration' => array( 'url' => 'field_concept_illustration_url', 'title' => 'field_concept_illustration_title', 'attributes' => 'field_concept_illustration_attributes', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_illustration' => array( 'url' => 'field_concept_illustration_url', 'title' => 'field_concept_illustration_title', 'attributes' => 'field_concept_illustration_attributes', ), ), ), ), ), 'foreign keys' => array(), 'indexes' => array(), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_illustration', 'type' => 'link_field', 'module' => 'link', 'active' => '1', 'locked' => '0', 'cardinality' => '-1', 'deleted' => '0', 'columns' => array( 'url' => array( 'type' => 'varchar', 'length' => 2048, 'not null' => FALSE, 'sortable' => TRUE, ), 'title' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE, ), 'attributes' => array( 'type' => 'text', 'size' => 'medium', 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ), 'field_concept_source' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'max_length' => '255', ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_source' => array( 'value' => 'field_concept_source_value', 'format' => 'field_concept_source_format', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_source' => array( 'value' => 'field_concept_source_value', 'format' => 'field_concept_source_format', ), ), ), ), ), 'foreign keys' => array( 'format' => array( 'table' => 'filter_format', 'columns' => array( 'format' => 'format', ), ), ), 'indexes' => array( 'format' => array( 'format', ), ), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_source', 'type' => 'text', 'module' => 'text', 'active' => '1', 'locked' => '0', 'cardinality' => '-1', 'deleted' => '0', 'columns' => array( 'value' => array( 'type' => 'varchar', 'length' => '255', 'not null' => FALSE, ), 'format' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ), 'field_concept_lien' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'attributes' => array( 'target' => 'default', 'class' => '', 'rel' => '', ), 'url' => 0, 'title' => 'optional', 'title_value' => '', 'title_maxlength' => 128, 'enable_tokens' => 1, 'display' => array( 'url_cutoff' => 80, ), ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_lien' => array( 'url' => 'field_concept_lien_url', 'title' => 'field_concept_lien_title', 'attributes' => 'field_concept_lien_attributes', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_lien' => array( 'url' => 'field_concept_lien_url', 'title' => 'field_concept_lien_title', 'attributes' => 'field_concept_lien_attributes', ), ), ), ), ), 'foreign keys' => array(), 'indexes' => array(), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_lien', 'type' => 'link_field', 'module' => 'link', 'active' => '1', 'locked' => '0', 'cardinality' => '-1', 'deleted' => '0', 'columns' => array( 'url' => array( 'type' => 'varchar', 'length' => 2048, 'not null' => FALSE, 'sortable' => TRUE, ), 'title' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'sortable' => TRUE, ), 'attributes' => array( 'type' => 'text', 'size' => 'medium', 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ), 'field_concept_identifiant' => array( 'translatable' => '0', 'entity_types' => array(), 'settings' => array( 'max_length' => '255', ), 'storage' => array( 'type' => 'field_sql_storage', 'settings' => array(), 'module' => 'field_sql_storage', 'active' => '1', 'details' => array( 'sql' => array( 'FIELD_LOAD_CURRENT' => array( 'field_data_field_concept_identifiant' => array( 'value' => 'field_concept_identifiant_value', 'format' => 'field_concept_identifiant_format', ), ), 'FIELD_LOAD_REVISION' => array( 'field_revision_field_concept_identifiant' => array( 'value' => 'field_concept_identifiant_value', 'format' => 'field_concept_identifiant_format', ), ), ), ), ), 'foreign keys' => array( 'format' => array( 'table' => 'filter_format', 'columns' => array( 'format' => 'format', ), ), ), 'indexes' => array( 'format' => array( 'format', ), ), 'field_permissions' => array( 'type' => '0', ), 'field_name' => 'field_concept_identifiant', 'type' => 'text', 'module' => 'text', 'active' => '1', 'locked' => '0', 'cardinality' => '1', 'deleted' => '0', 'columns' => array( 'value' => array( 'type' => 'varchar', 'length' => '255', 'not null' => FALSE, ), 'format' => array( 'type' => 'varchar', 'length' => 255, 'not null' => FALSE, ), ), 'bundles' => array( 'node' => array( 'dummy', ), ), ) ); } /** * Structure type de contenu "Concept SKOS". */ function _concept_installed_instances() { return array( 'field_concept_libelle_alt' => array( 'label' => 'Libellé alternatif', 'widget' => array( 'weight' => '32', 'type' => 'text_textfield', 'module' => 'text', 'active' => 1, 'settings' => array( 'size' => '60', ), ), 'settings' => array( 'text_processing' => '0', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'text_default', 'settings' => array(), 'module' => 'text', 'weight' => 1, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_libelle_alt', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ), 'field_concept_sigle' => array( 'label' => 'Sigle', 'widget' => array( 'weight' => '33', 'type' => 'text_textfield', 'module' => 'text', 'active' => 1, 'settings' => array( 'size' => '60', ), ), 'settings' => array( 'text_processing' => '0', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'text_default', 'settings' => array(), 'module' => 'text', 'weight' => 2, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_sigle', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ), 'field_concept_illustration' => array( 'label' => 'Illustration', 'widget' => array( 'weight' => '34', 'type' => 'link_field', 'module' => 'link', 'active' => 0, 'settings' => array(), ), 'settings' => array( 'validate_url' => 1, 'url' => 0, 'title' => 'optional', 'title_value' => '', 'title_maxlength' => '128', 'enable_tokens' => 1, 'display' => array( 'url_cutoff' => '80', ), 'attributes' => array( 'target' => 'default', 'rel' => '', 'class' => '', 'configurable_title' => 0, 'title' => '', ), 'rel_remove' => 'default', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'link_default', 'settings' => array(), 'module' => 'link', 'weight' => 3, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_illustration', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ), 'field_concept_source' => array( 'label' => 'Source', 'widget' => array( 'weight' => '35', 'type' => 'text_textfield', 'module' => 'text', 'active' => 1, 'settings' => array( 'size' => '60', ), ), 'settings' => array( 'text_processing' => '0', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'text_default', 'settings' => array(), 'module' => 'text', 'weight' => 4, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_source', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ), 'field_concept_lien' => array( 'label' => 'Lien', 'widget' => array( 'weight' => '36', 'type' => 'link_field', 'module' => 'link', 'active' => 0, 'settings' => array(), ), 'settings' => array( 'validate_url' => 1, 'url' => 0, 'title' => 'optional', 'title_value' => '', 'title_maxlength' => '128', 'enable_tokens' => 1, 'display' => array( 'url_cutoff' => '80', ), 'attributes' => array( 'target' => 'default', 'rel' => '', 'class' => '', 'configurable_title' => 0, 'title' => '', ), 'rel_remove' => 'default', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'link_default', 'settings' => array(), 'module' => 'link', 'weight' => 5, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_lien', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ), 'field_concept_identifiant' => array( 'label' => 'Identifiant', 'widget' => array( 'weight' => '37', 'type' => 'text_textfield', 'module' => 'text', 'active' => 1, 'settings' => array( 'size' => '60', ), ), 'settings' => array( 'text_processing' => '0', 'user_register_form' => FALSE, ), 'display' => array( 'default' => array( 'label' => 'above', 'type' => 'text_default', 'settings' => array(), 'module' => 'text', 'weight' => 6, ), 'teaser' => array( 'type' => 'hidden', 'label' => 'above', 'settings' => array(), 'weight' => 0, ), ), 'required' => 0, 'description' => '', 'default_value' => NULL, 'field_name' => 'field_concept_identifiant', 'entity_type' => 'node', 'bundle' => 'dummy', 'deleted' => '0', ) ); } /* * hook_uninstall() * Appelé lors de la désinstallation du module */ function glossaire_uninstall() { $name = 'concept_skos'; $sql = 'SELECT nid FROM {node} n WHERE n.type = :type'; $result = db_query($sql, array(':type' => $name)); $nids = array(); foreach ($result as $row) { $nids[] = $row->nid; } node_delete_multiple($nids); variable_del('additional_settings__active_tab_' . $name); variable_del('node_preview_' . $name); variable_del('node_options_' . $name); variable_del('node_submitted_' . $name); variable_del('menu_options_' . $name); variable_del('menu_parent_' . $name); foreach (array_keys(_concept_installed_fields()) as $field) { field_delete_field($field); } $instances = field_info_instances('node', $name); foreach ($instances as $instance_name => $instance) { field_delete_instance($instance); } node_type_delete($name); field_purge_batch(1000); }