Created
December 5, 2011 23:54
-
-
Save sameronline/1435978 to your computer and use it in GitHub Desktop.
customformatter example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hook_field_formatter_info() { | |
return array( | |
'youtube_video' => array( | |
'label' => t('Youtube Video'), | |
'field types' => array('text'), | |
) | |
); | |
} | |
function hook_theme() { | |
return array( | |
'MODULENAME_formatter_youtube_video' => array( | |
'arguments' =>array('element' => NULL), | |
), | |
'example_formatter_plain' => array( | |
'arguments' =>array('element' => NULL), | |
), | |
); | |
} | |
function theme_MODULENAME_formatter_youtube_video($element){ | |
dsm($element['#item']['value']); | |
return ""; | |
} | |
$width= variable_get("youtube_size_width",400); | |
<iframe width="$width" height="315" src="http://www.youtube.com/embed/zUo1ICUAR1w" frameborder="0" allowfullscreen></iframe> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ate_youtube
sites\default\modules\AllianceEnhanced\ate_youtube
use ate_qqform module as example (see the hook_menu) and the form with it
sample code is here:
https://gist.github.com/1435978
http://drupal.org/node/1046864
http://api.drupal.org/api/drupal/modules--system--system.module/function/system_settings_form/6
make refresh everytime you change the formatter settings or anything in the hook
/admin/build/ds/layout/appliance/test
node/15017/ds/test