easy_social_example.module in Easy Social 8.4
Same filename and directory in other branches
Easy Social Example module.
File
contrib/easy_social_example/easy_social_example.moduleView source
<?php
/**
* @file
* Easy Social Example module.
*/
use Drupal\Core\Url;
/**
* Implements hook_easy_social_widget().
*/
function easy_social_example_easy_social_widget() {
$widgets = array();
// The key is going to be the widget's machine_name.
$widgets['example'] = array(
'name' => t('Example'),
);
return $widgets;
}
/**
* Implements hook_theme().
*/
function easy_social_example_theme() {
$return = array();
// The theme function should be named "easy_social_$WIDGET", where $WIDGET is
// the widget's machine_name.
$return['easy_social_example'] = array(
'variables' => array(),
);
return $return;
}
/**
* Implements hook_preprocess_HOOK() for easy_social_example theme.
*
* @see easy_social_theme()
* @see theme_easy_social_example()
*/
function easy_social_example_preprocess_easy_social_example(&$variables) {
// You can still pre-process this as usual.
// Notice that the config settings have been automatically added.
$options = array();
$options['attributes']['class'] = array(
'class' => 'example-share-button',
);
$url = Url::fromUri('http://www.example.com/share', $options);
$example_share_link = \Drupal::l(t('Example share'), $url);
$variables['example_share_link'] = $example_share_link;
}
/**
* Implements hook_process_HOOK() for easy_social_example theme.
*
* @see easy_social_theme()
* @see theme_easy_social_example()
*/
function easy_social_example_process_easy_social_example(&$variables) {
// You can still process this as usual.
}
Functions
Name![]() |
Description |
---|---|
easy_social_example_easy_social_widget | Implements hook_easy_social_widget(). |
easy_social_example_preprocess_easy_social_example | Implements hook_preprocess_HOOK() for easy_social_example theme. |
easy_social_example_process_easy_social_example | Implements hook_process_HOOK() for easy_social_example theme. |
easy_social_example_theme | Implements hook_theme(). |