diff --git a/core/modules/grid/config/grid.ninesixty_12.yml b/core/modules/grid/config/grid.ninesixty_12.yml index 780ef44..405317c 100644 --- a/core/modules/grid/config/grid.ninesixty_12.yml +++ b/core/modules/grid/config/grid.ninesixty_12.yml @@ -1,7 +1,7 @@ id: ninesixty_12 label: '960px wide, 12 column grid' -pluginId: equal_column_grid -pluginConfiguration: +type: equal_column +options: type: 'fixed' width: 960 columns: 12 diff --git a/core/modules/grid/config/grid.ninesixty_16.yml b/core/modules/grid/config/grid.ninesixty_16.yml index 2f9e0c4..4ddff62 100644 --- a/core/modules/grid/config/grid.ninesixty_16.yml +++ b/core/modules/grid/config/grid.ninesixty_16.yml @@ -1,7 +1,7 @@ id: ninesixty_16 label: '960px wide, 16 column grid' -pluginId: equal_column_grid -pluginConfiguration: +type: equal_column +options: type: 'fixed' width: 960 columns: 16 diff --git a/core/modules/grid/config/grid.six_column_fluid.yml b/core/modules/grid/config/grid.six_column_fluid.yml index 67dbe56..baff675 100644 --- a/core/modules/grid/config/grid.six_column_fluid.yml +++ b/core/modules/grid/config/grid.six_column_fluid.yml @@ -1,7 +1,7 @@ id: six_column_fluid label: Six column fluid -pluginId: equal_column_grid -pluginConfiguration: +type: equal_column +options: type: 'fluid' width: 100 columns: 6 diff --git a/core/modules/grid/config/grid.three_column_fluid.yml b/core/modules/grid/config/grid.three_column_fluid.yml index 4e8aaf9..345e90c 100644 --- a/core/modules/grid/config/grid.three_column_fluid.yml +++ b/core/modules/grid/config/grid.three_column_fluid.yml @@ -1,7 +1,7 @@ id: three_column_fluid label: Three column fluid -pluginId: equal_column_grid -pluginConfiguration: +types: equal_column +options: type: 'fluid' width: 100 columns: 3 diff --git a/core/modules/grid/config/grid.twelve_column_fluid.yml b/core/modules/grid/config/grid.twelve_column_fluid.yml index b120870..35022f6 100644 --- a/core/modules/grid/config/grid.twelve_column_fluid.yml +++ b/core/modules/grid/config/grid.twelve_column_fluid.yml @@ -1,7 +1,7 @@ id: twelve_column_fluid label: Twelve column fluid -pluginId: equal_column_grid -pluginConfiguration: +type: equal_column +options: type: 'fluid' width: 100 columns: 12 diff --git a/core/modules/grid/grid.info b/core/modules/grid/grid.info index 43d5f2f..9dd6db4 100644 --- a/core/modules/grid/grid.info +++ b/core/modules/grid/grid.info @@ -1,9 +1,8 @@ -name = Grid builder -description = Simple grid system builder. +name = Grid +description = Pluggable grid system manager. package = Core version = VERSION core = 8.x dependencies[] = config -dependencies[] = breakpoint configure = admin/structure/grids diff --git a/core/modules/grid/grid.module b/core/modules/grid/grid.module index ce33410..0e2e5ba 100644 --- a/core/modules/grid/grid.module +++ b/core/modules/grid/grid.module @@ -2,18 +2,18 @@ /** * @file - * Simple grid builder tool. + * Pluggable grid system manager module. */ -use Drupal\gridbuilder\Grid; +use Drupal\grid\Grid; /** * Implements hook_entity_info(). */ -function gridbuilder_entity_info() { +function grid_entity_info() { $types['grid'] = array( 'label' => 'Grid', - 'entity class' => 'Drupal\gridbuilder\Grid', + 'entity class' => 'Drupal\grid\Grid', 'controller class' => 'Drupal\Core\Config\Entity\ConfigStorageController', 'config prefix' => 'grid', 'entity keys' => array( @@ -25,7 +25,7 @@ function gridbuilder_entity_info() { return $types; } -function gridbuilder_help() { +function grid_help() { $grid1 = entity_load('grid', 'six_column_fluid'); $grid2 = entity_load('grid', 'ninesixty_12'); return $grid1->getGridCss() . $grid2->getGridCss(); diff --git a/core/modules/grid/lib/Drupal/grid/Grid.php b/core/modules/grid/lib/Drupal/grid/Grid.php index 5de4c90..236df5b 100644 --- a/core/modules/grid/lib/Drupal/grid/Grid.php +++ b/core/modules/grid/lib/Drupal/grid/Grid.php @@ -2,17 +2,18 @@ /** * @file - * Definition of Drupal\gridbuilder\Grid. + * Definition of Drupal\grid\Grid. */ -namespace Drupal\gridbuilder; +namespace Drupal\grid; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\grid\Plugin\GridInterface; /** * Defines the grid entity. */ -class Grid extends ConfigEntityBase { +class Grid extends ConfigEntityBase implements GridInterface { /** * The grid ID (machine name). @@ -52,9 +53,9 @@ class Grid extends ConfigEntityBase { /** * Instantiated plugin to handle the grid. * - * @see Drupal\gridbuilder\Grid::GetPlugin(). + * @see Drupal\grid\Grid::GetPlugin(). * - * @var Drupal\gridbuilder\Plugin\GridBuilderInterface + * @var Drupal\grid\Plugin\GridInterface */ public $plugin; @@ -64,17 +65,17 @@ class Grid extends ConfigEntityBase { public function getPlugin() { if (!isset($this->plugin)) { // Pass on Grid ID as part of the configuration array. - $this->pluginConfiguration['id'] = $this->id; - $this->plugin = drupal_container()->get('plugin.manager.gridbuilder')->createInstance($this->pluginId, $this->pluginConfiguration); + $this->options['id'] = $this->id; + $this->plugin = drupal_container()->get('plugin.manager.grid')->createInstance($this->type, $this->options); } return $this->plugin; } /** - * Generate the grid CSS using the plugin implementation. + * Implements Drupal\grid\Plugin\GridInterface::getGridCss(). */ - public function getGridCss() { - return $this->getPlugin()->getGridCss(); + public function getGridCss($wrapper_selector = NULL, $col_selector_prefix = NULL, $skip_spacing = FALSE) { + return $this->getPlugin()->getGridCss($wrapper_selector, $col_selector_prefix, $skip_spacing); } } diff --git a/core/modules/grid/lib/Drupal/grid/GridBundle.php b/core/modules/grid/lib/Drupal/grid/GridBundle.php index 2528ae9..7c68f29 100644 --- a/core/modules/grid/lib/Drupal/grid/GridBundle.php +++ b/core/modules/grid/lib/Drupal/grid/GridBundle.php @@ -2,24 +2,24 @@ /** * @file - * Definition of Drupal\gridbuilder\GridBuilderBundle. + * Definition of Drupal\grid\GridBundle. */ -namespace Drupal\gridbuilder; +namespace Drupal\grid; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; /** - * GridBuilder dependency injection container. + * Grid dependency injection container. */ -class GridBuilderBundle extends Bundle { +class GridBundle extends Bundle { /** * Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build(). */ public function build(ContainerBuilder $container) { - // Register the GridBuilderManager class with the dependency injection container. - $container->register('plugin.manager.gridbuilder', 'Drupal\gridbuilder\Plugin\Type\GridBuilderManager'); + // Register the GridManager class with the dependency injection container. + $container->register('plugin.manager.grid', 'Drupal\grid\Plugin\Type\GridManager'); } } diff --git a/core/modules/grid/lib/Drupal/grid/Plugin/GridInterface.php b/core/modules/grid/lib/Drupal/grid/Plugin/GridInterface.php index cbde3af..ca73fd8 100644 --- a/core/modules/grid/lib/Drupal/grid/Plugin/GridInterface.php +++ b/core/modules/grid/lib/Drupal/grid/Plugin/GridInterface.php @@ -2,15 +2,15 @@ /** * @file - * Definition of Drupal\gridbuilder\Plugin\GridBuilderInterface. + * Definition of Drupal\grid\Plugin\GridInterface. */ -namespace Drupal\gridbuilder\Plugin; +namespace Drupal\grid\Plugin; /** - * Defines the shared interface for all gridbuilder plugins. + * Defines the shared interface for all grid plugins. */ -interface GridBuilderInterface { +interface GridInterface { /** * Generates grid CSS for this grid system. diff --git a/core/modules/grid/lib/Drupal/grid/Plugin/Type/GridManager.php b/core/modules/grid/lib/Drupal/grid/Plugin/Type/GridManager.php index 730f04f..f86ec60 100644 --- a/core/modules/grid/lib/Drupal/grid/Plugin/Type/GridManager.php +++ b/core/modules/grid/lib/Drupal/grid/Plugin/Type/GridManager.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\gridbuilder\Plugin\Type\GridBuilderManager. + * Definition of Drupal\grid\Plugin\Type\GridManager. */ -namespace Drupal\gridbuilder\Plugin\Type; +namespace Drupal\grid\Plugin\Type; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; @@ -13,19 +13,15 @@ use Drupal\Component\Plugin\Factory\ReflectionFactory; /** - * GridBuilder plugin manager. + * Grid plugin manager. */ -class GridBuilderManager extends PluginManagerBase { - - protected $defaults = array( - 'class' => 'Drupal\gridbuilder\Plugin\gridbuilder\gridbuilder\EqualColumnGrid', - ); +class GridManager extends PluginManagerBase { /** * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct(). */ public function __construct() { - $this->discovery = new AnnotatedClassDiscovery('gridbuilder', 'gridbuilder'); + $this->discovery = new AnnotatedClassDiscovery('grid', 'grid'); $this->factory = new ReflectionFactory($this); } } diff --git a/core/modules/grid/lib/Drupal/grid/Plugin/grid/grid/EqualColumn.php b/core/modules/grid/lib/Drupal/grid/Plugin/grid/grid/EqualColumn.php index 6c99b0b..db38826 100644 --- a/core/modules/grid/lib/Drupal/grid/Plugin/grid/grid/EqualColumn.php +++ b/core/modules/grid/lib/Drupal/grid/Plugin/grid/grid/EqualColumn.php @@ -2,36 +2,25 @@ /** * @file - * Definition of Drupal\gridbuilder\Plugin\gridbuilder\gridbuilder\EqualColumnGrid. + * Definition of Drupal\grid\Plugin\grid\grid\EqualColumn. */ -namespace Drupal\gridbuilder\Plugin\gridbuilder\gridbuilder; +namespace Drupal\grid\Plugin\grid\grid; use Drupal\Component\Plugin\Discovery\DiscoveryInterface; -use Drupal\gridbuilder\Plugin\GridBuilderInterface; +use Drupal\grid\Plugin\GridInterface; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Annotation\Plugin; /** * @Plugin( - * id = "equal_column_grid", - * derivative = "Drupal\gridbuilder\Plugin\Derivative\GridBuilder" + * id = "equal_column" * ) */ -class EqualColumnGrid extends PluginBase implements GridBuilderInterface { +class EqualColumn extends PluginBase implements GridInterface { /** - * Overrides Drupal\Component\Plugin\PluginBase::__construct(). - */ - public function __construct(array $configuration, $plugin_id, DiscoveryInterface $discovery) { - // Get definition by discovering the declarative information. - $definition = $discovery->getDefinition($plugin_id); - parent::__construct($configuration, $plugin_id, $discovery); - } - - - /** - * Implements Drupal\gridbuilder\Plugin\GridBuilderInterface::getGridCss(). + * Implements Drupal\grid\Plugin\GridInterface::getGridCss(). */ public function getGridCss($wrapper_selector = NULL, $col_selector_prefix = NULL, $skip_spacing = FALSE) { $grid = $this->configuration;