DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer...

113
DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 OH MY!

Transcript of DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer...

Page 1: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

DRUPALCON BALTIMORE

PLUGINS, COMPOSER AND PHP7 OH MY!

Page 2: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

KRIS VANDERWATER

CTOOLS CO-MAINTAINER DRUPAL 8 CONTRIBUTOR PAGE LAYOUT SPECIALIST PLUGIN SUBSYSTEM CO-AUTHOR ACQUIA TECHNICAL CONSULTANT

Page 3: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 4: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 5: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 6: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 7: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 8: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 9: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

?

Page 10: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

History

Page 11: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 12: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

https://www.drupal.org/node/1826054 Expose Drupal Components outside of Drupal

Page 13: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

https://www.drupal.org/node/1497366

Committed by Dries: July 14th 2012 (Nearly 5 years ago)

Page 14: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 15: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 16: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PRIORITIES

Page 17: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

1. Static Factory Methods

PRIORITIES

Page 18: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

1. Static Factory Methods

2. Constructors

PRIORITIES

Page 19: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

1. Static Factory Methods

2. Constructors

3. Array based Plugin Definitions

PRIORITIES

Page 20: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

1. Static Factory Methods

2. Constructors

3. Array based Plugin Definitions

4. Plugin Filtering

PRIORITIES

Page 21: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

1. Static Factory Methods

2. Constructors

3. Array based Plugin Definitions

4. Plugin Filtering

5. Plugin Mutating

PRIORITIES

Page 22: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 23: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

and 5.6

Page 24: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 25: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

STATIC FACTORY

Page 26: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 27: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 28: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PLUGIN:: __CONSTRUCT()

Page 29: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

Page 30: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

▸ array $configuration

Page 31: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

▸ array $configuration

▸ $plugin_id

Page 32: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

▸ array $configuration

▸ $plugin_id

▸ $plugin_definition

Page 33: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

▸ array $configuration

▸ Dumping ground for all the things…

▸ $plugin_id

▸ $plugin_definition

Page 34: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ D8

▸ array $configuration

▸ Dumping ground for all the things…

▸ Kinda sucks…

▸ $plugin_id

▸ $plugin_definition

Page 35: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ PHP Component

Page 36: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ PHP Component

▸ No prescribed constructor or parameters.

Page 37: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ PHP Component

▸ No proscribed constructor or parameters.

▸ Custom Constructors

Page 38: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN::__CONSTRUCT()

▸ PHP Component

▸ No proscribed constructor or parameters.

▸ Custom Constructors

▸ Custom Factories

Page 39: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PHP 5.6

Page 40: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Variadics

Page 41: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Variadics

▸ Replacement for func_get_args()

Page 42: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Variadics

▸ Replacement for func_get_args()

▸ WAAAAAAY better

Page 43: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Variadics

▸ Replacement for func_get_args()

▸ WAAAAAAY better

▸ Now with type-hints!

Page 44: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Argument Unpacking

Page 45: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Argument Unpacking

▸ Essentially the opposite of variadics

Page 46: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Argument Unpacking

▸ Essentially the opposite of variadics

▸ Like exploding an array into a function

Page 47: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6

▸ Argument Unpacking

▸ Essentially the opposite of variadics

▸ Like exploding an array into a function

▸ call_user_func_array()

Page 48: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6 VARIADICS & ARGUMENT UNPACKING EXAMPLE

public function createInstance($definition, ...$constructors) { $class = $definition->getClass(); return new $class($definition, ...$constructors); }

Page 49: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6 VARIADICS & ARGUMENT UNPACKING EXAMPLE

public function createInstance($definition, ...$constructors) { $class = $definition->getClass(); return new $class($definition, ...$constructors); }

