Your SlideShare is downloading. ×
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Вадим Малай - Developing for Panels. CTools Plugins.
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Вадим Малай - Developing for Panels. CTools Plugins.

161

Published on

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
161
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Developing for Panels CTools Plugins Vadim Malai Drupal Developer wearepropeople.com vadim.malai@wearepropeople.com
  • 2. Panels Layouts wearepropeople.com
  • 3. Метод “Click-a” wearepropeople.com
  • 4. Где ? wearepropeople.com
  • 5. Как это выглядит ? wearepropeople.com
  • 6. Структура wearepropeople.com
  • 7. Опции wearepropeople.com
  • 8. Пример и Результат wearepropeople.com
  • 9. Из кода wearepropeople.com
  • 10. Декларация в модуле function my_layout_ctools_plugin_directory($owner, $plugin_type) { // Создайте папку 'plugins' в модуле и ставьте .inc файл туда. if ($owner == 'panels' && $plugin_type == 'layouts') { return "plugins/$plugin_type"; }} wearepropeople.com
  • 11. В .info Файл-е Темы ; Panels layouts. Можете создать несколько папок в папке "layouts", каждая из которых будет содержать файлы макетов Panels. plugins[panels][layouts] = plugins/layouts wearepropeople.com
  • 12. Декларация Макета my_layout.inc $plugin = array( 'title' => t('Layout Title'), 'category' => t('Layout Category'), 'icon' => 'my_layout_icon.png', 'theme' => 'my_layout', //Соответствует с названием файла 'css' => 'my_layout.css', 'regions' => array( 'feature' => t('Feature'), // Найменование Регионов ), ); wearepropeople.com
  • 13. Вывод регионов my_layout.tpl.php Доступные Переменные: * - $content: Массив с содержимым * - $css_id: Уникальный идентификатор. * - $panel_prefix: Обёртка макета. * - $panel_suffix: wearepropeople.com
  • 14. Region / Pane Styles wearepropeople.com
  • 15. Декларация в модуле function module_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'panels') { return "plugins/$plugin_type"; } } wearepropeople.com
  • 16. В .info Файл-е Темы ; Panels styles. Можете создать несколько папок в папке "styles", каждая из которых будет содержать файлы стилей Panels. plugins[panels][styles] = plugins/styles wearepropeople.com
  • 17. Декларация Стиля $plugin = array( 'title' => t('Style Title'), 'description' => t('Style Description.'), 'render region' => 'module_render_region', 'render pane' => 'module_render_pane', 'settings form' => 'module_raw_region_settings_form', 'pane settings form' => 'module_raw_pane_settings_form', ); wearepropeople.com
  • 18. Настройки Стилей function module_raw_region_settings_form($style_settings) { $style_settings // Array with previous selected settings // Implements Form API return $form; } wearepropeople.com
  • 19. Настройка вывода function theme_panels_extra_styles_wrapper_render_region($vars) { $panes = $vars['panes']; // Panes from region. $settings = $vars['settings']; // Style Settings. $content = $vars[’content’]; // Pane Item Settings. // Some magic happens. return $output; } wearepropeople.com
  • 20. Ctools Content Types wearepropeople.com
  • 21. Декларация Content Panes function module_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'ctools' && $plugin_type == 'content_types') { return 'plugins/' . $plugin_type; } } wearepropeople.com
  • 22. Декларация Plugin-a $plugin = array( 'single' => TRUE, 'title' => t('Title'), 'description' => t('Description'), 'category' => t('Category'), 'edit form' => 'module_edit_form', 'render callback' => 'module_render', 'admin info' => 'module_admin_info', 'defaults' => array( ), 'all contexts' => TRUE, ); wearepropeople.com
  • 23. Настройки function module_edit_form($form, &$form_state) { $conf = $form_state['conf']; // Implements Form API return $form; } function module_edit_form_submit(&$form, &$form_state) { foreach (array_keys($form_state['plugin']['defaults']) as $key) { $form_state['conf'][$key] = $form_state['values'][$key]; } } wearepropeople.com
  • 24. Вывод Content-a function module_render($subtype, $conf, $args, $contexts) { if (!empty($contexts)) { $content = ctools_context_keyword_substitute($conf['text'], array(), $contexts); } $block = new stdClass(); $block->title = t('This is my title!'); $block->content = $content; return $block; } wearepropeople.com
  • 25. Плагин Доступа wearepropeople.com
  • 26. Декларация Плагина Доступа function custom_module_ctools_plugin_directory($module, $plugin) { if ($module == 'ctools' && !empty($plugin)) { } } wearepropeople.com return "plugins/$plugin";
  • 27. Декларация Плагина $plugin = array( 'title' => t('Title'), 'description' => t('Description'), 'callback' => 'module_custom_ctools_access_check', 'default' => array('some_value' => 0), 'settings form' => 'module_custom_ctools_settings', 'summary' => 'module_custom_ctools_summary', 'required context' => new ctools_context_required(t('Node'), 'node), ); wearepropeople.com
  • 28. Настройки Плагина function module_custom_ctools_settings($form, &$form_state, $conf) { // Implements Form API return $form; } function module_custom_ctools_summary($conf, $context) { // Return Summary } wearepropeople.com
  • 29. Разрешение на Вывода function module_custom_ctools_access_check($conf, $context) { $context; // Context of row input $conf; // Entered Settings return FALSE; // Access Denied return TRUE; // Allow Access } wearepropeople.com
  • 30. wearepropeople.com
  • 31. wearepropeople.com

×