Skip to content

Commit

Permalink
Merge pull request #163 from jmolivas/twig-base-entity-missing
Browse files Browse the repository at this point in the history
Twig base entity generation
  • Loading branch information
jmolivas committed Jul 16, 2014
2 parents 8ec143d + 838d631 commit 6188060
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<?php
{% extends "base/class.php.twig" %}

/**
* @file
* Contains \Drupal\{{module}}\Entity\Form\{{ entity_class }}DeleteForm.
*/
{% block file_path %}
Drupal\{{module}}\Entity\Form\{{ entity_class }}DeleteForm.
{% endblock %}

{% block namespace_class %}
namespace Drupal\{{module}}\Entity\Form;
{% endblock %}

{% block use_class %}
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Url;
{% endblock %}

{% block class_declaration %}
/**
* Provides a form for deleting a {{ entity_class }} entity.
*
* @ingroup {{module}}
*/
class {{ entity_class }}DeleteForm extends ContentEntityConfirmFormBase {
class {{ entity_class }}DeleteForm extends ContentEntityConfirmFormBase
{% endblock %}

{% block class_methods %}
/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -48,5 +53,4 @@ class {{ entity_class }}DeleteForm extends ContentEntityConfirmFormBase {
watchdog('content', '@type: deleted %title.', array('@type' => $this->entity->bundle(), '%title' => $this->entity->label()));
$form_state['redirect_route']['route_name'] = '{{ entity_name }}.list';
}
}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
<?php
/**
* @file
* Definition of Drupal\{{module}}\Entity\Form\{{ entity_class }}Form.
*/
{% extends "base/class.php.twig" %}

{% block file_path %}
Drupal\{{module}}\Entity\Form\{{ entity_class }}Form.
{% endblock %}

{% block namespace_class %}
namespace Drupal\{{module}}\Entity\Form;
{% endblock %}

{% block use_class %}
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Language\Language;
{% endblock %}

{% block class_declaration %}
/**
* Form controller for the {{ entity_class }} entity edit forms.
*
* @ingroup {{module}}
*/
class {{ entity_class }}Form extends ContentEntityForm {
class {{ entity_class }}Form extends ContentEntityForm
{% endblock %}

{% block class_methods %}
/**
* Overrides Drupal\Core\Entity\EntityFormController::buildForm().
*/
Expand Down Expand Up @@ -52,4 +59,4 @@ class {{ entity_class }}Form extends ContentEntityForm {
$entity = $this->entity;
$entity->save();
}
}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
<?php
/**
* @file
* Defines Drupal\{{module}}\Entity\Form\{{ entity_class }}SettingsForm.
*/
{% extends "base/class.php.twig" %}

{% block file_path %}
Drupal\{{module}}\Entity\Form\{{ entity_class }}SettingsForm.
{% endblock %}

{% block namespace_class %}
namespace Drupal\{{module}}\Entity\Form;
{% endblock %}

{% block use_class %}
use Drupal\Core\Form\FormBase;
{% endblock %}

{% block class_declaration %}
/**
* Class {{ entity_class }}SettingsForm.
* @package Drupal\{{module}}\Form
* @ingroup {{module}}
*/
class {{ entity_class }}SettingsForm extends FormBase {
class {{ entity_class }}SettingsForm extends FormBase
{% endblock %}

{% block class_methods %}
/**
* Returns a unique string identifying the form.
*
Expand Down Expand Up @@ -51,4 +59,4 @@ class {{ entity_class }}SettingsForm extends FormBase {
$form['{{ entity_class }}_settings']['#markup'] = 'Settings form for {{ entity_class }}. Manage field settings here.';
return $form;
}
}
{% endblock %}

0 comments on commit 6188060

Please sign in to comment.