Drupal as a framework
Upcoming SlideShare
Loading in...5
×
 

Drupal as a framework

on

  • 71 views

Diapositivas de la charla Drupal como framework, dada en el grupo phpMAD, en Abril de 2014. ...

Diapositivas de la charla Drupal como framework, dada en el grupo phpMAD, en Abril de 2014.
Hablamos del patrón de diseño que usa Drupal7, el que usa Drupal8, sus diferencias y como afecta eso a la hora de desarrollar módulos utilizando Drupal.
Podéis ver el vídeo aquí: https://www.youtube.com/watch?v=-aI18i506MM

Statistics

Views

Total Views
71
Views on SlideShare
71
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Drupal as a framework Drupal as a framework Presentation Transcript

    • DRUPAL as a framework Samuel Solís @estoyausente linkedin.com/in/samuelsolisfuentes
    • Drupal as a framework Samuel Solís | @estoyausente What is DRUPAL?
    • Drupal as framework Samuel Solís | @estoyausente CMSs Frameworks Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente CMSs Frameworks ¿CMF? Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente Drupal inside Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente diff drupal7 drupal8 - PAC (presentation-abstraction-control)! + MVC! + Orient-Object code! + PHP standards! + Symfony2 component! + Twig! + Build-in web services! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente PAC Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente Drupal7’s PAC http://dsheiko.com/ Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente http://dsheiko.com/ Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente ! block_example/! ├── block_example.info ├── block_example.install ├── block_example.module └── block_example.test tree block_example Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente function block_example_block_info() {! $blocks['example_configurable_text'] = !! array(! 'info' => t('Example),! 'cache' => DRUPAL_CACHE_PER_ROLE,! );! return $blocks;! } ! vi block_example.module Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente function block_example_block_configure($delta = '') {! $form = array();! if ($delta == ‘example_configurable_text’){! $form['block_example_string'] = array(! '#type' => ‘textfield',! '#title' => t('Block contents’),! '#size' => 60,! '#description' => t('This text example'),! '#default_value' => variable_get('block_example_string', t('Some example content.’)),! ); ! } return $form;! } Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente function block_example_block_save($delta = '', $edit = array()) {! if ($delta == ‘example_configurable_text’){! ! variable_set(‘block_example_string’,! ! $edit[‘block_example_string’]);! }! }! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente function block_example_block_view($delta = '') { switch ($delta) {! case ‘example_configurable_text':! $block['subject'] = t('Title'); $block['content'] = block_example_contents();! break; ! }! return $block;! }! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente function block_example_contents() { return variable_get(‘block_example_string’);! }! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente Drupal8’s MVC Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente block_example/ ├── block_example.info.yml ├── block_example.module ├── block_example.routing.yml └── lib └── Drupal └── block_example ├── Controller │   └── BlockExampleController.php ├── Plugin │   └── Block │   ├── ExampleConfigurableTextBlock.php │   ├── ExampleEmptyBlock.php │   └── ExampleUppercaseBlock.php └── Tests ├── BlockExampleMenuTest.php └── BlockExampleTest.php tree block_example Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente block_example/ ├── block_example.info.yml ├── block_example.module ├── block_example.routing.yml └── lib └── Drupal └── block_example ├── Controller │   └── BlockExampleController.php ├── Plugin │   └── Block │   ├── ExampleConfigurableTextBlock.php │   ├── ExampleEmptyBlock.php │   └── ExampleUppercaseBlock.php └── Tests ├── BlockExampleMenuTest.php └── BlockExampleTest.php tree block_example Drupal as a framework Samuel Solís | @estoyausente PSR 0
    • Drupal for devs Samuel Solís | @estoyausente function block_example_menu_link_defaults() { $links['block_example'] = array( 'link_title' => 'Block Example’, 'route_name' => ‘block_example.description', ); return $links; } vi block_example.module Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente block_example.description: path: ‘examples/block_example’ defaults: _content: 'Drupalblock_exampleController BlockExampleController::description' requirements: _access: 'TRUE' vi block_example.routing.yml Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente namespace Drupalblock_exampleController; class BlockExampleController { public function description() { $build = array( '#markup' => t(‘Descripion'), ); return $build; } } vi BlockExampleController.php Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente namespace Drupalblock_examplePluginBlock; use DrupalblockAnnotationBlock; use DrupalblockBlockBase; use DrupalCoreAnnotationTranslation; vi BlockExampleConfigurableText.php Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente class ExampleConfigurableTextBlock extends BlockBase { ! public function defaultConfiguration() { return array( 'block_example_string' => t(‘Default'), ); } ! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente public function blockForm($form, &$form_state) { $form['block_example_string_text'] = array( '#type' => ‘textfield', '#title' => t('Block contents’), '#size' => 60, '#description' => t(‘Description'), '#default_value' => $this->configuration[‘block_example_string'], ); return $form; } ! ! Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente public function blockSubmit($form, & $form_state) { $this->configuration['block_example_string'] = $form_state[‘values'] ['block_example_string_text']; } Drupal as a framework Samuel Solís | @estoyausente
    • Drupal for devs Samuel Solís | @estoyausente public function build() { return array( '#type' => ‘markup', '#markup' => $this->configuration[‘block_example_string'], ); } ! }//end class Drupal as a framework Samuel Solís | @estoyausente
    • Drupal as framework Samuel Solís | @estoyausente Drush Drupal as a framework Samuel Solís | @estoyausente
    • Samuel Solís @estoyausente