public function createInstance(FooInterface …$constructors) {…

Page 50: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PHP 5.6 VARIADICS & ARGUMENT UNPACKING EXAMPLE

public function createInstance($definition, ...$constructors) { $class = $definition->getClass(); return new $class($definition, ...$constructors); }

public function createInstance(FooInterface …$constructors) {…

public function createInstance(…$constructors) : PluginInterface {

Page 51: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PLUGIN DEFINITIONS

Page 52: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ D8

Page 53: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ D8

▸ Kris’ inexperience showing

Page 54: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ D8

▸ Kris’ inexperience showing

▸ Objects technically supported but painful to implement

Page 55: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ D8

▸ Kris’ inexperience showing

▸ Objects technically supported but painful to implement

▸ Thank Tim Plunkett for it even being possible

Page 56: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ D8

▸ Kris’ inexperience showing

▸ Objects technically supported but painful to implement

▸ Thank Tim Plunkett for it even being possible

▸ Frustrating since you are generally writing objects but end up with arrays… :-p

Page 57: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

Page 58: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

▸ Write it proper

Page 59: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

▸ Write it proper

▸ Objects by default

Page 60: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

▸ Write it proper

▸ Objects by default

▸ Proper PHP Interfaces make array style easy to get

Page 61: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

▸ Write it proper

▸ Objects by default

▸ Proper PHP Interfaces make array style easy to get

▸ Objects are nicer to use than arrays

Page 62: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN DEFINITIONS

▸ PHP Component

▸ Write it proper

▸ Objects by default

▸ Proper PHP Interfaces make array style easy to get

▸ Objects are nicer to use than arrays

▸ Methods for your definitions

Page 63: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PLUGIN FILTERS

Page 64: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ D8

Page 65: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ D8

▸ Plugins by available context

Page 66: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ D8

▸ Plugins by available context

▸ Only core could have done this easily

Page 67: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ D8

▸ Plugins by available context

▸ Only core could have done this easily

▸ Custom Blocks

Page 68: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ PHP Component

Page 69: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ PHP Component

▸ Custom Filter classes

Page 70: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ PHP Component

▸ Custom Filter classes

▸ Multiple Filter passes

Page 71: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ PHP Component

▸ Custom Filter classes

▸ Multiple Filter passes

▸ Blocks by Context & reusable custom blocks

Page 72: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

▸ PHP Component

▸ Custom Filter classes

▸ Multiple Filter passes

▸ Blocks by Context & reusable custom blocks

▸ Filtered on demand

Page 73: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

$filters[] = new PluginDefinitionFilter1(); $filters[] = new PluginDefinitionFilter2(); $filters[] = new PluginDefinitionFilter3(); $definitions = $discovery->getFilteredDefinitions(…$filters);

Page 74: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN FILTERS

$filters[] = new PluginDefinitionFilter1(); $filters[] = new PluginDefinitionFilter2(); $filters[] = new PluginDefinitionFilter3(); $definitions = $discovery->getFilteredDefinitions(…$filters);

$filter1 = new PluginDefinitionFilter1(); $filter2 = new PluginDefinitionFilter2(); $filter3 = new PluginDefinitionFilter3(); $definitions = $discovery->getFilteredDefinitions($filter1, $filter2, $filter3);

Page 75: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

PLUGIN MUTATORS

Page 76: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

Page 77: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

▸ Derivers

Page 78: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

▸ Derivers

▸ Alter hooks

Page 79: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

▸ Derivers

▸ Alter hooks

▸ Initially implemented via decorator pattern

Page 80: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

▸ Derivers

▸ Alter hooks

▸ Initially implemented via decorator pattern

▸ Decorator replaced with hard-coded expectations

Page 81: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ D8

▸ Derivers

▸ Alter hooks

▸ Initially implemented via decorator pattern

▸ Decorator replaced with hard-coded expectations

▸ Order of operations problem

Page 82: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ PHP Component

Page 83: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ PHP Component

▸ Mutates the full set of available plugin definitions

Page 84: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ PHP Component

▸ Mutates the full set of available plugin definitions

▸ Can easily introspect definitions

Page 85: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

▸ PHP Component

▸ Mutates the full set of available plugin definitions

▸ Can easily introspect definitions

▸ Derivatives already implemented

Page 86: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

PLUGIN MUTATORS

public function mutate(PluginDefinitionInterface …$definitions) : array { $results = []; foreach ($definitions as $definition) { if ($definition instanceof PluginDefinitionDerivativeInterface) { $deriver = $this->deriverResolver->getDeriverInstance($definition->getDeriver()); foreach ($deriver->getDerivativeDefinitions($definition) as $pluginDefinition) { $results[$pluginDefinition->getPluginId()] = $pluginDefinition; } continue; } $results[$definition->getPluginId()] = $definition; } return $results; }

Page 87: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TERMINOLOGY

Page 88: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

TERMINOLOGY

▸ Dictionary

Page 89: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

TERMINOLOGY

▸ Dictionary

▸ Type

Page 90: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

TERMINOLOGY

▸ Dictionary

▸ Type

▸ Set

Page 91: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

TERMINOLOGY

▸ Dictionary

▸ Type

▸ Set

▸ Filter

Page 92: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

TERMINOLOGY

▸ Dictionary

▸ Type

▸ Set

▸ Filter

▸ Mutator

Page 93: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

?

Page 94: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

WHY THIS SESSION?

▸ Component reaching degree of maturity

Page 95: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

WHY THIS SESSION?

▸ Component reaching degree of maturity

▸ Drupal Opportunity

Page 96: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

COMPONENT MATURITY

Page 97: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Hedron

Page 98: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Hedron

▸ Comunicata

Page 99: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Hedron

▸ Comunicata

▸ PHPJmeter

Page 100: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Plugin Component

Page 101: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Plugin Component

▸ Usable

Page 102: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

COMPONENT MATURITY

▸ Plugin Component

▸ Usable

▸ Drupal outside of Drupal

Page 103: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

OPINION

Page 104: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical
Page 105: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

CONCLUSION

Page 106: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

CONCLUSION

▸ Drupal is awesome

Page 107: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

CONCLUSION

▸ Drupal is awesome

▸ PHP7 is awesome

Page 108: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

CONCLUSION

▸ Drupal is awesome

▸ PHP7 is awesome

▸ Using plugins outside of Drupal is awesome

Page 109: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

CONCLUSION

▸ Drupal is awesome

▸ PHP7 is awesome

▸ Using plugins outside of Drupal is awesome

▸ Many other Drupal apis would be awesome to have too

Page 110: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

TEXT

CONCLUSION

▸ Drupal is awesome

▸ PHP7 is awesome

▸ Using plugins outside of Drupal is awesome

▸ Many other Drupal apis would be awesome to have too

▸ Can we make this happen?

Page 111: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

QUESTIONS?

Page 112: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

Join Us for Contribution Sprints

First-Time Sprinter Workshop

9:00am-12:00pmRoom: 307-308

#drupalsprint

s

Friday, April 28, 2017

Mentored Core Sprint

9:00am-12:00pmRoom:301-303

General Sprints 9:00am-6:00pmRoom:309-310

Page 113: DRUPALCON BALTIMORE PLUGINS, COMPOSER AND PHP7 … Redux.pdfkris vanderwater ctools co-maintainer drupal 8 contributor page layout specialist plugin subsystem co-author acquia technical

THANK YOU!

WHAT DID YOU THINK?

Locate this session at the DrupalCon Baltimore website:http://baltimore2017.drupal.org/schedule

Take the surveyhttps://www.surveymonkey.com/r/drupalconbaltimore