Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twig base entity generation #163

Merged
merged 3 commits into from
Jul 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}