La page d'accueil. Par défaut, la page d'accueil de drupal liste les 10 derniers contenu du site dont l'option de publication en page d'accueil est cochée. (voir créer du contenu) Ce comportement est souvent judicieux lorsque l'on souhaite faire un blog ou un site d'actualité, mais reste très rudimentaire et est souvent mal adapté dans la plupart des autres cas. On veut souvent avoir une page de bienvenue comme page d'accueil avec des informations qui permettent de guider l'internaute sur notre site. Pour réaliser une telle page d'accueil, il faut d'abord créer un contenu de type page (ou autre) puis ensuite définir ce contenu comme page d'accueil de notre site.
Définir un contenu comme page d'accueil Il suffit de se rendre dans administrer/paramètres. Voilà ! Form API Reference. Drupal 7 Javascript exemple Ajax Framework à partir d'un lien | Code Karaté. For a Daily Dose of Drupal episode that covers this blog post topic as well, take a look at Drupal 7 Ajax Framework Link Example . After struggling to find documentation on how to take advantage of the Drupal Ajax Framework with just a simple HTML link I decided to provide an example to anyone else who might be struggling with the same problem. The documentation on drupal.org is very detailed, however most of the documentation centers around using the Drupal 7 Ajax Framework with forms. In this case I just want to use the Drupal 7 Ajax Framework with a simple link. I am going to start by creating a simple module that will provide an example. First we create the ajax_link.info file: name = "Ajax Link Test" description = "A simple Ajax link example" core = 7.x The next step is to create the ajax_link.module file.
Next we create the page callback for our hook_menu implementation. Now we save everything, clear the cache and take a look at the page. We now create the Ajax callback. That is it. Effet miroir sur une image avec le canvas HTML5. Comment créer et appliquer des styles d’images avec Drupal 7 via le code. Cet article fait suite au précédent post : « Comment créer et appliquer des styles d’images avec Drupal 7 via l’UI » ou je vous détaillais comment, via l’interface d’administration, créer un style d’image. Aujourd’hui le sujet reste le même, mais la création sera faite par la programmation.
Si comme moi, vous êtes confrontés à maintenir à jour des sites Drupal, vous avez déjà dû vous poser tout un tas de questions sur la pérennisation des configurations et de ce fait, vous vous êtes résignés à faire vos modifications directement depuis l’interface d’administration. Du coup, pour chaque chose simple qu’il est possible de faire via le back-office de Drupal, il faut trouver comment le faire en code. Ainsi, sur la même base que l’article précédent, voici comment créer et appliquer un style d’image par la programmation. Créer un style d’image via le code On ne peut plus simple non ? Voici d’autres fonctions utiles si vous souhaitez intervenir sur les différents styles d’images : Crédits Photo.
Reset admin password in drupal 7. Views : afficher du contenu hierarchisé. Cet article est la traduction du billet de Michael Anello : Displaying Hierarchical Content. Vous connaissez Michael Anello : vous avez été nombreux à lire et, je n'en doute pas ;-) , apprécier son papier sur Blueprint CSS. Dans Displaying Hierarchical Content il aborde notamment une des fonctionnalités de Views : les relations. Avec son accord, ses exemples ont été francisés et j'ai également détaillé le processus CCK de création des types de contenus personnalisés qu'il utilise pour l'article. Afficher du contenu de façon hiérarchisée est un besoin courant pour les sites pilotés par bases de données. Pour notre exemple, disons que vous allez réaliser un site sur les voitures.
Dans cet exemple, je prendrais deux marques (Peugeot et Citroën) et elles auront chacune trois véhicules : Le puissant module CCK de Drupal vous permet de créer des types de contenus pour votre site. Le type de contenu Constructeurs automobiles Le type de contenu Modèles de voitures Voilà qui est fait ! Search for taxonomy_get | Drupal 6.
Migrate. Theming. Comment créer et mettre à jour un node par la programmation. Bien que cela puisse paraître compliqué de l’extérieur, créer et modifier des contenus Drupal sans l’aide de l’interface d’administration est une chose relativement simple lorsque l’on s’est déjà confronté au problème. Néanmoins il faut être prudent avec ce que vous voulez sauvegarder, puisqu’en outrepassant le système naturel de création de contenus via l’interface d’admin vous avez la possibilité de faire tout et n’importe quoi et d’empêcher les autres modules de fonctionner correctement.
Voici donc un poste très simple sur la création de nodes via la programmation. 1.1 Initialisation de l’objet node Notes : - Définition de la langue : Si le module Locale n’est pas activé sur votre site, utilisez la constante LANGUAGE_NONE afin de ne pas spécifier de langue en particulier à votre contenu, sinon insérez la langue désirée. - Node_object_prepare() : remplit par défaut certaines valeurs telles que le statut, la promotion en page d’accueil, les commentaires ou encore le sticky.
How to implement Drupal AJAX Autocomplete | Drupal Development, Alfresco Development and SproutCore Development from Appnovation. Tutoriels | Wonder Drupal. Rendering Drupal 7 fields (the right way) The short answer. Use field_view_field()! The long answer. Drupal 7 brought us Entities, and with them the powerful Field API for 'storing, loading, editing, and rendering field data.' attached to them.
If you're managing everything through 'manage fields' and 'manage display' tabs of your content type, then every part of that process is rather wonderfully taken care of for you. We often, however, come across the need to render a field outside the context of it's entity. A common example might include rendering a node's author in a sidebar block. You may well have seen (or written!) // This is WRONG example. Poking around the node object for the value you wanted to print was fairly common in Drupal 6, and the 'safe_value' sounds like it's been sanitised, right?
Firstly, the ['und'] element is part of the field localisation in Drupal 7 (see this article from Gábor Hojtsy for more on that); directly accessing that value will cause issues in any kind of multi-lingual environment. This Rocks. Taxonomy CSV import/export help. This module allows to import/export taxonomies, structures or simple lists of terms into/from a vocabulary from/to a CSV file, a url or a copy-and-paste text. CSV format is a simple list of values separated by a delimiter, often comma (,) or semicolon (;), and enclosures, often quotation marks ("). If you are unsure how to create a CSV file, you might want to use LibreOffice Calc or another spreadsheet application to export your data into a CSV file.
Specific import or export formats can be added simply by a plug-in mecanism (or ask author!). After enabling the module, permissions "import taxonomy by csv" and "export taxonomy by csv" need to be set. Main "administer taxonomy" permission is not needed to use module, but this is recommended. Internationalization is supported, except for attached Fields [Taxonomy CSV pour Drupal 7 only]. So you can import a list or a structure of terms, then translate them. 1. Multiple formats can be used to import or export vocabulary. 1. 1. 2. Mixed scheme. UPsites | Drupal 7 Database Schema. Drupal7_model_0.png (2553×2399) Token. Tokens are small bits of text that can be placed into larger documents via simple placeholders, like %site-name or [user]. The Token module provides a central API for modules to use these tokens, and expose their own token values. Note that Token module doesn't provide any visible functions to the user on its own, it just provides token handling services for other modules.
For Drupal 6, the Token module provides a "Token Actions" module which can be enabled separately. This provides several "actions" for the Drupal core Actions/Trigger modules to use that take advantage of the Token replacement functionality. Modules that use the Token module and provide tokens via the API include Organic Groups, Pathauto, Comment Notify, and Commerce. Also check out the full list of modules that use or provide tokens or the list of open issues tagged with 'token'. Pledges #D7CX: The basic token API is now a part of Drupal 7!
#D7AX - I pledge to make this module as accessible as it can be. Form generation | form.inc. Functions to enable the processing and display of HTML forms. Drupal uses these functions to achieve consistency in its form processing and presentation, while simplifying code and reducing the amount of HTML that must be explicitly generated by modules. The primary function used with forms is drupal_get_form(), which is used for forms presented interactively to a user.
Forms can also be built and submitted programmatically without any user input using the drupal_form_submit() function. drupal_get_form() handles retrieving, processing, and displaying a rendered HTML form for modules automatically. Here is an example of how to use drupal_get_form() and a form builder function: Or with any number of additional arguments: $extra = "extra"; $form = drupal_get_form('my_module_example_form', $extra); ... function my_module_example_form($form, &$form_state, $extra) { $form['submit'] = array( '#type' => 'submit', '#value' => $extra, ); return $form; } Functions File includes/form.inc, line 25. Form API Reference. Drupal_set_message | bootstrap.inc. Sets a message to display to the user. Messages are stored in a session variable and displayed in page.tpl.php via the $messages theme variable. Example usage: drupal_set_message(t('An error occurred and processing did not complete.'), 'error'); Parameters string $message: (optional) The translated message to be displayed to the user.
String $type: (optional) The message's type. 'status''warning''error' bool $repeat: (optional) If this is FALSE and the message is already set, then the message won't be repeated. Return value array|null A multidimensional array with keys corresponding to the set message types. See also drupal_get_messages() theme_status_messages() 265 calls to drupal_set_message() File includes/bootstrap.inc, line 1777 Functions that need to be loaded on every Drupal request. Code. Form API Quickstart Guide. Note that these instructions focus on Drupal 6. Corresponding documentation for Drupal 7 is here. The Drupal Form API provides sophisticated form techniques and also allows for almost unlimited possibilities for custom theming, validation, and execution of forms. Even better, ANY form (even those in core) can be altered in almost any way imaginable—elements can be removed, added, and rearranged. Perhaps most important, the Form API provides a secure framework for forms, protecting against many exploits, and the programmer has to do almost nothing to get this protection.
This page is certainly not a comprehensive guide to this functionality. It should provide a good working foundation with which to do the most basic form creation, theming, validation, and execution. Jump to sections on creating, theming, validating, submitting and understanding the flow. Creating Forms <? Create a submit button: <? A few things to note: Let's take a look at a working piece of code using the API: Theming Forms.
Hook_menu | system.api.php. Define menu items and page callbacks. This hook enables modules to register paths in order to define how URL requests are handled. Paths may be registered for URL handling only, or they can register a link to be placed in a menu (usually the Navigation menu). A path and its associated information is commonly called a "menu router item". This hook is rarely called (for example, when modules are enabled), and its results are cached in the database. hook_menu() implementations return an associative array whose keys define paths and whose values are an associative array of properties for each path. (The complete list of properties is in the return value section below.) Callback Functions The definition for each path may include a page callback function, which is invoked when the registered path is requested.
Function mymodule_menu() { $items['abc/def'] = array( 'page callback' => 'mymodule_abc_view', ); return $items; } function mymodule_abc_view($ghi = 0, $jkl = '') { } Callback Arguments File. Migrate Drupal 6 to Drupal 7. Changing from Drupal 6 to Drupal 7 is not just a simple update. The steps seem straightforward, but there are major changes in the way Drupal 7 works and stores data. So a move up across major version numbers is really a "migration" as opposed to a simple update or patch.
If your site is fairly simple, with good backups, and you use the right approach, you can accomplish the migration without too much trouble. The more complex your site is, the more complex the migration will be. Doing a migration involves several steps. You might want to review these related tutorials. Step 1: Backup your site's database * It is wise to try an update or upgrade on a test copy of your site before applying it to your live site. There is a handy tool called Backup and Migrate, which helps simplify the backup process, which you can download from this page Step 2: Backup all your folders and files You can't be too paranoid about having extra copies. 16. Search for api. Le manuel du designer. Sommaire NB: ce signe [^], à coté de chaque titre de paragraphe, vous permet de revenir au sommaire ci-dessous Introduction aux thèmes ^ Pré-requis Drupal est reconnu pour sa puissance et sa flexibilité, il est ainsi parfois difficile de comprendre comment interagissent les différents éléments qui composent l'application.
Même s'il existe de nombreuses façons de réaliser un thème, toutes ne sont pas forcément recommandées. Avoir connaissance des bonnes pratiques permet de minimiser les erreurs et de faciliter la maintenance. Même si vous choisissez de ne pas respecter les règles et de mettre en œuvre votre propre méthode, vous aurez de meilleurs chances de succès en en ayant connaissance. Cela ne veut pas dire que vous devez comprendre Drupal dans les moindres détails pour être capable de créer votre propre thème. Le but de ce manuel est d'introduire les notions qui vous permettront de mieux appréhender le fonctionnement de la couche graphique d'une application Drupal. .info (requis) Autres.