Last active
June 19, 2018 13:07
-
-
Save johndevman/16ea1f0637ac69410725dd42a4a1a4c2 to your computer and use it in GitHub Desktop.
Configurable layout plugin
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
example_image: | |
label: 'Image' | |
class: '\Drupal\example\Plugin\Layout\LayoutDefaultConfig' | |
path: layouts/example--image | |
template: example--image | |
category: 'Columns: 1' | |
icon: icon-image.svg |
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 | |
namespace Drupal\example\Plugin\Layout; | |
use Drupal\Core\Layout\LayoutDefault; | |
use Drupal\Core\Plugin\PluginFormInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
/** | |
* Provides a default class for configurable Layout plugins. | |
*/ | |
class LayoutDefaultConfig extends LayoutDefault implements PluginFormInterface { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function defaultConfiguration() { | |
return []; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { | |
return $form; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment