Skip to content

Instantly share code, notes, and snippets.

@jackfoust
jackfoust / Form and Block Render Example
Last active August 29, 2015 14:08
#drupal Form and Block Render to display site alert message. Drupal 7
<?php
/**
* @file
* Create form for alert message entry and render a block with message if message is not empty. Blocked place in header in this example with custom CSS.
*/
/**
* Implements hook_menu().
*/
@jackfoust
jackfoust / Feeds Importer Plugin
Last active August 29, 2015 14:08
#drupal Sample plugin for Feeds Importer module.Drupal 7
<?php
/**
* @file
* Creates a plugin that in this example was used in the Feeds Importer module. Plugin can execute PHP against values passed to it.
*/
$plugin = array(
'form' => 'MODULE_NAME_PLUGIN_NAME_form',
// Optional validation callback.
'validate' => 'MODULE_NAME_PLUGIN_NAME__validate',
@jackfoust
jackfoust / Drupal Entity Field Export
Last active August 29, 2015 14:08
#drupal Entity export. Useful in hook_install() and hook_uninstall(). Drupal 7
<?php
/**
* @file
* Export serialized data containing fields attached to an Entity. Example used when Features not installed.
*/
function MODULE_NAME_install() {
drupal_install_schema(SCHEMA_NAME);
MODULE_NAME_add_entity_fields();