Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -0,0 +1,14 @@
{{ machine_name }}.{{ entity_type_id }}.*:
type: config_entity
label: {{ entity_type_label }}
mapping:
id:
type: string
label: ID
label:
type: label
label: Label
uuid:
type: string
description:
type: string

View file

@ -0,0 +1,12 @@
name: {{ name }}
type: module
description: 'Provides {{ entity_type_label|article|lower }} configuration entity.'
package: {{ package }}
core: 8.x
{% if dependencies %}
dependencies:
{% for dependency in dependencies %}
- {{ dependency }}
{% endfor %}
{% endif %}
configure: entity.{{ entity_type_id }}.collection

View file

@ -0,0 +1,5 @@
entity.{{ entity_type_id }}.add_form:
route_name: 'entity.{{ entity_type_id }}.add_form'
title: 'Add {{ entity_type_label|lower }}'
appears_on:
- entity.{{ entity_type_id }}.collection

View file

@ -0,0 +1,5 @@
entity.{{ entity_type_id }}.overview:
title: {{ entity_type_label|plural }}
parent: system.admin_structure
description: 'List of {{ entity_type_label|lower|plural }} to extend site functionality.'
route_name: entity.{{ entity_type_id }}.collection

View file

@ -0,0 +1,2 @@
administer {{ entity_type_id }}:
title: 'Administer {{ entity_type_label|lower }}'

View file

@ -0,0 +1,31 @@
entity.{{ entity_type_id }}.collection:
path: '/admin/structure/{{ entity_type_id|u2h }}'
defaults:
_entity_list: '{{ entity_type_id }}'
_title: '{{ entity_type_label }} configuration'
requirements:
_permission: 'administer {{ entity_type_id }}'
entity.{{ entity_type_id }}.add_form:
path: '/admin/structure/{{ entity_type_id }}/add'
defaults:
_entity_form: '{{ entity_type_id }}.add'
_title: 'Add {{ entity_type_label|article|lower }}'
requirements:
_permission: 'administer {{ entity_type_id }}'
entity.{{ entity_type_id }}.edit_form:
path: '/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}'
defaults:
_entity_form: '{{ entity_type_id }}.edit'
_title: 'Edit {{ entity_type_label|article|lower }}'
requirements:
_permission: 'administer {{ entity_type_id }}'
entity.{{ entity_type_id }}.delete_form:
path: '/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}/delete'
defaults:
_entity_form: '{{ entity_type_id }}.delete'
_title: 'Delete {{ entity_type_label|article|lower }}'
requirements:
_permission: 'administer {{ entity_type_id }}'

View file

@ -0,0 +1,76 @@
<?php
namespace Drupal\{{ machine_name }}\Entity;
{% sort %}
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\{{ machine_name }}\{{ class_prefix }}Interface;
{% endsort %}
/**
* Defines the {{ entity_type_label|lower }} entity type.
*
* @ConfigEntityType(
* id = "{{ entity_type_id }}",
* label = @Translation("{{ entity_type_label }}"),
* label_collection = @Translation("{{ entity_type_label|plural }}"),
* label_singular = @Translation("{{ entity_type_label|lower }}"),
* label_plural = @Translation("{{ entity_type_label|plural|lower }}"),
* label_count = @PluralTranslation(
* singular = "@count {{ entity_type_label|lower }}",
* plural = "@count {{ entity_type_label|plural|lower }}",
* ),
* handlers = {
* "list_builder" = "Drupal\{{ machine_name }}\{{ class_prefix }}ListBuilder",
* "form" = {
* "add" = "Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form",
* "edit" = "Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form",
* "delete" = "Drupal\Core\Entity\EntityDeleteForm"
* }
* },
* config_prefix = "{{ entity_type_id }}",
* admin_permission = "administer {{ entity_type_id }}",
* links = {
* "collection" = "/admin/structure/{{ entity_type_id|u2h }}",
* "add-form" = "/admin/structure/{{ entity_type_id|u2h }}/add",
* "edit-form" = "/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}",
* "delete-form" = "/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}/delete"
* },
* entity_keys = {
* "id" = "id",
* "label" = "label",
* "uuid" = "uuid"
* }
* )
*/
class {{ class_prefix }} extends ConfigEntityBase implements {{ class_prefix }}Interface {
/**
* The {{ entity_type_label|lower }} ID.
*
* @var string
*/
protected $id;
/**
* The {{ entity_type_label|lower }} label.
*
* @var string
*/
protected $label;
/**
* The {{ entity_type_label|lower }} status.
*
* @var bool
*/
protected $status;
/**
* The {{ entity_type_id|lower }} description.
*
* @var string
*/
protected $description;
}

View file

@ -0,0 +1,12 @@
<?php
namespace Drupal\{{ machine_name }};
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
* Provides an interface defining {{ entity_type_label|article|lower }} entity type.
*/
interface {{ class_prefix }}Interface extends ConfigEntityInterface {
}

View file

@ -0,0 +1,34 @@
<?php
namespace Drupal\{{ machine_name }};
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
/**
* Provides a listing of {{ entity_type_label|lower|plural }}.
*/
class {{ class_prefix }}ListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['label'] = $this->t('Label');
$header['id'] = $this->t('Machine name');
$header['status'] = $this->t('Status');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\{{ machine_name }}\{{ class_prefix }}Interface $entity */
$row['label'] = $entity->label();
$row['id'] = $entity->id();
$row['status'] = $entity->status() ? $this->t('Enabled') : $this->t('Disabled');
return $row + parent::buildRow($entity);
}
}

View file

@ -0,0 +1,70 @@
<?php
namespace Drupal\{{ machine_name }}\Form;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* {{ entity_type_label }} form.
*
* @property \Drupal\{{ machine_name }}\{{ class_prefix }}Interface $entity
*/
class {{ class_prefix }}Form extends EntityForm {
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#maxlength' => 255,
'#default_value' => $this->entity->label(),
'#description' => $this->t('Label for the {{ entity_type_label|lower }}.'),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $this->entity->id(),
'#machine_name' => [
'exists' => '\Drupal\{{ machine_name }}\Entity\{{ class_prefix }}::load',
],
'#disabled' => !$this->entity->isNew(),
];
$form['status'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enabled'),
'#default_value' => $this->entity->status(),
];
$form['description'] = [
'#type' => 'textarea',
'#title' => $this->t('Description'),
'#default_value' => $this->entity->get('description'),
'#description' => $this->t('Description of the {{ entity_type_label|lower }}.'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$result = parent::save($form, $form_state);
$message_args = ['%label' => $this->entity->label()];
$message = $result == SAVED_NEW
? $this->t('Created new {{ entity_type_label|lower }} %label.', $message_args)
: $this->t('Updated {{ entity_type_label|lower }} %label.', $message_args);
$this->messenger()->addStatus($message);
$form_state->setRedirectUrl($this->entity->toUrl('collection'));
return $result;
}
}