Commit 0132847d authored by Achilles's avatar Achilles

eiek entitychanger modules first version

parent eeaeef81
<?php
/**
* @file
* Contains aitisi_entity.page.inc.
*
* Page callback for Aitisi entity entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Aitisi entity templates.
*
* Default template: aitisi_entity.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_aitisi_entity(array &$variables) {
// Fetch AitisiEntity Entity Object.
$aitisi_entity = $variables['elements']['#aitisi_entity'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
{
"name": "drupal/eiek",
"type": "drupal-module",
"description": "My Entities module",
"keywords": ["Drupal"],
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/eiek",
"minimum-stability": "dev",
"support": {
"issues": "https://www.drupal.org/project/issues/eiek",
"source": "http://cgit.drupalcode.org/eiek"
},
"require": { }
}
<?php
/**
* @file
* Contains eidikotita_entity.page.inc.
*
* Page callback for Eidikotita entity entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Eidikotita entity templates.
*
* Default template: eidikotita_entity.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_eidikotita_entity(array &$variables) {
// Fetch EidikotitaEntity Entity Object.
$eidikotita_entity = $variables['elements']['#eidikotita_entity'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
name: eiek
type: module
description: My Entities module
core: 8.x
package: Custom
dependencies:
- datetime
- telephone
<?php
use Drupal\Core\Database\Database;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\field\FieldStorageConfigInterface;
/**
* Add a new test able
*/
/*
function eiek_update_8210(&$sandbox) {
$spec = array(
'type' => 'varchar',
'description' => "New Col",
'length' => 20,
'not null' => FALSE,
);
$schema = Database::getConnection()->schema();
$schema->addField('student_entity', 'iekbek', $spec);
}
*/
/*
$edum = \Drupal::entityDefinitionUpdateManager();
$em = \Drupal::entityManager();
$field_iekbek = BaseFieldDefinition::create('string')
->setLabel(t('IEK BEK'))
->setDescription(t('The IEK that created the BEK'))
->setRevisionable(TRUE)
->setSettings(array(
'max_length' => 30,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$edum->installFieldStorageDefinition('iekbek','student_entity','eiek',$field_iekbek);
// $edum->installFieldStorageDefinition($field_iekbek);
//}
/* $spec = array(
'description' => 'My description',
'fields' => array(
'myfield1' => array(
'description' => 'Myfield1 description.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'myfield2' => array(
'description' => 'Myfield2 description',
'type' => 'text',
'not null' => TRUE,
),
),
'primary key' => array('myfield1'),
);
$schema = Database::getConnection()->schema();
$schema->createTable('mytable2', $spec);*/
//}
//function eiek_update_8202() {
/*
$database = \Drupal::database();
// Retrieve existing field data.
$entity_type = 'student_entity';
$field = 'iekbek';
$field_storage_configs = \Drupal::entityTypeManager()->getStorage('field_storage_config')
->loadByProperties([
'field_name' => $field,
]);
foreach ($field_storage_configs as $field_storage) {
$new_field_storage = $field_storage->toArray();
$new_field_storage['settings']['max_length'] = 100;
$new_field_storage = FieldStorageConfig::create($new_field_storage);
$new_field_storage->original = $new_field_storage;
$new_field_storage->enforceIsNew(FALSE);
$new_field_storage->save();
}
*/
//}
//function eiek_update_8208() {
// Update definitions and schema.
// $manager = \Drupal::entityDefinitionUpdateManager();
//$storage_definition = $manager->getFieldStorageDefinition('iekbek', 'student_entity');
// $manager->updateFieldStorageDefinition($storage_definition);
//}
entity.student_entity.add_form:
route_name: entity.student_entity.add_form
title: 'Add Student entity'
appears_on:
- entity.student_entity.collection
entity.eidikotita_entity.add_form:
route_name: entity.eidikotita_entity.add_form
title: 'Add Eidikotita entity'
appears_on:
- entity.eidikotita_entity.collection
entity.aitisi_entity.add_form:
route_name: entity.aitisi_entity.add_form
title: 'Add Aitisi entity'
appears_on:
- entity.aitisi_entity.collection
entity.region_entity.add_form:
route_name: entity.region_entity.add_form
title: 'Add Region entity'
appears_on:
- entity.region_entity.collection
entity.school_entity.add_form:
route_name: entity.school_entity.add_form
title: 'Add School entity'
appears_on:
- entity.school_entity.collection
# Student entity menu items definition
entity.student_entity.collection:
title: 'Student entity list'
route_name: entity.student_entity.collection
description: 'List Student entity entities'
parent: system.admin_structure
weight: 100
student_entity.admin.structure.settings:
title: Student entity settings
description: 'Configure Student entity entities'
route_name: student_entity.settings
parent: system.admin_structure
# Eidikotita entity menu items definition
entity.eidikotita_entity.collection:
title: 'Eidikotita entity list'
route_name: entity.eidikotita_entity.collection
description: 'List Eidikotita entity entities'
parent: system.admin_structure
weight: 100
eidikotita_entity.admin.structure.settings:
title: Eidikotita entity settings
description: 'Configure Eidikotita entity entities'
route_name: eidikotita_entity.settings
parent: system.admin_structure
# Aitisi entity menu items definition
entity.aitisi_entity.collection:
title: 'Aitisi entity list'
route_name: entity.aitisi_entity.collection
description: 'List Aitisi entity entities'
parent: system.admin_structure
weight: 100
aitisi_entity.admin.structure.settings:
title: Aitisi entity settings
description: 'Configure Aitisi entity entities'
route_name: aitisi_entity.settings
parent: system.admin_structure
# Region entity menu items definition
entity.region_entity.collection:
title: 'Region entity list'
route_name: entity.region_entity.collection
description: 'List Region entity entities'
parent: system.admin_structure
weight: 100
region_entity.admin.structure.settings:
title: Region entity settings
description: 'Configure Region entity entities'
route_name: region_entity.settings
parent: system.admin_structure
# School entity menu items definition
entity.school_entity.collection:
title: 'School entity list'
route_name: entity.school_entity.collection
description: 'List School entity entities'
parent: system.admin_structure
weight: 100
school_entity.admin.structure.settings:
title: School entity settings
description: 'Configure School entity entities'
route_name: school_entity.settings
parent: system.admin_structure
# Student entity routing definition
student_entity.settings_tab:
route_name: student_entity.settings
title: 'Settings'
base_route: student_entity.settings
entity.student_entity.canonical:
route_name: entity.student_entity.canonical
base_route: entity.student_entity.canonical
title: 'View'
entity.student_entity.edit_form:
route_name: entity.student_entity.edit_form
base_route: entity.student_entity.canonical
title: 'Edit'
entity.student_entity.version_history:
route_name: entity.student_entity.version_history
base_route: entity.student_entity.canonical
title: 'Revisions'
entity.student_entity.delete_form:
route_name: entity.student_entity.delete_form
base_route: entity.student_entity.canonical
title: Delete
weight: 10
# Eidikotita entity routing definition
eidikotita_entity.settings_tab:
route_name: eidikotita_entity.settings
title: 'Settings'
base_route: eidikotita_entity.settings
entity.eidikotita_entity.canonical:
route_name: entity.eidikotita_entity.canonical
base_route: entity.eidikotita_entity.canonical
title: 'View'
entity.eidikotita_entity.edit_form:
route_name: entity.eidikotita_entity.edit_form
base_route: entity.eidikotita_entity.canonical
title: 'Edit'
entity.eidikotita_entity.version_history:
route_name: entity.eidikotita_entity.version_history
base_route: entity.eidikotita_entity.canonical
title: 'Revisions'
entity.eidikotita_entity.delete_form:
route_name: entity.eidikotita_entity.delete_form
base_route: entity.eidikotita_entity.canonical
title: Delete
weight: 10
# Aitisi entity routing definition
aitisi_entity.settings_tab:
route_name: aitisi_entity.settings
title: 'Settings'
base_route: aitisi_entity.settings
entity.aitisi_entity.canonical:
route_name: entity.aitisi_entity.canonical
base_route: entity.aitisi_entity.canonical
title: 'View'
entity.aitisi_entity.edit_form:
route_name: entity.aitisi_entity.edit_form
base_route: entity.aitisi_entity.canonical
title: 'Edit'
entity.aitisi_entity.version_history:
route_name: entity.aitisi_entity.version_history
base_route: entity.aitisi_entity.canonical
title: 'Revisions'
entity.aitisi_entity.delete_form:
route_name: entity.aitisi_entity.delete_form
base_route: entity.aitisi_entity.canonical
title: Delete
weight: 10
# Region entity routing definition
region_entity.settings_tab:
route_name: region_entity.settings
title: 'Settings'
base_route: region_entity.settings
entity.region_entity.canonical:
route_name: entity.region_entity.canonical
base_route: entity.region_entity.canonical
title: 'View'
entity.region_entity.edit_form:
route_name: entity.region_entity.edit_form
base_route: entity.region_entity.canonical
title: 'Edit'
entity.region_entity.delete_form:
route_name: entity.region_entity.delete_form
base_route: entity.region_entity.canonical
title: Delete
weight: 10
# School entity routing definition
school_entity.settings_tab:
route_name: school_entity.settings
title: 'Settings'
base_route: school_entity.settings
entity.school_entity.canonical:
route_name: entity.school_entity.canonical
base_route: entity.school_entity.canonical
title: 'View'
entity.school_entity.edit_form:
route_name: entity.school_entity.edit_form
base_route: entity.school_entity.canonical
title: 'Edit'
entity.school_entity.delete_form:
route_name: entity.school_entity.delete_form
base_route: entity.school_entity.canonical
title: Delete
weight: 10
<?php
/**
* @file
* Contains eiek.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function eiek_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the eiek module.
case 'help.page.eiek':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('My Entities module') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function eiek_theme() {
return [
'eiek' => [
'template' => 'eiek',
'render element' => 'children',
],
];
}
add student entity entities:
title: 'Create new Student entity entities'
administer student entity entities:
title: 'Administer Student entity entities'
description: 'Allow to access the administration form to configure Student entity entities.'
restrict access: true
delete student entity entities:
title: 'Delete Student entity entities'
edit student entity entities:
title: 'Edit Student entity entities'
access student entity overview:
title: 'Access the Student entity overview page'
view published student entity entities:
title: 'View published Student entity entities'
view unpublished student entity entities:
title: 'View unpublished Student entity entities'
view all student entity revisions:
title: 'View all Student entity revisions'
revert all student entity revisions:
title: 'Revert all Student entity revisions'
description: 'Role requires permission <em>view Student entity revisions</em> and <em>edit rights</em> for student entity entities in question or <em>administer student entity entities</em>.'
delete all student entity revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>view Student entity revisions</em> and <em>delete rights</em> for student entity entities in question or <em>administer student entity entities</em>.'
add request entity entities:
title: 'Create new Request entity entities'
administer request entity entities:
title: 'Administer Request entity entities'
description: 'Allow to access the administration form to configure Request entity entities.'
restrict access: true
delete request entity entities:
title: 'Delete Request entity entities'
edit request entity entities:
title: 'Edit Request entity entities'
access request entity overview:
title: 'Access the Request entity overview page'
view published request entity entities:
title: 'View published Request entity entities'
view unpublished request entity entities:
title: 'View unpublished Request entity entities'
view all request entity revisions:
title: 'View all Request entity revisions'
revert all request entity revisions:
title: 'Revert all Request entity revisions'
description: 'Role requires permission <em>view Request entity revisions</em> and <em>edit rights</em> for request entity entities in question or <em>administer request entity entities</em>.'
delete all request entity revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>view Request entity revisions</em> and <em>delete rights</em> for request entity entities in question or <em>administer request entity entities</em>.'
add eidikotita entity entities:
title: 'Create new Eidikotita entity entities'
administer eidikotita entity entities:
title: 'Administer Eidikotita entity entities'
description: 'Allow to access the administration form to configure Eidikotita entity entities.'
restrict access: true
delete eidikotita entity entities:
title: 'Delete Eidikotita entity entities'
edit eidikotita entity entities:
title: 'Edit Eidikotita entity entities'
access eidikotita entity overview:
title: 'Access the Eidikotita entity overview page'
view published eidikotita entity entities:
title: 'View published Eidikotita entity entities'
view unpublished eidikotita entity entities:
title: 'View unpublished Eidikotita entity entities'
view all eidikotita entity revisions:
title: 'View all Eidikotita entity revisions'
revert all eidikotita entity revisions:
title: 'Revert all Eidikotita entity revisions'
description: 'Role requires permission <em>view Eidikotita entity revisions</em> and <em>edit rights</em> for eidikotita entity entities in question or <em>administer eidikotita entity entities</em>.'
delete all eidikotita entity revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>view Eidikotita entity revisions</em> and <em>delete rights</em> for eidikotita entity entities in question or <em>administer eidikotita entity entities</em>.'
add aitisi entity entities:
title: 'Create new Aitisi entity entities'
administer aitisi entity entities:
title: 'Administer Aitisi entity entities'
description: 'Allow to access the administration form to configure Aitisi entity entities.'
restrict access: true
delete aitisi entity entities:
title: 'Delete Aitisi entity entities'
edit aitisi entity entities:
title: 'Edit Aitisi entity entities'
access aitisi entity overview:
title: 'Access the Aitisi entity overview page'
view published aitisi entity entities:
title: 'View published Aitisi entity entities'
view unpublished aitisi entity entities:
title: 'View unpublished Aitisi entity entities'
view all aitisi entity revisions:
title: 'View all Aitisi entity revisions'
revert all aitisi entity revisions:
title: 'Revert all Aitisi entity revisions'
description: 'Role requires permission <em>view Aitisi entity revisions</em> and <em>edit rights</em> for aitisi entity entities in question or <em>administer aitisi entity entities</em>.'
delete all aitisi entity revisions:
title: 'Delete all revisions'
description: 'Role requires permission to <em>view Aitisi entity revisions</em> and <em>delete rights</em> for aitisi entity entities in question or <em>administer aitisi entity entities</em>.'
add region entity entities:
title: 'Create new Region entity entities'
administer region entity entities:
title: 'Administer Region entity entities'
description: 'Allow to access the administration form to configure Region entity entities.'
restrict access: true
delete region entity entities:
title: 'Delete Region entity entities'
edit region entity entities:
title: 'Edit Region entity entities'
access region entity overview:
title: 'Access the Region entity overview page'
view published region entity entities:
title: 'View published Region entity entities'
view unpublished region entity entities:
title: 'View unpublished Region entity entities'
add school entity entities:
title: 'Create new School entity entities'
administer school entity entities:
title: 'Administer School entity entities'
description: 'Allow to access the administration form to configure School entity entities.'
restrict access: true
delete school entity entities:
title: 'Delete School entity entities'
edit school entity entities:
title: 'Edit School entity entities'
access school entity overview:
title: 'Access the School entity overview page'
view published school entity entities:
title: 'View published School entity entities'
view unpublished school entity entities:
title: 'View unpublished School entity entities'
<?php
/**
* @file
* Contains region_entity.page.inc.
*
* Page callback for Region entity entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Region entity templates.
*
* Default template: region_entity.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_region_entity(array &$variables) {