X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FBlock%2Fblock.php.twig;fp=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FBlock%2Fblock.php.twig;h=7bc5cf477ab935e8a3c4b07e57971e29c76d05bf;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=c7d4cec4f5fa129b0b472c80c9502cd553130036;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console/templates/module/src/Plugin/Block/block.php.twig b/vendor/drupal/console/templates/module/src/Plugin/Block/block.php.twig index c7d4cec4f..7bc5cf477 100644 --- a/vendor/drupal/console/templates/module/src/Plugin/Block/block.php.twig +++ b/vendor/drupal/console/templates/module/src/Plugin/Block/block.php.twig @@ -42,10 +42,10 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements * The plugin implementation definition. */ public function __construct( - array $configuration, - $plugin_id, - $plugin_definition, - {{ servicesAsParameters(services)|join(', \n\t') }} + array $configuration, + $plugin_id, + $plugin_definition, + {{ servicesAsParameters(services)|join(', \n\t') }} ) { parent::__construct($configuration, $plugin_id, $plugin_definition); {{ serviceClassInitialization(services) }} @@ -69,18 +69,18 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements {% endblock %} {% block class_methods %} {% if inputs %} - /** * {@inheritdoc} */ public function defaultConfiguration() { return [ - {% for input in inputs %} - '{{ input.name }}' => {{ input.default_code }}, - {% endfor %} +{% for input in inputs %} + {% if input.default_value is defined and input.default_value|length %} + '{{ input.name }}' => {{ input.default_value }}, + {% endif %} +{% endfor %} ] + parent::defaultConfiguration(); - - } + } /** * {@inheritdoc} @@ -89,19 +89,21 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements {% for input in inputs %} $form['{{ input.name }}'] = [ '#type' => '{{ input.type }}', - '#title' => $this->t('{{ input.label }}'), - '#description' => $this->t('{{ input.description }}'), -{% if input.options|length %} + '#title' => $this->t('{{ input.label|escape }}'), +{% if input.description is defined and input.description is not empty %} + '#description' => $this->t('{{ input.description|e }}'), +{% endif %} +{% if input.options is defined and input.options|length %} '#options' => {{ input.options }}, {% endif %} - '#default_value' => $this->configuration['{{ input.name }}'], -{% if input.maxlength|length %} + '#default_value' => $this->configuration['{{ input.name }}'], +{% if input.maxlength is defined and input.maxlength|length %} '#maxlength' => {{ input.maxlength }}, {% endif %} -{% if input.size|length %} +{% if input.size is defined and input.size|length %} '#size' => {{ input.size }}, {% endif %} -{% if input.weight|length %} +{% if input.weight is defined and input.weight|length %} '#weight' => '{{ input.weight }}', {% endif %} ];