Skip to content

The drupal module provides a field that can output defined callbacks that will be pushed though drupal_render.

Notifications You must be signed in to change notification settings

itomic/itomic_page_insert

Repository files navigation

README

The module provides a field that can output defined callbacks that will be pushed though drupal_render.

This works well with the paragraphs module.

How to use this module

To define the callbacks, create a custom module and define the following hook. Then include you custom callback function.

/**
 * hook_itomic_page_insert
 */
function my_module_itomic_page_inserts(&$vars) {

  $vars['my_page_insert'] = array(
    'callback'  => 'my_module_loader',
    'title'     => t('My Page Insert'), 
  );
  return $vars;
}

/**
 * Callback
 */
function my_module_loader() {
    $base = drupal_get_path('module', 'my_module');

    $content = array();
    $content['#attached'] = array(    // Add custom CSS.
        'css' => array(
            $base . '/color.css' => array(),
        ),
        // Add custom JavaScript.
        'js' => array(
            $base . '/color.js',
        )
    );
    $content['#markup'] = '<h1>Hello world</h1>';

    return $content;
}

About

The drupal module provides a field that can output defined callbacks that will be pushed though drupal_render.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages