From afd13c229bfadd2189e624ce7d67637aff1a8d51 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 4 Apr 2018 11:01:50 +0300 Subject: [PATCH 01/94] Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8c461cb --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# zencrm +A simple, case-management-focused CRM for small altruistic organisations. From d0f175f69d3cf21cacb24ba43b49780ce25515e6 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 4 Apr 2018 13:54:49 +0300 Subject: [PATCH 02/94] Update README.md --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c461cb..203b858 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# zencrm +# Zen CRM A simple, case-management-focused CRM for small altruistic organisations. + +# Current Status +**April 2018** the very beginning. Hardly exists at all. + +# The Plan +Zen CRM will be available as: +* A Drupal module, on drupal.org +* A Drupal install profile / distribution +* A hosted service + +# Find out more +* More details, including user stories, can be found in the [Zen CRM Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) + + + From 30f66710f01b19343170b03b76be19aafd2a17e7 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 4 Apr 2018 13:56:53 +0300 Subject: [PATCH 03/94] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 203b858..accd9c9 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # Zen CRM A simple, case-management-focused CRM for small altruistic organisations. -# Current Status +## Current Status **April 2018** the very beginning. Hardly exists at all. -# The Plan +## The Plan Zen CRM will be available as: * A Drupal module, on drupal.org * A Drupal install profile / distribution * A hosted service -# Find out more +## Find out more * More details, including user stories, can be found in the [Zen CRM Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) From 4756074cf733152c7b2b8572dbde8ebeab7e6eeb Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 4 Apr 2018 12:59:01 +0200 Subject: [PATCH 04/94] Generated module and Person entity Changed "published" status of entity to "enabled". Removed author field from display --- .gitignore | 1 + composer.json | 14 + modules/zencrm_entities/composer.json | 14 + modules/zencrm_entities/person.page.inc | 30 ++ .../src/Controller/PersonController.php | 163 ++++++++++ modules/zencrm_entities/src/Entity/Person.php | 288 ++++++++++++++++++ .../src/Entity/PersonInterface.php | 97 ++++++ .../src/Entity/PersonViewsData.php | 24 ++ .../src/Form/PersonDeleteForm.php | 15 + .../zencrm_entities/src/Form/PersonForm.php | 71 +++++ .../src/Form/PersonRevisionDeleteForm.php | 123 ++++++++ .../src/Form/PersonRevisionRevertForm.php | 149 +++++++++ .../PersonRevisionRevertTranslationForm.php | 115 +++++++ .../src/Form/PersonSettingsForm.php | 53 ++++ .../src/PersonAccessControlHandler.php | 47 +++ .../src/PersonHtmlRouteProvider.php | 196 ++++++++++++ .../zencrm_entities/src/PersonListBuilder.php | 40 +++ modules/zencrm_entities/src/PersonStorage.php | 58 ++++ .../src/PersonStorageInterface.php | 61 ++++ .../src/PersonTranslationHandler.php | 14 + .../templates/person.html.twig | 22 ++ .../templates/zencrm-entities.html.twig | 1 + .../tests/src/Functional/LoadTest.php | 46 +++ .../zencrm_entities/zencrm_entities.info.yml | 5 + .../zencrm_entities.links.action.yml | 5 + .../zencrm_entities.links.menu.yml | 14 + .../zencrm_entities.links.task.yml | 27 ++ .../zencrm_entities/zencrm_entities.module | 35 +++ .../zencrm_entities.permissions.yml | 30 ++ templates/zencrm.html.twig | 1 + tests/src/Functional/LoadTest.php | 46 +++ zencrm.info.yml | 5 + zencrm.module | 35 +++ 33 files changed, 1845 insertions(+) create mode 100644 .gitignore create mode 100644 composer.json create mode 100644 modules/zencrm_entities/composer.json create mode 100644 modules/zencrm_entities/person.page.inc create mode 100644 modules/zencrm_entities/src/Controller/PersonController.php create mode 100644 modules/zencrm_entities/src/Entity/Person.php create mode 100644 modules/zencrm_entities/src/Entity/PersonInterface.php create mode 100644 modules/zencrm_entities/src/Entity/PersonViewsData.php create mode 100644 modules/zencrm_entities/src/Form/PersonDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/PersonForm.php create mode 100644 modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php create mode 100644 modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php create mode 100644 modules/zencrm_entities/src/Form/PersonSettingsForm.php create mode 100644 modules/zencrm_entities/src/PersonAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/PersonHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/PersonListBuilder.php create mode 100644 modules/zencrm_entities/src/PersonStorage.php create mode 100644 modules/zencrm_entities/src/PersonStorageInterface.php create mode 100644 modules/zencrm_entities/src/PersonTranslationHandler.php create mode 100644 modules/zencrm_entities/templates/person.html.twig create mode 100644 modules/zencrm_entities/templates/zencrm-entities.html.twig create mode 100644 modules/zencrm_entities/tests/src/Functional/LoadTest.php create mode 100644 modules/zencrm_entities/zencrm_entities.info.yml create mode 100644 modules/zencrm_entities/zencrm_entities.links.action.yml create mode 100644 modules/zencrm_entities/zencrm_entities.links.menu.yml create mode 100644 modules/zencrm_entities/zencrm_entities.links.task.yml create mode 100644 modules/zencrm_entities/zencrm_entities.module create mode 100644 modules/zencrm_entities/zencrm_entities.permissions.yml create mode 100644 templates/zencrm.html.twig create mode 100644 tests/src/Functional/LoadTest.php create mode 100644 zencrm.info.yml create mode 100644 zencrm.module diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..70d917a --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/zencrm", + "type": "drupal-module", + "description": "Zen CRM", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/zencrm", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/zencrm", + "source": "http://cgit.drupalcode.org/zencrm" + }, + "require": { } +} diff --git a/modules/zencrm_entities/composer.json b/modules/zencrm_entities/composer.json new file mode 100644 index 0000000..d587368 --- /dev/null +++ b/modules/zencrm_entities/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/zencrm_entities", + "type": "drupal-module", + "description": "Zen CRM Entities", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/zencrm_entities", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/zencrm_entities", + "source": "http://cgit.drupalcode.org/zencrm_entities" + }, + "require": { } +} diff --git a/modules/zencrm_entities/person.page.inc b/modules/zencrm_entities/person.page.inc new file mode 100644 index 0000000..7230a19 --- /dev/null +++ b/modules/zencrm_entities/person.page.inc @@ -0,0 +1,30 @@ +entityManager()->getStorage('person')->loadRevision($person_revision); + $view_builder = $this->entityManager()->getViewBuilder('person'); + + return $view_builder->view($person); + } + + /** + * Page title callback for a Person revision. + * + * @param int $person_revision + * The Person revision ID. + * + * @return string + * The page title. + */ + public function revisionPageTitle($person_revision) { + $person = $this->entityManager()->getStorage('person')->loadRevision($person_revision); + return $this->t('Revision of %title from %date', ['%title' => $person->label(), '%date' => format_date($person->getRevisionCreationTime())]); + } + + /** + * Generates an overview table of older revisions of a Person . + * + * @param \Drupal\zencrm_entities\Entity\PersonInterface $person + * A Person object. + * + * @return array + * An array as expected by drupal_render(). + */ + public function revisionOverview(PersonInterface $person) { + $account = $this->currentUser(); + $langcode = $person->language()->getId(); + $langname = $person->language()->getName(); + $languages = $person->getTranslationLanguages(); + $has_translations = (count($languages) > 1); + $person_storage = $this->entityManager()->getStorage('person'); + + $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $person->label()]) : $this->t('Revisions for %title', ['%title' => $person->label()]); + $header = [$this->t('Revision'), $this->t('Operations')]; + + $revert_permission = (($account->hasPermission("revert all person revisions") || $account->hasPermission('administer person entities'))); + $delete_permission = (($account->hasPermission("delete all person revisions") || $account->hasPermission('administer person entities'))); + + $rows = []; + + $vids = $person_storage->revisionIds($person); + + $latest_revision = TRUE; + + foreach (array_reverse($vids) as $vid) { + /** @var \Drupal\zencrm_entities\PersonInterface $revision */ + $revision = $person_storage->loadRevision($vid); + // Only show revisions that are affected by the language that is being + // displayed. + if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { + $username = [ + '#theme' => 'username', + '#account' => $revision->getRevisionUser(), + ]; + + // Use revision link to link to revisions that are not active. + $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); + if ($vid != $person->getRevisionId()) { + $link = $this->l($date, new Url('entity.person.revision', ['person' => $person->id(), 'person_revision' => $vid])); + } + else { + $link = $person->link($date); + } + + $row = []; + $column = [ + 'data' => [ + '#type' => 'inline_template', + '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', + '#context' => [ + 'date' => $link, + 'username' => \Drupal::service('renderer')->renderPlain($username), + 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], + ], + ], + ]; + $row[] = $column; + + if ($latest_revision) { + $row[] = [ + 'data' => [ + '#prefix' => '', + '#markup' => $this->t('Current revision'), + '#suffix' => '', + ], + ]; + foreach ($row as &$current) { + $current['class'] = ['revision-current']; + } + $latest_revision = FALSE; + } + else { + $links = []; + if ($revert_permission) { + $links['revert'] = [ + 'title' => $this->t('Revert'), + 'url' => $has_translations ? + Url::fromRoute('entity.person.translation_revert', ['person' => $person->id(), 'person_revision' => $vid, 'langcode' => $langcode]) : + Url::fromRoute('entity.person.revision_revert', ['person' => $person->id(), 'person_revision' => $vid]), + ]; + } + + if ($delete_permission) { + $links['delete'] = [ + 'title' => $this->t('Delete'), + 'url' => Url::fromRoute('entity.person.revision_delete', ['person' => $person->id(), 'person_revision' => $vid]), + ]; + } + + $row[] = [ + 'data' => [ + '#type' => 'operations', + '#links' => $links, + ], + ]; + } + + $rows[] = $row; + } + } + + $build['person_revisions_table'] = [ + '#theme' => 'table', + '#rows' => $rows, + '#header' => $header, + ]; + + return $build; + } + +} diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php new file mode 100644 index 0000000..fd38dee --- /dev/null +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -0,0 +1,288 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + protected function urlRouteParameters($rel) { + $uri_route_parameters = parent::urlRouteParameters($rel); + + if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + + return $uri_route_parameters; + } + + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageInterface $storage) { + parent::preSave($storage); + + foreach (array_keys($this->getTranslationLanguages()) as $langcode) { + $translation = $this->getTranslation($langcode); + + // If no owner has been set explicitly, make the anonymous user the owner. + if (!$translation->getOwner()) { + $translation->setOwnerId(0); + } + } + + // If no revision author has been set explicitly, make the person owner the + // revision author. + if (!$this->getRevisionUser()) { + $this->setRevisionUserId($this->getOwnerId()); + } + } + + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Person entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE); + + $fields['first_name'] = BaseFieldDefinition::create('string') + ->setLabel(t('First Name')) + ->setDescription(t('First Name.')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['middle_names'] = BaseFieldDefinition::create('string') + ->setLabel(t('Middle Names')) + ->setDescription(t('Middle Names.')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['last_name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Last Name')) + ->setDescription(t('Last Name.')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Enabled')) + ->setDescription(t('If this is ticked, the record is active')) + ->setRevisionable(TRUE) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Revision translation affected')) + ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) + ->setReadOnly(TRUE) + ->setRevisionable(TRUE) + ->setTranslatable(TRUE); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/PersonInterface.php b/modules/zencrm_entities/src/Entity/PersonInterface.php new file mode 100644 index 0000000..ebe7d5f --- /dev/null +++ b/modules/zencrm_entities/src/Entity/PersonInterface.php @@ -0,0 +1,97 @@ +entity->isNew()) { + $form['new_revision'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Create new revision'), + '#default_value' => FALSE, + '#weight' => 10, + ]; + } + + $entity = $this->entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + // Save as a new revision if requested to do so. + if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { + $entity->setNewRevision(); + + // If a new revision is created, save the current user as revision author. + $entity->setRevisionCreationTime(REQUEST_TIME); + $entity->setRevisionUserId(\Drupal::currentUser()->id()); + } + else { + $entity->setNewRevision(FALSE); + } + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Person.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Person.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.person.canonical', ['person' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php new file mode 100644 index 0000000..c6addc9 --- /dev/null +++ b/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php @@ -0,0 +1,123 @@ +PersonStorage = $entity_storage; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + $entity_manager = $container->get('entity.manager'); + return new static( + $entity_manager->getStorage('person'), + $container->get('database') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'person_revision_delete_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.person.version_history', ['person' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL) { + $this->revision = $this->PersonStorage->loadRevision($person_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->PersonStorage->deleteRevision($this->revision->getRevisionId()); + + $this->logger('content')->notice('Person: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Revision from %revision-date of Person %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + $form_state->setRedirect( + 'entity.person.canonical', + ['person' => $this->revision->id()] + ); + if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {person_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { + $form_state->setRedirect( + 'entity.person.version_history', + ['person' => $this->revision->id()] + ); + } + } + +} diff --git a/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php b/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php new file mode 100644 index 0000000..25ad7e5 --- /dev/null +++ b/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php @@ -0,0 +1,149 @@ +PersonStorage = $entity_storage; + $this->dateFormatter = $date_formatter; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('person'), + $container->get('date.formatter') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'person_revision_revert_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.person.version_history', ['person' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Revert'); + } + + /** + * {@inheritdoc} + */ + public function getDescription() { + return ''; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL) { + $this->revision = $this->PersonStorage->loadRevision($person_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + // The revision timestamp will be updated when the revision is saved. Keep + // the original one for the confirmation message. + $original_revision_timestamp = $this->revision->getRevisionCreationTime(); + + $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); + $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); + $this->revision->save(); + + $this->logger('content')->notice('Person: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Person %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + $form_state->setRedirect( + 'entity.person.version_history', + ['person' => $this->revision->id()] + ); + } + + /** + * Prepares a revision to be reverted. + * + * @param \Drupal\zencrm_entities\Entity\PersonInterface $revision + * The revision to be reverted. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + * + * @return \Drupal\zencrm_entities\Entity\PersonInterface + * The prepared revision ready to be stored. + */ + protected function prepareRevertedRevision(PersonInterface $revision, FormStateInterface $form_state) { + $revision->setNewRevision(); + $revision->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $revision; + } + +} diff --git a/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php new file mode 100644 index 0000000..2a5aa67 --- /dev/null +++ b/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php @@ -0,0 +1,115 @@ +languageManager = $language_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('person'), + $container->get('date.formatter'), + $container->get('language_manager') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'person_revision_revert_translation_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL, $langcode = NULL) { + $this->langcode = $langcode; + $form = parent::buildForm($form, $form_state, $person_revision); + + $form['revert_untranslated_fields'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Revert content shared among translations'), + '#default_value' => FALSE, + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + protected function prepareRevertedRevision(PersonInterface $revision, FormStateInterface $form_state) { + $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); + + /** @var \Drupal\zencrm_entities\Entity\PersonInterface $default_revision */ + $latest_revision = $this->PersonStorage->load($revision->id()); + $latest_revision_translation = $latest_revision->getTranslation($this->langcode); + + $revision_translation = $revision->getTranslation($this->langcode); + + foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { + if ($definition->isTranslatable() || $revert_untranslated_fields) { + $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); + } + } + + $latest_revision_translation->setNewRevision(); + $latest_revision_translation->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $latest_revision_translation; + } + +} diff --git a/modules/zencrm_entities/src/Form/PersonSettingsForm.php b/modules/zencrm_entities/src/Form/PersonSettingsForm.php new file mode 100644 index 0000000..402a0da --- /dev/null +++ b/modules/zencrm_entities/src/Form/PersonSettingsForm.php @@ -0,0 +1,53 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished person entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published person entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit person entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete person entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add person entities'); + } + +} diff --git a/modules/zencrm_entities/src/PersonHtmlRouteProvider.php b/modules/zencrm_entities/src/PersonHtmlRouteProvider.php new file mode 100644 index 0000000..8d9e7cb --- /dev/null +++ b/modules/zencrm_entities/src/PersonHtmlRouteProvider.php @@ -0,0 +1,196 @@ +id(); + + if ($history_route = $this->getHistoryRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.version_history", $history_route); + } + + if ($revision_route = $this->getRevisionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision", $revision_route); + } + + if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); + } + + if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); + } + + if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { + $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the version history route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getHistoryRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('version-history')) { + $route = new Route($entity_type->getLinkTemplate('version-history')); + $route + ->setDefaults([ + '_title' => "{$entity_type->getLabel()} revisions", + '_controller' => '\Drupal\zencrm_entities\Controller\PersonController::revisionOverview', + ]) + ->setRequirement('_permission', 'access person revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision')) { + $route = new Route($entity_type->getLinkTemplate('revision')); + $route + ->setDefaults([ + '_controller' => '\Drupal\zencrm_entities\Controller\PersonController::revisionShow', + '_title_callback' => '\Drupal\zencrm_entities\Controller\PersonController::revisionPageTitle', + ]) + ->setRequirement('_permission', 'access person revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_revert')) { + $route = new Route($entity_type->getLinkTemplate('revision_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionRevertForm', + '_title' => 'Revert to earlier revision', + ]) + ->setRequirement('_permission', 'revert all person revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision delete route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_delete')) { + $route = new Route($entity_type->getLinkTemplate('revision_delete')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionDeleteForm', + '_title' => 'Delete earlier revision', + ]) + ->setRequirement('_permission', 'delete all person revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision translation revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('translation_revert')) { + $route = new Route($entity_type->getLinkTemplate('translation_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionRevertTranslationForm', + '_title' => 'Revert to earlier revision of a translation', + ]) + ->setRequirement('_permission', 'revert all person revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\PersonSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/PersonListBuilder.php b/modules/zencrm_entities/src/PersonListBuilder.php new file mode 100644 index 0000000..e462a15 --- /dev/null +++ b/modules/zencrm_entities/src/PersonListBuilder.php @@ -0,0 +1,40 @@ +t('Person ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\Person */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.person.edit_form', + ['person' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/PersonStorage.php b/modules/zencrm_entities/src/PersonStorage.php new file mode 100644 index 0000000..84a3340 --- /dev/null +++ b/modules/zencrm_entities/src/PersonStorage.php @@ -0,0 +1,58 @@ +database->query( + 'SELECT vid FROM {person_revision} WHERE id=:id ORDER BY vid', + [':id' => $entity->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function userRevisionIds(AccountInterface $account) { + return $this->database->query( + 'SELECT vid FROM {person_field_revision} WHERE uid = :uid ORDER BY vid', + [':uid' => $account->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function countDefaultLanguageRevisions(PersonInterface $entity) { + return $this->database->query('SELECT COUNT(*) FROM {person_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) + ->fetchField(); + } + + /** + * {@inheritdoc} + */ + public function clearRevisionsLanguage(LanguageInterface $language) { + return $this->database->update('person_revision') + ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) + ->condition('langcode', $language->getId()) + ->execute(); + } + +} diff --git a/modules/zencrm_entities/src/PersonStorageInterface.php b/modules/zencrm_entities/src/PersonStorageInterface.php new file mode 100644 index 0000000..727393c --- /dev/null +++ b/modules/zencrm_entities/src/PersonStorageInterface.php @@ -0,0 +1,61 @@ + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/templates/zencrm-entities.html.twig b/modules/zencrm_entities/templates/zencrm-entities.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/zencrm_entities/templates/zencrm-entities.html.twig @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/zencrm_entities/tests/src/Functional/LoadTest.php b/modules/zencrm_entities/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..2b23546 --- /dev/null +++ b/modules/zencrm_entities/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +user = $this->drupalCreateUser(['administer site configuration']); + $this->drupalLogin($this->user); + } + + /** + * Tests that the home page loads with a 200 response. + */ + public function testLoad() { + $this->drupalGet(Url::fromRoute('')); + $this->assertSession()->statusCodeEquals(200); + } + +} diff --git a/modules/zencrm_entities/zencrm_entities.info.yml b/modules/zencrm_entities/zencrm_entities.info.yml new file mode 100644 index 0000000..7e46fd5 --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.info.yml @@ -0,0 +1,5 @@ +name: 'Zen CRM Entities' +type: module +description: 'Zen CRM Entities' +core: 8.x +package: 'Zen CRM' diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml new file mode 100644 index 0000000..13b90f7 --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -0,0 +1,5 @@ +entity.person.add_form: + route_name: entity.person.add_form + title: 'Add Person' + appears_on: + - entity.person.collection diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml new file mode 100644 index 0000000..e55e04e --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -0,0 +1,14 @@ + +# Person menu items definition +entity.person.collection: + title: 'Person list' + route_name: entity.person.collection + description: 'List Person entities' + parent: system.admin_structure + weight: 100 + +person.admin.structure.settings: + title: 'Person settings' + description: 'Configure Person entities' + route_name: person.settings + parent: system.admin_structure diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml new file mode 100644 index 0000000..b0f95d1 --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -0,0 +1,27 @@ +# Person routing definition +person.settings_tab: + route_name: person.settings + title: 'Settings' + base_route: person.settings + +entity.person.canonical: + route_name: entity.person.canonical + base_route: entity.person.canonical + title: 'View' + +entity.person.edit_form: + route_name: entity.person.edit_form + base_route: entity.person.canonical + title: 'Edit' + +entity.person.version_history: + route_name: entity.person.version_history + base_route: entity.person.canonical + title: 'Revisions' + +entity.person.delete_form: + route_name: entity.person.delete_form + base_route: entity.person.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module new file mode 100644 index 0000000..be031b1 --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '

' . t('Zen CRM Entities') . '

'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function zencrm_entities_theme() { + return [ + 'zencrm_entities' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml new file mode 100644 index 0000000..9e60c2f --- /dev/null +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -0,0 +1,30 @@ +add person entities: + title: 'Create new Person entities' + +administer person entities: + title: 'Administer Person entities' + description: 'Allow to access the administration form to configure Person entities.' + restrict access: true + +delete person entities: + title: 'Delete Person entities' + +edit person entities: + title: 'Edit Person entities' + +view published person entities: + title: 'View published Person entities' + +view unpublished person entities: + title: 'View unpublished Person entities' + +view all person revisions: + title: 'View all Person revisions' + +revert all person revisions: + title: 'Revert all Person revisions' + description: 'Role requires permission view Person revisions and edit rights for person entities in question or administer person entities.' + +delete all person revisions: + title: 'Delete all revisions' + description: 'Role requires permission to view Person revisions and delete rights for person entities in question or administer person entities.' diff --git a/templates/zencrm.html.twig b/templates/zencrm.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/templates/zencrm.html.twig @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/src/Functional/LoadTest.php b/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..b3c682b --- /dev/null +++ b/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +user = $this->drupalCreateUser(['administer site configuration']); + $this->drupalLogin($this->user); + } + + /** + * Tests that the home page loads with a 200 response. + */ + public function testLoad() { + $this->drupalGet(Url::fromRoute('')); + $this->assertSession()->statusCodeEquals(200); + } + +} diff --git a/zencrm.info.yml b/zencrm.info.yml new file mode 100644 index 0000000..de8354d --- /dev/null +++ b/zencrm.info.yml @@ -0,0 +1,5 @@ +name: 'Zen CRM' +type: module +description: 'Zen CRM' +core: 8.x +package: 'Zen CRM' diff --git a/zencrm.module b/zencrm.module new file mode 100644 index 0000000..20421e4 --- /dev/null +++ b/zencrm.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '

' . t('Zen CRM') . '

'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function zencrm_theme() { + return [ + 'zencrm' => [ + 'render element' => 'children', + ], + ]; +} From e933c3ae2322ccb4427759475a0215094584efb9 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 5 Apr 2018 15:31:17 +0200 Subject: [PATCH 05/94] added dependency on zencrm_entities --- zencrm.info.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zencrm.info.yml b/zencrm.info.yml index de8354d..fba8d8e 100644 --- a/zencrm.info.yml +++ b/zencrm.info.yml @@ -3,3 +3,5 @@ type: module description: 'Zen CRM' core: 8.x package: 'Zen CRM' +dependencies: + - zencrm_entities From 7ac39fc385ce0e5ccbf8e186c5e28bc59edf7ec4 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 5 Apr 2018 20:05:00 +0200 Subject: [PATCH 06/94] Gennerated Profile entity --- .../config/schema/profile_type.schema.yml | 12 + modules/zencrm_entities/profile.page.inc | 30 ++ .../src/Controller/ProfileController.php | 163 ++++++++++ .../zencrm_entities/src/Entity/Profile.php | 281 ++++++++++++++++++ .../src/Entity/ProfileInterface.php | 116 ++++++++ .../src/Entity/ProfileType.php | 58 ++++ .../src/Entity/ProfileTypeInterface.php | 13 + .../src/Entity/ProfileViewsData.php | 24 ++ .../src/Form/ProfileDeleteForm.php | 15 + .../zencrm_entities/src/Form/ProfileForm.php | 71 +++++ .../src/Form/ProfileRevisionDeleteForm.php | 123 ++++++++ .../src/Form/ProfileRevisionRevertForm.php | 149 ++++++++++ .../ProfileRevisionRevertTranslationForm.php | 115 +++++++ .../src/Form/ProfileSettingsForm.php | 53 ++++ .../src/Form/ProfileTypeDeleteForm.php | 53 ++++ .../src/Form/ProfileTypeForm.php | 65 ++++ .../src/ProfileAccessControlHandler.php | 47 +++ .../src/ProfileHtmlRouteProvider.php | 196 ++++++++++++ .../src/ProfileListBuilder.php | 40 +++ .../zencrm_entities/src/ProfileStorage.php | 58 ++++ .../src/ProfileStorageInterface.php | 61 ++++ .../src/ProfileTranslationHandler.php | 14 + .../src/ProfileTypeHtmlRouteProvider.php | 28 ++ .../src/ProfileTypeListBuilder.php | 32 ++ .../profile-content-add-list.html.twig | 23 ++ .../templates/profile.html.twig | 22 ++ .../zencrm_entities.links.action.yml | 11 + .../zencrm_entities.links.menu.yml | 18 ++ .../zencrm_entities.links.task.yml | 23 ++ .../zencrm_entities/zencrm_entities.module | 34 ++- .../zencrm_entities.permissions.yml | 30 ++ 31 files changed, 1974 insertions(+), 4 deletions(-) create mode 100644 modules/zencrm_entities/config/schema/profile_type.schema.yml create mode 100644 modules/zencrm_entities/profile.page.inc create mode 100644 modules/zencrm_entities/src/Controller/ProfileController.php create mode 100644 modules/zencrm_entities/src/Entity/Profile.php create mode 100644 modules/zencrm_entities/src/Entity/ProfileInterface.php create mode 100644 modules/zencrm_entities/src/Entity/ProfileType.php create mode 100644 modules/zencrm_entities/src/Entity/ProfileTypeInterface.php create mode 100644 modules/zencrm_entities/src/Entity/ProfileViewsData.php create mode 100644 modules/zencrm_entities/src/Form/ProfileDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileSettingsForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileTypeDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ProfileTypeForm.php create mode 100644 modules/zencrm_entities/src/ProfileAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/ProfileHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/ProfileListBuilder.php create mode 100644 modules/zencrm_entities/src/ProfileStorage.php create mode 100644 modules/zencrm_entities/src/ProfileStorageInterface.php create mode 100644 modules/zencrm_entities/src/ProfileTranslationHandler.php create mode 100644 modules/zencrm_entities/src/ProfileTypeHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/ProfileTypeListBuilder.php create mode 100644 modules/zencrm_entities/templates/profile-content-add-list.html.twig create mode 100644 modules/zencrm_entities/templates/profile.html.twig diff --git a/modules/zencrm_entities/config/schema/profile_type.schema.yml b/modules/zencrm_entities/config/schema/profile_type.schema.yml new file mode 100644 index 0000000..ef343e5 --- /dev/null +++ b/modules/zencrm_entities/config/schema/profile_type.schema.yml @@ -0,0 +1,12 @@ +zencrm_entities.profile_type.*: + type: config_entity + label: 'Profile type config' + mapping: + id: + type: string + label: 'ID' + label: + type: label + label: 'Label' + uuid: + type: string diff --git a/modules/zencrm_entities/profile.page.inc b/modules/zencrm_entities/profile.page.inc new file mode 100644 index 0000000..8bbf578 --- /dev/null +++ b/modules/zencrm_entities/profile.page.inc @@ -0,0 +1,30 @@ +entityManager()->getStorage('profile')->loadRevision($profile_revision); + $view_builder = $this->entityManager()->getViewBuilder('profile'); + + return $view_builder->view($profile); + } + + /** + * Page title callback for a Profile revision. + * + * @param int $profile_revision + * The Profile revision ID. + * + * @return string + * The page title. + */ + public function revisionPageTitle($profile_revision) { + $profile = $this->entityManager()->getStorage('profile')->loadRevision($profile_revision); + return $this->t('Revision of %title from %date', ['%title' => $profile->label(), '%date' => format_date($profile->getRevisionCreationTime())]); + } + + /** + * Generates an overview table of older revisions of a Profile . + * + * @param \Drupal\zencrm_entities\Entity\ProfileInterface $profile + * A Profile object. + * + * @return array + * An array as expected by drupal_render(). + */ + public function revisionOverview(ProfileInterface $profile) { + $account = $this->currentUser(); + $langcode = $profile->language()->getId(); + $langname = $profile->language()->getName(); + $languages = $profile->getTranslationLanguages(); + $has_translations = (count($languages) > 1); + $profile_storage = $this->entityManager()->getStorage('profile'); + + $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $profile->label()]) : $this->t('Revisions for %title', ['%title' => $profile->label()]); + $header = [$this->t('Revision'), $this->t('Operations')]; + + $revert_permission = (($account->hasPermission("revert all profile revisions") || $account->hasPermission('administer profile entities'))); + $delete_permission = (($account->hasPermission("delete all profile revisions") || $account->hasPermission('administer profile entities'))); + + $rows = []; + + $vids = $profile_storage->revisionIds($profile); + + $latest_revision = TRUE; + + foreach (array_reverse($vids) as $vid) { + /** @var \Drupal\zencrm_entities\ProfileInterface $revision */ + $revision = $profile_storage->loadRevision($vid); + // Only show revisions that are affected by the language that is being + // displayed. + if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { + $username = [ + '#theme' => 'username', + '#account' => $revision->getRevisionUser(), + ]; + + // Use revision link to link to revisions that are not active. + $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); + if ($vid != $profile->getRevisionId()) { + $link = $this->l($date, new Url('entity.profile.revision', ['profile' => $profile->id(), 'profile_revision' => $vid])); + } + else { + $link = $profile->link($date); + } + + $row = []; + $column = [ + 'data' => [ + '#type' => 'inline_template', + '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', + '#context' => [ + 'date' => $link, + 'username' => \Drupal::service('renderer')->renderPlain($username), + 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], + ], + ], + ]; + $row[] = $column; + + if ($latest_revision) { + $row[] = [ + 'data' => [ + '#prefix' => '', + '#markup' => $this->t('Current revision'), + '#suffix' => '', + ], + ]; + foreach ($row as &$current) { + $current['class'] = ['revision-current']; + } + $latest_revision = FALSE; + } + else { + $links = []; + if ($revert_permission) { + $links['revert'] = [ + 'title' => $this->t('Revert'), + 'url' => $has_translations ? + Url::fromRoute('entity.profile.translation_revert', ['profile' => $profile->id(), 'profile_revision' => $vid, 'langcode' => $langcode]) : + Url::fromRoute('entity.profile.revision_revert', ['profile' => $profile->id(), 'profile_revision' => $vid]), + ]; + } + + if ($delete_permission) { + $links['delete'] = [ + 'title' => $this->t('Delete'), + 'url' => Url::fromRoute('entity.profile.revision_delete', ['profile' => $profile->id(), 'profile_revision' => $vid]), + ]; + } + + $row[] = [ + 'data' => [ + '#type' => 'operations', + '#links' => $links, + ], + ]; + } + + $rows[] = $row; + } + } + + $build['profile_revisions_table'] = [ + '#theme' => 'table', + '#rows' => $rows, + '#header' => $header, + ]; + + return $build; + } + +} diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php new file mode 100644 index 0000000..f6094fc --- /dev/null +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -0,0 +1,281 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + protected function urlRouteParameters($rel) { + $uri_route_parameters = parent::urlRouteParameters($rel); + + if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + + return $uri_route_parameters; + } + + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageInterface $storage) { + parent::preSave($storage); + + foreach (array_keys($this->getTranslationLanguages()) as $langcode) { + $translation = $this->getTranslation($langcode); + + // If no owner has been set explicitly, make the anonymous user the owner. + if (!$translation->getOwner()) { + $translation->setOwnerId(0); + } + } + + // If no revision author has been set explicitly, make the profile owner the + // revision author. + if (!$this->getRevisionUser()) { + $this->setRevisionUserId($this->getOwnerId()); + } + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Profile entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', [ + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Profile entity.')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Profile is published.')) + ->setRevisionable(TRUE) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Revision translation affected')) + ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) + ->setReadOnly(TRUE) + ->setRevisionable(TRUE) + ->setTranslatable(TRUE); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/ProfileInterface.php b/modules/zencrm_entities/src/Entity/ProfileInterface.php new file mode 100644 index 0000000..382bd0a --- /dev/null +++ b/modules/zencrm_entities/src/Entity/ProfileInterface.php @@ -0,0 +1,116 @@ +entity->isNew()) { + $form['new_revision'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Create new revision'), + '#default_value' => FALSE, + '#weight' => 10, + ]; + } + + $entity = $this->entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + // Save as a new revision if requested to do so. + if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { + $entity->setNewRevision(); + + // If a new revision is created, save the current user as revision author. + $entity->setRevisionCreationTime(REQUEST_TIME); + $entity->setRevisionUserId(\Drupal::currentUser()->id()); + } + else { + $entity->setNewRevision(FALSE); + } + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Profile.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Profile.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.profile.canonical', ['profile' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php new file mode 100644 index 0000000..6d38c90 --- /dev/null +++ b/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php @@ -0,0 +1,123 @@ +ProfileStorage = $entity_storage; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + $entity_manager = $container->get('entity.manager'); + return new static( + $entity_manager->getStorage('profile'), + $container->get('database') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'profile_revision_delete_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.profile.version_history', ['profile' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL) { + $this->revision = $this->ProfileStorage->loadRevision($profile_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->ProfileStorage->deleteRevision($this->revision->getRevisionId()); + + $this->logger('content')->notice('Profile: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Revision from %revision-date of Profile %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + $form_state->setRedirect( + 'entity.profile.canonical', + ['profile' => $this->revision->id()] + ); + if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {profile_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { + $form_state->setRedirect( + 'entity.profile.version_history', + ['profile' => $this->revision->id()] + ); + } + } + +} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php new file mode 100644 index 0000000..e43516c --- /dev/null +++ b/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php @@ -0,0 +1,149 @@ +ProfileStorage = $entity_storage; + $this->dateFormatter = $date_formatter; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('profile'), + $container->get('date.formatter') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'profile_revision_revert_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.profile.version_history', ['profile' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Revert'); + } + + /** + * {@inheritdoc} + */ + public function getDescription() { + return ''; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL) { + $this->revision = $this->ProfileStorage->loadRevision($profile_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + // The revision timestamp will be updated when the revision is saved. Keep + // the original one for the confirmation message. + $original_revision_timestamp = $this->revision->getRevisionCreationTime(); + + $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); + $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); + $this->revision->save(); + + $this->logger('content')->notice('Profile: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Profile %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + $form_state->setRedirect( + 'entity.profile.version_history', + ['profile' => $this->revision->id()] + ); + } + + /** + * Prepares a revision to be reverted. + * + * @param \Drupal\zencrm_entities\Entity\ProfileInterface $revision + * The revision to be reverted. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + * + * @return \Drupal\zencrm_entities\Entity\ProfileInterface + * The prepared revision ready to be stored. + */ + protected function prepareRevertedRevision(ProfileInterface $revision, FormStateInterface $form_state) { + $revision->setNewRevision(); + $revision->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $revision; + } + +} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php new file mode 100644 index 0000000..66c672d --- /dev/null +++ b/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php @@ -0,0 +1,115 @@ +languageManager = $language_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('profile'), + $container->get('date.formatter'), + $container->get('language_manager') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'profile_revision_revert_translation_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL, $langcode = NULL) { + $this->langcode = $langcode; + $form = parent::buildForm($form, $form_state, $profile_revision); + + $form['revert_untranslated_fields'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Revert content shared among translations'), + '#default_value' => FALSE, + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + protected function prepareRevertedRevision(ProfileInterface $revision, FormStateInterface $form_state) { + $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); + + /** @var \Drupal\zencrm_entities\Entity\ProfileInterface $default_revision */ + $latest_revision = $this->ProfileStorage->load($revision->id()); + $latest_revision_translation = $latest_revision->getTranslation($this->langcode); + + $revision_translation = $revision->getTranslation($this->langcode); + + foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { + if ($definition->isTranslatable() || $revert_untranslated_fields) { + $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); + } + } + + $latest_revision_translation->setNewRevision(); + $latest_revision_translation->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $latest_revision_translation; + } + +} diff --git a/modules/zencrm_entities/src/Form/ProfileSettingsForm.php b/modules/zencrm_entities/src/Form/ProfileSettingsForm.php new file mode 100644 index 0000000..e077fc7 --- /dev/null +++ b/modules/zencrm_entities/src/Form/ProfileSettingsForm.php @@ -0,0 +1,53 @@ +t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.profile_type.collection'); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return $this->t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->entity->delete(); + + drupal_set_message( + $this->t('content @type: deleted @label.', + [ + '@type' => $this->entity->bundle(), + '@label' => $this->entity->label(), + ] + ) + ); + + $form_state->setRedirectUrl($this->getCancelUrl()); + } + +} diff --git a/modules/zencrm_entities/src/Form/ProfileTypeForm.php b/modules/zencrm_entities/src/Form/ProfileTypeForm.php new file mode 100644 index 0000000..091b9fa --- /dev/null +++ b/modules/zencrm_entities/src/Form/ProfileTypeForm.php @@ -0,0 +1,65 @@ +entity; + $form['label'] = [ + '#type' => 'textfield', + '#title' => $this->t('Label'), + '#maxlength' => 255, + '#default_value' => $profile_type->label(), + '#description' => $this->t("Label for the Profile type."), + '#required' => TRUE, + ]; + + $form['id'] = [ + '#type' => 'machine_name', + '#default_value' => $profile_type->id(), + '#machine_name' => [ + 'exists' => '\Drupal\zencrm_entities\Entity\ProfileType::load', + ], + '#disabled' => !$profile_type->isNew(), + ]; + + /* You will need additional form elements for your custom properties. */ + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $profile_type = $this->entity; + $status = $profile_type->save(); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Profile type.', [ + '%label' => $profile_type->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Profile type.', [ + '%label' => $profile_type->label(), + ])); + } + $form_state->setRedirectUrl($profile_type->toUrl('collection')); + } + +} diff --git a/modules/zencrm_entities/src/ProfileAccessControlHandler.php b/modules/zencrm_entities/src/ProfileAccessControlHandler.php new file mode 100644 index 0000000..0eac19c --- /dev/null +++ b/modules/zencrm_entities/src/ProfileAccessControlHandler.php @@ -0,0 +1,47 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished profile entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published profile entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit profile entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete profile entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add profile entities'); + } + +} diff --git a/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php b/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php new file mode 100644 index 0000000..de8faf0 --- /dev/null +++ b/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php @@ -0,0 +1,196 @@ +id(); + + if ($history_route = $this->getHistoryRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.version_history", $history_route); + } + + if ($revision_route = $this->getRevisionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision", $revision_route); + } + + if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); + } + + if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); + } + + if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { + $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the version history route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getHistoryRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('version-history')) { + $route = new Route($entity_type->getLinkTemplate('version-history')); + $route + ->setDefaults([ + '_title' => "{$entity_type->getLabel()} revisions", + '_controller' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionOverview', + ]) + ->setRequirement('_permission', 'access profile revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision')) { + $route = new Route($entity_type->getLinkTemplate('revision')); + $route + ->setDefaults([ + '_controller' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionShow', + '_title_callback' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionPageTitle', + ]) + ->setRequirement('_permission', 'access profile revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_revert')) { + $route = new Route($entity_type->getLinkTemplate('revision_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionRevertForm', + '_title' => 'Revert to earlier revision', + ]) + ->setRequirement('_permission', 'revert all profile revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision delete route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_delete')) { + $route = new Route($entity_type->getLinkTemplate('revision_delete')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionDeleteForm', + '_title' => 'Delete earlier revision', + ]) + ->setRequirement('_permission', 'delete all profile revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision translation revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('translation_revert')) { + $route = new Route($entity_type->getLinkTemplate('translation_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionRevertTranslationForm', + '_title' => 'Revert to earlier revision of a translation', + ]) + ->setRequirement('_permission', 'revert all profile revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\ProfileSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/ProfileListBuilder.php b/modules/zencrm_entities/src/ProfileListBuilder.php new file mode 100644 index 0000000..93ae336 --- /dev/null +++ b/modules/zencrm_entities/src/ProfileListBuilder.php @@ -0,0 +1,40 @@ +t('Profile ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\Profile */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.profile.edit_form', + ['profile' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/ProfileStorage.php b/modules/zencrm_entities/src/ProfileStorage.php new file mode 100644 index 0000000..0be322b --- /dev/null +++ b/modules/zencrm_entities/src/ProfileStorage.php @@ -0,0 +1,58 @@ +database->query( + 'SELECT vid FROM {profile_revision} WHERE id=:id ORDER BY vid', + [':id' => $entity->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function userRevisionIds(AccountInterface $account) { + return $this->database->query( + 'SELECT vid FROM {profile_field_revision} WHERE uid = :uid ORDER BY vid', + [':uid' => $account->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function countDefaultLanguageRevisions(ProfileInterface $entity) { + return $this->database->query('SELECT COUNT(*) FROM {profile_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) + ->fetchField(); + } + + /** + * {@inheritdoc} + */ + public function clearRevisionsLanguage(LanguageInterface $language) { + return $this->database->update('profile_revision') + ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) + ->condition('langcode', $language->getId()) + ->execute(); + } + +} diff --git a/modules/zencrm_entities/src/ProfileStorageInterface.php b/modules/zencrm_entities/src/ProfileStorageInterface.php new file mode 100644 index 0000000..96a7d6f --- /dev/null +++ b/modules/zencrm_entities/src/ProfileStorageInterface.php @@ -0,0 +1,61 @@ +t('Profile type'); + $header['id'] = $this->t('Machine name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $row['label'] = $entity->label(); + $row['id'] = $entity->id(); + // You probably want a few more properties here... + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/templates/profile-content-add-list.html.twig b/modules/zencrm_entities/templates/profile-content-add-list.html.twig new file mode 100644 index 0000000..e0e7f1d --- /dev/null +++ b/modules/zencrm_entities/templates/profile-content-add-list.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Default theme implementation to present a list of custom content entity types/bundles. + * + * Available variables: + * - types: A collection of all the available custom entity types/bundles. + * Each type/bundle contains the following: + * - link: A link to add a content entity of this type. + * - description: A description of this content entity types/bundle. + * + * @see template_preprocess_profile_content_add_list() + * + * @ingroup themeable + */ +#} +{% spaceless %} +
+ {% for type in types %} +
{{ type.link }}
+ {% endfor %} +
+{% endspaceless %} diff --git a/modules/zencrm_entities/templates/profile.html.twig b/modules/zencrm_entities/templates/profile.html.twig new file mode 100644 index 0000000..e244ec6 --- /dev/null +++ b/modules/zencrm_entities/templates/profile.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file profile.html.twig + * Default theme implementation to present Profile data. + * + * This template is used when viewing Profile pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_profile() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index 13b90f7..142652b 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -3,3 +3,14 @@ entity.person.add_form: title: 'Add Person' appears_on: - entity.person.collection +entity.profile.add_form: + route_name: entity.profile.add_page + title: 'Add Profile' + appears_on: + - entity.profile.collection +entity.profile_type.add_form: + route_name: entity.profile_type.add_form + title: 'Add Profile type' + appears_on: + - entity.profile_type.collection + diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index e55e04e..c3f4d63 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -12,3 +12,21 @@ person.admin.structure.settings: description: 'Configure Person entities' route_name: person.settings parent: system.admin_structure + +# Profile menu items definition +entity.profile.collection: + title: 'Profile list' + route_name: entity.profile.collection + description: 'List Profile entities' + parent: system.admin_structure + weight: 100 + + +# Profile type menu items definition +entity.profile_type.collection: + title: 'Profile type' + route_name: entity.profile_type.collection + description: 'List Profile type (bundles)' + parent: system.admin_structure + weight: 99 + diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index b0f95d1..6ce894f 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -25,3 +25,26 @@ entity.person.delete_form: title: Delete weight: 10 +# Profile routing definition + +entity.profile.canonical: + route_name: entity.profile.canonical + base_route: entity.profile.canonical + title: 'View' + +entity.profile.edit_form: + route_name: entity.profile.edit_form + base_route: entity.profile.canonical + title: 'Edit' + +entity.profile.version_history: + route_name: entity.profile.version_history + base_route: entity.profile.canonical + title: 'Revisions' + +entity.profile.delete_form: + route_name: entity.profile.delete_form + base_route: entity.profile.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index be031b1..985f2fd 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -27,9 +27,35 @@ function zencrm_entities_help($route_name, RouteMatchInterface $route_match) { * Implements hook_theme(). */ function zencrm_entities_theme() { - return [ - 'zencrm_entities' => [ - 'render element' => 'children', - ], + $theme = []; + $theme['zencrm_entities'] = [ + 'render element' => 'children', ]; + $theme['profile'] = [ + 'render element' => 'elements', + 'file' => 'profile.page.inc', + 'template' => 'profile', + ]; + $theme['profile_content_add_list'] = [ + 'render element' => 'content', + 'variables' => ['content' => NULL], + 'file' => 'profile.page.inc', + ]; + return $theme; +} + +/** +* Implements hook_theme_suggestions_HOOK(). +*/ +function zencrm_entities_theme_suggestions_profile(array $variables) { + $suggestions = []; + $entity = $variables['elements']['#profile']; + $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); + + $suggestions[] = 'profile__' . $sanitized_view_mode; + $suggestions[] = 'profile__' . $entity->bundle(); + $suggestions[] = 'profile__' . $entity->bundle() . '__' . $sanitized_view_mode; + $suggestions[] = 'profile__' . $entity->id(); + $suggestions[] = 'profile__' . $entity->id() . '__' . $sanitized_view_mode; + return $suggestions; } diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 9e60c2f..5e56d93 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -28,3 +28,33 @@ revert all person revisions: delete all person revisions: title: 'Delete all revisions' description: 'Role requires permission to view Person revisions and delete rights for person entities in question or administer person entities.' +add profile entities: + title: 'Create new Profile entities' + +administer profile entities: + title: 'Administer Profile entities' + description: 'Allow to access the administration form to configure Profile entities.' + restrict access: true + +delete profile entities: + title: 'Delete Profile entities' + +edit profile entities: + title: 'Edit Profile entities' + +view published profile entities: + title: 'View published Profile entities' + +view unpublished profile entities: + title: 'View unpublished Profile entities' + +view all profile revisions: + title: 'View all Profile revisions' + +revert all profile revisions: + title: 'Revert all Profile revisions' + description: 'Role requires permission view Profile revisions and edit rights for profile entities in question or administer profile entities.' + +delete all profile revisions: + title: 'Delete all revisions' + description: 'Role requires permission to view Profile revisions and delete rights for profile entities in question or administer profile entities.' From 6cf7d5ee6fd8364a7a2f6429f8bd4cc61dc47e77 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 5 Apr 2018 23:02:55 +0200 Subject: [PATCH 07/94] Added full_name and first_and_last_name fields to the Person entity type. The full name is now the entity label. The first_and_last_name is so that it can be used in search and autocomplete. --- modules/zencrm_entities/src/Entity/Person.php | 11 +++++++++++ .../zencrm_entities/zencrm_entities.module | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index fd38dee..55d6236 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -49,6 +49,7 @@ use Drupal\user\UserInterface; * "uid" = "user_id", * "langcode" = "langcode", * "status" = "status", + * "label" = "full_name", * }, * links = { * "canonical" = "/zencrm/person/{person}", @@ -192,6 +193,16 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setSetting('handler', 'default') ->setTranslatable(TRUE); + $fields['full_name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Full Name')) + ->setDescription(t('The full name of the person.')) + ->setRevisionable(TRUE); + + $fields['first_and_last_name'] = BaseFieldDefinition::create('string') + ->setLabel(t('First and Last Name')) + ->setDescription(t('The first and last name of the person. Used for searching and autocomplete')) + ->setRevisionable(TRUE); + $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First Name')) ->setDescription(t('First Name.')) diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 985f2fd..42ba0cc 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -7,6 +7,25 @@ use Drupal\Core\Routing\RouteMatchInterface; +/** +* Implements hook_ENTITY_TYPE_presave(). +* Computes the full_name field from first_name middle_names and last_name. +* Computes the first_and_last_name field from first_name and last_name. +*/ +function zencrm_entities_person_presave($entity) { + $first_name = $entity->first_name->getString(); + $middle_names = $entity->middle_names->getString(); + $last_name = $entity->last_name->getString(); + if ($middle_names) { + $middle_names .= ' '; + } + $first_and_last_name = $first_name . ' ' . $last_name; + $full_name = $first_name . ' ' . $middle_names . $last_name; + $entity->set('full_name', $full_name); + $entity->set('first_and_last_name', $first_and_last_name); +} + + /** * Implements hook_help(). */ From 7cd8290047a2e7ba875fa5043ab36bf28975d896 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 5 Apr 2018 23:30:05 +0200 Subject: [PATCH 08/94] whitespace --- modules/zencrm_entities/zencrm_entities.info.yml | 3 +++ modules/zencrm_entities/zencrm_entities.module | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/zencrm_entities/zencrm_entities.info.yml b/modules/zencrm_entities/zencrm_entities.info.yml index 7e46fd5..34ab4af 100644 --- a/modules/zencrm_entities/zencrm_entities.info.yml +++ b/modules/zencrm_entities/zencrm_entities.info.yml @@ -3,3 +3,6 @@ type: module description: 'Zen CRM Entities' core: 8.x package: 'Zen CRM' +mtime: 1522776761 +version: null +php: 5.5.9 diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 42ba0cc..78eda19 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -8,10 +8,10 @@ use Drupal\Core\Routing\RouteMatchInterface; /** -* Implements hook_ENTITY_TYPE_presave(). -* Computes the full_name field from first_name middle_names and last_name. -* Computes the first_and_last_name field from first_name and last_name. -*/ + * Implements hook_ENTITY_TYPE_presave(). + * Computes the full_name field from first_name middle_names and last_name. + * Computes the first_and_last_name field from first_name and last_name. + */ function zencrm_entities_person_presave($entity) { $first_name = $entity->first_name->getString(); $middle_names = $entity->middle_names->getString(); From af3b194aa4f1577bb39d9f446bec48e9aec1c471 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 5 Apr 2018 23:31:16 +0200 Subject: [PATCH 09/94] Added "persons" view with entity reference display This is used for the Person entity reference field on the Profile entity type --- .../config/install/views.view.persons.yml | 371 ++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 modules/zencrm_entities/config/install/views.view.persons.yml diff --git a/modules/zencrm_entities/config/install/views.view.persons.yml b/modules/zencrm_entities/config/install/views.view.persons.yml new file mode 100644 index 0000000..0f2a968 --- /dev/null +++ b/modules/zencrm_entities/config/install/views.view.persons.yml @@ -0,0 +1,371 @@ +crm:~/drupal$ + 070f7a04-6bdc-4992-bc48-20803c6ef0f4 +langcode: en +status: true +id: persons +label: Persons +module: views +description: '' +tag: '' +base_table: person_field_data +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: ‹‹ + next: ›› + style: + type: default + options: + grouping: { } + row_class: '' + default_row_class: true + uses_fields: false + row: + type: fields + options: + inline: { } + separator: '' + hide_empty: false + default_field_elements: true + fields: + first_name: + table: person_field_data + field: first_name + id: first_name + entity_type: null + entity_field: first_name + plugin_id: field + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: { } + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + last_name: + id: last_name + table: person_field_data + field: last_name + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: person + entity_field: last_name + plugin_id: field + first_and_last_name: + id: first_and_last_name + table: person_field_data + field: first_and_last_name + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: person + entity_field: first_and_last_name + plugin_id: field + full_name: + id: full_name + table: person_field_data + field: full_name + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: person + entity_field: full_name + plugin_id: field + filters: { } + sorts: { } + header: { } + footer: { } + empty: { } + relationships: { } + arguments: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + tags: { } + entity_reference_1: + display_plugin: entity_reference + id: entity_reference_1 + display_title: 'Entity Reference' + position: 1 + display_options: + display_extenders: { } + style: + type: entity_reference + options: + search_fields: + first_name: first_name + last_name: last_name + first_and_last_name: first_and_last_name + full_name: full_name + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + tags: { } From 60fefb703e9bfc1f47aac3b6f8bb276e3f5bd78f Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 00:40:34 +0200 Subject: [PATCH 10/94] Added base field to Profile entity, which references the Person. --- .../config/install/views.view.persons.yml | 2 -- .../zencrm_entities/src/Entity/Profile.php | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/modules/zencrm_entities/config/install/views.view.persons.yml b/modules/zencrm_entities/config/install/views.view.persons.yml index 0f2a968..32067e7 100644 --- a/modules/zencrm_entities/config/install/views.view.persons.yml +++ b/modules/zencrm_entities/config/install/views.view.persons.yml @@ -1,5 +1,3 @@ -crm:~/drupal$ - 070f7a04-6bdc-4992-bc48-20803c6ef0f4 langcode: en status: true id: persons diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php index f6094fc..d58acb5 100644 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -224,9 +224,34 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface 'autocomplete_type' => 'tags', 'placeholder' => '', ], + ]); + + $fields['person'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Person')) + ->setDescription(t('The person this profile is of.')) + ->setSetting('target_type', 'person') + ->setSetting('handler', 'views') + ->setSetting('handler_settings', [ + 'view' => [ + 'view_name' => 'persons', + 'display_name' => 'entity_reference_1', + 'arguments' => [] + ] ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayOptions('view', [ + 'label' => 'above', + 'weight' => 0, + ]); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) From 3424e84588cfb6166879d9dadbd95b718eb0a5f7 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 11:14:12 +0200 Subject: [PATCH 11/94] Generated ContactDetails Entity and added Person field. --- .../taxonomy.vocabulary.contact_types.yml | 8 + .../zencrm_entities/contact_details.page.inc | 30 ++ .../ContactDetailsAccessControlHandler.php | 47 +++ .../src/ContactDetailsHtmlRouteProvider.php | 196 +++++++++++ .../src/ContactDetailsListBuilder.php | 40 +++ .../src/ContactDetailsStorage.php | 58 ++++ .../src/ContactDetailsStorageInterface.php | 61 ++++ .../src/ContactDetailsTranslationHandler.php | 14 + .../Controller/ContactDetailsController.php | 163 ++++++++++ .../src/Entity/ContactDetails.php | 304 ++++++++++++++++++ .../src/Entity/ContactDetailsInterface.php | 116 +++++++ .../src/Entity/ContactDetailsViewsData.php | 24 ++ .../src/Form/ContactDetailsDeleteForm.php | 15 + .../src/Form/ContactDetailsForm.php | 71 ++++ .../Form/ContactDetailsRevisionDeleteForm.php | 123 +++++++ .../Form/ContactDetailsRevisionRevertForm.php | 149 +++++++++ ...ctDetailsRevisionRevertTranslationForm.php | 115 +++++++ .../src/Form/ContactDetailsSettingsForm.php | 53 +++ .../templates/contact_details.html.twig | 22 ++ .../zencrm_entities.links.action.yml | 5 + .../zencrm_entities.links.menu.yml | 14 + .../zencrm_entities.links.task.yml | 27 ++ .../zencrm_entities.permissions.yml | 30 ++ 23 files changed, 1685 insertions(+) create mode 100644 modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml create mode 100644 modules/zencrm_entities/contact_details.page.inc create mode 100644 modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/ContactDetailsListBuilder.php create mode 100644 modules/zencrm_entities/src/ContactDetailsStorage.php create mode 100644 modules/zencrm_entities/src/ContactDetailsStorageInterface.php create mode 100644 modules/zencrm_entities/src/ContactDetailsTranslationHandler.php create mode 100644 modules/zencrm_entities/src/Controller/ContactDetailsController.php create mode 100644 modules/zencrm_entities/src/Entity/ContactDetails.php create mode 100644 modules/zencrm_entities/src/Entity/ContactDetailsInterface.php create mode 100644 modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsForm.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php create mode 100644 modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php create mode 100644 modules/zencrm_entities/templates/contact_details.html.twig diff --git a/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml b/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml new file mode 100644 index 0000000..ec2ce9f --- /dev/null +++ b/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml @@ -0,0 +1,8 @@ +langcode: en +status: true +dependencies: { } +name: 'Contact Types' +vid: contact_types +description: '' +hierarchy: 0 +weight: 0 diff --git a/modules/zencrm_entities/contact_details.page.inc b/modules/zencrm_entities/contact_details.page.inc new file mode 100644 index 0000000..4924125 --- /dev/null +++ b/modules/zencrm_entities/contact_details.page.inc @@ -0,0 +1,30 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished contact details entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published contact details entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit contact details entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete contact details entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add contact details entities'); + } + +} diff --git a/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php b/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php new file mode 100644 index 0000000..55e0d14 --- /dev/null +++ b/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php @@ -0,0 +1,196 @@ +id(); + + if ($history_route = $this->getHistoryRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.version_history", $history_route); + } + + if ($revision_route = $this->getRevisionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision", $revision_route); + } + + if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); + } + + if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); + } + + if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { + $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the version history route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getHistoryRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('version-history')) { + $route = new Route($entity_type->getLinkTemplate('version-history')); + $route + ->setDefaults([ + '_title' => "{$entity_type->getLabel()} revisions", + '_controller' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionOverview', + ]) + ->setRequirement('_permission', 'access contact details revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision')) { + $route = new Route($entity_type->getLinkTemplate('revision')); + $route + ->setDefaults([ + '_controller' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionShow', + '_title_callback' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionPageTitle', + ]) + ->setRequirement('_permission', 'access contact details revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_revert')) { + $route = new Route($entity_type->getLinkTemplate('revision_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionRevertForm', + '_title' => 'Revert to earlier revision', + ]) + ->setRequirement('_permission', 'revert all contact details revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision delete route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('revision_delete')) { + $route = new Route($entity_type->getLinkTemplate('revision_delete')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionDeleteForm', + '_title' => 'Delete earlier revision', + ]) + ->setRequirement('_permission', 'delete all contact details revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the revision translation revert route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('translation_revert')) { + $route = new Route($entity_type->getLinkTemplate('translation_revert')); + $route + ->setDefaults([ + '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionRevertTranslationForm', + '_title' => 'Revert to earlier revision of a translation', + ]) + ->setRequirement('_permission', 'revert all contact details revisions') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\ContactDetailsSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/ContactDetailsListBuilder.php b/modules/zencrm_entities/src/ContactDetailsListBuilder.php new file mode 100644 index 0000000..0ede242 --- /dev/null +++ b/modules/zencrm_entities/src/ContactDetailsListBuilder.php @@ -0,0 +1,40 @@ +t('Contact Details ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\ContactDetails */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.contact_details.edit_form', + ['contact_details' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/ContactDetailsStorage.php b/modules/zencrm_entities/src/ContactDetailsStorage.php new file mode 100644 index 0000000..b2613f0 --- /dev/null +++ b/modules/zencrm_entities/src/ContactDetailsStorage.php @@ -0,0 +1,58 @@ +database->query( + 'SELECT vid FROM {contact_details_revision} WHERE id=:id ORDER BY vid', + [':id' => $entity->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function userRevisionIds(AccountInterface $account) { + return $this->database->query( + 'SELECT vid FROM {contact_details_field_revision} WHERE uid = :uid ORDER BY vid', + [':uid' => $account->id()] + )->fetchCol(); + } + + /** + * {@inheritdoc} + */ + public function countDefaultLanguageRevisions(ContactDetailsInterface $entity) { + return $this->database->query('SELECT COUNT(*) FROM {contact_details_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) + ->fetchField(); + } + + /** + * {@inheritdoc} + */ + public function clearRevisionsLanguage(LanguageInterface $language) { + return $this->database->update('contact_details_revision') + ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) + ->condition('langcode', $language->getId()) + ->execute(); + } + +} diff --git a/modules/zencrm_entities/src/ContactDetailsStorageInterface.php b/modules/zencrm_entities/src/ContactDetailsStorageInterface.php new file mode 100644 index 0000000..01709f0 --- /dev/null +++ b/modules/zencrm_entities/src/ContactDetailsStorageInterface.php @@ -0,0 +1,61 @@ +entityManager()->getStorage('contact_details')->loadRevision($contact_details_revision); + $view_builder = $this->entityManager()->getViewBuilder('contact_details'); + + return $view_builder->view($contact_details); + } + + /** + * Page title callback for a Contact Details revision. + * + * @param int $contact_details_revision + * The Contact Details revision ID. + * + * @return string + * The page title. + */ + public function revisionPageTitle($contact_details_revision) { + $contact_details = $this->entityManager()->getStorage('contact_details')->loadRevision($contact_details_revision); + return $this->t('Revision of %title from %date', ['%title' => $contact_details->label(), '%date' => format_date($contact_details->getRevisionCreationTime())]); + } + + /** + * Generates an overview table of older revisions of a Contact Details . + * + * @param \Drupal\zencrm_entities\Entity\ContactDetailsInterface $contact_details + * A Contact Details object. + * + * @return array + * An array as expected by drupal_render(). + */ + public function revisionOverview(ContactDetailsInterface $contact_details) { + $account = $this->currentUser(); + $langcode = $contact_details->language()->getId(); + $langname = $contact_details->language()->getName(); + $languages = $contact_details->getTranslationLanguages(); + $has_translations = (count($languages) > 1); + $contact_details_storage = $this->entityManager()->getStorage('contact_details'); + + $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $contact_details->label()]) : $this->t('Revisions for %title', ['%title' => $contact_details->label()]); + $header = [$this->t('Revision'), $this->t('Operations')]; + + $revert_permission = (($account->hasPermission("revert all contact details revisions") || $account->hasPermission('administer contact details entities'))); + $delete_permission = (($account->hasPermission("delete all contact details revisions") || $account->hasPermission('administer contact details entities'))); + + $rows = []; + + $vids = $contact_details_storage->revisionIds($contact_details); + + $latest_revision = TRUE; + + foreach (array_reverse($vids) as $vid) { + /** @var \Drupal\zencrm_entities\ContactDetailsInterface $revision */ + $revision = $contact_details_storage->loadRevision($vid); + // Only show revisions that are affected by the language that is being + // displayed. + if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { + $username = [ + '#theme' => 'username', + '#account' => $revision->getRevisionUser(), + ]; + + // Use revision link to link to revisions that are not active. + $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); + if ($vid != $contact_details->getRevisionId()) { + $link = $this->l($date, new Url('entity.contact_details.revision', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid])); + } + else { + $link = $contact_details->link($date); + } + + $row = []; + $column = [ + 'data' => [ + '#type' => 'inline_template', + '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', + '#context' => [ + 'date' => $link, + 'username' => \Drupal::service('renderer')->renderPlain($username), + 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], + ], + ], + ]; + $row[] = $column; + + if ($latest_revision) { + $row[] = [ + 'data' => [ + '#prefix' => '', + '#markup' => $this->t('Current revision'), + '#suffix' => '', + ], + ]; + foreach ($row as &$current) { + $current['class'] = ['revision-current']; + } + $latest_revision = FALSE; + } + else { + $links = []; + if ($revert_permission) { + $links['revert'] = [ + 'title' => $this->t('Revert'), + 'url' => $has_translations ? + Url::fromRoute('entity.contact_details.translation_revert', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid, 'langcode' => $langcode]) : + Url::fromRoute('entity.contact_details.revision_revert', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid]), + ]; + } + + if ($delete_permission) { + $links['delete'] = [ + 'title' => $this->t('Delete'), + 'url' => Url::fromRoute('entity.contact_details.revision_delete', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid]), + ]; + } + + $row[] = [ + 'data' => [ + '#type' => 'operations', + '#links' => $links, + ], + ]; + } + + $rows[] = $row; + } + } + + $build['contact_details_revisions_table'] = [ + '#theme' => 'table', + '#rows' => $rows, + '#header' => $header, + ]; + + return $build; + } + +} diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php new file mode 100644 index 0000000..caa42db --- /dev/null +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -0,0 +1,304 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + protected function urlRouteParameters($rel) { + $uri_route_parameters = parent::urlRouteParameters($rel); + + if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { + $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); + } + + return $uri_route_parameters; + } + + /** + * {@inheritdoc} + */ + public function preSave(EntityStorageInterface $storage) { + parent::preSave($storage); + + foreach (array_keys($this->getTranslationLanguages()) as $langcode) { + $translation = $this->getTranslation($langcode); + + // If no owner has been set explicitly, make the anonymous user the owner. + if (!$translation->getOwner()) { + $translation->setOwnerId(0); + } + } + + // If no revision author has been set explicitly, make the contact_details owner the + // revision author. + if (!$this->getRevisionUser()) { + $this->setRevisionUserId($this->getOwnerId()); + } + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Contact Details entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', [ + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['person'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Person')) + ->setDescription(t('The person this profile is of.')) + ->setSetting('target_type', 'person') + ->setSetting('handler', 'views') + ->setSetting('handler_settings', [ + 'view' => [ + 'view_name' => 'persons', + 'display_name' => 'entity_reference_1', + 'arguments' => [] + ] + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayOptions('view', [ + 'label' => 'above', + 'weight' => 0, + ]); + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Contact Details entity.')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Contact Details is published.')) + ->setRevisionable(TRUE) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Revision translation affected')) + ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) + ->setReadOnly(TRUE) + ->setRevisionable(TRUE) + ->setTranslatable(TRUE); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php b/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php new file mode 100644 index 0000000..583ef18 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php @@ -0,0 +1,116 @@ +entity->isNew()) { + $form['new_revision'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Create new revision'), + '#default_value' => FALSE, + '#weight' => 10, + ]; + } + + $entity = $this->entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + // Save as a new revision if requested to do so. + if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { + $entity->setNewRevision(); + + // If a new revision is created, save the current user as revision author. + $entity->setRevisionCreationTime(REQUEST_TIME); + $entity->setRevisionUserId(\Drupal::currentUser()->id()); + } + else { + $entity->setNewRevision(FALSE); + } + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Contact Details.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Contact Details.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.contact_details.canonical', ['contact_details' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php new file mode 100644 index 0000000..4aa9dae --- /dev/null +++ b/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php @@ -0,0 +1,123 @@ +ContactDetailsStorage = $entity_storage; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + $entity_manager = $container->get('entity.manager'); + return new static( + $entity_manager->getStorage('contact_details'), + $container->get('database') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'contact_details_revision_delete_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.contact_details.version_history', ['contact_details' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL) { + $this->revision = $this->ContactDetailsStorage->loadRevision($contact_details_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->ContactDetailsStorage->deleteRevision($this->revision->getRevisionId()); + + $this->logger('content')->notice('Contact Details: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Revision from %revision-date of Contact Details %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + $form_state->setRedirect( + 'entity.contact_details.canonical', + ['contact_details' => $this->revision->id()] + ); + if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {contact_details_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { + $form_state->setRedirect( + 'entity.contact_details.version_history', + ['contact_details' => $this->revision->id()] + ); + } + } + +} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php new file mode 100644 index 0000000..6063050 --- /dev/null +++ b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php @@ -0,0 +1,149 @@ +ContactDetailsStorage = $entity_storage; + $this->dateFormatter = $date_formatter; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('contact_details'), + $container->get('date.formatter') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'contact_details_revision_revert_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.contact_details.version_history', ['contact_details' => $this->revision->id()]); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return t('Revert'); + } + + /** + * {@inheritdoc} + */ + public function getDescription() { + return ''; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL) { + $this->revision = $this->ContactDetailsStorage->loadRevision($contact_details_revision); + $form = parent::buildForm($form, $form_state); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + // The revision timestamp will be updated when the revision is saved. Keep + // the original one for the confirmation message. + $original_revision_timestamp = $this->revision->getRevisionCreationTime(); + + $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); + $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); + $this->revision->save(); + + $this->logger('content')->notice('Contact Details: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Contact Details %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); + $form_state->setRedirect( + 'entity.contact_details.version_history', + ['contact_details' => $this->revision->id()] + ); + } + + /** + * Prepares a revision to be reverted. + * + * @param \Drupal\zencrm_entities\Entity\ContactDetailsInterface $revision + * The revision to be reverted. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + * + * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface + * The prepared revision ready to be stored. + */ + protected function prepareRevertedRevision(ContactDetailsInterface $revision, FormStateInterface $form_state) { + $revision->setNewRevision(); + $revision->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $revision; + } + +} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php new file mode 100644 index 0000000..2bcc6ff --- /dev/null +++ b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php @@ -0,0 +1,115 @@ +languageManager = $language_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('entity.manager')->getStorage('contact_details'), + $container->get('date.formatter'), + $container->get('language_manager') + ); + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'contact_details_revision_revert_translation_confirm'; + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL, $langcode = NULL) { + $this->langcode = $langcode; + $form = parent::buildForm($form, $form_state, $contact_details_revision); + + $form['revert_untranslated_fields'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Revert content shared among translations'), + '#default_value' => FALSE, + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + protected function prepareRevertedRevision(ContactDetailsInterface $revision, FormStateInterface $form_state) { + $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); + + /** @var \Drupal\zencrm_entities\Entity\ContactDetailsInterface $default_revision */ + $latest_revision = $this->ContactDetailsStorage->load($revision->id()); + $latest_revision_translation = $latest_revision->getTranslation($this->langcode); + + $revision_translation = $revision->getTranslation($this->langcode); + + foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { + if ($definition->isTranslatable() || $revert_untranslated_fields) { + $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); + } + } + + $latest_revision_translation->setNewRevision(); + $latest_revision_translation->isDefaultRevision(TRUE); + $revision->setRevisionCreationTime(REQUEST_TIME); + + return $latest_revision_translation; + } + +} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php b/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php new file mode 100644 index 0000000..315d7b5 --- /dev/null +++ b/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php @@ -0,0 +1,53 @@ + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index 142652b..a4527ce 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -14,3 +14,8 @@ entity.profile_type.add_form: appears_on: - entity.profile_type.collection +entity.contact_details.add_form: + route_name: entity.contact_details.add_form + title: 'Add Contact Details' + appears_on: + - entity.contact_details.collection diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index c3f4d63..87ab050 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -30,3 +30,17 @@ entity.profile_type.collection: parent: system.admin_structure weight: 99 + +# Contact Details menu items definition +entity.contact_details.collection: + title: 'Contact Details list' + route_name: entity.contact_details.collection + description: 'List Contact Details entities' + parent: system.admin_structure + weight: 100 + +contact_details.admin.structure.settings: + title: 'Contact Details settings' + description: 'Configure Contact Details entities' + route_name: contact_details.settings + parent: system.admin_structure diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index 6ce894f..601e202 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -48,3 +48,30 @@ entity.profile.delete_form: title: Delete weight: 10 +# Contact Details routing definition +contact_details.settings_tab: + route_name: contact_details.settings + title: 'Settings' + base_route: contact_details.settings + +entity.contact_details.canonical: + route_name: entity.contact_details.canonical + base_route: entity.contact_details.canonical + title: 'View' + +entity.contact_details.edit_form: + route_name: entity.contact_details.edit_form + base_route: entity.contact_details.canonical + title: 'Edit' + +entity.contact_details.version_history: + route_name: entity.contact_details.version_history + base_route: entity.contact_details.canonical + title: 'Revisions' + +entity.contact_details.delete_form: + route_name: entity.contact_details.delete_form + base_route: entity.contact_details.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 5e56d93..363d994 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -58,3 +58,33 @@ revert all profile revisions: delete all profile revisions: title: 'Delete all revisions' description: 'Role requires permission to view Profile revisions and delete rights for profile entities in question or administer profile entities.' +add contact details entities: + title: 'Create new Contact Details entities' + +administer contact details entities: + title: 'Administer Contact Details entities' + description: 'Allow to access the administration form to configure Contact Details entities.' + restrict access: true + +delete contact details entities: + title: 'Delete Contact Details entities' + +edit contact details entities: + title: 'Edit Contact Details entities' + +view published contact details entities: + title: 'View published Contact Details entities' + +view unpublished contact details entities: + title: 'View unpublished Contact Details entities' + +view all contact details revisions: + title: 'View all Contact Details revisions' + +revert all contact details revisions: + title: 'Revert all Contact Details revisions' + description: 'Role requires permission view Contact Details revisions and edit rights for contact details entities in question or administer contact details entities.' + +delete all contact details revisions: + title: 'Delete all revisions' + description: 'Role requires permission to view Contact Details revisions and delete rights for contact details entities in question or administer contact details entities.' From 54f9366fff556b408bdce14cbd711334f864048b Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 13:05:05 +0200 Subject: [PATCH 12/94] Added "label" taxonomy term field to Contact Details entity type. --- .../src/Entity/ContactDetails.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index caa42db..119fb76 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -224,6 +224,37 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); + + $fields['label'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Label')) + ->setDescription(t('E.g. Home, Business, Temporary')) + ->setSetting('handler', 'default:taxonomy_term') + ->setSetting('target_type', 'taxonomy_term') + ->setSetting('handler_settings', [ + 'target_bundles' => [ + 'tags' => 'tags', + ], + 'auto_create' => 'true' + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'placeholder' => '', + ], + ]) + ->setDisplayOptions('view', [ + 'settings' => ['link' => 'false'], + 'type' => 'entity_reference_label', + 'label' => 'above', + 'weight' => 0, + ]) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['person'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Person')) ->setDescription(t('The person this profile is of.')) From 599ee239ffce460f54abbec3a8e9df4f72682ca8 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 13:43:25 +0200 Subject: [PATCH 13/94] In process with Contact Details type field. --- .../zencrm_entities/src/Entity/ContactDetails.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 119fb76..b9680fc 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -224,15 +224,16 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - - $fields['label'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Label')) + // This field is not displayed but is used to compute the name of the entity. + // See zencrm_entities.module - zencrm_entities_contact_details_presave(). + $fields['type'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Type')) ->setDescription(t('E.g. Home, Business, Temporary')) ->setSetting('handler', 'default:taxonomy_term') ->setSetting('target_type', 'taxonomy_term') ->setSetting('handler_settings', [ 'target_bundles' => [ - 'tags' => 'tags', + 'contact_details_types' => 'contact_details_types', ], 'auto_create' => 'true' ]) @@ -290,7 +291,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'max_length' => 50, 'text_processing' => 0, ]) - ->setDefaultValue('') ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'string', @@ -299,10 +299,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) - ->setRequired(TRUE); + ]); $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) From 190a90a4dbc493797efd40474e37bedcea8e1b95 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 13:58:46 +0200 Subject: [PATCH 14/94] Set label of Contact Details entity to its type Also made some trivial changes --- .../src/Entity/ContactDetails.php | 43 ++++--------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index b9680fc..c075e42 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -45,7 +45,7 @@ use Drupal\user\UserInterface; * entity_keys = { * "id" = "id", * "revision" = "vid", - * "label" = "name", + * "label" = "type", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", @@ -171,6 +171,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet } /** + ->setDisplayConfigurable('view', TRUE); * {@inheritdoc} */ public function setOwner(UserInterface $account) { @@ -207,9 +208,9 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setSetting('handler', 'default') ->setTranslatable(TRUE) ->setDisplayOptions('view', [ - 'label' => 'hidden', + 'label' => 'inline', 'type' => 'author', - 'weight' => 0, + 'weight' => 100, ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', @@ -220,12 +221,8 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'autocomplete_type' => 'tags', 'placeholder' => '', ], - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + ]); - // This field is not displayed but is used to compute the name of the entity. - // See zencrm_entities.module - zencrm_entities_contact_details_presave(). $fields['type'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Type')) ->setDescription(t('E.g. Home, Business, Temporary')) @@ -249,10 +246,9 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayOptions('view', [ 'settings' => ['link' => 'false'], 'type' => 'entity_reference_label', - 'label' => 'above', + 'label' => 'hidden', 'weight' => 0, ]) - ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); @@ -278,32 +274,11 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'placeholder' => '', ], ]) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'weight' => 0, - ]); - - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the Contact Details entity.')) - ->setRevisionable(TRUE) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]); + ->setRequired(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Contact Details is published.')) + ->setLabel(t('Enabled')) + ->setDescription(t('If this is ticked then this set of contact details is active.')) ->setRevisionable(TRUE) ->setDefaultValue(TRUE) ->setDisplayOptions('form', [ From 0ecdf1247c36d7811cdf03b60d977c6a5bd76400 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 14:12:29 +0200 Subject: [PATCH 15/94] Removed published/enabled checkbox till decide what to do with that. Also placed author on forms and views --- .../src/Entity/ContactDetails.php | 10 ++++---- modules/zencrm_entities/src/Entity/Person.php | 25 +++++++++++++++---- .../zencrm_entities/src/Entity/Profile.php | 14 +++++------ 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index c075e42..d3d2072 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -280,11 +280,11 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setLabel(t('Enabled')) ->setDescription(t('If this is ticked then this set of contact details is active.')) ->setRevisionable(TRUE) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 55d6236..90b6b3f 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -191,6 +191,21 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayOptions('view', [ + 'label' => 'inline', + 'type' => 'author', + 'weight' => 100, + ]) ->setTranslatable(TRUE); $fields['full_name'] = BaseFieldDefinition::create('string') @@ -272,11 +287,11 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setLabel(t('Enabled')) ->setDescription(t('If this is ticked, the record is active')) ->setRevisionable(TRUE) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php index d58acb5..1c12222 100644 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -211,9 +211,9 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface ->setSetting('handler', 'default') ->setTranslatable(TRUE) ->setDisplayOptions('view', [ - 'label' => 'hidden', + 'label' => 'inline', 'type' => 'author', - 'weight' => 0, + 'weight' => 100, ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', @@ -279,11 +279,11 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface ->setLabel(t('Publishing status')) ->setDescription(t('A boolean indicating whether the Profile is published.')) ->setRevisionable(TRUE) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) From 4a49cfecfb394c9f7485aa256e5375315c768d16 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 14:19:48 +0200 Subject: [PATCH 16/94] Added contact_details_types vocab and removed previous draft of it --- .../install/taxonomy.vocabulary.contact_details_types.yml | 8 ++++++++ .../config/optional/taxonomy.vocabulary.contact_types.yml | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml delete mode 100644 modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml diff --git a/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml b/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml new file mode 100644 index 0000000..fcdb838 --- /dev/null +++ b/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml @@ -0,0 +1,8 @@ +langcode: en +status: true +dependencies: { } +name: 'Contact Details Types' +vid: contact_details_types +description: 'E.g. "Home", "Business"' +hierarchy: 0 +weight: 0 diff --git a/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml b/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml deleted file mode 100644 index ec2ce9f..0000000 --- a/modules/zencrm_entities/config/optional/taxonomy.vocabulary.contact_types.yml +++ /dev/null @@ -1,8 +0,0 @@ -langcode: en -status: true -dependencies: { } -name: 'Contact Types' -vid: contact_types -description: '' -hierarchy: 0 -weight: 0 From 3128d0cabf4c0fb2e235d6dd73ef8632fb30064a Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 15:34:03 +0200 Subject: [PATCH 17/94] Profile labels now read "First Name Last Name - Profile Type" --- modules/zencrm_entities/src/Entity/Person.php | 2 ++ .../zencrm_entities/src/Entity/Profile.php | 22 +++---------------- .../zencrm_entities/zencrm_entities.module | 14 ++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 90b6b3f..63c0e96 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -208,11 +208,13 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ]) ->setTranslatable(TRUE); + // This field is computed in a presave hook. $fields['full_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Full Name')) ->setDescription(t('The full name of the person.')) ->setRevisionable(TRUE); + // This field is computed in a presave hook. $fields['first_and_last_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First and Last Name')) ->setDescription(t('The first and last name of the person. Used for searching and autocomplete')) diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php index 1c12222..813d9ed 100644 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -253,27 +253,11 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface 'weight' => 0, ]); + // This field is computed in a presave hook. $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) - ->setDescription(t('The name of the Profile entity.')) - ->setRevisionable(TRUE) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) - ->setRequired(TRUE); + ->setDescription(t('The name of this profile instance.')) + ->setRevisionable(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 78eda19..c847905 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -26,6 +26,20 @@ function zencrm_entities_person_presave($entity) { } +/** + * Implements hook_ENTITY_TYPE_presave(). + * Computes the name field from the full name of the referenced person + * plus the profile type. + */ +function zencrm_entities_profile_presave($entity) { + $person_id = $entity->person->first()->getValue()['target_id']; + $person = \Drupal\zencrm_entities\Entity\Person::load($person_id); + $full_name = $person->full_name->getString(); + $bundle_name = $entity->type->entity->label(); + $entity->set('name', $full_name . ' - ' . $bundle_name); +} + + /** * Implements hook_help(). */ From b629a13ec88ffee9c346f3c7deb44e02ec89cc21 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 16:14:40 +0200 Subject: [PATCH 18/94] Added address, phone and email to contact details. --- .../src/Entity/ContactDetails.php | 92 ++++++++++++++++++- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index d3d2072..700244a 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -214,7 +214,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', - 'weight' => 5, + 'weight' => 100, 'settings' => [ 'match_operator' => 'CONTAINS', 'size' => '60', @@ -236,7 +236,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', - 'weight' => 5, + 'weight' => 0, 'settings' => [ 'match_operator' => 'CONTAINS', 'size' => '60', @@ -266,7 +266,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', - 'weight' => 5, + 'weight' => 1, 'settings' => [ 'match_operator' => 'CONTAINS', 'size' => '60', @@ -276,6 +276,92 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ]) ->setRequired(TRUE); + $fields['phone'] = BaseFieldDefinition::create('string') + ->setLabel(t('Main Phone Number')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 2, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 2, + )); + + $fields['phone2'] = BaseFieldDefinition::create('string') + ->setLabel(t('Alternative Phone Number')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 3, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 3, + )); + + $fields['email'] = BaseFieldDefinition::create('string') + ->setLabel(t('Email Address')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 30, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 4, + )); + + $fields['postal_address'] = BaseFieldDefinition::create('string_long') + ->setLabel(t('Postal Address')) + ->setDescription(t('Full address, apart from post code.')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 255, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'text', + 'weight' => 5, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textarea', + 'weight' => 5, + )); + + $fields['post_code'] = BaseFieldDefinition::create('string') + ->setLabel(t('Post Code')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 10, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 6, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 6, + )); + $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Enabled')) ->setDescription(t('If this is ticked then this set of contact details is active.')) From f764ed56703904e48e0f18c192ffb41a4db36cf9 Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 10 Apr 2018 13:02:51 +0200 Subject: [PATCH 19/94] Added search module with database server, Person index and view --- .../install/search_api.index.person_index.yml | 34 +++ .../search_api.server.zencrm_server.yml | 16 ++ .../install/views.view.person_search.yml | 230 ++++++++++++++++++ .../templates/zen-crm-search.html.twig | 1 + .../tests/src/Functional/LoadTest.php | 46 ++++ modules/zencrm_search/zencrm_search.info.yml | 9 + modules/zencrm_search/zencrm_search.module | 35 +++ 7 files changed, 371 insertions(+) create mode 100644 modules/zencrm_search/config/install/search_api.index.person_index.yml create mode 100644 modules/zencrm_search/config/install/search_api.server.zencrm_server.yml create mode 100644 modules/zencrm_search/config/install/views.view.person_search.yml create mode 100644 modules/zencrm_search/templates/zen-crm-search.html.twig create mode 100644 modules/zencrm_search/tests/src/Functional/LoadTest.php create mode 100644 modules/zencrm_search/zencrm_search.info.yml create mode 100644 modules/zencrm_search/zencrm_search.module diff --git a/modules/zencrm_search/config/install/search_api.index.person_index.yml b/modules/zencrm_search/config/install/search_api.index.person_index.yml new file mode 100644 index 0000000..2844bd3 --- /dev/null +++ b/modules/zencrm_search/config/install/search_api.index.person_index.yml @@ -0,0 +1,34 @@ +langcode: en +status: true +dependencies: + config: + - search_api.server.zencrm_server + module: + - search_api + - zencrm_entities +id: person_index +name: 'Person Index' +description: '' +read_only: false +field_settings: + full_name: + label: 'Full Name' + datasource_id: 'entity:person' + property_path: full_name + type: text +datasource_settings: + 'entity:person': + languages: + default: true + selected: { } +processor_settings: + rendered_item: { } + aggregated_field: { } + add_url: { } +tracker_settings: + default: + indexing_order: fifo +options: + index_directly: true + cron_limit: 50 +server: zencrm_server diff --git a/modules/zencrm_search/config/install/search_api.server.zencrm_server.yml b/modules/zencrm_search/config/install/search_api.server.zencrm_server.yml new file mode 100644 index 0000000..e61f3e6 --- /dev/null +++ b/modules/zencrm_search/config/install/search_api.server.zencrm_server.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - search_api_db +id: zencrm_server +name: 'Zen CRM Server' +description: '' +backend: search_api_db +backend_config: + database: 'default:default' + min_chars: 3 + partial_matches: false + autocomplete: + suggest_suffix: true + suggest_words: true diff --git a/modules/zencrm_search/config/install/views.view.person_search.yml b/modules/zencrm_search/config/install/views.view.person_search.yml new file mode 100644 index 0000000..3a30696 --- /dev/null +++ b/modules/zencrm_search/config/install/views.view.person_search.yml @@ -0,0 +1,230 @@ +langcode: en +status: true +dependencies: + config: + - search_api.index.person_index + module: + - search_api +id: person_search +label: 'Person Search' +module: views +description: '' +tag: '' +base_table: search_api_index_person_index +base_field: search_api_id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + bypass_access: false + skip_access: false + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 20 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: ‹‹ + next: ›› + style: + type: default + row: + type: fields + fields: + full_name: + id: full_name + table: search_api_index_person_index + field: full_name + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + entity_type: null + entity_field: null + plugin_id: search_api_field + filters: + search_api_fulltext: + id: search_api_fulltext + table: search_api_index_person_index + field: search_api_fulltext + relationship: none + group_type: group + admin_label: '' + operator: or + value: '' + group: 1 + exposed: true + expose: + operator_id: search_api_fulltext_op + label: 'Search for People' + description: '' + use_operator: false + operator: search_api_fulltext_op + identifier: search_api_fulltext + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + standard_user: '0' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + parse_mode: terms + min_length: null + fields: { } + plugin_id: search_api_fulltext + sorts: { } + title: 'Person Search' + header: { } + footer: { } + empty: { } + relationships: { } + arguments: { } + display_extenders: { } + use_ajax: true + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + tags: { } + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 2 + display_options: + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + display_extenders: { } + path: person-search + exposed_block: true + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + tags: { } diff --git a/modules/zencrm_search/templates/zen-crm-search.html.twig b/modules/zencrm_search/templates/zen-crm-search.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/zencrm_search/templates/zen-crm-search.html.twig @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/zencrm_search/tests/src/Functional/LoadTest.php b/modules/zencrm_search/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..ca6137b --- /dev/null +++ b/modules/zencrm_search/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +user = $this->drupalCreateUser(['administer site configuration']); + $this->drupalLogin($this->user); + } + + /** + * Tests that the home page loads with a 200 response. + */ + public function testLoad() { + $this->drupalGet(Url::fromRoute('')); + $this->assertSession()->statusCodeEquals(200); + } + +} diff --git a/modules/zencrm_search/zencrm_search.info.yml b/modules/zencrm_search/zencrm_search.info.yml new file mode 100644 index 0000000..c7c650c --- /dev/null +++ b/modules/zencrm_search/zencrm_search.info.yml @@ -0,0 +1,9 @@ +name: 'Zen CRM Search' +type: module +description: 'Provides search functionality for Zen CRM' +core: 8.x +package: 'Zen CRM' +dependencies: + - zencrm_entities + - search_api + - search_api_db diff --git a/modules/zencrm_search/zencrm_search.module b/modules/zencrm_search/zencrm_search.module new file mode 100644 index 0000000..382110b --- /dev/null +++ b/modules/zencrm_search/zencrm_search.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '

' . t('Provides search functionality for Zen CRM') . '

'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function zencrm_search_theme() { + return [ + 'zencrm_search' => [ + 'render element' => 'children', + ], + ]; +} From 0e0b31cfcd8d54368c5b9d83493e568107efe77c Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 10 Apr 2018 17:19:03 +0200 Subject: [PATCH 20/94] Added custom block for creating profiles against a person. It renders a link for each available profile type and they open in a popup which has a route and a controller. --- src/Controller/ProfileController.php | 34 +++++++++++++++++++++ src/Plugin/Block/ProfileCreator.php | 44 ++++++++++++++++++++++++++++ zencrm.routing.yml | 7 +++++ 3 files changed, 85 insertions(+) create mode 100644 src/Controller/ProfileController.php create mode 100644 src/Plugin/Block/ProfileCreator.php create mode 100644 zencrm.routing.yml diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php new file mode 100644 index 0000000..82661e4 --- /dev/null +++ b/src/Controller/ProfileController.php @@ -0,0 +1,34 @@ + $type, + 'person' => $person_id + ); + + $node = \Drupal::entityTypeManager() + ->getStorage('profile') + ->create($values); + + $form = \Drupal::entityTypeManager() + ->getFormObject('profile', 'default') + ->setEntity($node); + return \Drupal::formBuilder()->getForm($form); + } + +} diff --git a/src/Plugin/Block/ProfileCreator.php b/src/Plugin/Block/ProfileCreator.php new file mode 100644 index 0000000..b6d11ef --- /dev/null +++ b/src/Plugin/Block/ProfileCreator.php @@ -0,0 +1,44 @@ +getParameter('person')->id(); + $markup = ""; + + // Only offer profile creation on profiles they don't already have. + $profile_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('profile'); + foreach($profile_types as $id => $type) { + $profiles = \Drupal::entityTypeManager() + ->getStorage('profile') + ->loadByProperties(['type' => $id, 'person' => $person_id]); + if (!reset($profiles)) { + $label = $type['label']; + $markup .= "

Create $label Profile

"; + } + } + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => "
$markup
" + ]; + + } + +} diff --git a/zencrm.routing.yml b/zencrm.routing.yml new file mode 100644 index 0000000..256f6be --- /dev/null +++ b/zencrm.routing.yml @@ -0,0 +1,7 @@ +zencrm.profile.create: + path: '/zencrm/profile/add/{type}/{person_id}' + defaults: + _controller: '\Drupal\zencrm\Controller\ProfileController::createProfileForPerson' + _title: 'Add New Profile' + requirements: + _permission: 'access content' From 20469e3aa74253c7a10f1bf8b27067dc7407c9aa Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 10 Apr 2018 17:26:16 +0200 Subject: [PATCH 21/94] Search is now case-insensitive. --- .../config/install/search_api.index.person_index.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/zencrm_search/config/install/search_api.index.person_index.yml b/modules/zencrm_search/config/install/search_api.index.person_index.yml index 2844bd3..65dc376 100644 --- a/modules/zencrm_search/config/install/search_api.index.person_index.yml +++ b/modules/zencrm_search/config/install/search_api.index.person_index.yml @@ -21,10 +21,18 @@ datasource_settings: languages: default: true selected: { } +processor_settings: processor_settings: rendered_item: { } aggregated_field: { } add_url: { } + ignorecase: + all_fields: true + fields: + - full_name + weights: + preprocess_index: -20 + preprocess_query: -20 tracker_settings: default: indexing_order: fifo From 3d8c7f6ca1e98b2584142fdb6e7072bb066920ad Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 10 Apr 2018 17:56:30 +0200 Subject: [PATCH 22/94] removed visibility of base fields in Profile --- .../zencrm_entities/src/Entity/Profile.php | 51 +++++-------------- 1 file changed, 12 insertions(+), 39 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php index 813d9ed..67ff931 100644 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -209,49 +209,22 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ - 'label' => 'inline', - 'type' => 'author', - 'weight' => 100, - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]); + ->setTranslatable(TRUE); + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 5, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]); $fields['person'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Person')) ->setDescription(t('The person this profile is of.')) - ->setSetting('target_type', 'person') - ->setSetting('handler', 'views') - ->setSetting('handler_settings', [ - 'view' => [ - 'view_name' => 'persons', - 'display_name' => 'entity_reference_1', - 'arguments' => [] - ] - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'weight' => 0, - ]); + ->setSetting('target_type', 'person'); // This field is computed in a presave hook. $fields['name'] = BaseFieldDefinition::create('string') From c47ce313b36f0c18bb65eb2ef5564588edee2719 Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 10 Apr 2018 18:09:25 +0200 Subject: [PATCH 23/94] Removed all fields from Person in default view mode --- modules/zencrm_entities/src/Entity/Person.php | 53 ++++++------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 63c0e96..0ea1f5f 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -191,21 +191,21 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setDisplayOptions('view', [ - 'label' => 'inline', - 'type' => 'author', - 'weight' => 100, - ]) +# ->setDisplayOptions('form', [ +# 'type' => 'entity_reference_autocomplete', +# 'weight' => 5, +# 'settings' => [ +# 'match_operator' => 'CONTAINS', +# 'size' => '60', +# 'autocomplete_type' => 'tags', +# 'placeholder' => '', +# ], +# ]) +# ->setDisplayOptions('view', [ +# 'label' => 'inline', +# 'type' => 'author', +# 'weight' => 100, +# ]) ->setTranslatable(TRUE); // This field is computed in a presave hook. @@ -228,18 +228,11 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { 'max_length' => 50, 'text_processing' => 0, ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, ]) ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); $fields['middle_names'] = BaseFieldDefinition::create('string') @@ -250,18 +243,11 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { 'max_length' => 50, 'text_processing' => 0, ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + ->setDisplayConfigurable('form', TRUE); $fields['last_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Last Name')) @@ -271,18 +257,11 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { 'max_length' => 50, 'text_processing' => 0, ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, ]) ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') From add15f2c6d90f67822df5e5986893cc32e207abb Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 10:44:29 +0200 Subject: [PATCH 24/94] removed all person stuff and rand update entiees --- .../src/Controller/PersonController.php | 163 ------------------ modules/zencrm_entities/src/Entity/Person.php | 126 ++++---------- .../src/Entity/PersonInterface.php | 60 +++---- .../zencrm_entities/src/Form/PersonForm.php | 21 --- .../src/Form/PersonRevisionDeleteForm.php | 123 ------------- .../src/Form/PersonRevisionRevertForm.php | 149 ---------------- .../PersonRevisionRevertTranslationForm.php | 115 ------------ .../src/PersonHtmlRouteProvider.php | 140 --------------- modules/zencrm_entities/src/PersonStorage.php | 58 ------- .../src/PersonStorageInterface.php | 61 ------- .../src/PersonTranslationHandler.php | 14 -- .../zencrm_entities.links.action.yml | 5 + .../zencrm_entities.links.menu.yml | 14 ++ .../zencrm_entities.links.task.yml | 22 +++ .../zencrm_entities.permissions.yml | 19 ++ 15 files changed, 117 insertions(+), 973 deletions(-) delete mode 100644 modules/zencrm_entities/src/Controller/PersonController.php delete mode 100644 modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php delete mode 100644 modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php delete mode 100644 modules/zencrm_entities/src/PersonStorage.php delete mode 100644 modules/zencrm_entities/src/PersonStorageInterface.php delete mode 100644 modules/zencrm_entities/src/PersonTranslationHandler.php diff --git a/modules/zencrm_entities/src/Controller/PersonController.php b/modules/zencrm_entities/src/Controller/PersonController.php deleted file mode 100644 index e5297c7..0000000 --- a/modules/zencrm_entities/src/Controller/PersonController.php +++ /dev/null @@ -1,163 +0,0 @@ -entityManager()->getStorage('person')->loadRevision($person_revision); - $view_builder = $this->entityManager()->getViewBuilder('person'); - - return $view_builder->view($person); - } - - /** - * Page title callback for a Person revision. - * - * @param int $person_revision - * The Person revision ID. - * - * @return string - * The page title. - */ - public function revisionPageTitle($person_revision) { - $person = $this->entityManager()->getStorage('person')->loadRevision($person_revision); - return $this->t('Revision of %title from %date', ['%title' => $person->label(), '%date' => format_date($person->getRevisionCreationTime())]); - } - - /** - * Generates an overview table of older revisions of a Person . - * - * @param \Drupal\zencrm_entities\Entity\PersonInterface $person - * A Person object. - * - * @return array - * An array as expected by drupal_render(). - */ - public function revisionOverview(PersonInterface $person) { - $account = $this->currentUser(); - $langcode = $person->language()->getId(); - $langname = $person->language()->getName(); - $languages = $person->getTranslationLanguages(); - $has_translations = (count($languages) > 1); - $person_storage = $this->entityManager()->getStorage('person'); - - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $person->label()]) : $this->t('Revisions for %title', ['%title' => $person->label()]); - $header = [$this->t('Revision'), $this->t('Operations')]; - - $revert_permission = (($account->hasPermission("revert all person revisions") || $account->hasPermission('administer person entities'))); - $delete_permission = (($account->hasPermission("delete all person revisions") || $account->hasPermission('administer person entities'))); - - $rows = []; - - $vids = $person_storage->revisionIds($person); - - $latest_revision = TRUE; - - foreach (array_reverse($vids) as $vid) { - /** @var \Drupal\zencrm_entities\PersonInterface $revision */ - $revision = $person_storage->loadRevision($vid); - // Only show revisions that are affected by the language that is being - // displayed. - if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { - $username = [ - '#theme' => 'username', - '#account' => $revision->getRevisionUser(), - ]; - - // Use revision link to link to revisions that are not active. - $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); - if ($vid != $person->getRevisionId()) { - $link = $this->l($date, new Url('entity.person.revision', ['person' => $person->id(), 'person_revision' => $vid])); - } - else { - $link = $person->link($date); - } - - $row = []; - $column = [ - 'data' => [ - '#type' => 'inline_template', - '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', - '#context' => [ - 'date' => $link, - 'username' => \Drupal::service('renderer')->renderPlain($username), - 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], - ], - ], - ]; - $row[] = $column; - - if ($latest_revision) { - $row[] = [ - 'data' => [ - '#prefix' => '', - '#markup' => $this->t('Current revision'), - '#suffix' => '', - ], - ]; - foreach ($row as &$current) { - $current['class'] = ['revision-current']; - } - $latest_revision = FALSE; - } - else { - $links = []; - if ($revert_permission) { - $links['revert'] = [ - 'title' => $this->t('Revert'), - 'url' => $has_translations ? - Url::fromRoute('entity.person.translation_revert', ['person' => $person->id(), 'person_revision' => $vid, 'langcode' => $langcode]) : - Url::fromRoute('entity.person.revision_revert', ['person' => $person->id(), 'person_revision' => $vid]), - ]; - } - - if ($delete_permission) { - $links['delete'] = [ - 'title' => $this->t('Delete'), - 'url' => Url::fromRoute('entity.person.revision_delete', ['person' => $person->id(), 'person_revision' => $vid]), - ]; - } - - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#links' => $links, - ], - ]; - } - - $rows[] = $row; - } - } - - $build['person_revisions_table'] = [ - '#theme' => 'table', - '#rows' => $rows, - '#header' => $header, - ]; - - return $build; - } - -} diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 0ea1f5f..239bf26 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -4,8 +4,7 @@ namespace Drupal\zencrm_entities\Entity; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\Core\Entity\RevisionableContentEntityBase; -use Drupal\Core\Entity\RevisionableInterface; +use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityChangedTrait; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\UserInterface; @@ -19,11 +18,9 @@ use Drupal\user\UserInterface; * id = "person", * label = @Translation("Person"), * handlers = { - * "storage" = "Drupal\zencrm_entities\PersonStorage", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "list_builder" = "Drupal\zencrm_entities\PersonListBuilder", * "views_data" = "Drupal\zencrm_entities\Entity\PersonViewsData", - * "translation" = "Drupal\zencrm_entities\PersonTranslationHandler", * * "form" = { * "default" = "Drupal\zencrm_entities\Form\PersonForm", @@ -37,36 +34,26 @@ use Drupal\user\UserInterface; * }, * }, * base_table = "person", - * data_table = "person_field_data", - * revision_table = "person_revision", - * revision_data_table = "person_field_revision", - * translatable = TRUE, * admin_permission = "administer person entities", * entity_keys = { * "id" = "id", - * "revision" = "vid", + * "label" = "full_name", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", * "status" = "status", - * "label" = "full_name", * }, * links = { - * "canonical" = "/zencrm/person/{person}", - * "add-form" = "/zencrm/person/add", - * "edit-form" = "/zencrm/person/{person}/edit", - * "delete-form" = "/zencrm/person/{person}/delete", - * "version-history" = "/zencrm/person/{person}/revisions", - * "revision" = "/zencrm/person/{person}/revisions/{person_revision}/view", - * "revision_revert" = "/zencrm/person/{person}/revisions/{person_revision}/revert", - * "revision_delete" = "/zencrm/person/{person}/revisions/{person_revision}/delete", - * "translation_revert" = "/zencrm/person/{person}/revisions/{person_revision}/revert/{langcode}", - * "collection" = "/zencrm/person", + * "canonical" = "/admin/structure/person/{person}", + * "add-form" = "/admin/structure/person/add", + * "edit-form" = "/admin/structure/person/{person}/edit", + * "delete-form" = "/admin/structure/person/{person}/delete", + * "collection" = "/admin/structure/person", * }, * field_ui_base_route = "person.settings" * ) */ -class Person extends RevisionableContentEntityBase implements PersonInterface { +class Person extends ContentEntityBase implements PersonInterface { use EntityChangedTrait; @@ -83,42 +70,18 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { /** * {@inheritdoc} */ - protected function urlRouteParameters($rel) { - $uri_route_parameters = parent::urlRouteParameters($rel); - - if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - - return $uri_route_parameters; + public function getName() { + return $this->get('name')->value; } /** * {@inheritdoc} */ - public function preSave(EntityStorageInterface $storage) { - parent::preSave($storage); - - foreach (array_keys($this->getTranslationLanguages()) as $langcode) { - $translation = $this->getTranslation($langcode); - - // If no owner has been set explicitly, make the anonymous user the owner. - if (!$translation->getOwner()) { - $translation->setOwnerId(0); - } - } - - // If no revision author has been set explicitly, make the person owner the - // revision author. - if (!$this->getRevisionUser()) { - $this->setRevisionUserId($this->getOwnerId()); - } + public function setName($name) { + $this->set('name', $name); + return $this; } - /** * {@inheritdoc} */ @@ -191,34 +154,28 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') -# ->setDisplayOptions('form', [ -# 'type' => 'entity_reference_autocomplete', -# 'weight' => 5, -# 'settings' => [ -# 'match_operator' => 'CONTAINS', -# 'size' => '60', -# 'autocomplete_type' => 'tags', -# 'placeholder' => '', -# ], -# ]) -# ->setDisplayOptions('view', [ -# 'label' => 'inline', -# 'type' => 'author', -# 'weight' => 100, -# ]) + # ->setDisplayOptions('view', [ + # 'label' => 'hidden', + # 'type' => 'author', + # 'weight' => 0, + # ]) + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 5, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]) ->setTranslatable(TRUE); + // This field is computed in a presave hook. $fields['full_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Full Name')) - ->setDescription(t('The full name of the person.')) - ->setRevisionable(TRUE); - - // This field is computed in a presave hook. - $fields['first_and_last_name'] = BaseFieldDefinition::create('string') - ->setLabel(t('First and Last Name')) - ->setDescription(t('The first and last name of the person. Used for searching and autocomplete')) - ->setRevisionable(TRUE); + ->setDescription(t('The full name of the person.')); $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First Name')) @@ -238,7 +195,6 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { $fields['middle_names'] = BaseFieldDefinition::create('string') ->setLabel(t('Middle Names')) ->setDescription(t('Middle Names.')) - ->setRevisionable(TRUE) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, @@ -249,10 +205,10 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ]) ->setDisplayConfigurable('form', TRUE); + $fields['last_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Last Name')) ->setDescription(t('Last Name.')) - ->setRevisionable(TRUE) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, @@ -265,13 +221,12 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setRequired(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Enabled')) - ->setDescription(t('If this is ticked, the record is active')) - ->setRevisionable(TRUE) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Person is published.')) + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') @@ -282,13 +237,6 @@ class Person extends RevisionableContentEntityBase implements PersonInterface { ->setLabel(t('Changed')) ->setDescription(t('The time that the entity was last edited.')); - $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Revision translation affected')) - ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) - ->setReadOnly(TRUE) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE); - return $fields; } diff --git a/modules/zencrm_entities/src/Entity/PersonInterface.php b/modules/zencrm_entities/src/Entity/PersonInterface.php index ebe7d5f..90ceaff 100644 --- a/modules/zencrm_entities/src/Entity/PersonInterface.php +++ b/modules/zencrm_entities/src/Entity/PersonInterface.php @@ -3,7 +3,6 @@ namespace Drupal\zencrm_entities\Entity; use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\user\EntityOwnerInterface; @@ -12,10 +11,29 @@ use Drupal\user\EntityOwnerInterface; * * @ingroup zencrm_entities */ -interface PersonInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface { +interface PersonInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface { // Add get/set methods for your configuration properties here. + /** + * Gets the Person name. + * + * @return string + * Name of the Person. + */ + public function getName(); + + /** + * Sets the Person name. + * + * @param string $name + * The Person name. + * + * @return \Drupal\zencrm_entities\Entity\PersonInterface + * The called Person entity. + */ + public function setName($name); + /** * Gets the Person creation timestamp. * @@ -56,42 +74,4 @@ interface PersonInterface extends ContentEntityInterface, RevisionLogInterface, */ public function setPublished($published); - /** - * Gets the Person revision creation timestamp. - * - * @return int - * The UNIX timestamp of when this revision was created. - */ - public function getRevisionCreationTime(); - - /** - * Sets the Person revision creation timestamp. - * - * @param int $timestamp - * The UNIX timestamp of when this revision was created. - * - * @return \Drupal\zencrm_entities\Entity\PersonInterface - * The called Person entity. - */ - public function setRevisionCreationTime($timestamp); - - /** - * Gets the Person revision author. - * - * @return \Drupal\user\UserInterface - * The user entity for the revision author. - */ - public function getRevisionUser(); - - /** - * Sets the Person revision author. - * - * @param int $uid - * The user ID of the revision author. - * - * @return \Drupal\zencrm_entities\Entity\PersonInterface - * The called Person entity. - */ - public function setRevisionUserId($uid); - } diff --git a/modules/zencrm_entities/src/Form/PersonForm.php b/modules/zencrm_entities/src/Form/PersonForm.php index 7475873..42478d8 100644 --- a/modules/zencrm_entities/src/Form/PersonForm.php +++ b/modules/zencrm_entities/src/Form/PersonForm.php @@ -19,15 +19,6 @@ class PersonForm extends ContentEntityForm { /* @var $entity \Drupal\zencrm_entities\Entity\Person */ $form = parent::buildForm($form, $form_state); - if (!$this->entity->isNew()) { - $form['new_revision'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Create new revision'), - '#default_value' => FALSE, - '#weight' => 10, - ]; - } - $entity = $this->entity; return $form; @@ -39,18 +30,6 @@ class PersonForm extends ContentEntityForm { public function save(array $form, FormStateInterface $form_state) { $entity = $this->entity; - // Save as a new revision if requested to do so. - if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { - $entity->setNewRevision(); - - // If a new revision is created, save the current user as revision author. - $entity->setRevisionCreationTime(REQUEST_TIME); - $entity->setRevisionUserId(\Drupal::currentUser()->id()); - } - else { - $entity->setNewRevision(FALSE); - } - $status = parent::save($form, $form_state); switch ($status) { diff --git a/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php deleted file mode 100644 index c6addc9..0000000 --- a/modules/zencrm_entities/src/Form/PersonRevisionDeleteForm.php +++ /dev/null @@ -1,123 +0,0 @@ -PersonStorage = $entity_storage; - $this->connection = $connection; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); - return new static( - $entity_manager->getStorage('person'), - $container->get('database') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'person_revision_delete_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.person.version_history', ['person' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL) { - $this->revision = $this->PersonStorage->loadRevision($person_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->PersonStorage->deleteRevision($this->revision->getRevisionId()); - - $this->logger('content')->notice('Person: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Person %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); - $form_state->setRedirect( - 'entity.person.canonical', - ['person' => $this->revision->id()] - ); - if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {person_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { - $form_state->setRedirect( - 'entity.person.version_history', - ['person' => $this->revision->id()] - ); - } - } - -} diff --git a/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php b/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php deleted file mode 100644 index 25ad7e5..0000000 --- a/modules/zencrm_entities/src/Form/PersonRevisionRevertForm.php +++ /dev/null @@ -1,149 +0,0 @@ -PersonStorage = $entity_storage; - $this->dateFormatter = $date_formatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('person'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'person_revision_revert_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.person.version_history', ['person' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Revert'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return ''; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL) { - $this->revision = $this->PersonStorage->loadRevision($person_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // The revision timestamp will be updated when the revision is saved. Keep - // the original one for the confirmation message. - $original_revision_timestamp = $this->revision->getRevisionCreationTime(); - - $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); - $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); - $this->revision->save(); - - $this->logger('content')->notice('Person: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Person %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); - $form_state->setRedirect( - 'entity.person.version_history', - ['person' => $this->revision->id()] - ); - } - - /** - * Prepares a revision to be reverted. - * - * @param \Drupal\zencrm_entities\Entity\PersonInterface $revision - * The revision to be reverted. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return \Drupal\zencrm_entities\Entity\PersonInterface - * The prepared revision ready to be stored. - */ - protected function prepareRevertedRevision(PersonInterface $revision, FormStateInterface $form_state) { - $revision->setNewRevision(); - $revision->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $revision; - } - -} diff --git a/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php deleted file mode 100644 index 2a5aa67..0000000 --- a/modules/zencrm_entities/src/Form/PersonRevisionRevertTranslationForm.php +++ /dev/null @@ -1,115 +0,0 @@ -languageManager = $language_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('person'), - $container->get('date.formatter'), - $container->get('language_manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'person_revision_revert_translation_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $person_revision = NULL, $langcode = NULL) { - $this->langcode = $langcode; - $form = parent::buildForm($form, $form_state, $person_revision); - - $form['revert_untranslated_fields'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Revert content shared among translations'), - '#default_value' => FALSE, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - protected function prepareRevertedRevision(PersonInterface $revision, FormStateInterface $form_state) { - $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); - - /** @var \Drupal\zencrm_entities\Entity\PersonInterface $default_revision */ - $latest_revision = $this->PersonStorage->load($revision->id()); - $latest_revision_translation = $latest_revision->getTranslation($this->langcode); - - $revision_translation = $revision->getTranslation($this->langcode); - - foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { - if ($definition->isTranslatable() || $revert_untranslated_fields) { - $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); - } - } - - $latest_revision_translation->setNewRevision(); - $latest_revision_translation->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $latest_revision_translation; - } - -} diff --git a/modules/zencrm_entities/src/PersonHtmlRouteProvider.php b/modules/zencrm_entities/src/PersonHtmlRouteProvider.php index 8d9e7cb..c90219e 100644 --- a/modules/zencrm_entities/src/PersonHtmlRouteProvider.php +++ b/modules/zencrm_entities/src/PersonHtmlRouteProvider.php @@ -22,26 +22,6 @@ class PersonHtmlRouteProvider extends AdminHtmlRouteProvider { $entity_type_id = $entity_type->id(); - if ($history_route = $this->getHistoryRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.version_history", $history_route); - } - - if ($revision_route = $this->getRevisionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision", $revision_route); - } - - if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); - } - - if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); - } - - if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); - } - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { $collection->add("$entity_type_id.settings", $settings_form_route); } @@ -49,126 +29,6 @@ class PersonHtmlRouteProvider extends AdminHtmlRouteProvider { return $collection; } - /** - * Gets the version history route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getHistoryRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('version-history')) { - $route = new Route($entity_type->getLinkTemplate('version-history')); - $route - ->setDefaults([ - '_title' => "{$entity_type->getLabel()} revisions", - '_controller' => '\Drupal\zencrm_entities\Controller\PersonController::revisionOverview', - ]) - ->setRequirement('_permission', 'access person revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision')) { - $route = new Route($entity_type->getLinkTemplate('revision')); - $route - ->setDefaults([ - '_controller' => '\Drupal\zencrm_entities\Controller\PersonController::revisionShow', - '_title_callback' => '\Drupal\zencrm_entities\Controller\PersonController::revisionPageTitle', - ]) - ->setRequirement('_permission', 'access person revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_revert')) { - $route = new Route($entity_type->getLinkTemplate('revision_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionRevertForm', - '_title' => 'Revert to earlier revision', - ]) - ->setRequirement('_permission', 'revert all person revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision delete route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_delete')) { - $route = new Route($entity_type->getLinkTemplate('revision_delete')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionDeleteForm', - '_title' => 'Delete earlier revision', - ]) - ->setRequirement('_permission', 'delete all person revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision translation revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('translation_revert')) { - $route = new Route($entity_type->getLinkTemplate('translation_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\PersonRevisionRevertTranslationForm', - '_title' => 'Revert to earlier revision of a translation', - ]) - ->setRequirement('_permission', 'revert all person revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - /** * Gets the settings form route. * diff --git a/modules/zencrm_entities/src/PersonStorage.php b/modules/zencrm_entities/src/PersonStorage.php deleted file mode 100644 index 84a3340..0000000 --- a/modules/zencrm_entities/src/PersonStorage.php +++ /dev/null @@ -1,58 +0,0 @@ -database->query( - 'SELECT vid FROM {person_revision} WHERE id=:id ORDER BY vid', - [':id' => $entity->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function userRevisionIds(AccountInterface $account) { - return $this->database->query( - 'SELECT vid FROM {person_field_revision} WHERE uid = :uid ORDER BY vid', - [':uid' => $account->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function countDefaultLanguageRevisions(PersonInterface $entity) { - return $this->database->query('SELECT COUNT(*) FROM {person_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) - ->fetchField(); - } - - /** - * {@inheritdoc} - */ - public function clearRevisionsLanguage(LanguageInterface $language) { - return $this->database->update('person_revision') - ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) - ->condition('langcode', $language->getId()) - ->execute(); - } - -} diff --git a/modules/zencrm_entities/src/PersonStorageInterface.php b/modules/zencrm_entities/src/PersonStorageInterface.php deleted file mode 100644 index 727393c..0000000 --- a/modules/zencrm_entities/src/PersonStorageInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -view Contact Details revisions and delete rights for contact details entities in question or administer contact details entities.' +add person entities: + title: 'Create new Person entities' + +administer person entities: + title: 'Administer Person entities' + description: 'Allow to access the administration form to configure Person entities.' + restrict access: true + +delete person entities: + title: 'Delete Person entities' + +edit person entities: + title: 'Edit Person entities' + +view published person entities: + title: 'View published Person entities' + +view unpublished person entities: + title: 'View unpublished Person entities' From 494ac6cdc13c6cddffb25f0f87d0e6b4135b33f8 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 11:30:22 +0200 Subject: [PATCH 25/94] Tidied up contact details base fields --- .../src/Entity/ContactDetails.php | 124 ++++++++---------- zencrm.info.yml | 1 + 2 files changed, 53 insertions(+), 72 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 700244a..8008217 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -171,7 +171,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet } /** - ->setDisplayConfigurable('view', TRUE); * {@inheritdoc} */ public function setOwner(UserInterface $account) { @@ -206,78 +205,72 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ - 'label' => 'inline', - 'type' => 'author', - 'weight' => 100, - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 100, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]); + # ->setDisplayOptions('view', [ + # 'label' => 'inline', + # 'type' => 'author', + # 'weight' => 100, + # ]) + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 100, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]) + ->setTranslatable(TRUE); - $fields['type'] = BaseFieldDefinition::create('entity_reference') + + // Type field is used in entity reference fields etc + // so it is not exposed to user configuration. + $fields['type'] = BaseFieldDefinition::create('string') ->setLabel(t('Type')) ->setDescription(t('E.g. Home, Business, Temporary')) - ->setSetting('handler', 'default:taxonomy_term') - ->setSetting('target_type', 'taxonomy_term') - ->setSetting('handler_settings', [ - 'target_bundles' => [ - 'contact_details_types' => 'contact_details_types', - ], - 'auto_create' => 'true' - ]) ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 0, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'placeholder' => '', - ], - ]) - ->setDisplayOptions('view', [ - 'settings' => ['link' => 'false'], - 'type' => 'entity_reference_label', 'label' => 'hidden', + 'type' => 'text', 'weight' => 0, ]) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'string', + 'weight' => 0, + )) ->setRequired(TRUE); + // Person field is always set from the context so no form or display required. $fields['person'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Person')) ->setDescription(t('The person this profile is of.')) ->setSetting('target_type', 'person') - ->setSetting('handler', 'views') - ->setSetting('handler_settings', [ - 'view' => [ - 'view_name' => 'persons', - 'display_name' => 'entity_reference_1', - 'arguments' => [] - ] - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 1, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) ->setRequired(TRUE); + // Type field is used for mailings, + // so it is not exposed to user configuration. + $fields['email'] = BaseFieldDefinition::create('string') + ->setLabel(t('Email Address')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 30, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'string', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 0, + )); + $fields['phone'] = BaseFieldDefinition::create('string') ->setLabel(t('Main Phone Number')) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) ->setSettings(array( 'default_value' => '', 'max_length' => 20, @@ -300,6 +293,8 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'max_length' => 20, 'text_processing' => 0, )) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'string', @@ -310,26 +305,11 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'weight' => 3, )); - $fields['email'] = BaseFieldDefinition::create('string') - ->setLabel(t('Email Address')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 30, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 4, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 4, - )); - $fields['postal_address'] = BaseFieldDefinition::create('string_long') ->setLabel(t('Postal Address')) ->setDescription(t('Full address, apart from post code.')) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) ->setSettings(array( 'default_value' => '', 'max_length' => 255, diff --git a/zencrm.info.yml b/zencrm.info.yml index fba8d8e..e41cab6 100644 --- a/zencrm.info.yml +++ b/zencrm.info.yml @@ -5,3 +5,4 @@ core: 8.x package: 'Zen CRM' dependencies: - zencrm_entities + - zencrm_search From 6d63d5f3286565ba5501b9b68cdbc63ca83d49cc Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 11:35:09 +0200 Subject: [PATCH 26/94] Finished making person not revisionable Am making stuff not revisionable for the initial hosted release and then will think about how to properly implement revisioning later. Also removed now-unneeded contact details types vocabulary (contact details type is now a text field) --- .../install/taxonomy.vocabulary.contact_details_types.yml | 8 -------- modules/zencrm_entities/src/Entity/Person.php | 2 -- 2 files changed, 10 deletions(-) delete mode 100644 modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml diff --git a/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml b/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml deleted file mode 100644 index fcdb838..0000000 --- a/modules/zencrm_entities/config/install/taxonomy.vocabulary.contact_details_types.yml +++ /dev/null @@ -1,8 +0,0 @@ -langcode: en -status: true -dependencies: { } -name: 'Contact Details Types' -vid: contact_details_types -description: 'E.g. "Home", "Business"' -hierarchy: 0 -weight: 0 diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 239bf26..2d9eb97 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -151,7 +151,6 @@ class Person extends ContentEntityBase implements PersonInterface { $fields['user_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Authored by')) ->setDescription(t('The user ID of author of the Person entity.')) - ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') # ->setDisplayOptions('view', [ @@ -180,7 +179,6 @@ class Person extends ContentEntityBase implements PersonInterface { $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First Name')) ->setDescription(t('First Name.')) - ->setRevisionable(TRUE) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, From 2ae3fcea56410a5b9c0d276d1fdcf590909135bc Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 11:42:45 +0200 Subject: [PATCH 27/94] Made contact details not revisionable --- .../zencrm_entities/contact_details.page.inc | 4 +- .../ContactDetailsAccessControlHandler.php | 2 +- .../src/ContactDetailsHtmlRouteProvider.php | 142 +--------- .../src/ContactDetailsListBuilder.php | 4 +- .../src/ContactDetailsStorage.php | 58 ---- .../src/ContactDetailsStorageInterface.php | 61 ----- .../src/ContactDetailsTranslationHandler.php | 14 - .../Controller/ContactDetailsController.php | 163 ----------- .../src/Entity/ContactDetails.php | 252 ++++-------------- .../src/Entity/ContactDetailsInterface.php | 75 ++---- .../src/Entity/ContactDetailsViewsData.php | 2 +- .../src/Form/ContactDetailsDeleteForm.php | 2 +- .../src/Form/ContactDetailsForm.php | 27 +- .../Form/ContactDetailsRevisionDeleteForm.php | 123 --------- .../Form/ContactDetailsRevisionRevertForm.php | 149 ----------- ...ctDetailsRevisionRevertTranslationForm.php | 115 -------- .../src/Form/ContactDetailsSettingsForm.php | 4 +- .../templates/contact_details.html.twig | 4 +- .../zencrm_entities.links.action.yml | 5 + .../zencrm_entities.links.menu.yml | 14 + .../zencrm_entities.links.task.yml | 22 ++ .../zencrm_entities.permissions.yml | 19 ++ 22 files changed, 141 insertions(+), 1120 deletions(-) delete mode 100644 modules/zencrm_entities/src/ContactDetailsStorage.php delete mode 100644 modules/zencrm_entities/src/ContactDetailsStorageInterface.php delete mode 100644 modules/zencrm_entities/src/ContactDetailsTranslationHandler.php delete mode 100644 modules/zencrm_entities/src/Controller/ContactDetailsController.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php diff --git a/modules/zencrm_entities/contact_details.page.inc b/modules/zencrm_entities/contact_details.page.inc index 4924125..f0e4278 100644 --- a/modules/zencrm_entities/contact_details.page.inc +++ b/modules/zencrm_entities/contact_details.page.inc @@ -4,13 +4,13 @@ * @file * Contains contact_details.page.inc. * - * Page callback for Contact Details entities. + * Page callback for Contact details entities. */ use Drupal\Core\Render\Element; /** - * Prepares variables for Contact Details templates. + * Prepares variables for Contact details templates. * * Default template: contact_details.html.twig. * diff --git a/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php b/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php index e38051e..cc3f87a 100644 --- a/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php +++ b/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php @@ -8,7 +8,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessResult; /** - * Access controller for the Contact Details entity. + * Access controller for the Contact details entity. * * @see \Drupal\zencrm_entities\Entity\ContactDetails. */ diff --git a/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php b/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php index 55e0d14..3aaed44 100644 --- a/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php +++ b/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php @@ -7,7 +7,7 @@ use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider; use Symfony\Component\Routing\Route; /** - * Provides routes for Contact Details entities. + * Provides routes for Contact details entities. * * @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider * @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider @@ -22,26 +22,6 @@ class ContactDetailsHtmlRouteProvider extends AdminHtmlRouteProvider { $entity_type_id = $entity_type->id(); - if ($history_route = $this->getHistoryRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.version_history", $history_route); - } - - if ($revision_route = $this->getRevisionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision", $revision_route); - } - - if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); - } - - if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); - } - - if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); - } - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { $collection->add("$entity_type_id.settings", $settings_form_route); } @@ -49,126 +29,6 @@ class ContactDetailsHtmlRouteProvider extends AdminHtmlRouteProvider { return $collection; } - /** - * Gets the version history route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getHistoryRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('version-history')) { - $route = new Route($entity_type->getLinkTemplate('version-history')); - $route - ->setDefaults([ - '_title' => "{$entity_type->getLabel()} revisions", - '_controller' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionOverview', - ]) - ->setRequirement('_permission', 'access contact details revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision')) { - $route = new Route($entity_type->getLinkTemplate('revision')); - $route - ->setDefaults([ - '_controller' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionShow', - '_title_callback' => '\Drupal\zencrm_entities\Controller\ContactDetailsController::revisionPageTitle', - ]) - ->setRequirement('_permission', 'access contact details revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_revert')) { - $route = new Route($entity_type->getLinkTemplate('revision_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionRevertForm', - '_title' => 'Revert to earlier revision', - ]) - ->setRequirement('_permission', 'revert all contact details revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision delete route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_delete')) { - $route = new Route($entity_type->getLinkTemplate('revision_delete')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionDeleteForm', - '_title' => 'Delete earlier revision', - ]) - ->setRequirement('_permission', 'delete all contact details revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision translation revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('translation_revert')) { - $route = new Route($entity_type->getLinkTemplate('translation_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ContactDetailsRevisionRevertTranslationForm', - '_title' => 'Revert to earlier revision of a translation', - ]) - ->setRequirement('_permission', 'revert all contact details revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - /** * Gets the settings form route. * diff --git a/modules/zencrm_entities/src/ContactDetailsListBuilder.php b/modules/zencrm_entities/src/ContactDetailsListBuilder.php index 0ede242..da9264f 100644 --- a/modules/zencrm_entities/src/ContactDetailsListBuilder.php +++ b/modules/zencrm_entities/src/ContactDetailsListBuilder.php @@ -7,7 +7,7 @@ use Drupal\Core\Entity\EntityListBuilder; use Drupal\Core\Link; /** - * Defines a class to build a listing of Contact Details entities. + * Defines a class to build a listing of Contact details entities. * * @ingroup zencrm_entities */ @@ -18,7 +18,7 @@ class ContactDetailsListBuilder extends EntityListBuilder { * {@inheritdoc} */ public function buildHeader() { - $header['id'] = $this->t('Contact Details ID'); + $header['id'] = $this->t('Contact details ID'); $header['name'] = $this->t('Name'); return $header + parent::buildHeader(); } diff --git a/modules/zencrm_entities/src/ContactDetailsStorage.php b/modules/zencrm_entities/src/ContactDetailsStorage.php deleted file mode 100644 index b2613f0..0000000 --- a/modules/zencrm_entities/src/ContactDetailsStorage.php +++ /dev/null @@ -1,58 +0,0 @@ -database->query( - 'SELECT vid FROM {contact_details_revision} WHERE id=:id ORDER BY vid', - [':id' => $entity->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function userRevisionIds(AccountInterface $account) { - return $this->database->query( - 'SELECT vid FROM {contact_details_field_revision} WHERE uid = :uid ORDER BY vid', - [':uid' => $account->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function countDefaultLanguageRevisions(ContactDetailsInterface $entity) { - return $this->database->query('SELECT COUNT(*) FROM {contact_details_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) - ->fetchField(); - } - - /** - * {@inheritdoc} - */ - public function clearRevisionsLanguage(LanguageInterface $language) { - return $this->database->update('contact_details_revision') - ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) - ->condition('langcode', $language->getId()) - ->execute(); - } - -} diff --git a/modules/zencrm_entities/src/ContactDetailsStorageInterface.php b/modules/zencrm_entities/src/ContactDetailsStorageInterface.php deleted file mode 100644 index 01709f0..0000000 --- a/modules/zencrm_entities/src/ContactDetailsStorageInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -entityManager()->getStorage('contact_details')->loadRevision($contact_details_revision); - $view_builder = $this->entityManager()->getViewBuilder('contact_details'); - - return $view_builder->view($contact_details); - } - - /** - * Page title callback for a Contact Details revision. - * - * @param int $contact_details_revision - * The Contact Details revision ID. - * - * @return string - * The page title. - */ - public function revisionPageTitle($contact_details_revision) { - $contact_details = $this->entityManager()->getStorage('contact_details')->loadRevision($contact_details_revision); - return $this->t('Revision of %title from %date', ['%title' => $contact_details->label(), '%date' => format_date($contact_details->getRevisionCreationTime())]); - } - - /** - * Generates an overview table of older revisions of a Contact Details . - * - * @param \Drupal\zencrm_entities\Entity\ContactDetailsInterface $contact_details - * A Contact Details object. - * - * @return array - * An array as expected by drupal_render(). - */ - public function revisionOverview(ContactDetailsInterface $contact_details) { - $account = $this->currentUser(); - $langcode = $contact_details->language()->getId(); - $langname = $contact_details->language()->getName(); - $languages = $contact_details->getTranslationLanguages(); - $has_translations = (count($languages) > 1); - $contact_details_storage = $this->entityManager()->getStorage('contact_details'); - - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $contact_details->label()]) : $this->t('Revisions for %title', ['%title' => $contact_details->label()]); - $header = [$this->t('Revision'), $this->t('Operations')]; - - $revert_permission = (($account->hasPermission("revert all contact details revisions") || $account->hasPermission('administer contact details entities'))); - $delete_permission = (($account->hasPermission("delete all contact details revisions") || $account->hasPermission('administer contact details entities'))); - - $rows = []; - - $vids = $contact_details_storage->revisionIds($contact_details); - - $latest_revision = TRUE; - - foreach (array_reverse($vids) as $vid) { - /** @var \Drupal\zencrm_entities\ContactDetailsInterface $revision */ - $revision = $contact_details_storage->loadRevision($vid); - // Only show revisions that are affected by the language that is being - // displayed. - if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { - $username = [ - '#theme' => 'username', - '#account' => $revision->getRevisionUser(), - ]; - - // Use revision link to link to revisions that are not active. - $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); - if ($vid != $contact_details->getRevisionId()) { - $link = $this->l($date, new Url('entity.contact_details.revision', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid])); - } - else { - $link = $contact_details->link($date); - } - - $row = []; - $column = [ - 'data' => [ - '#type' => 'inline_template', - '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', - '#context' => [ - 'date' => $link, - 'username' => \Drupal::service('renderer')->renderPlain($username), - 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], - ], - ], - ]; - $row[] = $column; - - if ($latest_revision) { - $row[] = [ - 'data' => [ - '#prefix' => '', - '#markup' => $this->t('Current revision'), - '#suffix' => '', - ], - ]; - foreach ($row as &$current) { - $current['class'] = ['revision-current']; - } - $latest_revision = FALSE; - } - else { - $links = []; - if ($revert_permission) { - $links['revert'] = [ - 'title' => $this->t('Revert'), - 'url' => $has_translations ? - Url::fromRoute('entity.contact_details.translation_revert', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid, 'langcode' => $langcode]) : - Url::fromRoute('entity.contact_details.revision_revert', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid]), - ]; - } - - if ($delete_permission) { - $links['delete'] = [ - 'title' => $this->t('Delete'), - 'url' => Url::fromRoute('entity.contact_details.revision_delete', ['contact_details' => $contact_details->id(), 'contact_details_revision' => $vid]), - ]; - } - - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#links' => $links, - ], - ]; - } - - $rows[] = $row; - } - } - - $build['contact_details_revisions_table'] = [ - '#theme' => 'table', - '#rows' => $rows, - '#header' => $header, - ]; - - return $build; - } - -} diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 8008217..dba5e21 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -4,26 +4,23 @@ namespace Drupal\zencrm_entities\Entity; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\Core\Entity\RevisionableContentEntityBase; -use Drupal\Core\Entity\RevisionableInterface; +use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityChangedTrait; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\UserInterface; /** - * Defines the Contact Details entity. + * Defines the Contact details entity. * * @ingroup zencrm_entities * * @ContentEntityType( * id = "contact_details", - * label = @Translation("Contact Details"), + * label = @Translation("Contact details"), * handlers = { - * "storage" = "Drupal\zencrm_entities\ContactDetailsStorage", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "list_builder" = "Drupal\zencrm_entities\ContactDetailsListBuilder", * "views_data" = "Drupal\zencrm_entities\Entity\ContactDetailsViewsData", - * "translation" = "Drupal\zencrm_entities\ContactDetailsTranslationHandler", * * "form" = { * "default" = "Drupal\zencrm_entities\Form\ContactDetailsForm", @@ -37,36 +34,26 @@ use Drupal\user\UserInterface; * }, * }, * base_table = "contact_details", - * data_table = "contact_details_field_data", - * revision_table = "contact_details_revision", - * revision_data_table = "contact_details_field_revision", - * translatable = TRUE, * admin_permission = "administer contact details entities", * entity_keys = { * "id" = "id", - * "revision" = "vid", - * "label" = "type", + * "label" = "name", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", * "status" = "status", * }, * links = { - * "canonical" = "/zencrm/contact_details/{contact_details}", - * "add-form" = "/zencrm/contact_details/add", - * "edit-form" = "/zencrm/contact_details/{contact_details}/edit", - * "delete-form" = "/zencrm/contact_details/{contact_details}/delete", - * "version-history" = "/zencrm/contact_details/{contact_details}/revisions", - * "revision" = "/zencrm/contact_details/{contact_details}/revisions/{contact_details_revision}/view", - * "revision_revert" = "/zencrm/contact_details/{contact_details}/revisions/{contact_details_revision}/revert", - * "revision_delete" = "/zencrm/contact_details/{contact_details}/revisions/{contact_details_revision}/delete", - * "translation_revert" = "/zencrm/contact_details/{contact_details}/revisions/{contact_details_revision}/revert/{langcode}", - * "collection" = "/zencrm/contact_details", + * "canonical" = "/admin/structure/contact_details/{contact_details}", + * "add-form" = "/admin/structure/contact_details/add", + * "edit-form" = "/admin/structure/contact_details/{contact_details}/edit", + * "delete-form" = "/admin/structure/contact_details/{contact_details}/delete", + * "collection" = "/admin/structure/contact_details", * }, * field_ui_base_route = "contact_details.settings" * ) */ -class ContactDetails extends RevisionableContentEntityBase implements ContactDetailsInterface { +class ContactDetails extends ContentEntityBase implements ContactDetailsInterface { use EntityChangedTrait; @@ -80,44 +67,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ]; } - /** - * {@inheritdoc} - */ - protected function urlRouteParameters($rel) { - $uri_route_parameters = parent::urlRouteParameters($rel); - - if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - - return $uri_route_parameters; - } - - /** - * {@inheritdoc} - */ - public function preSave(EntityStorageInterface $storage) { - parent::preSave($storage); - - foreach (array_keys($this->getTranslationLanguages()) as $langcode) { - $translation = $this->getTranslation($langcode); - - // If no owner has been set explicitly, make the anonymous user the owner. - if (!$translation->getOwner()) { - $translation->setOwnerId(0); - } - } - - // If no revision author has been set explicitly, make the contact_details owner the - // revision author. - if (!$this->getRevisionUser()) { - $this->setRevisionUserId($this->getOwnerId()); - } - } - /** * {@inheritdoc} */ @@ -201,156 +150,58 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet $fields['user_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Contact Details entity.')) + ->setDescription(t('The user ID of author of the Contact details entity.')) ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - # ->setDisplayOptions('view', [ - # 'label' => 'inline', - # 'type' => 'author', - # 'weight' => 100, - # ]) - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 100, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]) - ->setTranslatable(TRUE); - - - // Type field is used in entity reference fields etc - // so it is not exposed to user configuration. - $fields['type'] = BaseFieldDefinition::create('string') - ->setLabel(t('Type')) - ->setDescription(t('E.g. Home, Business, Temporary')) - ->setDisplayOptions('form', [ + ->setTranslatable(TRUE) + ->setDisplayOptions('view', [ 'label' => 'hidden', - 'type' => 'text', + 'type' => 'author', 'weight' => 0, ]) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'string', - 'weight' => 0, - )) - ->setRequired(TRUE); - - - // Person field is always set from the context so no form or display required. - $fields['person'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Person')) - ->setDescription(t('The person this profile is of.')) - ->setSetting('target_type', 'person') - ->setRequired(TRUE); - - // Type field is used for mailings, - // so it is not exposed to user configuration. - $fields['email'] = BaseFieldDefinition::create('string') - ->setLabel(t('Email Address')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 30, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'string', - 'weight' => 0, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 0, - )); - - $fields['phone'] = BaseFieldDefinition::create('string') - ->setLabel(t('Main Phone Number')) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 20, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 2, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 2, - )); - - $fields['phone2'] = BaseFieldDefinition::create('string') - ->setLabel(t('Alternative Phone Number')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 20, - 'text_processing' => 0, - )) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 3, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 3, - )); - - $fields['postal_address'] = BaseFieldDefinition::create('string_long') - ->setLabel(t('Postal Address')) - ->setDescription(t('Full address, apart from post code.')) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 255, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'text', + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', 'weight' => 5, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textarea', - 'weight' => 5, - )); + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); - $fields['post_code'] = BaseFieldDefinition::create('string') - ->setLabel(t('Post Code')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 10, + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Contact details entity.')) + ->setSettings([ + 'max_length' => 50, 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'string', - 'weight' => 6, - )) - ->setDisplayOptions('form', array( + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ 'type' => 'string_textfield', - 'weight' => 6, - )); + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Enabled')) - ->setDescription(t('If this is ticked then this set of contact details is active.')) - ->setRevisionable(TRUE) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Contact details is published.')) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) @@ -360,13 +211,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setLabel(t('Changed')) ->setDescription(t('The time that the entity was last edited.')); - $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Revision translation affected')) - ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) - ->setReadOnly(TRUE) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE); - return $fields; } diff --git a/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php b/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php index 583ef18..bf304ff 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php +++ b/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php @@ -3,114 +3,75 @@ namespace Drupal\zencrm_entities\Entity; use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\user\EntityOwnerInterface; /** - * Provides an interface for defining Contact Details entities. + * Provides an interface for defining Contact details entities. * * @ingroup zencrm_entities */ -interface ContactDetailsInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface { +interface ContactDetailsInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface { // Add get/set methods for your configuration properties here. /** - * Gets the Contact Details name. + * Gets the Contact details name. * * @return string - * Name of the Contact Details. + * Name of the Contact details. */ public function getName(); /** - * Sets the Contact Details name. + * Sets the Contact details name. * * @param string $name - * The Contact Details name. + * The Contact details name. * * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The called Contact Details entity. + * The called Contact details entity. */ public function setName($name); /** - * Gets the Contact Details creation timestamp. + * Gets the Contact details creation timestamp. * * @return int - * Creation timestamp of the Contact Details. + * Creation timestamp of the Contact details. */ public function getCreatedTime(); /** - * Sets the Contact Details creation timestamp. + * Sets the Contact details creation timestamp. * * @param int $timestamp - * The Contact Details creation timestamp. + * The Contact details creation timestamp. * * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The called Contact Details entity. + * The called Contact details entity. */ public function setCreatedTime($timestamp); /** - * Returns the Contact Details published status indicator. + * Returns the Contact details published status indicator. * - * Unpublished Contact Details are only visible to restricted users. + * Unpublished Contact details are only visible to restricted users. * * @return bool - * TRUE if the Contact Details is published. + * TRUE if the Contact details is published. */ public function isPublished(); /** - * Sets the published status of a Contact Details. + * Sets the published status of a Contact details. * * @param bool $published - * TRUE to set this Contact Details to published, FALSE to set it to unpublished. + * TRUE to set this Contact details to published, FALSE to set it to unpublished. * * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The called Contact Details entity. + * The called Contact details entity. */ public function setPublished($published); - /** - * Gets the Contact Details revision creation timestamp. - * - * @return int - * The UNIX timestamp of when this revision was created. - */ - public function getRevisionCreationTime(); - - /** - * Sets the Contact Details revision creation timestamp. - * - * @param int $timestamp - * The UNIX timestamp of when this revision was created. - * - * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The called Contact Details entity. - */ - public function setRevisionCreationTime($timestamp); - - /** - * Gets the Contact Details revision author. - * - * @return \Drupal\user\UserInterface - * The user entity for the revision author. - */ - public function getRevisionUser(); - - /** - * Sets the Contact Details revision author. - * - * @param int $uid - * The user ID of the revision author. - * - * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The called Contact Details entity. - */ - public function setRevisionUserId($uid); - } diff --git a/modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php b/modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php index 14c6b02..02b71d0 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php +++ b/modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php @@ -5,7 +5,7 @@ namespace Drupal\zencrm_entities\Entity; use Drupal\views\EntityViewsData; /** - * Provides Views data for Contact Details entities. + * Provides Views data for Contact details entities. */ class ContactDetailsViewsData extends EntityViewsData { diff --git a/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php b/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php index 6000b68..b2801ae 100644 --- a/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php +++ b/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php @@ -5,7 +5,7 @@ namespace Drupal\zencrm_entities\Form; use Drupal\Core\Entity\ContentEntityDeleteForm; /** - * Provides a form for deleting Contact Details entities. + * Provides a form for deleting Contact details entities. * * @ingroup zencrm_entities */ diff --git a/modules/zencrm_entities/src/Form/ContactDetailsForm.php b/modules/zencrm_entities/src/Form/ContactDetailsForm.php index 9a62a45..31605ce 100644 --- a/modules/zencrm_entities/src/Form/ContactDetailsForm.php +++ b/modules/zencrm_entities/src/Form/ContactDetailsForm.php @@ -6,7 +6,7 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Form\FormStateInterface; /** - * Form controller for Contact Details edit forms. + * Form controller for Contact details edit forms. * * @ingroup zencrm_entities */ @@ -19,15 +19,6 @@ class ContactDetailsForm extends ContentEntityForm { /* @var $entity \Drupal\zencrm_entities\Entity\ContactDetails */ $form = parent::buildForm($form, $form_state); - if (!$this->entity->isNew()) { - $form['new_revision'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Create new revision'), - '#default_value' => FALSE, - '#weight' => 10, - ]; - } - $entity = $this->entity; return $form; @@ -39,29 +30,17 @@ class ContactDetailsForm extends ContentEntityForm { public function save(array $form, FormStateInterface $form_state) { $entity = $this->entity; - // Save as a new revision if requested to do so. - if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { - $entity->setNewRevision(); - - // If a new revision is created, save the current user as revision author. - $entity->setRevisionCreationTime(REQUEST_TIME); - $entity->setRevisionUserId(\Drupal::currentUser()->id()); - } - else { - $entity->setNewRevision(FALSE); - } - $status = parent::save($form, $form_state); switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Contact Details.', [ + drupal_set_message($this->t('Created the %label Contact details.', [ '%label' => $entity->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Contact Details.', [ + drupal_set_message($this->t('Saved the %label Contact details.', [ '%label' => $entity->label(), ])); } diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php deleted file mode 100644 index 4aa9dae..0000000 --- a/modules/zencrm_entities/src/Form/ContactDetailsRevisionDeleteForm.php +++ /dev/null @@ -1,123 +0,0 @@ -ContactDetailsStorage = $entity_storage; - $this->connection = $connection; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); - return new static( - $entity_manager->getStorage('contact_details'), - $container->get('database') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'contact_details_revision_delete_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.contact_details.version_history', ['contact_details' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL) { - $this->revision = $this->ContactDetailsStorage->loadRevision($contact_details_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->ContactDetailsStorage->deleteRevision($this->revision->getRevisionId()); - - $this->logger('content')->notice('Contact Details: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Contact Details %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); - $form_state->setRedirect( - 'entity.contact_details.canonical', - ['contact_details' => $this->revision->id()] - ); - if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {contact_details_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { - $form_state->setRedirect( - 'entity.contact_details.version_history', - ['contact_details' => $this->revision->id()] - ); - } - } - -} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php deleted file mode 100644 index 6063050..0000000 --- a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertForm.php +++ /dev/null @@ -1,149 +0,0 @@ -ContactDetailsStorage = $entity_storage; - $this->dateFormatter = $date_formatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('contact_details'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'contact_details_revision_revert_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.contact_details.version_history', ['contact_details' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Revert'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return ''; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL) { - $this->revision = $this->ContactDetailsStorage->loadRevision($contact_details_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // The revision timestamp will be updated when the revision is saved. Keep - // the original one for the confirmation message. - $original_revision_timestamp = $this->revision->getRevisionCreationTime(); - - $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); - $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); - $this->revision->save(); - - $this->logger('content')->notice('Contact Details: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Contact Details %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); - $form_state->setRedirect( - 'entity.contact_details.version_history', - ['contact_details' => $this->revision->id()] - ); - } - - /** - * Prepares a revision to be reverted. - * - * @param \Drupal\zencrm_entities\Entity\ContactDetailsInterface $revision - * The revision to be reverted. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return \Drupal\zencrm_entities\Entity\ContactDetailsInterface - * The prepared revision ready to be stored. - */ - protected function prepareRevertedRevision(ContactDetailsInterface $revision, FormStateInterface $form_state) { - $revision->setNewRevision(); - $revision->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $revision; - } - -} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php deleted file mode 100644 index 2bcc6ff..0000000 --- a/modules/zencrm_entities/src/Form/ContactDetailsRevisionRevertTranslationForm.php +++ /dev/null @@ -1,115 +0,0 @@ -languageManager = $language_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('contact_details'), - $container->get('date.formatter'), - $container->get('language_manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'contact_details_revision_revert_translation_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $contact_details_revision = NULL, $langcode = NULL) { - $this->langcode = $langcode; - $form = parent::buildForm($form, $form_state, $contact_details_revision); - - $form['revert_untranslated_fields'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Revert content shared among translations'), - '#default_value' => FALSE, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - protected function prepareRevertedRevision(ContactDetailsInterface $revision, FormStateInterface $form_state) { - $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); - - /** @var \Drupal\zencrm_entities\Entity\ContactDetailsInterface $default_revision */ - $latest_revision = $this->ContactDetailsStorage->load($revision->id()); - $latest_revision_translation = $latest_revision->getTranslation($this->langcode); - - $revision_translation = $revision->getTranslation($this->langcode); - - foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { - if ($definition->isTranslatable() || $revert_untranslated_fields) { - $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); - } - } - - $latest_revision_translation->setNewRevision(); - $latest_revision_translation->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $latest_revision_translation; - } - -} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php b/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php index 315d7b5..44685a7 100644 --- a/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php +++ b/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php @@ -35,7 +35,7 @@ class ContactDetailsSettingsForm extends FormBase { } /** - * Defines the settings form for Contact Details entities. + * Defines the settings form for Contact details entities. * * @param array $form * An associative array containing the structure of the form. @@ -46,7 +46,7 @@ class ContactDetailsSettingsForm extends FormBase { * Form definition array. */ public function buildForm(array $form, FormStateInterface $form_state) { - $form['contactdetails_settings']['#markup'] = 'Settings form for Contact Details entities. Manage field settings here.'; + $form['contactdetails_settings']['#markup'] = 'Settings form for Contact details entities. Manage field settings here.'; return $form; } diff --git a/modules/zencrm_entities/templates/contact_details.html.twig b/modules/zencrm_entities/templates/contact_details.html.twig index 45a0307..64daa12 100644 --- a/modules/zencrm_entities/templates/contact_details.html.twig +++ b/modules/zencrm_entities/templates/contact_details.html.twig @@ -1,9 +1,9 @@ {# /** * @file contact_details.html.twig - * Default theme implementation to present Contact Details data. + * Default theme implementation to present Contact details data. * - * This template is used when viewing Contact Details pages. + * This template is used when viewing Contact details pages. * * * Available variables: diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index 4ea5048..d0a9b65 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -24,3 +24,8 @@ entity.person.add_form: title: 'Add Person' appears_on: - entity.person.collection +entity.contact_details.add_form: + route_name: entity.contact_details.add_form + title: 'Add Contact details' + appears_on: + - entity.contact_details.collection diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index c0332d5..3da7254 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -58,3 +58,17 @@ person.admin.structure.settings: description: 'Configure Person entities' route_name: person.settings parent: system.admin_structure + +# Contact details menu items definition +entity.contact_details.collection: + title: 'Contact details list' + route_name: entity.contact_details.collection + description: 'List Contact details entities' + parent: system.admin_structure + weight: 100 + +contact_details.admin.structure.settings: + title: 'Contact details settings' + description: 'Configure Contact details entities' + route_name: contact_details.settings + parent: system.admin_structure diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index 337fbc6..37a3aab 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -97,3 +97,25 @@ entity.person.delete_form: title: Delete weight: 10 +# Contact details routing definition +contact_details.settings_tab: + route_name: contact_details.settings + title: 'Settings' + base_route: contact_details.settings + +entity.contact_details.canonical: + route_name: entity.contact_details.canonical + base_route: entity.contact_details.canonical + title: 'View' + +entity.contact_details.edit_form: + route_name: entity.contact_details.edit_form + base_route: entity.contact_details.canonical + title: 'Edit' + +entity.contact_details.delete_form: + route_name: entity.contact_details.delete_form + base_route: entity.contact_details.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index e22ed16..7c26a82 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -107,3 +107,22 @@ view published person entities: view unpublished person entities: title: 'View unpublished Person entities' +add contact details entities: + title: 'Create new Contact details entities' + +administer contact details entities: + title: 'Administer Contact details entities' + description: 'Allow to access the administration form to configure Contact details entities.' + restrict access: true + +delete contact details entities: + title: 'Delete Contact details entities' + +edit contact details entities: + title: 'Edit Contact details entities' + +view published contact details entities: + title: 'View published Contact details entities' + +view unpublished contact details entities: + title: 'View unpublished Contact details entities' From 10b84fb208dd0e9bd1fc9158eb8d2e056452a359 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 11:44:47 +0200 Subject: [PATCH 28/94] Added base fields back into ContactDetails class --- .../src/Entity/ContactDetails.php | 184 +++++++++++++----- 1 file changed, 140 insertions(+), 44 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index dba5e21..3ec2266 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -37,7 +37,7 @@ use Drupal\user\UserInterface; * admin_permission = "administer contact details entities", * entity_keys = { * "id" = "id", - * "label" = "name", + * "label" = "type", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", @@ -150,58 +150,154 @@ class ContactDetails extends ContentEntityBase implements ContactDetailsInterfac $fields['user_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Contact details entity.')) - ->setRevisionable(TRUE) + ->setDescription(t('The user ID of author of the Contact Details entity.')) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ + # ->setDisplayOptions('view', [ + # 'label' => 'inline', + # 'type' => 'author', + # 'weight' => 100, + # ]) + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 100, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]) + ->setTranslatable(TRUE); + + + // Type field is used in entity reference fields etc + // so it is not exposed to user configuration. + $fields['type'] = BaseFieldDefinition::create('string') + ->setLabel(t('Type')) + ->setDescription(t('E.g. Home, Business, Temporary')) + ->setDisplayOptions('form', [ 'label' => 'hidden', - 'type' => 'author', + 'type' => 'text', 'weight' => 0, ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); - - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the Contact details entity.')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', + ->setDisplayOptions('view', array( + 'label' => 'hidden', 'type' => 'string', - 'weight' => -4, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) + 'weight' => 0, + )) ->setRequired(TRUE); + + // Person field is always set from the context so no form or display required. + $fields['person'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Person')) + ->setDescription(t('The person this profile is of.')) + ->setSetting('target_type', 'person') + ->setRequired(TRUE); + + // Type field is used for mailings, + // so it is not exposed to user configuration. + $fields['email'] = BaseFieldDefinition::create('string') + ->setLabel(t('Email Address')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 30, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'string', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 0, + )); + + $fields['phone'] = BaseFieldDefinition::create('string') + ->setLabel(t('Main Phone Number')) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 2, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 2, + )); + + $fields['phone2'] = BaseFieldDefinition::create('string') + ->setLabel(t('Alternative Phone Number')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 3, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 3, + )); + + $fields['postal_address'] = BaseFieldDefinition::create('string_long') + ->setLabel(t('Postal Address')) + ->setDescription(t('Full address, apart from post code.')) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 255, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'text', + 'weight' => 5, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textarea', + 'weight' => 5, + )); + + $fields['post_code'] = BaseFieldDefinition::create('string') + ->setLabel(t('Post Code')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 10, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => 6, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => 6, + )); + $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Contact details is published.')) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); + ->setLabel(t('Enabled')) + ->setDescription(t('If this is ticked then this set of contact details is active.')) + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) From 1e1bfe0ca9d3d1759bb19ec16a4b654aaf35bda0 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 11:51:14 +0200 Subject: [PATCH 29/94] removed profile files ready for regenerating as unrevisionable --- .../config/schema/profile_type.schema.yml | 12 - modules/zencrm_entities/profile.page.inc | 30 -- .../src/Controller/ProfileController.php | 163 ----------- .../zencrm_entities/src/Entity/Profile.php | 263 ------------------ .../src/Entity/ProfileInterface.php | 116 -------- .../src/Entity/ProfileType.php | 58 ---- .../src/Entity/ProfileTypeInterface.php | 13 - .../src/Entity/ProfileViewsData.php | 24 -- .../src/Form/ProfileDeleteForm.php | 15 - .../zencrm_entities/src/Form/ProfileForm.php | 71 ----- .../src/Form/ProfileRevisionDeleteForm.php | 123 -------- .../src/Form/ProfileRevisionRevertForm.php | 149 ---------- .../ProfileRevisionRevertTranslationForm.php | 115 -------- .../src/Form/ProfileSettingsForm.php | 53 ---- .../src/Form/ProfileTypeDeleteForm.php | 53 ---- .../src/Form/ProfileTypeForm.php | 65 ----- .../src/ProfileAccessControlHandler.php | 47 ---- .../src/ProfileHtmlRouteProvider.php | 196 ------------- .../src/ProfileListBuilder.php | 40 --- .../zencrm_entities/src/ProfileStorage.php | 58 ---- .../src/ProfileStorageInterface.php | 61 ---- .../src/ProfileTranslationHandler.php | 14 - .../src/ProfileTypeHtmlRouteProvider.php | 28 -- .../src/ProfileTypeListBuilder.php | 32 --- .../profile-content-add-list.html.twig | 23 -- .../templates/profile.html.twig | 22 -- 26 files changed, 1844 deletions(-) delete mode 100644 modules/zencrm_entities/config/schema/profile_type.schema.yml delete mode 100644 modules/zencrm_entities/profile.page.inc delete mode 100644 modules/zencrm_entities/src/Controller/ProfileController.php delete mode 100644 modules/zencrm_entities/src/Entity/Profile.php delete mode 100644 modules/zencrm_entities/src/Entity/ProfileInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/ProfileType.php delete mode 100644 modules/zencrm_entities/src/Entity/ProfileTypeInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/ProfileViewsData.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileSettingsForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileTypeDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ProfileTypeForm.php delete mode 100644 modules/zencrm_entities/src/ProfileAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/ProfileHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/ProfileListBuilder.php delete mode 100644 modules/zencrm_entities/src/ProfileStorage.php delete mode 100644 modules/zencrm_entities/src/ProfileStorageInterface.php delete mode 100644 modules/zencrm_entities/src/ProfileTranslationHandler.php delete mode 100644 modules/zencrm_entities/src/ProfileTypeHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/ProfileTypeListBuilder.php delete mode 100644 modules/zencrm_entities/templates/profile-content-add-list.html.twig delete mode 100644 modules/zencrm_entities/templates/profile.html.twig diff --git a/modules/zencrm_entities/config/schema/profile_type.schema.yml b/modules/zencrm_entities/config/schema/profile_type.schema.yml deleted file mode 100644 index ef343e5..0000000 --- a/modules/zencrm_entities/config/schema/profile_type.schema.yml +++ /dev/null @@ -1,12 +0,0 @@ -zencrm_entities.profile_type.*: - type: config_entity - label: 'Profile type config' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - uuid: - type: string diff --git a/modules/zencrm_entities/profile.page.inc b/modules/zencrm_entities/profile.page.inc deleted file mode 100644 index 8bbf578..0000000 --- a/modules/zencrm_entities/profile.page.inc +++ /dev/null @@ -1,30 +0,0 @@ -entityManager()->getStorage('profile')->loadRevision($profile_revision); - $view_builder = $this->entityManager()->getViewBuilder('profile'); - - return $view_builder->view($profile); - } - - /** - * Page title callback for a Profile revision. - * - * @param int $profile_revision - * The Profile revision ID. - * - * @return string - * The page title. - */ - public function revisionPageTitle($profile_revision) { - $profile = $this->entityManager()->getStorage('profile')->loadRevision($profile_revision); - return $this->t('Revision of %title from %date', ['%title' => $profile->label(), '%date' => format_date($profile->getRevisionCreationTime())]); - } - - /** - * Generates an overview table of older revisions of a Profile . - * - * @param \Drupal\zencrm_entities\Entity\ProfileInterface $profile - * A Profile object. - * - * @return array - * An array as expected by drupal_render(). - */ - public function revisionOverview(ProfileInterface $profile) { - $account = $this->currentUser(); - $langcode = $profile->language()->getId(); - $langname = $profile->language()->getName(); - $languages = $profile->getTranslationLanguages(); - $has_translations = (count($languages) > 1); - $profile_storage = $this->entityManager()->getStorage('profile'); - - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $profile->label()]) : $this->t('Revisions for %title', ['%title' => $profile->label()]); - $header = [$this->t('Revision'), $this->t('Operations')]; - - $revert_permission = (($account->hasPermission("revert all profile revisions") || $account->hasPermission('administer profile entities'))); - $delete_permission = (($account->hasPermission("delete all profile revisions") || $account->hasPermission('administer profile entities'))); - - $rows = []; - - $vids = $profile_storage->revisionIds($profile); - - $latest_revision = TRUE; - - foreach (array_reverse($vids) as $vid) { - /** @var \Drupal\zencrm_entities\ProfileInterface $revision */ - $revision = $profile_storage->loadRevision($vid); - // Only show revisions that are affected by the language that is being - // displayed. - if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { - $username = [ - '#theme' => 'username', - '#account' => $revision->getRevisionUser(), - ]; - - // Use revision link to link to revisions that are not active. - $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); - if ($vid != $profile->getRevisionId()) { - $link = $this->l($date, new Url('entity.profile.revision', ['profile' => $profile->id(), 'profile_revision' => $vid])); - } - else { - $link = $profile->link($date); - } - - $row = []; - $column = [ - 'data' => [ - '#type' => 'inline_template', - '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}

{{ message }}

{% endif %}', - '#context' => [ - 'date' => $link, - 'username' => \Drupal::service('renderer')->renderPlain($username), - 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], - ], - ], - ]; - $row[] = $column; - - if ($latest_revision) { - $row[] = [ - 'data' => [ - '#prefix' => '', - '#markup' => $this->t('Current revision'), - '#suffix' => '', - ], - ]; - foreach ($row as &$current) { - $current['class'] = ['revision-current']; - } - $latest_revision = FALSE; - } - else { - $links = []; - if ($revert_permission) { - $links['revert'] = [ - 'title' => $this->t('Revert'), - 'url' => $has_translations ? - Url::fromRoute('entity.profile.translation_revert', ['profile' => $profile->id(), 'profile_revision' => $vid, 'langcode' => $langcode]) : - Url::fromRoute('entity.profile.revision_revert', ['profile' => $profile->id(), 'profile_revision' => $vid]), - ]; - } - - if ($delete_permission) { - $links['delete'] = [ - 'title' => $this->t('Delete'), - 'url' => Url::fromRoute('entity.profile.revision_delete', ['profile' => $profile->id(), 'profile_revision' => $vid]), - ]; - } - - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#links' => $links, - ], - ]; - } - - $rows[] = $row; - } - } - - $build['profile_revisions_table'] = [ - '#theme' => 'table', - '#rows' => $rows, - '#header' => $header, - ]; - - return $build; - } - -} diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php deleted file mode 100644 index 67ff931..0000000 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ /dev/null @@ -1,263 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - protected function urlRouteParameters($rel) { - $uri_route_parameters = parent::urlRouteParameters($rel); - - if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) { - $uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId(); - } - - return $uri_route_parameters; - } - - /** - * {@inheritdoc} - */ - public function preSave(EntityStorageInterface $storage) { - parent::preSave($storage); - - foreach (array_keys($this->getTranslationLanguages()) as $langcode) { - $translation = $this->getTranslation($langcode); - - // If no owner has been set explicitly, make the anonymous user the owner. - if (!$translation->getOwner()) { - $translation->setOwnerId(0); - } - } - - // If no revision author has been set explicitly, make the profile owner the - // revision author. - if (!$this->getRevisionUser()) { - $this->setRevisionUserId($this->getOwnerId()); - } - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Profile entity.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - ->setTranslatable(TRUE); - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 5, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]); - - $fields['person'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Person')) - ->setDescription(t('The person this profile is of.')) - ->setSetting('target_type', 'person'); - - // This field is computed in a presave hook. - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of this profile instance.')) - ->setRevisionable(TRUE); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Profile is published.')) - ->setRevisionable(TRUE) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Revision translation affected')) - ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) - ->setReadOnly(TRUE) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/ProfileInterface.php b/modules/zencrm_entities/src/Entity/ProfileInterface.php deleted file mode 100644 index 382bd0a..0000000 --- a/modules/zencrm_entities/src/Entity/ProfileInterface.php +++ /dev/null @@ -1,116 +0,0 @@ -entity->isNew()) { - $form['new_revision'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Create new revision'), - '#default_value' => FALSE, - '#weight' => 10, - ]; - } - - $entity = $this->entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - // Save as a new revision if requested to do so. - if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { - $entity->setNewRevision(); - - // If a new revision is created, save the current user as revision author. - $entity->setRevisionCreationTime(REQUEST_TIME); - $entity->setRevisionUserId(\Drupal::currentUser()->id()); - } - else { - $entity->setNewRevision(FALSE); - } - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Profile.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Profile.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.profile.canonical', ['profile' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php deleted file mode 100644 index 6d38c90..0000000 --- a/modules/zencrm_entities/src/Form/ProfileRevisionDeleteForm.php +++ /dev/null @@ -1,123 +0,0 @@ -ProfileStorage = $entity_storage; - $this->connection = $connection; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); - return new static( - $entity_manager->getStorage('profile'), - $container->get('database') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'profile_revision_delete_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.profile.version_history', ['profile' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL) { - $this->revision = $this->ProfileStorage->loadRevision($profile_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->ProfileStorage->deleteRevision($this->revision->getRevisionId()); - - $this->logger('content')->notice('Profile: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Profile %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); - $form_state->setRedirect( - 'entity.profile.canonical', - ['profile' => $this->revision->id()] - ); - if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {profile_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { - $form_state->setRedirect( - 'entity.profile.version_history', - ['profile' => $this->revision->id()] - ); - } - } - -} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php deleted file mode 100644 index e43516c..0000000 --- a/modules/zencrm_entities/src/Form/ProfileRevisionRevertForm.php +++ /dev/null @@ -1,149 +0,0 @@ -ProfileStorage = $entity_storage; - $this->dateFormatter = $date_formatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('profile'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'profile_revision_revert_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.profile.version_history', ['profile' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Revert'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return ''; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL) { - $this->revision = $this->ProfileStorage->loadRevision($profile_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // The revision timestamp will be updated when the revision is saved. Keep - // the original one for the confirmation message. - $original_revision_timestamp = $this->revision->getRevisionCreationTime(); - - $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); - $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); - $this->revision->save(); - - $this->logger('content')->notice('Profile: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Profile %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); - $form_state->setRedirect( - 'entity.profile.version_history', - ['profile' => $this->revision->id()] - ); - } - - /** - * Prepares a revision to be reverted. - * - * @param \Drupal\zencrm_entities\Entity\ProfileInterface $revision - * The revision to be reverted. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return \Drupal\zencrm_entities\Entity\ProfileInterface - * The prepared revision ready to be stored. - */ - protected function prepareRevertedRevision(ProfileInterface $revision, FormStateInterface $form_state) { - $revision->setNewRevision(); - $revision->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $revision; - } - -} diff --git a/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php b/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php deleted file mode 100644 index 66c672d..0000000 --- a/modules/zencrm_entities/src/Form/ProfileRevisionRevertTranslationForm.php +++ /dev/null @@ -1,115 +0,0 @@ -languageManager = $language_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('profile'), - $container->get('date.formatter'), - $container->get('language_manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'profile_revision_revert_translation_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $profile_revision = NULL, $langcode = NULL) { - $this->langcode = $langcode; - $form = parent::buildForm($form, $form_state, $profile_revision); - - $form['revert_untranslated_fields'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Revert content shared among translations'), - '#default_value' => FALSE, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - protected function prepareRevertedRevision(ProfileInterface $revision, FormStateInterface $form_state) { - $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); - - /** @var \Drupal\zencrm_entities\Entity\ProfileInterface $default_revision */ - $latest_revision = $this->ProfileStorage->load($revision->id()); - $latest_revision_translation = $latest_revision->getTranslation($this->langcode); - - $revision_translation = $revision->getTranslation($this->langcode); - - foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { - if ($definition->isTranslatable() || $revert_untranslated_fields) { - $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); - } - } - - $latest_revision_translation->setNewRevision(); - $latest_revision_translation->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $latest_revision_translation; - } - -} diff --git a/modules/zencrm_entities/src/Form/ProfileSettingsForm.php b/modules/zencrm_entities/src/Form/ProfileSettingsForm.php deleted file mode 100644 index e077fc7..0000000 --- a/modules/zencrm_entities/src/Form/ProfileSettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.profile_type.collection'); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return $this->t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - - drupal_set_message( - $this->t('content @type: deleted @label.', - [ - '@type' => $this->entity->bundle(), - '@label' => $this->entity->label(), - ] - ) - ); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - -} diff --git a/modules/zencrm_entities/src/Form/ProfileTypeForm.php b/modules/zencrm_entities/src/Form/ProfileTypeForm.php deleted file mode 100644 index 091b9fa..0000000 --- a/modules/zencrm_entities/src/Form/ProfileTypeForm.php +++ /dev/null @@ -1,65 +0,0 @@ -entity; - $form['label'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#maxlength' => 255, - '#default_value' => $profile_type->label(), - '#description' => $this->t("Label for the Profile type."), - '#required' => TRUE, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => $profile_type->id(), - '#machine_name' => [ - 'exists' => '\Drupal\zencrm_entities\Entity\ProfileType::load', - ], - '#disabled' => !$profile_type->isNew(), - ]; - - /* You will need additional form elements for your custom properties. */ - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $profile_type = $this->entity; - $status = $profile_type->save(); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Profile type.', [ - '%label' => $profile_type->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Profile type.', [ - '%label' => $profile_type->label(), - ])); - } - $form_state->setRedirectUrl($profile_type->toUrl('collection')); - } - -} diff --git a/modules/zencrm_entities/src/ProfileAccessControlHandler.php b/modules/zencrm_entities/src/ProfileAccessControlHandler.php deleted file mode 100644 index 0eac19c..0000000 --- a/modules/zencrm_entities/src/ProfileAccessControlHandler.php +++ /dev/null @@ -1,47 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished profile entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published profile entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit profile entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete profile entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add profile entities'); - } - -} diff --git a/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php b/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php deleted file mode 100644 index de8faf0..0000000 --- a/modules/zencrm_entities/src/ProfileHtmlRouteProvider.php +++ /dev/null @@ -1,196 +0,0 @@ -id(); - - if ($history_route = $this->getHistoryRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.version_history", $history_route); - } - - if ($revision_route = $this->getRevisionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision", $revision_route); - } - - if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); - } - - if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); - } - - if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); - } - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the version history route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getHistoryRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('version-history')) { - $route = new Route($entity_type->getLinkTemplate('version-history')); - $route - ->setDefaults([ - '_title' => "{$entity_type->getLabel()} revisions", - '_controller' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionOverview', - ]) - ->setRequirement('_permission', 'access profile revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision')) { - $route = new Route($entity_type->getLinkTemplate('revision')); - $route - ->setDefaults([ - '_controller' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionShow', - '_title_callback' => '\Drupal\zencrm_entities\Controller\ProfileController::revisionPageTitle', - ]) - ->setRequirement('_permission', 'access profile revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_revert')) { - $route = new Route($entity_type->getLinkTemplate('revision_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionRevertForm', - '_title' => 'Revert to earlier revision', - ]) - ->setRequirement('_permission', 'revert all profile revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision delete route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_delete')) { - $route = new Route($entity_type->getLinkTemplate('revision_delete')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionDeleteForm', - '_title' => 'Delete earlier revision', - ]) - ->setRequirement('_permission', 'delete all profile revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision translation revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('translation_revert')) { - $route = new Route($entity_type->getLinkTemplate('translation_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\zencrm_entities\Form\ProfileRevisionRevertTranslationForm', - '_title' => 'Revert to earlier revision of a translation', - ]) - ->setRequirement('_permission', 'revert all profile revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\ProfileSettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/ProfileListBuilder.php b/modules/zencrm_entities/src/ProfileListBuilder.php deleted file mode 100644 index 93ae336..0000000 --- a/modules/zencrm_entities/src/ProfileListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Profile ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\Profile */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.profile.edit_form', - ['profile' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/ProfileStorage.php b/modules/zencrm_entities/src/ProfileStorage.php deleted file mode 100644 index 0be322b..0000000 --- a/modules/zencrm_entities/src/ProfileStorage.php +++ /dev/null @@ -1,58 +0,0 @@ -database->query( - 'SELECT vid FROM {profile_revision} WHERE id=:id ORDER BY vid', - [':id' => $entity->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function userRevisionIds(AccountInterface $account) { - return $this->database->query( - 'SELECT vid FROM {profile_field_revision} WHERE uid = :uid ORDER BY vid', - [':uid' => $account->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function countDefaultLanguageRevisions(ProfileInterface $entity) { - return $this->database->query('SELECT COUNT(*) FROM {profile_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) - ->fetchField(); - } - - /** - * {@inheritdoc} - */ - public function clearRevisionsLanguage(LanguageInterface $language) { - return $this->database->update('profile_revision') - ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) - ->condition('langcode', $language->getId()) - ->execute(); - } - -} diff --git a/modules/zencrm_entities/src/ProfileStorageInterface.php b/modules/zencrm_entities/src/ProfileStorageInterface.php deleted file mode 100644 index 96a7d6f..0000000 --- a/modules/zencrm_entities/src/ProfileStorageInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -t('Profile type'); - $header['id'] = $this->t('Machine name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - $row['label'] = $entity->label(); - $row['id'] = $entity->id(); - // You probably want a few more properties here... - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/templates/profile-content-add-list.html.twig b/modules/zencrm_entities/templates/profile-content-add-list.html.twig deleted file mode 100644 index e0e7f1d..0000000 --- a/modules/zencrm_entities/templates/profile-content-add-list.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Default theme implementation to present a list of custom content entity types/bundles. - * - * Available variables: - * - types: A collection of all the available custom entity types/bundles. - * Each type/bundle contains the following: - * - link: A link to add a content entity of this type. - * - description: A description of this content entity types/bundle. - * - * @see template_preprocess_profile_content_add_list() - * - * @ingroup themeable - */ -#} -{% spaceless %} -
- {% for type in types %} -
{{ type.link }}
- {% endfor %} -
-{% endspaceless %} diff --git a/modules/zencrm_entities/templates/profile.html.twig b/modules/zencrm_entities/templates/profile.html.twig deleted file mode 100644 index e244ec6..0000000 --- a/modules/zencrm_entities/templates/profile.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file profile.html.twig - * Default theme implementation to present Profile data. - * - * This template is used when viewing Profile pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_profile() - * - * @ingroup themeable - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - From a48e37ad396d82de69267eb3f91dda8ccbfb70c1 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 12:18:27 +0200 Subject: [PATCH 30/94] Changed name of Profile entity to Hat so as not to conflict with Profile or Profile2 module on existing sites --- .../config/schema/hat_type.schema.yml | 12 + modules/zencrm_entities/hat.page.inc | 30 +++ .../src/Entity/ContactDetails.php | 2 +- modules/zencrm_entities/src/Entity/Hat.php | 210 ++++++++++++++++++ .../src/Entity/HatInterface.php | 77 +++++++ .../zencrm_entities/src/Entity/HatType.php | 58 +++++ .../src/Entity/HatTypeInterface.php | 13 ++ .../src/Entity/HatViewsData.php | 24 ++ .../src/Form/HatDeleteForm.php | 15 ++ modules/zencrm_entities/src/Form/HatForm.php | 50 +++++ .../src/Form/HatSettingsForm.php | 53 +++++ .../src/Form/HatTypeDeleteForm.php | 53 +++++ .../zencrm_entities/src/Form/HatTypeForm.php | 65 ++++++ .../src/HatAccessControlHandler.php | 47 ++++ .../src/HatHtmlRouteProvider.php | 56 +++++ .../zencrm_entities/src/HatListBuilder.php | 40 ++++ .../src/HatTranslationHandler.php | 14 ++ .../src/HatTypeHtmlRouteProvider.php | 28 +++ .../src/HatTypeListBuilder.php | 32 +++ .../templates/hat-content-add-list.html.twig | 23 ++ .../zencrm_entities/templates/hat.html.twig | 22 ++ .../zencrm_entities.links.action.yml | 21 +- .../zencrm_entities.links.menu.yml | 36 +-- .../zencrm_entities.links.task.yml | 41 ++-- .../zencrm_entities/zencrm_entities.module | 28 +-- .../zencrm_entities.permissions.yml | 50 ++--- ...rofileController.php => HatController.php} | 10 +- .../{ProfileCreator.php => HatCreator.php} | 22 +- zencrm.routing.yml | 8 +- 29 files changed, 1024 insertions(+), 116 deletions(-) create mode 100644 modules/zencrm_entities/config/schema/hat_type.schema.yml create mode 100644 modules/zencrm_entities/hat.page.inc create mode 100644 modules/zencrm_entities/src/Entity/Hat.php create mode 100644 modules/zencrm_entities/src/Entity/HatInterface.php create mode 100644 modules/zencrm_entities/src/Entity/HatType.php create mode 100644 modules/zencrm_entities/src/Entity/HatTypeInterface.php create mode 100644 modules/zencrm_entities/src/Entity/HatViewsData.php create mode 100644 modules/zencrm_entities/src/Form/HatDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/HatForm.php create mode 100644 modules/zencrm_entities/src/Form/HatSettingsForm.php create mode 100644 modules/zencrm_entities/src/Form/HatTypeDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/HatTypeForm.php create mode 100644 modules/zencrm_entities/src/HatAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/HatHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/HatListBuilder.php create mode 100644 modules/zencrm_entities/src/HatTranslationHandler.php create mode 100644 modules/zencrm_entities/src/HatTypeHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/HatTypeListBuilder.php create mode 100644 modules/zencrm_entities/templates/hat-content-add-list.html.twig create mode 100644 modules/zencrm_entities/templates/hat.html.twig rename src/Controller/{ProfileController.php => HatController.php} (67%) rename src/Plugin/Block/{ProfileCreator.php => HatCreator.php} (50%) diff --git a/modules/zencrm_entities/config/schema/hat_type.schema.yml b/modules/zencrm_entities/config/schema/hat_type.schema.yml new file mode 100644 index 0000000..a35a59d --- /dev/null +++ b/modules/zencrm_entities/config/schema/hat_type.schema.yml @@ -0,0 +1,12 @@ +zencrm_entities.hat_type.*: + type: config_entity + label: 'Hat type config' + mapping: + id: + type: string + label: 'ID' + label: + type: label + label: 'Label' + uuid: + type: string diff --git a/modules/zencrm_entities/hat.page.inc b/modules/zencrm_entities/hat.page.inc new file mode 100644 index 0000000..fc43680 --- /dev/null +++ b/modules/zencrm_entities/hat.page.inc @@ -0,0 +1,30 @@ +setLabel(t('Person')) - ->setDescription(t('The person this profile is of.')) + ->setDescription(t('The person this set of contact details is for.')) ->setSetting('target_type', 'person') ->setRequired(TRUE); diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php new file mode 100644 index 0000000..8c0243e --- /dev/null +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -0,0 +1,210 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of the author.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE); + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 5, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]); + + // This field is always implied from the context, + // so has no form or view display. + $fields['person'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Person')) + ->setDescription(t('The person this hat is of.')) + ->setSetting('target_type', 'person'); + + // This field is computed in a presave hook, and used for entity reference + // options when selecting a person for involvement in a case etc. + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of this hat instance as it appears in entity reference fields.')); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Hat is published.')) + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); + + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/HatInterface.php b/modules/zencrm_entities/src/Entity/HatInterface.php new file mode 100644 index 0000000..477a903 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/HatInterface.php @@ -0,0 +1,77 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Hat.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Hat.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.hat.canonical', ['hat' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/HatSettingsForm.php b/modules/zencrm_entities/src/Form/HatSettingsForm.php new file mode 100644 index 0000000..60a800b --- /dev/null +++ b/modules/zencrm_entities/src/Form/HatSettingsForm.php @@ -0,0 +1,53 @@ +t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.hat_type.collection'); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return $this->t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->entity->delete(); + + drupal_set_message( + $this->t('content @type: deleted @label.', + [ + '@type' => $this->entity->bundle(), + '@label' => $this->entity->label(), + ] + ) + ); + + $form_state->setRedirectUrl($this->getCancelUrl()); + } + +} diff --git a/modules/zencrm_entities/src/Form/HatTypeForm.php b/modules/zencrm_entities/src/Form/HatTypeForm.php new file mode 100644 index 0000000..9ec51dd --- /dev/null +++ b/modules/zencrm_entities/src/Form/HatTypeForm.php @@ -0,0 +1,65 @@ +entity; + $form['label'] = [ + '#type' => 'textfield', + '#title' => $this->t('Label'), + '#maxlength' => 255, + '#default_value' => $hat_type->label(), + '#description' => $this->t("Label for the Hat type."), + '#required' => TRUE, + ]; + + $form['id'] = [ + '#type' => 'machine_name', + '#default_value' => $hat_type->id(), + '#machine_name' => [ + 'exists' => '\Drupal\zencrm_entities\Entity\HatType::load', + ], + '#disabled' => !$hat_type->isNew(), + ]; + + /* You will need additional form elements for your custom properties. */ + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $hat_type = $this->entity; + $status = $hat_type->save(); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Hat type.', [ + '%label' => $hat_type->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Hat type.', [ + '%label' => $hat_type->label(), + ])); + } + $form_state->setRedirectUrl($hat_type->toUrl('collection')); + } + +} diff --git a/modules/zencrm_entities/src/HatAccessControlHandler.php b/modules/zencrm_entities/src/HatAccessControlHandler.php new file mode 100644 index 0000000..08b91f2 --- /dev/null +++ b/modules/zencrm_entities/src/HatAccessControlHandler.php @@ -0,0 +1,47 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished hat entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published hat entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit hat entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete hat entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add hat entities'); + } + +} diff --git a/modules/zencrm_entities/src/HatHtmlRouteProvider.php b/modules/zencrm_entities/src/HatHtmlRouteProvider.php new file mode 100644 index 0000000..0cda5ca --- /dev/null +++ b/modules/zencrm_entities/src/HatHtmlRouteProvider.php @@ -0,0 +1,56 @@ +id(); + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\HatSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/HatListBuilder.php b/modules/zencrm_entities/src/HatListBuilder.php new file mode 100644 index 0000000..68af059 --- /dev/null +++ b/modules/zencrm_entities/src/HatListBuilder.php @@ -0,0 +1,40 @@ +t('Hat ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\Hat */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.hat.edit_form', + ['hat' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/HatTranslationHandler.php b/modules/zencrm_entities/src/HatTranslationHandler.php new file mode 100644 index 0000000..63267a2 --- /dev/null +++ b/modules/zencrm_entities/src/HatTranslationHandler.php @@ -0,0 +1,14 @@ +t('Hat type'); + $header['id'] = $this->t('Machine name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $row['label'] = $entity->label(); + $row['id'] = $entity->id(); + // You probably want a few more properties here... + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/templates/hat-content-add-list.html.twig b/modules/zencrm_entities/templates/hat-content-add-list.html.twig new file mode 100644 index 0000000..1ae94e5 --- /dev/null +++ b/modules/zencrm_entities/templates/hat-content-add-list.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Default theme implementation to present a list of custom content entity types/bundles. + * + * Available variables: + * - types: A collection of all the available custom entity types/bundles. + * Each type/bundle contains the following: + * - link: A link to add a content entity of this type. + * - description: A description of this content entity types/bundle. + * + * @see template_preprocess_hat_content_add_list() + * + * @ingroup themeable + */ +#} +{% spaceless %} +
+ {% for type in types %} +
{{ type.link }}
+ {% endfor %} +
+{% endspaceless %} diff --git a/modules/zencrm_entities/templates/hat.html.twig b/modules/zencrm_entities/templates/hat.html.twig new file mode 100644 index 0000000..827d6b5 --- /dev/null +++ b/modules/zencrm_entities/templates/hat.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file hat.html.twig + * Default theme implementation to present Hat data. + * + * This template is used when viewing Hat pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_hat() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index d0a9b65..4c53da0 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -3,16 +3,6 @@ entity.person.add_form: title: 'Add Person' appears_on: - entity.person.collection -entity.profile.add_form: - route_name: entity.profile.add_page - title: 'Add Profile' - appears_on: - - entity.profile.collection -entity.profile_type.add_form: - route_name: entity.profile_type.add_form - title: 'Add Profile type' - appears_on: - - entity.profile_type.collection entity.contact_details.add_form: route_name: entity.contact_details.add_form @@ -29,3 +19,14 @@ entity.contact_details.add_form: title: 'Add Contact details' appears_on: - entity.contact_details.collection +entity.hat.add_form: + route_name: entity.hat.add_page + title: 'Add Hat' + appears_on: + - entity.hat.collection +entity.hat_type.add_form: + route_name: entity.hat_type.add_form + title: 'Add Hat type' + appears_on: + - entity.hat_type.collection + diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index 3da7254..fbbedb5 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -13,24 +13,6 @@ person.admin.structure.settings: route_name: person.settings parent: system.admin_structure -# Profile menu items definition -entity.profile.collection: - title: 'Profile list' - route_name: entity.profile.collection - description: 'List Profile entities' - parent: system.admin_structure - weight: 100 - - -# Profile type menu items definition -entity.profile_type.collection: - title: 'Profile type' - route_name: entity.profile_type.collection - description: 'List Profile type (bundles)' - parent: system.admin_structure - weight: 99 - - # Contact Details menu items definition entity.contact_details.collection: title: 'Contact Details list' @@ -72,3 +54,21 @@ contact_details.admin.structure.settings: description: 'Configure Contact details entities' route_name: contact_details.settings parent: system.admin_structure + +# Hat menu items definition +entity.hat.collection: + title: 'Hat list' + route_name: entity.hat.collection + description: 'List Hat entities' + parent: system.admin_structure + weight: 100 + + +# Hat type menu items definition +entity.hat_type.collection: + title: 'Hat type' + route_name: entity.hat_type.collection + description: 'List Hat type (bundles)' + parent: system.admin_structure + weight: 99 + diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index 37a3aab..012bc0e 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -25,29 +25,6 @@ entity.person.delete_form: title: Delete weight: 10 -# Profile routing definition - -entity.profile.canonical: - route_name: entity.profile.canonical - base_route: entity.profile.canonical - title: 'View' - -entity.profile.edit_form: - route_name: entity.profile.edit_form - base_route: entity.profile.canonical - title: 'Edit' - -entity.profile.version_history: - route_name: entity.profile.version_history - base_route: entity.profile.canonical - title: 'Revisions' - -entity.profile.delete_form: - route_name: entity.profile.delete_form - base_route: entity.profile.canonical - title: Delete - weight: 10 - # Contact Details routing definition contact_details.settings_tab: route_name: contact_details.settings @@ -119,3 +96,21 @@ entity.contact_details.delete_form: title: Delete weight: 10 +# Hat routing definition + +entity.hat.canonical: + route_name: entity.hat.canonical + base_route: entity.hat.canonical + title: 'View' + +entity.hat.edit_form: + route_name: entity.hat.edit_form + base_route: entity.hat.canonical + title: 'Edit' + +entity.hat.delete_form: + route_name: entity.hat.delete_form + base_route: entity.hat.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index c847905..7a77cf4 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -29,9 +29,9 @@ function zencrm_entities_person_presave($entity) { /** * Implements hook_ENTITY_TYPE_presave(). * Computes the name field from the full name of the referenced person - * plus the profile type. + * plus the hat type. */ -function zencrm_entities_profile_presave($entity) { +function zencrm_entities_hat_presave($entity) { $person_id = $entity->person->first()->getValue()['target_id']; $person = \Drupal\zencrm_entities\Entity\Person::load($person_id); $full_name = $person->full_name->getString(); @@ -64,15 +64,15 @@ function zencrm_entities_theme() { $theme['zencrm_entities'] = [ 'render element' => 'children', ]; - $theme['profile'] = [ + $theme['hat'] = [ 'render element' => 'elements', - 'file' => 'profile.page.inc', - 'template' => 'profile', + 'file' => 'hat.page.inc', + 'template' => 'hat', ]; - $theme['profile_content_add_list'] = [ + $theme['hat_content_add_list'] = [ 'render element' => 'content', 'variables' => ['content' => NULL], - 'file' => 'profile.page.inc', + 'file' => 'hat.page.inc', ]; return $theme; } @@ -80,15 +80,15 @@ function zencrm_entities_theme() { /** * Implements hook_theme_suggestions_HOOK(). */ -function zencrm_entities_theme_suggestions_profile(array $variables) { +function zencrm_entities_theme_suggestions_hat(array $variables) { $suggestions = []; - $entity = $variables['elements']['#profile']; + $entity = $variables['elements']['#hat']; $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); - $suggestions[] = 'profile__' . $sanitized_view_mode; - $suggestions[] = 'profile__' . $entity->bundle(); - $suggestions[] = 'profile__' . $entity->bundle() . '__' . $sanitized_view_mode; - $suggestions[] = 'profile__' . $entity->id(); - $suggestions[] = 'profile__' . $entity->id() . '__' . $sanitized_view_mode; + $suggestions[] = 'hat__' . $sanitized_view_mode; + $suggestions[] = 'hat__' . $entity->bundle(); + $suggestions[] = 'hat__' . $entity->bundle() . '__' . $sanitized_view_mode; + $suggestions[] = 'hat__' . $entity->id(); + $suggestions[] = 'hat__' . $entity->id() . '__' . $sanitized_view_mode; return $suggestions; } diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 7c26a82..486c58d 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -28,36 +28,6 @@ revert all person revisions: delete all person revisions: title: 'Delete all revisions' description: 'Role requires permission to view Person revisions and delete rights for person entities in question or administer person entities.' -add profile entities: - title: 'Create new Profile entities' - -administer profile entities: - title: 'Administer Profile entities' - description: 'Allow to access the administration form to configure Profile entities.' - restrict access: true - -delete profile entities: - title: 'Delete Profile entities' - -edit profile entities: - title: 'Edit Profile entities' - -view published profile entities: - title: 'View published Profile entities' - -view unpublished profile entities: - title: 'View unpublished Profile entities' - -view all profile revisions: - title: 'View all Profile revisions' - -revert all profile revisions: - title: 'Revert all Profile revisions' - description: 'Role requires permission view Profile revisions and edit rights for profile entities in question or administer profile entities.' - -delete all profile revisions: - title: 'Delete all revisions' - description: 'Role requires permission to view Profile revisions and delete rights for profile entities in question or administer profile entities.' add contact details entities: title: 'Create new Contact Details entities' @@ -126,3 +96,23 @@ view published contact details entities: view unpublished contact details entities: title: 'View unpublished Contact details entities' + +add hat entities: + title: 'Create new Hat entities' + +administer hat entities: + title: 'Administer Hat entities' + description: 'Allow to access the administration form to configure Hat entities.' + restrict access: true + +delete hat entities: + title: 'Delete Hat entities' + +edit hat entities: + title: 'Edit Hat entities' + +view published hat entities: + title: 'View published Hat entities' + +view unpublished hat entities: + title: 'View unpublished Hat entities' diff --git a/src/Controller/ProfileController.php b/src/Controller/HatController.php similarity index 67% rename from src/Controller/ProfileController.php rename to src/Controller/HatController.php index 82661e4..26d4b1b 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/HatController.php @@ -5,9 +5,9 @@ namespace Drupal\zencrm\Controller; use Drupal\Core\Controller\ControllerBase; /** - * Class ProfileController. + * Class HatController. */ -class ProfileController extends ControllerBase { +class HatController extends ControllerBase { /** * Hello. @@ -15,18 +15,18 @@ class ProfileController extends ControllerBase { * @return string * Return Hello string. */ - public function createProfileForPerson($type, $person_id) { + public function createHatForPerson($type, $person_id) { $values = array( 'type' => $type, 'person' => $person_id ); $node = \Drupal::entityTypeManager() - ->getStorage('profile') + ->getStorage('hat') ->create($values); $form = \Drupal::entityTypeManager() - ->getFormObject('profile', 'default') + ->getFormObject('hat', 'default') ->setEntity($node); return \Drupal::formBuilder()->getForm($form); } diff --git a/src/Plugin/Block/ProfileCreator.php b/src/Plugin/Block/HatCreator.php similarity index 50% rename from src/Plugin/Block/ProfileCreator.php rename to src/Plugin/Block/HatCreator.php index b6d11ef..79747d9 100644 --- a/src/Plugin/Block/ProfileCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -5,14 +5,14 @@ namespace Drupal\zencrm\Plugin\Block; use Drupal\Core\Block\BlockBase; /** - * Provides a 'ProfileCreator' block. + * Provides a 'HatCreator' block. * * @Block( - * id = "profile_creator", - * admin_label = @Translation("Profile creator"), + * id = "hat_creator", + * admin_label = @Translation("Hat creator"), * ) */ -class ProfileCreator extends BlockBase { +class HatCreator extends BlockBase { /** * {@inheritdoc} @@ -21,15 +21,15 @@ class ProfileCreator extends BlockBase { $person_id = \Drupal::routeMatch()->getParameter('person')->id(); $markup = ""; - // Only offer profile creation on profiles they don't already have. - $profile_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('profile'); - foreach($profile_types as $id => $type) { - $profiles = \Drupal::entityTypeManager() - ->getStorage('profile') + // Only offer hat creation on hats they don't already have. + $hat_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('hat'); + foreach($hat_types as $id => $type) { + $hats = \Drupal::entityTypeManager() + ->getStorage('hat') ->loadByProperties(['type' => $id, 'person' => $person_id]); - if (!reset($profiles)) { + if (!reset($hats)) { $label = $type['label']; - $markup .= "

Create $label Profile

"; + $markup .= "

Create $label Hat

"; } } return [ diff --git a/zencrm.routing.yml b/zencrm.routing.yml index 256f6be..3cfef4d 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -1,7 +1,7 @@ -zencrm.profile.create: - path: '/zencrm/profile/add/{type}/{person_id}' +zencrm.hat.create: + path: '/zencrm/hat/add/{type}/{person_id}' defaults: - _controller: '\Drupal\zencrm\Controller\ProfileController::createProfileForPerson' - _title: 'Add New Profile' + _controller: '\Drupal\zencrm\Controller\HatController::createHatForPerson' + _title: 'Add New Hat' requirements: _permission: 'access content' From cf0d928423ba27c2ec7e0f6af6ec6bf5e6dbcf60 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 12:39:39 +0200 Subject: [PATCH 31/94] Changing routes back after they got changed when regenerating entities --- modules/zencrm_entities/src/Entity/Person.php | 8 ++++---- modules/zencrm_entities/zencrm_entities.links.task.yml | 10 ---------- modules/zencrm_entities/zencrm_entities.module | 3 --- src/Plugin/Block/HatCreator.php | 2 ++ 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Person.php b/modules/zencrm_entities/src/Entity/Person.php index 2d9eb97..c7950fa 100644 --- a/modules/zencrm_entities/src/Entity/Person.php +++ b/modules/zencrm_entities/src/Entity/Person.php @@ -44,10 +44,10 @@ use Drupal\user\UserInterface; * "status" = "status", * }, * links = { - * "canonical" = "/admin/structure/person/{person}", - * "add-form" = "/admin/structure/person/add", - * "edit-form" = "/admin/structure/person/{person}/edit", - * "delete-form" = "/admin/structure/person/{person}/delete", + * "canonical" = "/zencrm/person/{person}", + * "add-form" = "/zencrm/person/add", + * "edit-form" = "/zencrm/person/{person}/edit", + * "delete-form" = "/zencrm/person/{person}/delete", * "collection" = "/admin/structure/person", * }, * field_ui_base_route = "person.settings" diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index 012bc0e..0545d15 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -14,11 +14,6 @@ entity.person.edit_form: base_route: entity.person.canonical title: 'Edit' -entity.person.version_history: - route_name: entity.person.version_history - base_route: entity.person.canonical - title: 'Revisions' - entity.person.delete_form: route_name: entity.person.delete_form base_route: entity.person.canonical @@ -41,11 +36,6 @@ entity.contact_details.edit_form: base_route: entity.contact_details.canonical title: 'Edit' -entity.contact_details.version_history: - route_name: entity.contact_details.version_history - base_route: entity.contact_details.canonical - title: 'Revisions' - entity.contact_details.delete_form: route_name: entity.contact_details.delete_form base_route: entity.contact_details.canonical diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 7a77cf4..7228358 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -10,7 +10,6 @@ use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_ENTITY_TYPE_presave(). * Computes the full_name field from first_name middle_names and last_name. - * Computes the first_and_last_name field from first_name and last_name. */ function zencrm_entities_person_presave($entity) { $first_name = $entity->first_name->getString(); @@ -19,10 +18,8 @@ function zencrm_entities_person_presave($entity) { if ($middle_names) { $middle_names .= ' '; } - $first_and_last_name = $first_name . ' ' . $last_name; $full_name = $first_name . ' ' . $middle_names . $last_name; $entity->set('full_name', $full_name); - $entity->set('first_and_last_name', $first_and_last_name); } diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index 79747d9..f189a5a 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -6,6 +6,8 @@ use Drupal\Core\Block\BlockBase; /** * Provides a 'HatCreator' block. + * Block contains links for creating hats of types that the person does not already have. + * The links open an entity create form in a popup. * * @Block( * id = "hat_creator", From 2725a5b27e4671ea2c9f4117e23debdc018498b0 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 12:44:28 +0200 Subject: [PATCH 32/94] Added HatCreator block placement to config. --- config/install/block.block.hatcreator.yml | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 config/install/block.block.hatcreator.yml diff --git a/config/install/block.block.hatcreator.yml b/config/install/block.block.hatcreator.yml new file mode 100644 index 0000000..0156ebe --- /dev/null +++ b/config/install/block.block.hatcreator.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + module: + - system + - zencrm + theme: + - bartik +id: hatcreator +theme: bartik +region: content +weight: 0 +provider: null +plugin: hat_creator +settings: + id: hat_creator + label: 'Hat creator' + provider: zencrm + label_display: visible +visibility: + request_path: + id: request_path + pages: '/zencrm/person/*' + negate: false + context_mapping: { } From 0ec801a42c6b0764009bc75b89e4b588a50abed0 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 12:46:17 +0200 Subject: [PATCH 33/94] Changed path for adding hat type to /zencrm The policy is that all paths (added by the module) that the hosted user will access should start with that. --- modules/zencrm_entities/src/Entity/HatType.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/HatType.php b/modules/zencrm_entities/src/Entity/HatType.php index 65b7944..5c7547c 100644 --- a/modules/zencrm_entities/src/Entity/HatType.php +++ b/modules/zencrm_entities/src/Entity/HatType.php @@ -31,11 +31,11 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase; * "uuid" = "uuid" * }, * links = { - * "canonical" = "/admin/structure/hat_type/{hat_type}", - * "add-form" = "/admin/structure/hat_type/add", - * "edit-form" = "/admin/structure/hat_type/{hat_type}/edit", - * "delete-form" = "/admin/structure/hat_type/{hat_type}/delete", - * "collection" = "/admin/structure/hat_type" + * "canonical" = "/zencrm/hat_type/{hat_type}", + * "add-form" = "/zencrm/hat_type/add", + * "edit-form" = "/zencrm/hat_type/{hat_type}/edit", + * "delete-form" = "/zencrm/hat_type/{hat_type}/delete", + * "collection" = "/zencrm/hat_type" * } * ) */ From 6067afed238ac1d87ac7a69e8c4b977bf7461f5d Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 12:52:51 +0200 Subject: [PATCH 34/94] Added sidebar search widget to config. --- ...k.block.exposedformperson_searchpage_1.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 config/install/block.block.exposedformperson_searchpage_1.yml diff --git a/config/install/block.block.exposedformperson_searchpage_1.yml b/config/install/block.block.exposedformperson_searchpage_1.yml new file mode 100644 index 0000000..c544140 --- /dev/null +++ b/config/install/block.block.exposedformperson_searchpage_1.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - views.view.person_search + module: + - views + theme: + - bartik +id: exposedformperson_searchpage_1 +theme: bartik +region: sidebar_first +weight: 0 +provider: null +plugin: 'views_exposed_filter_block:person_search-page_1' +settings: + id: 'views_exposed_filter_block:person_search-page_1' + label: '' + provider: views + label_display: visible + views_label: '' +visibility: { } From 3226ce01d372aae29c22fecf0588da83d0826e81 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 13:11:54 +0200 Subject: [PATCH 35/94] added destination to hat creator popup so it returns to person page after creation. --- src/Plugin/Block/HatCreator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index f189a5a..25e5d14 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -31,7 +31,7 @@ class HatCreator extends BlockBase { ->loadByProperties(['type' => $id, 'person' => $person_id]); if (!reset($hats)) { $label = $type['label']; - $markup .= "

Create $label Hat

"; + $markup .= "

Create $label Hat

"; } } return [ From 0068566b227de4f21032e0889d71c71177fdb264 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 13:19:03 +0200 Subject: [PATCH 36/94] more fixing paths to follow /zencrm policy it counts for things that they open in popups, too. --- modules/zencrm_entities/src/Entity/Hat.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index 8c0243e..ab6f5b2 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -49,12 +49,12 @@ use Drupal\user\UserInterface; * "status" = "status", * }, * links = { - * "canonical" = "/admin/structure/hat/{hat}", - * "add-page" = "/admin/structure/hat/add", - * "add-form" = "/admin/structure/hat/add/{hat_type}", - * "edit-form" = "/admin/structure/hat/{hat}/edit", - * "delete-form" = "/admin/structure/hat/{hat}/delete", - * "collection" = "/admin/structure/hat", + * "canonical" = "/zencrm/hat/{hat}", + * "add-page" = "/zencrm/hat/add", + * "add-form" = "/zencrm/hat/add/{hat_type}", + * "edit-form" = "/zencrm/hat/{hat}/edit", + * "delete-form" = "/zencrm/hat/{hat}/delete", + * "collection" = "/zencrm/hat", * }, * bundle_entity_type = "hat_type", * field_ui_base_route = "entity.hat_type.edit_form" From 32803ff8a829842daf3643ad1348b729a52a7a43 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 13:40:08 +0200 Subject: [PATCH 37/94] Added config for "this person's hats" view and its block placement Also moved other configurations into the optional dir --- ...k.block.exposedformperson_searchpage_1.yml | 0 .../block.block.hatcreator.yml | 1 - ...iews_block__this_person_s_hats_block_1.yml | 30 ++ .../views.view.this_person_s_hats.yml | 362 ++++++++++++++++++ 4 files changed, 392 insertions(+), 1 deletion(-) rename config/{install => optional}/block.block.exposedformperson_searchpage_1.yml (100%) rename config/{install => optional}/block.block.hatcreator.yml (94%) create mode 100644 config/optional/block.block.views_block__this_person_s_hats_block_1.yml create mode 100644 config/optional/views.view.this_person_s_hats.yml diff --git a/config/install/block.block.exposedformperson_searchpage_1.yml b/config/optional/block.block.exposedformperson_searchpage_1.yml similarity index 100% rename from config/install/block.block.exposedformperson_searchpage_1.yml rename to config/optional/block.block.exposedformperson_searchpage_1.yml diff --git a/config/install/block.block.hatcreator.yml b/config/optional/block.block.hatcreator.yml similarity index 94% rename from config/install/block.block.hatcreator.yml rename to config/optional/block.block.hatcreator.yml index 0156ebe..a010cf0 100644 --- a/config/install/block.block.hatcreator.yml +++ b/config/optional/block.block.hatcreator.yml @@ -14,7 +14,6 @@ provider: null plugin: hat_creator settings: id: hat_creator - label: 'Hat creator' provider: zencrm label_display: visible visibility: diff --git a/config/optional/block.block.views_block__this_person_s_hats_block_1.yml b/config/optional/block.block.views_block__this_person_s_hats_block_1.yml new file mode 100644 index 0000000..1828aa4 --- /dev/null +++ b/config/optional/block.block.views_block__this_person_s_hats_block_1.yml @@ -0,0 +1,30 @@ +langcode: en +status: true +dependencies: + config: + - views.view.this_person_s_hats + module: + - system + - views + theme: + - bartik +id: views_block__this_person_s_hats_block_1 +theme: bartik +region: content +weight: -2 +provider: null +plugin: 'views_block:this_person_s_hats-block_1' +settings: + id: 'views_block:this_person_s_hats-block_1' + label: '' + provider: views + label_display: visible + views_label: '' + items_per_page: none + context_mapping: { } +visibility: + request_path: + id: request_path + pages: '/zencrm/person/*' + negate: false + context_mapping: { } diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml new file mode 100644 index 0000000..719d945 --- /dev/null +++ b/config/optional/views.view.this_person_s_hats.yml @@ -0,0 +1,362 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: this_person_s_hats +label: 'This Person''s Hats' +module: views +description: '' +tag: '' +base_table: hat_field_data +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + offset: 0 + style: + type: grid + row: + type: fields + fields: + id: + id: id + table: hat_field_data + field: id + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: hat + entity_field: id + plugin_id: field + type: + id: type + table: hat_field_data + field: type + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: hat + entity_field: type + plugin_id: field + rendered_entity: + id: rendered_entity + table: hat + field: rendered_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + view_mode: default + entity_type: hat + plugin_id: rendered_entity + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: true + text: 'Edit' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + filters: { } + sorts: { } + title: 'This Person''s Hats' + header: { } + footer: { } + empty: { } + relationships: { } + arguments: + person: + id: person + table: hat_field_data + field: person + relationship: none + group_type: group + admin_label: '' + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: raw + default_argument_options: + index: 2 + use_alias: false + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: hat + entity_field: person + plugin_id: numeric + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: + - 'config:core.entity_view_display.hat.client.default' + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 1 + display_options: + display_extenders: { } + allow: + items_per_page: false + offset: '0' + pager: '0' + hide_fields: '0' + sort_fields: '0' + disable_filters: '0' + configure_sorts: '0' + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: + - 'config:core.entity_view_display.hat.client.default' From 689d208463668cfe3ea0485a631658413881ee7a Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 14:24:29 +0200 Subject: [PATCH 38/94] Added route and controller for adding new contact details to a person --- src/Controller/ContactDetailsController.php | 31 +++++++++++++++++++++ src/Plugin/Block/HatCreator.php | 2 +- zencrm.routing.yml | 8 ++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/Controller/ContactDetailsController.php diff --git a/src/Controller/ContactDetailsController.php b/src/Controller/ContactDetailsController.php new file mode 100644 index 0000000..17401f7 --- /dev/null +++ b/src/Controller/ContactDetailsController.php @@ -0,0 +1,31 @@ + $person_id + ); + + $node = \Drupal::entityTypeManager() + ->getStorage('contact_details') + ->create($values); + + $form = \Drupal::entityTypeManager() + ->getFormObject('contact_details', 'default') + ->setEntity($node); + return \Drupal::formBuilder()->getForm($form); + } + +} diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index 25e5d14..8e2b22a 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -31,7 +31,7 @@ class HatCreator extends BlockBase { ->loadByProperties(['type' => $id, 'person' => $person_id]); if (!reset($hats)) { $label = $type['label']; - $markup .= "

Create $label Hat

"; + $markup .= "

Add a $label Hat

"; } } return [ diff --git a/zencrm.routing.yml b/zencrm.routing.yml index 3cfef4d..7abe79d 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -5,3 +5,11 @@ zencrm.hat.create: _title: 'Add New Hat' requirements: _permission: 'access content' + +zencrm.contact_details.create: + path: '/zencrm/contact_details/add/{person_id}' + defaults: + _controller: '\Drupal\zencrm\Controller\ContactDetailsController::createContactDetailsForPerson' + _title: 'Add New Contact Details' + requirements: + _permission: 'access content' From 8166372c02e78fd7baac3c70165732a2759ee155 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 14:35:08 +0200 Subject: [PATCH 39/94] Fixed some paths --- modules/zencrm_entities/src/Entity/ContactDetails.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 6d5c21f..2eac59e 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -44,11 +44,11 @@ use Drupal\user\UserInterface; * "status" = "status", * }, * links = { - * "canonical" = "/admin/structure/contact_details/{contact_details}", - * "add-form" = "/admin/structure/contact_details/add", - * "edit-form" = "/admin/structure/contact_details/{contact_details}/edit", - * "delete-form" = "/admin/structure/contact_details/{contact_details}/delete", - * "collection" = "/admin/structure/contact_details", + * "canonical" = "/zencrm/contact_details/{contact_details}", + * "add-form" = "/zencrm/contact_details/add", + * "edit-form" = "/zencrm/contact_details/{contact_details}/edit", + * "delete-form" = "/zencrm/contact_details/{contact_details}/delete", + * "collection" = "/zencrm/contact_details", * }, * field_ui_base_route = "contact_details.settings" * ) From 9575233ee1a7daba1c2b9897d0a7ab033d8b87bf Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 14:49:12 +0200 Subject: [PATCH 40/94] Moved more config into optional --- ..._this_person_s_contact_details_block_1.yml | 29 ++ ...ews.view.this_person_s_contact_details.yml | 303 ++++++++++++++++++ ...k.block.exposedformperson_searchpage_1.yml | 0 .../search_api.index.person_index.yml | 0 .../search_api.server.zencrm_server.yml | 0 .../views.view.person_search.yml | 2 +- 6 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml create mode 100644 config/optional/views.view.this_person_s_contact_details.yml rename {config => modules/zencrm_search/config}/optional/block.block.exposedformperson_searchpage_1.yml (100%) rename modules/zencrm_search/config/{install => optional}/search_api.index.person_index.yml (100%) rename modules/zencrm_search/config/{install => optional}/search_api.server.zencrm_server.yml (100%) rename modules/zencrm_search/config/{install => optional}/views.view.person_search.yml (99%) diff --git a/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml b/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml new file mode 100644 index 0000000..da1caf0 --- /dev/null +++ b/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - views.view.this_person_s_contact_details + module: + - system + - views + theme: + - bartik +id: views_block__this_person_s_contact_details_block_1 +theme: bartik +region: content +weight: 0 +provider: null +plugin: 'views_block:this_person_s_contact_details-block_1' +settings: + id: 'views_block:this_person_s_contact_details-block_1' + label: '' + provider: views + label_display: visible + views_label: '' + items_per_page: none +visibility: + request_path: + id: request_path + pages: '/zencrm/person/*' + negate: false + context_mapping: { } diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml new file mode 100644 index 0000000..325c0db --- /dev/null +++ b/config/optional/views.view.this_person_s_contact_details.yml @@ -0,0 +1,303 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: this_person_s_contact_details +label: 'This Person''s Contact Details' +module: views +description: '' +tag: '' +base_table: contact_details +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + offset: 0 + style: + type: grid + row: + type: fields + options: + default_field_elements: true + inline: { } + separator: '' + hide_empty: false + fields: + id: + id: id + table: contact_details + field: id + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: id + plugin_id: field + rendered_entity: + id: rendered_entity + table: contact_details + field: rendered_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + view_mode: default + entity_type: contact_details + plugin_id: rendered_entity + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: true + text: 'Edit' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + filters: { } + sorts: { } + title: 'This Person''s Contact Details' + header: { } + footer: + area_text_custom: + id: area_text_custom + table: views + field: area_text_custom + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: true + content: '' + plugin_id: text_custom + empty: { } + relationships: { } + arguments: + person: + id: person + table: contact_details + field: person + relationship: none + group_type: group + admin_label: '' + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: raw + default_argument_options: + index: 2 + use_alias: false + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: contact_details + entity_field: person + plugin_id: numeric + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 1 + display_options: + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } diff --git a/config/optional/block.block.exposedformperson_searchpage_1.yml b/modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml similarity index 100% rename from config/optional/block.block.exposedformperson_searchpage_1.yml rename to modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml diff --git a/modules/zencrm_search/config/install/search_api.index.person_index.yml b/modules/zencrm_search/config/optional/search_api.index.person_index.yml similarity index 100% rename from modules/zencrm_search/config/install/search_api.index.person_index.yml rename to modules/zencrm_search/config/optional/search_api.index.person_index.yml diff --git a/modules/zencrm_search/config/install/search_api.server.zencrm_server.yml b/modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml similarity index 100% rename from modules/zencrm_search/config/install/search_api.server.zencrm_server.yml rename to modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml diff --git a/modules/zencrm_search/config/install/views.view.person_search.yml b/modules/zencrm_search/config/optional/views.view.person_search.yml similarity index 99% rename from modules/zencrm_search/config/install/views.view.person_search.yml rename to modules/zencrm_search/config/optional/views.view.person_search.yml index 3a30696..1cb218d 100644 --- a/modules/zencrm_search/config/install/views.view.person_search.yml +++ b/modules/zencrm_search/config/optional/views.view.person_search.yml @@ -34,7 +34,7 @@ display: exposed_form: type: basic options: - submit_button: Apply + submit_button: Search reset_button: false reset_button_label: Reset exposed_sorts_label: 'Sort by' From a6449a9cdc3d946ddaa0c5f54f44786d2e171dee Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 19:23:50 +0200 Subject: [PATCH 41/94] Hides contact details block when empty --- config/optional/views.view.this_person_s_contact_details.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml index 325c0db..5cb1cbf 100644 --- a/config/optional/views.view.this_person_s_contact_details.yml +++ b/config/optional/views.view.this_person_s_contact_details.yml @@ -234,7 +234,7 @@ display: relationship: none group_type: group admin_label: '' - empty: true + empty: false tokenize: true content: '' plugin_id: text_custom @@ -294,6 +294,7 @@ display: position: 1 display_options: display_extenders: { } + block_hide_empty: true cache_metadata: max-age: -1 contexts: From 25981b45f659eb6c160c968679427b2dd06b92a9 Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 19:33:52 +0200 Subject: [PATCH 42/94] When person has no hats, hat creator show in content pane. --- .../views.view.this_person_s_hats.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml index 719d945..096acdf 100644 --- a/config/optional/views.view.this_person_s_hats.yml +++ b/config/optional/views.view.this_person_s_hats.yml @@ -1,6 +1,8 @@ langcode: en status: true dependencies: + config: + - block.block.hatcreator module: - zencrm_entities id: this_person_s_hats @@ -244,7 +246,7 @@ display: exclude: false alter: alter_text: true - text: 'Edit' + text: '' make_link: false path: '' absolute: false @@ -287,7 +289,20 @@ display: title: 'This Person''s Hats' header: { } footer: { } - empty: { } + empty: + entity_block: + id: entity_block + table: views + field: entity_block + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: true + target: hatcreator + view_mode: default + bypass_access: false + plugin_id: entity relationships: { } arguments: person: From 6e85b82b2d0dd8e3cb2655acb7e1b2518d219d5a Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 19:38:24 +0200 Subject: [PATCH 43/94] moved hat creator to sidebar --- config/optional/block.block.hatcreator.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/optional/block.block.hatcreator.yml b/config/optional/block.block.hatcreator.yml index a010cf0..682d32f 100644 --- a/config/optional/block.block.hatcreator.yml +++ b/config/optional/block.block.hatcreator.yml @@ -8,12 +8,13 @@ dependencies: - bartik id: hatcreator theme: bartik -region: content -weight: 0 +region: sidebar_second +weight: -8 provider: null plugin: hat_creator settings: id: hat_creator + label: '' provider: zencrm label_display: visible visibility: From 607941c72566d0b8df74c68516048cbb984587ab Mon Sep 17 00:00:00 2001 From: naomi Date: Wed, 11 Apr 2018 20:00:39 +0200 Subject: [PATCH 44/94] More fiddling with the hats and contact details view blocks. --- config/optional/block.block.hatcreator.yml | 4 ++-- ...ws_block__this_person_s_contact_details_block_1.yml | 4 ++-- ...k.block.views_block__this_person_s_hats_block_1.yml | 4 ++-- .../views.view.this_person_s_contact_details.yml | 6 +++--- config/optional/views.view.this_person_s_hats.yml | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/optional/block.block.hatcreator.yml b/config/optional/block.block.hatcreator.yml index 682d32f..b9cd32f 100644 --- a/config/optional/block.block.hatcreator.yml +++ b/config/optional/block.block.hatcreator.yml @@ -1,5 +1,5 @@ langcode: en -status: true +status: false dependencies: module: - system @@ -9,7 +9,7 @@ dependencies: id: hatcreator theme: bartik region: sidebar_second -weight: -8 +weight: -6 provider: null plugin: hat_creator settings: diff --git a/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml b/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml index da1caf0..81039c7 100644 --- a/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml +++ b/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml @@ -10,8 +10,8 @@ dependencies: - bartik id: views_block__this_person_s_contact_details_block_1 theme: bartik -region: content -weight: 0 +region: sidebar_second +weight: -7 provider: null plugin: 'views_block:this_person_s_contact_details-block_1' settings: diff --git a/config/optional/block.block.views_block__this_person_s_hats_block_1.yml b/config/optional/block.block.views_block__this_person_s_hats_block_1.yml index 1828aa4..026110f 100644 --- a/config/optional/block.block.views_block__this_person_s_hats_block_1.yml +++ b/config/optional/block.block.views_block__this_person_s_hats_block_1.yml @@ -10,8 +10,8 @@ dependencies: - bartik id: views_block__this_person_s_hats_block_1 theme: bartik -region: content -weight: -2 +region: sidebar_second +weight: -8 provider: null plugin: 'views_block:this_person_s_hats-block_1' settings: diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml index 5cb1cbf..e734510 100644 --- a/config/optional/views.view.this_person_s_contact_details.yml +++ b/config/optional/views.view.this_person_s_contact_details.yml @@ -4,7 +4,7 @@ dependencies: module: - zencrm_entities id: this_person_s_contact_details -label: 'This Person''s Contact Details' +label: 'Contact Details' module: views description: '' tag: '' @@ -224,7 +224,7 @@ display: plugin_id: custom filters: { } sorts: { } - title: 'This Person''s Contact Details' + title: 'Contact Details' header: { } footer: area_text_custom: @@ -234,7 +234,7 @@ display: relationship: none group_type: group admin_label: '' - empty: false + empty: true tokenize: true content: '' plugin_id: text_custom diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml index 096acdf..d75fa87 100644 --- a/config/optional/views.view.this_person_s_hats.yml +++ b/config/optional/views.view.this_person_s_hats.yml @@ -6,7 +6,7 @@ dependencies: module: - zencrm_entities id: this_person_s_hats -label: 'This Person''s Hats' +label: Hats module: views description: '' tag: '' @@ -286,10 +286,9 @@ display: plugin_id: custom filters: { } sorts: { } - title: 'This Person''s Hats' + title: Hats header: { } - footer: { } - empty: + footer: entity_block: id: entity_block table: views @@ -301,8 +300,9 @@ display: tokenize: true target: hatcreator view_mode: default - bypass_access: false + bypass_access: true plugin_id: entity + empty: { } relationships: { } arguments: person: From 2cf897c92b9bc5ec71a56a9a9b514a7562177926 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 12:06:51 +0200 Subject: [PATCH 45/94] Changed path for adding hat to /zencrm/hat/{person_id}/.... Because the person id needs to be in third place in the URL, so that it filters the entity reference view for the contact details. But the second place cannot be "person" as then it would try to render the person blocks on th page. --- src/Controller/HatController.php | 4 ++-- src/Plugin/Block/HatCreator.php | 6 +++--- zencrm.routing.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Controller/HatController.php b/src/Controller/HatController.php index 26d4b1b..9440acf 100644 --- a/src/Controller/HatController.php +++ b/src/Controller/HatController.php @@ -15,9 +15,9 @@ class HatController extends ControllerBase { * @return string * Return Hello string. */ - public function createHatForPerson($type, $person_id) { + public function createHatForPerson($person_id, $hat_type_id) { $values = array( - 'type' => $type, + 'type' => $hat_type_id, 'person' => $person_id ); diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index 8e2b22a..6b06160 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -25,13 +25,13 @@ class HatCreator extends BlockBase { // Only offer hat creation on hats they don't already have. $hat_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('hat'); - foreach($hat_types as $id => $type) { + foreach($hat_types as $hat_type_id => $type) { $hats = \Drupal::entityTypeManager() ->getStorage('hat') - ->loadByProperties(['type' => $id, 'person' => $person_id]); + ->loadByProperties(['type' => $hat_type_id, 'person' => $person_id]); if (!reset($hats)) { $label = $type['label']; - $markup .= "

Add a $label Hat

"; + $markup .= "

Add a $label Hat

"; } } return [ diff --git a/zencrm.routing.yml b/zencrm.routing.yml index 7abe79d..8721158 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -1,5 +1,5 @@ zencrm.hat.create: - path: '/zencrm/hat/add/{type}/{person_id}' + path: '/zencrm/hat/{person_id}/add/{hat_type_id}' defaults: _controller: '\Drupal\zencrm\Controller\HatController::createHatForPerson' _title: 'Add New Hat' From fd3ee02099aa2011dcc79044a0ca0d63971725c6 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 12:51:21 +0200 Subject: [PATCH 46/94] Added Hat contact details field filtered by entity reference view. --- modules/zencrm_entities/src/Entity/Hat.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index ab6f5b2..f1e73e9 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -180,6 +180,27 @@ class Hat extends ContentEntityBase implements HatInterface { ->setDescription(t('The person this hat is of.')) ->setSetting('target_type', 'person'); + $fields['contact_details'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Contact Details')) + ->setDescription(t('The contact details to be used when communicating with this person in this capacity.')) + ->setSetting('target_type', 'contact_details') + ->setSetting('handler', 'views') + ->setSetting('handler_settings', ['view' => [ + 'view_name' => 'this_person_s_contact_details', + 'display_name' => 'entity_reference_1' + ]]) + ->setDisplayOptions('view', [ + 'label' => 'inline', + 'weight' => 0, + 'settings' => ['link' => 'false'] + ]) + ->setDisplayOptions('form', [ + 'type' => 'options_buttons', + 'weight' => 0, + ]) + ->setRequired(TRUE) + ->setTranslatable(TRUE); + // This field is computed in a presave hook, and used for entity reference // options when selecting a person for involvement in a case etc. $fields['name'] = BaseFieldDefinition::create('string') From 17070065e5bbc97a1d661f6481dd72d22866d9d8 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 13:00:04 +0200 Subject: [PATCH 47/94] Changed URL for adding contact details, in line with hat one --- zencrm.routing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zencrm.routing.yml b/zencrm.routing.yml index 8721158..e0335da 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -7,7 +7,7 @@ zencrm.hat.create: _permission: 'access content' zencrm.contact_details.create: - path: '/zencrm/contact_details/add/{person_id}' + path: '/zencrm/contact_details/{person_id}/add' defaults: _controller: '\Drupal\zencrm\Controller\ContactDetailsController::createContactDetailsForPerson' _title: 'Add New Contact Details' From 79c49eb99671df3fb1d78901eb5a5e7c6ec982b6 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 13:14:27 +0200 Subject: [PATCH 48/94] Changed URL for Hat edit page. --- modules/zencrm_entities/src/Entity/Hat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index f1e73e9..f53428f 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -52,7 +52,7 @@ use Drupal\user\UserInterface; * "canonical" = "/zencrm/hat/{hat}", * "add-page" = "/zencrm/hat/add", * "add-form" = "/zencrm/hat/add/{hat_type}", - * "edit-form" = "/zencrm/hat/{hat}/edit", + * "edit-form" = "/zencrm/hat/{person}/{hat}/edit", * "delete-form" = "/zencrm/hat/{hat}/delete", * "collection" = "/zencrm/hat", * }, From 58ac24db8f0bfc3d5786f6a25f274c42cbde5e48 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 13:42:52 +0200 Subject: [PATCH 49/94] Added route and controller for editing hat So that the person id is in the URL. --- modules/zencrm_entities/src/Entity/Hat.php | 2 +- src/Controller/HatController.php | 31 ++++++++++++++++++---- zencrm.routing.yml | 8 ++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index f53428f..f1e73e9 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -52,7 +52,7 @@ use Drupal\user\UserInterface; * "canonical" = "/zencrm/hat/{hat}", * "add-page" = "/zencrm/hat/add", * "add-form" = "/zencrm/hat/add/{hat_type}", - * "edit-form" = "/zencrm/hat/{person}/{hat}/edit", + * "edit-form" = "/zencrm/hat/{hat}/edit", * "delete-form" = "/zencrm/hat/{hat}/delete", * "collection" = "/zencrm/hat", * }, diff --git a/src/Controller/HatController.php b/src/Controller/HatController.php index 9440acf..cfdd66c 100644 --- a/src/Controller/HatController.php +++ b/src/Controller/HatController.php @@ -10,10 +10,10 @@ use Drupal\Core\Controller\ControllerBase; class HatController extends ControllerBase { /** - * Hello. + * Displays a form for creating a hat. + * The type of hat and the person are prepopulated. * - * @return string - * Return Hello string. + * @return form for creating a hat */ public function createHatForPerson($person_id, $hat_type_id) { $values = array( @@ -21,13 +21,34 @@ class HatController extends ControllerBase { 'person' => $person_id ); - $node = \Drupal::entityTypeManager() + $hat = \Drupal::entityTypeManager() ->getStorage('hat') ->create($values); $form = \Drupal::entityTypeManager() ->getFormObject('hat', 'default') - ->setEntity($node); + ->setEntity($hat); + return \Drupal::formBuilder()->getForm($form); + } + + /** + * Displays a form for editing a hat. + * The reason it is here is that the URL needs to have the person id in it + * in order to filter the contact details entity reference view to only show ones for that person. + * (The intuitive way to bring this about - changing the edit route for the entity itself - causes problems with the delete route) + * + * @return form for editing a hat + */ + public function editHatForPerson($person_id, $hat_id) { + error_log("hjhjhjhj"); + + $hat = \Drupal::entityTypeManager() + ->getStorage('hat') + ->load($hat_id); + + $form = \Drupal::entityTypeManager() + ->getFormObject('hat', 'default') + ->setEntity($hat); return \Drupal::formBuilder()->getForm($form); } diff --git a/zencrm.routing.yml b/zencrm.routing.yml index e0335da..fc56f9d 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -6,6 +6,14 @@ zencrm.hat.create: requirements: _permission: 'access content' +zencrm.hat.edit: + path: '/zencrm/hat/{person_id}/{hat_id}/edit' + defaults: + _controller: '\Drupal\zencrm\Controller\HatController::editHatForPerson' + _title: 'Edit Hat' + requirements: + _permission: 'access content' + zencrm.contact_details.create: path: '/zencrm/contact_details/{person_id}/add' defaults: From a2373ea7e7dc18eee9d0d51132275704dfdcee53 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 13:56:08 +0200 Subject: [PATCH 50/94] removed error log statement for debugging --- src/Controller/HatController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Controller/HatController.php b/src/Controller/HatController.php index cfdd66c..f4439d4 100644 --- a/src/Controller/HatController.php +++ b/src/Controller/HatController.php @@ -40,7 +40,6 @@ class HatController extends ControllerBase { * @return form for editing a hat */ public function editHatForPerson($person_id, $hat_id) { - error_log("hjhjhjhj"); $hat = \Drupal::entityTypeManager() ->getStorage('hat') From 61c969d7f42e88aafa48a889e7fac0812fb2349d Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 15:11:25 +0200 Subject: [PATCH 51/94] Created "person panel" block which displays in content area for a person Also moved contact details view config to zencrm_entities because it is referenced as an entity reference view in a base field on Hat. --- config/optional/block.block.personpanel.yml | 25 ++ ...ews.view.this_person_s_contact_details.yml | 258 +++++++++++++++++- src/Plugin/Block/PersonPanel.php | 57 ++++ 3 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 config/optional/block.block.personpanel.yml rename {config => modules/zencrm_entities/config}/optional/views.view.this_person_s_contact_details.yml (52%) create mode 100644 src/Plugin/Block/PersonPanel.php diff --git a/config/optional/block.block.personpanel.yml b/config/optional/block.block.personpanel.yml new file mode 100644 index 0000000..8da71f5 --- /dev/null +++ b/config/optional/block.block.personpanel.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + module: + - system + - zencrm + theme: + - bartik +id: personpanel +theme: bartik +region: content +weight: 0 +provider: null +plugin: person_panel +settings: + id: person_panel + label: 'Person Panel' + provider: zencrm + label_display: '0' +visibility: + request_path: + id: request_path + pages: '/zencrm/person/*' + negate: false + context_mapping: { } diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/modules/zencrm_entities/config/optional/views.view.this_person_s_contact_details.yml similarity index 52% rename from config/optional/views.view.this_person_s_contact_details.yml rename to modules/zencrm_entities/config/optional/views.view.this_person_s_contact_details.yml index e734510..67e207f 100644 --- a/config/optional/views.view.this_person_s_contact_details.yml +++ b/modules/zencrm_entities/config/optional/views.view.this_person_s_contact_details.yml @@ -236,7 +236,7 @@ display: admin_label: '' empty: true tokenize: true - content: '' + content: '' plugin_id: text_custom empty: { } relationships: { } @@ -302,3 +302,259 @@ display: - 'languages:language_interface' - url tags: { } + entity_reference_1: + display_plugin: entity_reference + id: entity_reference_1 + display_title: 'Entity Reference' + position: 2 + display_options: + display_extenders: { } + fields: + id: + id: id + table: contact_details + field: id + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: id + plugin_id: field + rendered_entity: + id: rendered_entity + table: contact_details + field: rendered_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + view_mode: default + entity_type: contact_details + plugin_id: rendered_entity + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: true + text: 'Edit' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + type: + id: type + table: contact_details + field: type + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: type + plugin_id: field + defaults: + fields: false + style: + type: entity_reference + options: + search_fields: + type: type + id: '0' + rendered_entity: '0' + nothing: '0' + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php new file mode 100644 index 0000000..359185a --- /dev/null +++ b/src/Plugin/Block/PersonPanel.php @@ -0,0 +1,57 @@ +getParameter('person')->id(); + $markup = ""; + $person = \Drupal::entityTypeManager()->getStorage('person')->load($person_id); + + // If the person has no contact details, suggest they create some + $link_to_add = "/zencrm/contact_details/$person_id/add?destination=/zencrm/person/$person_id"; + $contact_details = \Drupal::entityTypeManager() + ->getStorage('contact_details') + ->loadByProperties(['person' => $person_id]); + if (!reset($contact_details)) { + $markup .= "

This person has no contact details yet. To get started, "; + $markup .= "Add a set of contact details"; + $markup .= "

"; + } + + // If the person has no hats, suggest they create one, by rendering the hat creator block + $link_to_add = "/zencrm/hat/$person_id/add?destination=/zencrm/person/$person_id"; + $hats = \Drupal::entityTypeManager() + ->getStorage('hat') + ->loadByProperties(['person' => $person_id]); + if (!reset($hats)) { + $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; + $plugin_manager = \Drupal::service('plugin.manager.block'); + $block = $plugin_manager->createInstance('hat_creator', array()); + } + $markup .= render($block->build()); + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => "
$markup
" + ]; + + } +} From 6746b986db185c0b3ee556fc1e85c9c2da495984 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 15:24:32 +0200 Subject: [PATCH 52/94] Fixed conditional structure in Person Panel block. --- src/Plugin/Block/PersonPanel.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php index 359185a..3affd5c 100644 --- a/src/Plugin/Block/PersonPanel.php +++ b/src/Plugin/Block/PersonPanel.php @@ -7,7 +7,8 @@ use Drupal\Core\Block\BlockBase; /** * Provides a 'PersonPanel' block. * If the person has no contact details it advises to create them. - * If they have no hats it advises to create them. + * Hats cannot be created without contact details. + * If they have contact details but no hats, it advises to create a hat. * * @Block( * id = "person_panel", @@ -33,19 +34,22 @@ class PersonPanel extends BlockBase { $markup .= "

This person has no contact details yet. To get started, "; $markup .= "Add a set of contact details"; $markup .= "

"; + + } else { + // They have contact details, so they are able to create hats. + // If the person has no hats, suggest they create one, by rendering the hat creator block + $link_to_add = "/zencrm/hat/$person_id/add?destination=/zencrm/person/$person_id"; + $hats = \Drupal::entityTypeManager() + ->getStorage('hat') + ->loadByProperties(['person' => $person_id]); + if (!reset($hats)) { + $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; + $plugin_manager = \Drupal::service('plugin.manager.block'); + $block = $plugin_manager->createInstance('hat_creator', array()); + $markup .= render($block->build()); + } } - // If the person has no hats, suggest they create one, by rendering the hat creator block - $link_to_add = "/zencrm/hat/$person_id/add?destination=/zencrm/person/$person_id"; - $hats = \Drupal::entityTypeManager() - ->getStorage('hat') - ->loadByProperties(['person' => $person_id]); - if (!reset($hats)) { - $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; - $plugin_manager = \Drupal::service('plugin.manager.block'); - $block = $plugin_manager->createInstance('hat_creator', array()); - } - $markup .= render($block->build()); return [ '#cache' => [ 'max-age' => 0, From c9cf33ac1945b2f27840732d2250244a95fbb1e7 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 15:32:24 +0200 Subject: [PATCH 53/94] Generate case entity. (Called CaseEntity because "Case" is reserved word) --- modules/zencrm_entities/case_entity.page.inc | 30 +++ .../config/schema/case_entity_type.schema.yml | 12 + .../src/CaseEntityAccessControlHandler.php | 47 ++++ .../src/CaseEntityHtmlRouteProvider.php | 56 +++++ .../src/CaseEntityListBuilder.php | 40 ++++ .../src/CaseEntityTranslationHandler.php | 14 ++ .../src/CaseEntityTypeHtmlRouteProvider.php | 28 +++ .../src/CaseEntityTypeListBuilder.php | 32 +++ .../zencrm_entities/src/Entity/CaseEntity.php | 224 ++++++++++++++++++ .../src/Entity/CaseEntityInterface.php | 77 ++++++ .../src/Entity/CaseEntityType.php | 58 +++++ .../src/Entity/CaseEntityTypeInterface.php | 13 + .../src/Entity/CaseEntityViewsData.php | 24 ++ .../src/Form/CaseEntityDeleteForm.php | 15 ++ .../src/Form/CaseEntityForm.php | 50 ++++ .../src/Form/CaseEntitySettingsForm.php | 53 +++++ .../src/Form/CaseEntityTypeDeleteForm.php | 53 +++++ .../src/Form/CaseEntityTypeForm.php | 65 +++++ .../case-entity-content-add-list.html.twig | 23 ++ .../templates/case_entity.html.twig | 22 ++ .../zencrm_entities.links.action.yml | 11 + .../zencrm_entities.links.menu.yml | 18 ++ .../zencrm_entities.links.task.yml | 18 ++ .../zencrm_entities/zencrm_entities.module | 26 ++ .../zencrm_entities.permissions.yml | 19 ++ 25 files changed, 1028 insertions(+) create mode 100644 modules/zencrm_entities/case_entity.page.inc create mode 100644 modules/zencrm_entities/config/schema/case_entity_type.schema.yml create mode 100644 modules/zencrm_entities/src/CaseEntityAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/CaseEntityListBuilder.php create mode 100644 modules/zencrm_entities/src/CaseEntityTranslationHandler.php create mode 100644 modules/zencrm_entities/src/CaseEntityTypeHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/CaseEntityTypeListBuilder.php create mode 100644 modules/zencrm_entities/src/Entity/CaseEntity.php create mode 100644 modules/zencrm_entities/src/Entity/CaseEntityInterface.php create mode 100644 modules/zencrm_entities/src/Entity/CaseEntityType.php create mode 100644 modules/zencrm_entities/src/Entity/CaseEntityTypeInterface.php create mode 100644 modules/zencrm_entities/src/Entity/CaseEntityViewsData.php create mode 100644 modules/zencrm_entities/src/Form/CaseEntityDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/CaseEntityForm.php create mode 100644 modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php create mode 100644 modules/zencrm_entities/src/Form/CaseEntityTypeDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/CaseEntityTypeForm.php create mode 100644 modules/zencrm_entities/templates/case-entity-content-add-list.html.twig create mode 100644 modules/zencrm_entities/templates/case_entity.html.twig diff --git a/modules/zencrm_entities/case_entity.page.inc b/modules/zencrm_entities/case_entity.page.inc new file mode 100644 index 0000000..e78e68e --- /dev/null +++ b/modules/zencrm_entities/case_entity.page.inc @@ -0,0 +1,30 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished case entity entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published case entity entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit case entity entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete case entity entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add case entity entities'); + } + +} diff --git a/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php b/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php new file mode 100644 index 0000000..cf151ad --- /dev/null +++ b/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php @@ -0,0 +1,56 @@ +id(); + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\CaseEntitySettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/CaseEntityListBuilder.php b/modules/zencrm_entities/src/CaseEntityListBuilder.php new file mode 100644 index 0000000..d6c1bd2 --- /dev/null +++ b/modules/zencrm_entities/src/CaseEntityListBuilder.php @@ -0,0 +1,40 @@ +t('Case entity ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\CaseEntity */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.case_entity.edit_form', + ['case_entity' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/CaseEntityTranslationHandler.php b/modules/zencrm_entities/src/CaseEntityTranslationHandler.php new file mode 100644 index 0000000..37f20bb --- /dev/null +++ b/modules/zencrm_entities/src/CaseEntityTranslationHandler.php @@ -0,0 +1,14 @@ +t('Case entity type'); + $header['id'] = $this->t('Machine name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $row['label'] = $entity->label(); + $row['id'] = $entity->id(); + // You probably want a few more properties here... + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php new file mode 100644 index 0000000..68d2489 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -0,0 +1,224 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Case entity entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', [ + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Case entity entity.')) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Case entity is published.')) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/CaseEntityInterface.php b/modules/zencrm_entities/src/Entity/CaseEntityInterface.php new file mode 100644 index 0000000..7521202 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/CaseEntityInterface.php @@ -0,0 +1,77 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Case entity.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Case entity.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.case_entity.canonical', ['case_entity' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php b/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php new file mode 100644 index 0000000..507c6f1 --- /dev/null +++ b/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php @@ -0,0 +1,53 @@ +t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.case_entity_type.collection'); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return $this->t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->entity->delete(); + + drupal_set_message( + $this->t('content @type: deleted @label.', + [ + '@type' => $this->entity->bundle(), + '@label' => $this->entity->label(), + ] + ) + ); + + $form_state->setRedirectUrl($this->getCancelUrl()); + } + +} diff --git a/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php b/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php new file mode 100644 index 0000000..783b980 --- /dev/null +++ b/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php @@ -0,0 +1,65 @@ +entity; + $form['label'] = [ + '#type' => 'textfield', + '#title' => $this->t('Label'), + '#maxlength' => 255, + '#default_value' => $case_entity_type->label(), + '#description' => $this->t("Label for the Case entity type."), + '#required' => TRUE, + ]; + + $form['id'] = [ + '#type' => 'machine_name', + '#default_value' => $case_entity_type->id(), + '#machine_name' => [ + 'exists' => '\Drupal\zencrm_entities\Entity\CaseEntityType::load', + ], + '#disabled' => !$case_entity_type->isNew(), + ]; + + /* You will need additional form elements for your custom properties. */ + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $case_entity_type = $this->entity; + $status = $case_entity_type->save(); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Case entity type.', [ + '%label' => $case_entity_type->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Case entity type.', [ + '%label' => $case_entity_type->label(), + ])); + } + $form_state->setRedirectUrl($case_entity_type->toUrl('collection')); + } + +} diff --git a/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig b/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig new file mode 100644 index 0000000..2dbb6a8 --- /dev/null +++ b/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Default theme implementation to present a list of custom content entity types/bundles. + * + * Available variables: + * - types: A collection of all the available custom entity types/bundles. + * Each type/bundle contains the following: + * - link: A link to add a content entity of this type. + * - description: A description of this content entity types/bundle. + * + * @see template_preprocess_case_entity_content_add_list() + * + * @ingroup themeable + */ +#} +{% spaceless %} +
+ {% for type in types %} +
{{ type.link }}
+ {% endfor %} +
+{% endspaceless %} diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig new file mode 100644 index 0000000..41f7a76 --- /dev/null +++ b/modules/zencrm_entities/templates/case_entity.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file case_entity.html.twig + * Default theme implementation to present Case entity data. + * + * This template is used when viewing Case entity pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_case_entity() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index 4c53da0..20bba41 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -30,3 +30,14 @@ entity.hat_type.add_form: appears_on: - entity.hat_type.collection +entity.case_entity.add_form: + route_name: entity.case_entity.add_page + title: 'Add Case entity' + appears_on: + - entity.case_entity.collection +entity.case_entity_type.add_form: + route_name: entity.case_entity_type.add_form + title: 'Add Case entity type' + appears_on: + - entity.case_entity_type.collection + diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index fbbedb5..60664c4 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -72,3 +72,21 @@ entity.hat_type.collection: parent: system.admin_structure weight: 99 + +# Case entity menu items definition +entity.case_entity.collection: + title: 'Case entity list' + route_name: entity.case_entity.collection + description: 'List Case entity entities' + parent: system.admin_structure + weight: 100 + + +# Case entity type menu items definition +entity.case_entity_type.collection: + title: 'Case entity type' + route_name: entity.case_entity_type.collection + description: 'List Case entity type (bundles)' + parent: system.admin_structure + weight: 99 + diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index 0545d15..b21d97e 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -104,3 +104,21 @@ entity.hat.delete_form: title: Delete weight: 10 +# Case entity routing definition + +entity.case_entity.canonical: + route_name: entity.case_entity.canonical + base_route: entity.case_entity.canonical + title: 'View' + +entity.case_entity.edit_form: + route_name: entity.case_entity.edit_form + base_route: entity.case_entity.canonical + title: 'Edit' + +entity.case_entity.delete_form: + route_name: entity.case_entity.delete_form + base_route: entity.case_entity.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 7228358..2d142af 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -71,6 +71,16 @@ function zencrm_entities_theme() { 'variables' => ['content' => NULL], 'file' => 'hat.page.inc', ]; + $theme['case_entity'] = [ + 'render element' => 'elements', + 'file' => 'case_entity.page.inc', + 'template' => 'case_entity', + ]; + $theme['case_entity_content_add_list'] = [ + 'render element' => 'content', + 'variables' => ['content' => NULL], + 'file' => 'case_entity.page.inc', + ]; return $theme; } @@ -89,3 +99,19 @@ function zencrm_entities_theme_suggestions_hat(array $variables) { $suggestions[] = 'hat__' . $entity->id() . '__' . $sanitized_view_mode; return $suggestions; } + +/** +* Implements hook_theme_suggestions_HOOK(). +*/ +function zencrm_entities_theme_suggestions_case_entity(array $variables) { + $suggestions = []; + $entity = $variables['elements']['#case_entity']; + $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); + + $suggestions[] = 'case_entity__' . $sanitized_view_mode; + $suggestions[] = 'case_entity__' . $entity->bundle(); + $suggestions[] = 'case_entity__' . $entity->bundle() . '__' . $sanitized_view_mode; + $suggestions[] = 'case_entity__' . $entity->id(); + $suggestions[] = 'case_entity__' . $entity->id() . '__' . $sanitized_view_mode; + return $suggestions; +} diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 486c58d..90c6ab4 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -116,3 +116,22 @@ view published hat entities: view unpublished hat entities: title: 'View unpublished Hat entities' +add case entity entities: + title: 'Create new Case entity entities' + +administer case entity entities: + title: 'Administer Case entity entities' + description: 'Allow to access the administration form to configure Case entity entities.' + restrict access: true + +delete case entity entities: + title: 'Delete Case entity entities' + +edit case entity entities: + title: 'Edit Case entity entities' + +view published case entity entities: + title: 'View published Case entity entities' + +view unpublished case entity entities: + title: 'View unpublished Case entity entities' From 0cc4d50d712e52cefb0d7f1738657b52f75790ad Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 15:48:24 +0200 Subject: [PATCH 54/94] Added Involved Parties base field to case Multi-value entity reference field. --- .../zencrm_entities/src/Entity/CaseEntity.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index 68d2489..7c46fe2 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -201,6 +201,31 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); + + $fields['hats_involved'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Involved Parties')) + ->setDescription(t('People involved in this case, in their various capacities')) + ->setSetting('target_type', 'hat') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setCardinality(-1) + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'author', + 'weight' => 0, + ]) + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setRequired(TRUE); + $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) ->setDescription(t('A boolean indicating whether the Case entity is published.')) From b8537047009b7d7902bec22a74478db617a9bb11 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 17:37:43 +0200 Subject: [PATCH 55/94] added case view to person panel. --- .../zencrm_entities/src/Entity/CaseEntity.php | 2 +- src/Plugin/Block/PersonPanel.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index 7c46fe2..50ee000 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -51,7 +51,7 @@ use Drupal\user\UserInterface; * links = { * "canonical" = "/admin/structure/case_entity/{case_entity}", * "add-page" = "/admin/structure/case_entity/add", - * "add-form" = "/admin/structure/case_entity/add/{case_entity_type}", + * "add-form" = "/zencrm/case/add/{case_entity_type}", * "edit-form" = "/admin/structure/case_entity/{case_entity}/edit", * "delete-form" = "/admin/structure/case_entity/{case_entity}/delete", * "collection" = "/admin/structure/case_entity", diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php index 3affd5c..b13bd8d 100644 --- a/src/Plugin/Block/PersonPanel.php +++ b/src/Plugin/Block/PersonPanel.php @@ -9,6 +9,7 @@ use Drupal\Core\Block\BlockBase; * If the person has no contact details it advises to create them. * Hats cannot be created without contact details. * If they have contact details but no hats, it advises to create a hat. + * Otherwise display the case view for each hat, and links to create new cases. * * @Block( * id = "person_panel", @@ -24,6 +25,7 @@ class PersonPanel extends BlockBase { $person_id = \Drupal::routeMatch()->getParameter('person')->id(); $markup = ""; $person = \Drupal::entityTypeManager()->getStorage('person')->load($person_id); + // If the person has no contact details, suggest they create some $link_to_add = "/zencrm/contact_details/$person_id/add?destination=/zencrm/person/$person_id"; @@ -47,6 +49,12 @@ class PersonPanel extends BlockBase { $plugin_manager = \Drupal::service('plugin.manager.block'); $block = $plugin_manager->createInstance('hat_creator', array()); $markup .= render($block->build()); + } else { + + // they have hats, so display the case view for each hat. + foreach($hats as $hat) { + $markup .= $this->show_cases_for_hat($hat); + } } } @@ -54,8 +62,16 @@ class PersonPanel extends BlockBase { '#cache' => [ 'max-age' => 0, ], - '#markup' => "
$markup
" + '#markup' => "
$markup
" ]; } + + private function show_cases_for_hat($hat) { + $markup = ''; + $markup .= "

" . $hat->name->getString() . "

"; + $markup .= drupal_render(views_embed_view('this_hat_s_cases', 'block_1', $hat->id())); + error_log(print_r(views_embed_view('this_hat_s_cases', 'block_1', $hat->id()), true)); + return $markup; + } } From 65efcb21b4185884b6c297c3659ea44a8be92b84 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 17:47:45 +0200 Subject: [PATCH 56/94] Added This Hat's Cases view to config Also changed case entity paths --- .../optional/views.view.this_hat_s_cases.yml | 394 ++++++++++++++++++ .../zencrm_entities/src/Entity/CaseEntity.php | 10 +- 2 files changed, 399 insertions(+), 5 deletions(-) create mode 100644 config/optional/views.view.this_hat_s_cases.yml diff --git a/config/optional/views.view.this_hat_s_cases.yml b/config/optional/views.view.this_hat_s_cases.yml new file mode 100644 index 0000000..ebb1beb --- /dev/null +++ b/config/optional/views.view.this_hat_s_cases.yml @@ -0,0 +1,394 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: this_hat_s_cases +label: 'This hat''s cases' +module: views +description: '' +tag: '' +base_table: case_entity_field_data +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + offset: 0 + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + uses_fields: false + columns: { } + default: '' + info: { } + override: true + sticky: false + order: asc + caption: '' + summary: '' + description: '' + empty_table: false + row: + type: 'entity:case_entity' + fields: + name: + id: name + table: case_entity_field_data + field: name + relationship: none + group_type: group + admin_label: '' + label: Case + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: null + entity_field: name + plugin_id: field + type: + id: type + table: case_entity_field_data + field: type + relationship: none + group_type: group + admin_label: '' + label: Type + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: case_entity + entity_field: type + plugin_id: field + hats_involved_target_id: + id: hats_involved_target_id + table: case_entity__hats_involved + field: hats_involved_target_id + relationship: none + group_type: group + admin_label: '' + label: 'Involved Parties' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: case_entity + entity_field: hats_involved + plugin_id: field + view_case_entity: + id: view_case_entity + table: case_entity + field: view_case_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + text: 'Go to case' + output_url_as_text: false + absolute: false + entity_type: case_entity + plugin_id: entity_link + filters: { } + sorts: { } + title: 'This hat''s cases' + header: { } + footer: { } + empty: + area_text_custom: + id: area_text_custom + table: views + field: area_text_custom + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: false + content: '

This person is not involved in any cases in this capacity.

' + plugin_id: text_custom + relationships: { } + arguments: + hats_involved_target_id: + id: hats_involved_target_id + table: case_entity__hats_involved + field: hats_involved_target_id + relationship: none + group_type: group + admin_label: '' + default_action: empty + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: fixed + default_argument_options: + argument: '' + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: case_entity + entity_field: hats_involved + plugin_id: numeric + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 1 + display_options: + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index 50ee000..982b6d5 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -49,12 +49,12 @@ use Drupal\user\UserInterface; * "status" = "status", * }, * links = { - * "canonical" = "/admin/structure/case_entity/{case_entity}", - * "add-page" = "/admin/structure/case_entity/add", + * "canonical" = "/zencrm/case/{case_entity}", + * "add-page" = "/zencrm/case/add", * "add-form" = "/zencrm/case/add/{case_entity_type}", - * "edit-form" = "/admin/structure/case_entity/{case_entity}/edit", - * "delete-form" = "/admin/structure/case_entity/{case_entity}/delete", - * "collection" = "/admin/structure/case_entity", + * "edit-form" = "/zencrm/case/{case_entity}/edit", + * "delete-form" = "/zencrm/case/{case_entity}/delete", + * "collection" = "/zencrm/case", * }, * bundle_entity_type = "case_entity_type", * field_ui_base_route = "entity.case_entity_type.edit_form" From 12ccecdd5567019ec2ec409d00258c70fab065d9 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 18:25:03 +0200 Subject: [PATCH 57/94] Added links for creating cases, to person panel Plus some markup ready for css --- src/Plugin/Block/HatCreator.php | 2 +- src/Plugin/Block/PersonPanel.php | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index 6b06160..a29ed9f 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -38,7 +38,7 @@ class HatCreator extends BlockBase { '#cache' => [ 'max-age' => 0, ], - '#markup' => "
$markup
" + '#markup' => "" ]; } diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php index b13bd8d..47ecd63 100644 --- a/src/Plugin/Block/PersonPanel.php +++ b/src/Plugin/Block/PersonPanel.php @@ -33,7 +33,7 @@ class PersonPanel extends BlockBase { ->getStorage('contact_details') ->loadByProperties(['person' => $person_id]); if (!reset($contact_details)) { - $markup .= "

This person has no contact details yet. To get started, "; + $markup .= "

This person has no contact details yet. To get started, "; $markup .= "Add a set of contact details"; $markup .= "

"; @@ -45,7 +45,7 @@ class PersonPanel extends BlockBase { ->getStorage('hat') ->loadByProperties(['person' => $person_id]); if (!reset($hats)) { - $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; + $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; $plugin_manager = \Drupal::service('plugin.manager.block'); $block = $plugin_manager->createInstance('hat_creator', array()); $markup .= render($block->build()); @@ -53,7 +53,8 @@ class PersonPanel extends BlockBase { // they have hats, so display the case view for each hat. foreach($hats as $hat) { - $markup .= $this->show_cases_for_hat($hat); + $markup .= $this->showCases($hat); + $markup .= $this->showCaseCreationLinks($hat); } } } @@ -67,11 +68,22 @@ class PersonPanel extends BlockBase { } - private function show_cases_for_hat($hat) { + // Renders a view showing cases that hat is involved in. + private function showCases($hat) { $markup = ''; - $markup .= "

" . $hat->name->getString() . "

"; + $markup .= "

" . $hat->name->getString() . "

"; $markup .= drupal_render(views_embed_view('this_hat_s_cases', 'block_1', $hat->id())); - error_log(print_r(views_embed_view('this_hat_s_cases', 'block_1', $hat->id()), true)); - return $markup; + return "
$markup
"; + } + + // Provides links to create different types of cases, passing in the hat id. + private function showCaseCreationLinks($hat) { + $hat_id = $hat->id(); + $case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('case_entity'); + foreach($case_types as $case_type_id => $type) { + $label = $type['label']; + $markup .= "

Add a $label Case

"; + } + return ""; } } From 109c3e14c9f54d4a93fd87a75ea924c50f56b8b9 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 18:39:07 +0200 Subject: [PATCH 58/94] Added controller for creating new cases. --- src/Controller/CaseController.php | 34 +++++++++++++++++++++++++++++++ zencrm.routing.yml | 9 ++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/Controller/CaseController.php diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php new file mode 100644 index 0000000..cdf5cf2 --- /dev/null +++ b/src/Controller/CaseController.php @@ -0,0 +1,34 @@ + $case_type_id, + ); + + $case = \Drupal::entityTypeManager() + ->getStorage('case_entity') + ->create($values); + + $case->hats_involved->appendItem($hat_id); + + $form = \Drupal::entityTypeManager() + ->getFormObject('case_entity', 'default') + ->setEntity($case); + return \Drupal::formBuilder()->getForm($form); + } +} diff --git a/zencrm.routing.yml b/zencrm.routing.yml index fc56f9d..3266263 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -21,3 +21,12 @@ zencrm.contact_details.create: _title: 'Add New Contact Details' requirements: _permission: 'access content' + +zencrm.case.create: + path: '/zencrm/case/{hat_id}/add/{case_type_id}' + defaults: + _controller: '\Drupal\zencrm\Controller\CaseController::createCaseForHat' + _title: 'Add New Case' + requirements: + _permission: 'access content' + From 74e98818baa61b2da72d215fd3e84e28fcc618c0 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 12 Apr 2018 18:45:49 +0200 Subject: [PATCH 59/94] Hid some fields in case form display also added destination to case creator ajax links --- .../zencrm_entities/src/Entity/CaseEntity.php | 46 +++++++++---------- src/Plugin/Block/PersonPanel.php | 6 +-- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index 982b6d5..bad6bea 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -161,24 +161,22 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ - 'label' => 'hidden', - 'type' => 'author', - 'weight' => 0, - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + # ->setDisplayOptions('view', [ + # 'label' => 'hidden', + # 'type' => 'author', + # 'weight' => 0, + # ]) + # ->setDisplayOptions('form', [ + # 'type' => 'entity_reference_autocomplete', + # 'weight' => 5, + # 'settings' => [ + # 'match_operator' => 'CONTAINS', + # 'size' => '60', + # 'autocomplete_type' => 'tags', + # 'placeholder' => '', + # ], + # ]) + ->setTranslatable(TRUE); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) @@ -197,8 +195,6 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { 'type' => 'string_textfield', 'weight' => -4, ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); @@ -229,11 +225,11 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) ->setDescription(t('A boolean indicating whether the Case entity is published.')) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); +# ->setDisplayOptions('form', [ +# 'type' => 'boolean_checkbox', +# 'weight' => -3, +# ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php index 47ecd63..d67b2b7 100644 --- a/src/Plugin/Block/PersonPanel.php +++ b/src/Plugin/Block/PersonPanel.php @@ -54,7 +54,7 @@ class PersonPanel extends BlockBase { // they have hats, so display the case view for each hat. foreach($hats as $hat) { $markup .= $this->showCases($hat); - $markup .= $this->showCaseCreationLinks($hat); + $markup .= $this->showCaseCreationLinks($hat, $person_id); } } } @@ -77,12 +77,12 @@ class PersonPanel extends BlockBase { } // Provides links to create different types of cases, passing in the hat id. - private function showCaseCreationLinks($hat) { + private function showCaseCreationLinks($hat, $person_id) { $hat_id = $hat->id(); $case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('case_entity'); foreach($case_types as $case_type_id => $type) { $label = $type['label']; - $markup .= "

Add a $label Case

"; + $markup .= "

Add a $label Case

"; } return ""; } From 484fb5a1194eb7572e4f3452d6db0bae3acc138a Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 12:26:09 +0200 Subject: [PATCH 60/94] Added activity entity --- modules/zencrm_entities/activity.page.inc | 30 +++ .../config/schema/activity_type.schema.yml | 12 + .../src/ActivityAccessControlHandler.php | 47 ++++ .../src/ActivityHtmlRouteProvider.php | 56 +++++ .../src/ActivityListBuilder.php | 40 ++++ .../src/ActivityTranslationHandler.php | 14 ++ .../src/ActivityTypeHtmlRouteProvider.php | 28 +++ .../src/ActivityTypeListBuilder.php | 32 +++ .../zencrm_entities/src/Entity/Activity.php | 224 ++++++++++++++++++ .../src/Entity/ActivityInterface.php | 77 ++++++ .../src/Entity/ActivityType.php | 58 +++++ .../src/Entity/ActivityTypeInterface.php | 13 + .../src/Entity/ActivityViewsData.php | 24 ++ .../src/Form/ActivityDeleteForm.php | 15 ++ .../zencrm_entities/src/Form/ActivityForm.php | 50 ++++ .../src/Form/ActivitySettingsForm.php | 53 +++++ .../src/Form/ActivityTypeDeleteForm.php | 53 +++++ .../src/Form/ActivityTypeForm.php | 65 +++++ .../activity-content-add-list.html.twig | 23 ++ .../templates/activity.html.twig | 22 ++ .../zencrm_entities.links.action.yml | 11 + .../zencrm_entities.links.menu.yml | 18 ++ .../zencrm_entities.links.task.yml | 18 ++ .../zencrm_entities/zencrm_entities.module | 26 ++ .../zencrm_entities.permissions.yml | 19 ++ 25 files changed, 1028 insertions(+) create mode 100644 modules/zencrm_entities/activity.page.inc create mode 100644 modules/zencrm_entities/config/schema/activity_type.schema.yml create mode 100644 modules/zencrm_entities/src/ActivityAccessControlHandler.php create mode 100644 modules/zencrm_entities/src/ActivityHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/ActivityListBuilder.php create mode 100644 modules/zencrm_entities/src/ActivityTranslationHandler.php create mode 100644 modules/zencrm_entities/src/ActivityTypeHtmlRouteProvider.php create mode 100644 modules/zencrm_entities/src/ActivityTypeListBuilder.php create mode 100644 modules/zencrm_entities/src/Entity/Activity.php create mode 100644 modules/zencrm_entities/src/Entity/ActivityInterface.php create mode 100644 modules/zencrm_entities/src/Entity/ActivityType.php create mode 100644 modules/zencrm_entities/src/Entity/ActivityTypeInterface.php create mode 100644 modules/zencrm_entities/src/Entity/ActivityViewsData.php create mode 100644 modules/zencrm_entities/src/Form/ActivityDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ActivityForm.php create mode 100644 modules/zencrm_entities/src/Form/ActivitySettingsForm.php create mode 100644 modules/zencrm_entities/src/Form/ActivityTypeDeleteForm.php create mode 100644 modules/zencrm_entities/src/Form/ActivityTypeForm.php create mode 100644 modules/zencrm_entities/templates/activity-content-add-list.html.twig create mode 100644 modules/zencrm_entities/templates/activity.html.twig diff --git a/modules/zencrm_entities/activity.page.inc b/modules/zencrm_entities/activity.page.inc new file mode 100644 index 0000000..b625101 --- /dev/null +++ b/modules/zencrm_entities/activity.page.inc @@ -0,0 +1,30 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished activity entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published activity entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit activity entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete activity entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add activity entities'); + } + +} diff --git a/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php b/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php new file mode 100644 index 0000000..995afa5 --- /dev/null +++ b/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php @@ -0,0 +1,56 @@ +id(); + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\zencrm_entities\Form\ActivitySettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/modules/zencrm_entities/src/ActivityListBuilder.php b/modules/zencrm_entities/src/ActivityListBuilder.php new file mode 100644 index 0000000..5a46cd9 --- /dev/null +++ b/modules/zencrm_entities/src/ActivityListBuilder.php @@ -0,0 +1,40 @@ +t('Activity ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\zencrm_entities\Entity\Activity */ + $row['id'] = $entity->id(); + $row['name'] = Link::createFromRoute( + $entity->label(), + 'entity.activity.edit_form', + ['activity' => $entity->id()] + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/ActivityTranslationHandler.php b/modules/zencrm_entities/src/ActivityTranslationHandler.php new file mode 100644 index 0000000..97653bd --- /dev/null +++ b/modules/zencrm_entities/src/ActivityTranslationHandler.php @@ -0,0 +1,14 @@ +t('Activity type'); + $header['id'] = $this->t('Machine name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + $row['label'] = $entity->label(); + $row['id'] = $entity->id(); + // You probably want a few more properties here... + return $row + parent::buildRow($entity); + } + +} diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php new file mode 100644 index 0000000..e361038 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -0,0 +1,224 @@ + \Drupal::currentUser()->id(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Activity entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') +# ->setDisplayOptions('view', [ +# 'label' => 'hidden', +# 'type' => 'author', +# 'weight' => 0, +# ]) +# ->setDisplayOptions('form', [ +# 'type' => 'entity_reference_autocomplete', +# 'weight' => 5, +# 'settings' => [ +# 'match_operator' => 'CONTAINS', +# 'size' => '60', +# 'autocomplete_type' => 'tags', +# 'placeholder' => '', +# ], +# ]) +# ->setDisplayConfigurable('form', TRUE) +# ->setDisplayConfigurable('view', TRUE); + ->setTranslatable(TRUE); + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Activity entity.')) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => -4, + ]) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRequired(TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Activity is published.')) + ->setDefaultValue(TRUE) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'weight' => -3, + ]); + + $fields['created'] = BaseFieldDefinition::create('created') + ->setLabel(t('Created')) + ->setDescription(t('The time that the entity was created.')); + + $fields['changed'] = BaseFieldDefinition::create('changed') + ->setLabel(t('Changed')) + ->setDescription(t('The time that the entity was last edited.')); + + return $fields; + } + +} diff --git a/modules/zencrm_entities/src/Entity/ActivityInterface.php b/modules/zencrm_entities/src/Entity/ActivityInterface.php new file mode 100644 index 0000000..2529255 --- /dev/null +++ b/modules/zencrm_entities/src/Entity/ActivityInterface.php @@ -0,0 +1,77 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = $this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Activity.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Activity.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.activity.canonical', ['activity' => $entity->id()]); + } + +} diff --git a/modules/zencrm_entities/src/Form/ActivitySettingsForm.php b/modules/zencrm_entities/src/Form/ActivitySettingsForm.php new file mode 100644 index 0000000..5eaf677 --- /dev/null +++ b/modules/zencrm_entities/src/Form/ActivitySettingsForm.php @@ -0,0 +1,53 @@ +t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); + } + + /** + * {@inheritdoc} + */ + public function getCancelUrl() { + return new Url('entity.activity_type.collection'); + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return $this->t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->entity->delete(); + + drupal_set_message( + $this->t('content @type: deleted @label.', + [ + '@type' => $this->entity->bundle(), + '@label' => $this->entity->label(), + ] + ) + ); + + $form_state->setRedirectUrl($this->getCancelUrl()); + } + +} diff --git a/modules/zencrm_entities/src/Form/ActivityTypeForm.php b/modules/zencrm_entities/src/Form/ActivityTypeForm.php new file mode 100644 index 0000000..be3b89f --- /dev/null +++ b/modules/zencrm_entities/src/Form/ActivityTypeForm.php @@ -0,0 +1,65 @@ +entity; + $form['label'] = [ + '#type' => 'textfield', + '#title' => $this->t('Label'), + '#maxlength' => 255, + '#default_value' => $activity_type->label(), + '#description' => $this->t("Label for the Activity type."), + '#required' => TRUE, + ]; + + $form['id'] = [ + '#type' => 'machine_name', + '#default_value' => $activity_type->id(), + '#machine_name' => [ + 'exists' => '\Drupal\zencrm_entities\Entity\ActivityType::load', + ], + '#disabled' => !$activity_type->isNew(), + ]; + + /* You will need additional form elements for your custom properties. */ + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $activity_type = $this->entity; + $status = $activity_type->save(); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Activity type.', [ + '%label' => $activity_type->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Activity type.', [ + '%label' => $activity_type->label(), + ])); + } + $form_state->setRedirectUrl($activity_type->toUrl('collection')); + } + +} diff --git a/modules/zencrm_entities/templates/activity-content-add-list.html.twig b/modules/zencrm_entities/templates/activity-content-add-list.html.twig new file mode 100644 index 0000000..0c627f6 --- /dev/null +++ b/modules/zencrm_entities/templates/activity-content-add-list.html.twig @@ -0,0 +1,23 @@ +{# +/** + * @file + * Default theme implementation to present a list of custom content entity types/bundles. + * + * Available variables: + * - types: A collection of all the available custom entity types/bundles. + * Each type/bundle contains the following: + * - link: A link to add a content entity of this type. + * - description: A description of this content entity types/bundle. + * + * @see template_preprocess_activity_content_add_list() + * + * @ingroup themeable + */ +#} +{% spaceless %} +
+ {% for type in types %} +
{{ type.link }}
+ {% endfor %} +
+{% endspaceless %} diff --git a/modules/zencrm_entities/templates/activity.html.twig b/modules/zencrm_entities/templates/activity.html.twig new file mode 100644 index 0000000..682cbc6 --- /dev/null +++ b/modules/zencrm_entities/templates/activity.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file activity.html.twig + * Default theme implementation to present Activity data. + * + * This template is used when viewing Activity pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_activity() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml index 20bba41..52962cd 100644 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ b/modules/zencrm_entities/zencrm_entities.links.action.yml @@ -41,3 +41,14 @@ entity.case_entity_type.add_form: appears_on: - entity.case_entity_type.collection +entity.activity.add_form: + route_name: entity.activity.add_page + title: 'Add Activity' + appears_on: + - entity.activity.collection +entity.activity_type.add_form: + route_name: entity.activity_type.add_form + title: 'Add Activity type' + appears_on: + - entity.activity_type.collection + diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml index 60664c4..5c70787 100644 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ b/modules/zencrm_entities/zencrm_entities.links.menu.yml @@ -90,3 +90,21 @@ entity.case_entity_type.collection: parent: system.admin_structure weight: 99 + +# Activity menu items definition +entity.activity.collection: + title: 'Activity list' + route_name: entity.activity.collection + description: 'List Activity entities' + parent: system.admin_structure + weight: 100 + + +# Activity type menu items definition +entity.activity_type.collection: + title: 'Activity type' + route_name: entity.activity_type.collection + description: 'List Activity type (bundles)' + parent: system.admin_structure + weight: 99 + diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml index b21d97e..c9d127f 100644 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ b/modules/zencrm_entities/zencrm_entities.links.task.yml @@ -122,3 +122,21 @@ entity.case_entity.delete_form: title: Delete weight: 10 +# Activity routing definition + +entity.activity.canonical: + route_name: entity.activity.canonical + base_route: entity.activity.canonical + title: 'View' + +entity.activity.edit_form: + route_name: entity.activity.edit_form + base_route: entity.activity.canonical + title: 'Edit' + +entity.activity.delete_form: + route_name: entity.activity.delete_form + base_route: entity.activity.canonical + title: Delete + weight: 10 + diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module index 2d142af..064515a 100644 --- a/modules/zencrm_entities/zencrm_entities.module +++ b/modules/zencrm_entities/zencrm_entities.module @@ -81,6 +81,16 @@ function zencrm_entities_theme() { 'variables' => ['content' => NULL], 'file' => 'case_entity.page.inc', ]; + $theme['activity'] = [ + 'render element' => 'elements', + 'file' => 'activity.page.inc', + 'template' => 'activity', + ]; + $theme['activity_content_add_list'] = [ + 'render element' => 'content', + 'variables' => ['content' => NULL], + 'file' => 'activity.page.inc', + ]; return $theme; } @@ -115,3 +125,19 @@ function zencrm_entities_theme_suggestions_case_entity(array $variables) { $suggestions[] = 'case_entity__' . $entity->id() . '__' . $sanitized_view_mode; return $suggestions; } + +/** +* Implements hook_theme_suggestions_HOOK(). +*/ +function zencrm_entities_theme_suggestions_activity(array $variables) { + $suggestions = []; + $entity = $variables['elements']['#activity']; + $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); + + $suggestions[] = 'activity__' . $sanitized_view_mode; + $suggestions[] = 'activity__' . $entity->bundle(); + $suggestions[] = 'activity__' . $entity->bundle() . '__' . $sanitized_view_mode; + $suggestions[] = 'activity__' . $entity->id(); + $suggestions[] = 'activity__' . $entity->id() . '__' . $sanitized_view_mode; + return $suggestions; +} diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 90c6ab4..8f61d6c 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -135,3 +135,22 @@ view published case entity entities: view unpublished case entity entities: title: 'View unpublished Case entity entities' +add activity entities: + title: 'Create new Activity entities' + +administer activity entities: + title: 'Administer Activity entities' + description: 'Allow to access the administration form to configure Activity entities.' + restrict access: true + +delete activity entities: + title: 'Delete Activity entities' + +edit activity entities: + title: 'Edit Activity entities' + +view published activity entities: + title: 'View published Activity entities' + +view unpublished activity entities: + title: 'View unpublished Activity entities' From 9d84451cb005d1e1c9be0b51a0a5b3298566dbe6 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 13:18:24 +0200 Subject: [PATCH 61/94] Hid status field on activity --- modules/zencrm_entities/src/Entity/Activity.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php index e361038..5ea8719 100644 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -204,11 +204,11 @@ class Activity extends ContentEntityBase implements ActivityInterface { $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) ->setDescription(t('A boolean indicating whether the Activity is published.')) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'weight' => -3, - ]); + # ->setDisplayOptions('form', [ + # 'type' => 'boolean_checkbox', + # 'weight' => -3, + # ]) + ->setDefaultValue(TRUE); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) From 7c66cbd7914e108145579f79e66fff4446e39a5b Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 13:30:41 +0200 Subject: [PATCH 62/94] Cosmetic changes to case entity fields --- modules/zencrm_entities/src/Entity/CaseEntity.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index bad6bea..393d747 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -179,15 +179,15 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { ->setTranslatable(TRUE); $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the Case entity entity.')) + ->setLabel(t('Title')) + ->setDescription(t('A name for this case')) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, ]) ->setDefaultValue('') ->setDisplayOptions('view', [ - 'label' => 'above', + 'label' => 'hidden', 'type' => 'string', 'weight' => -4, ]) From 7eb0ee092bac1672f6c1fbe48e2c120ed4ee0f0b Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 13:35:04 +0200 Subject: [PATCH 63/94] Added case field to activity --- modules/zencrm_entities/src/Entity/Activity.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php index 5ea8719..14016a3 100644 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -180,6 +180,13 @@ class Activity extends ContentEntityBase implements ActivityInterface { # ->setDisplayConfigurable('view', TRUE); ->setTranslatable(TRUE); + // This field is always implied from the context, + // so has no form or view display. + $fields['case'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Case')) + ->setDescription(t('The case this activity belongs to.')) + ->setSetting('target_type', 'case_entity'); + $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) ->setDescription(t('The name of the Activity entity.')) From 0dec481020bf49ac5eba0fe92727c6ad33bfc32f Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 14:40:37 +0200 Subject: [PATCH 64/94] Added route and controller for adding activity to case --- .../zencrm_entities/src/Entity/Activity.php | 4 +- src/Controller/ActivityController.php | 35 ++++++++++++++++ src/Plugin/Block/ActivityCreator.php | 40 +++++++++++++++++++ zencrm.routing.yml | 8 ++++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/Controller/ActivityController.php create mode 100644 src/Plugin/Block/ActivityCreator.php diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php index 14016a3..8ef11d5 100644 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -182,14 +182,14 @@ class Activity extends ContentEntityBase implements ActivityInterface { // This field is always implied from the context, // so has no form or view display. - $fields['case'] = BaseFieldDefinition::create('entity_reference') + $fields['case_entity'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Case')) ->setDescription(t('The case this activity belongs to.')) ->setSetting('target_type', 'case_entity'); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')) - ->setDescription(t('The name of the Activity entity.')) + ->setDescription(t('The name of the Activity.')) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, diff --git a/src/Controller/ActivityController.php b/src/Controller/ActivityController.php new file mode 100644 index 0000000..a611c06 --- /dev/null +++ b/src/Controller/ActivityController.php @@ -0,0 +1,35 @@ + $activity_type_id, + 'case_entity' => $case_id, + ); + + $activity = \Drupal::entityTypeManager() + ->getStorage('activity') + ->create($values); + + $form = \Drupal::entityTypeManager() + ->getFormObject('activity', 'default') + ->setEntity($activity); + + return \Drupal::formBuilder()->getForm($form); + } +} diff --git a/src/Plugin/Block/ActivityCreator.php b/src/Plugin/Block/ActivityCreator.php new file mode 100644 index 0000000..21f689f --- /dev/null +++ b/src/Plugin/Block/ActivityCreator.php @@ -0,0 +1,40 @@ +getParameter('case_entity')->id(); + $markup = ""; + + $activity_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('activity'); + foreach($activity_types as $activity_type_id => $type) { + $label = $type['label']; + $markup .= "

Add a $label Activity

"; + } + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => "" + ]; + + } + +} diff --git a/zencrm.routing.yml b/zencrm.routing.yml index 3266263..54e5717 100644 --- a/zencrm.routing.yml +++ b/zencrm.routing.yml @@ -30,3 +30,11 @@ zencrm.case.create: requirements: _permission: 'access content' +zencrm.activity.create: + path: '/zencrm/activity/{case_id}/add/{activity_type_id}' + defaults: + _controller: '\Drupal\zencrm\Controller\ActivityController::createActivityForCase' + _title: 'Add New Activity' + requirements: + _permission: 'access content' + From 09142a52dc99dbb965ce0f5b5d61cc0556e9ff80 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 15:32:34 +0200 Subject: [PATCH 65/94] Removed case itself from case page template Because it will be managed with views and blocks. --- modules/zencrm_entities/templates/case_entity.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig index 41f7a76..26f4cb5 100644 --- a/modules/zencrm_entities/templates/case_entity.html.twig +++ b/modules/zencrm_entities/templates/case_entity.html.twig @@ -17,6 +17,6 @@ #} {% if content %} - {{- content -}} + {# removed content because case page is managed via views and blocks #} {% endif %} From 33a8b1e0a5e3daa7a04c88210798d97f7f9e3cb4 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 16:01:06 +0200 Subject: [PATCH 66/94] Added subject field to activity, and made that the label --- modules/zencrm_entities/src/Entity/Activity.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php index 8ef11d5..cba637a 100644 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -42,7 +42,7 @@ use Drupal\user\UserInterface; * entity_keys = { * "id" = "id", * "bundle" = "type", - * "label" = "name", + * "label" = "subject", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", @@ -187,9 +187,9 @@ class Activity extends ContentEntityBase implements ActivityInterface { ->setDescription(t('The case this activity belongs to.')) ->setSetting('target_type', 'case_entity'); - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the Activity.')) + $fields['subject'] = BaseFieldDefinition::create('string') + ->setLabel(t('Subject')) + ->setDescription(t('The purpose of the Activity.')) ->setSettings([ 'max_length' => 50, 'text_processing' => 0, @@ -204,8 +204,6 @@ class Activity extends ContentEntityBase implements ActivityInterface { 'type' => 'string_textfield', 'weight' => -4, ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); $fields['status'] = BaseFieldDefinition::create('boolean') From 171eaa73a267d5e0370da8214beb793c1ee8ed8c Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 16:26:24 +0200 Subject: [PATCH 67/94] cosmetic change --- src/Plugin/Block/ActivityCreator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/Block/ActivityCreator.php b/src/Plugin/Block/ActivityCreator.php index 21f689f..9c8067b 100644 --- a/src/Plugin/Block/ActivityCreator.php +++ b/src/Plugin/Block/ActivityCreator.php @@ -26,7 +26,7 @@ class ActivityCreator extends BlockBase { $activity_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('activity'); foreach($activity_types as $activity_type_id => $type) { $label = $type['label']; - $markup .= "

Add a $label Activity

"; + $markup .= "

Add a $label

"; } return [ '#cache' => [ From 483d1ac9d96df89f8b2ab0f4c4782ddb8d994145 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 17:20:51 +0200 Subject: [PATCH 68/94] Added Involved Parties block for case page --- src/Plugin/Block/InvolvedParties.php | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Plugin/Block/InvolvedParties.php diff --git a/src/Plugin/Block/InvolvedParties.php b/src/Plugin/Block/InvolvedParties.php new file mode 100644 index 0000000..be835e0 --- /dev/null +++ b/src/Plugin/Block/InvolvedParties.php @@ -0,0 +1,40 @@ +getParameter('case_entity')->id(); + $markup = ""; + + $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); + $hats_involved = $case->hats_involved->referencedEntities(); + foreach($hats_involved as $hat) { + $person_id = $hat->person->first()->getValue()['target_id']; + $markup .= "

" . $hat->name->getString() . "

"; + } + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => "" + ]; + + } + +} From 72936b0da6c694484366af395f70d5eea121363e Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 17:49:58 +0200 Subject: [PATCH 69/94] Put content back into case html template I discovered that it is where the "rendered entity" comes from. --- modules/zencrm_entities/templates/case_entity.html.twig | 2 +- src/Plugin/Block/InvolvedParties.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig index 26f4cb5..41f7a76 100644 --- a/modules/zencrm_entities/templates/case_entity.html.twig +++ b/modules/zencrm_entities/templates/case_entity.html.twig @@ -17,6 +17,6 @@ #} {% if content %} - {# removed content because case page is managed via views and blocks #} + {{- content -}} {% endif %} diff --git a/src/Plugin/Block/InvolvedParties.php b/src/Plugin/Block/InvolvedParties.php index be835e0..ce40a1f 100644 --- a/src/Plugin/Block/InvolvedParties.php +++ b/src/Plugin/Block/InvolvedParties.php @@ -26,7 +26,7 @@ class InvolvedParties extends BlockBase { $hats_involved = $case->hats_involved->referencedEntities(); foreach($hats_involved as $hat) { $person_id = $hat->person->first()->getValue()['target_id']; - $markup .= "

" . $hat->name->getString() . "

"; + $markup .= "

" . $hat->name->getString() . "

"; } return [ '#cache' => [ From 59785463337a8acc2790f2c1d9e2aabda92e40fa Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 18:19:43 +0200 Subject: [PATCH 70/94] Removed involved parties from default case view mode They will be handled by block code because they need to link to the persons not the hats --- .../zencrm_entities/src/Entity/CaseEntity.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index 393d747..d463a71 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -186,11 +186,6 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { 'text_processing' => 0, ]) ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'hidden', - 'type' => 'string', - 'weight' => -4, - ]) ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, @@ -205,11 +200,6 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { ->setSetting('handler', 'default') ->setTranslatable(TRUE) ->setCardinality(-1) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'author', - 'weight' => 0, - ]) ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', 'weight' => 5, @@ -233,7 +223,12 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); + ->setDescription(t('The time that the entity was created.')) + ->setDisplayOptions('view', [ + 'label' => 'inline', + 'type' => 'string', + 'weight' => 0, + ]); $fields['changed'] = BaseFieldDefinition::create('changed') ->setLabel(t('Changed')) From 73f072a1c55a3412f20259b3f93caebb16bb888a Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 18:44:38 +0200 Subject: [PATCH 71/94] Created Case Details Block Will use that for sidebar instead of previous Involved Parties block and case details view --- src/Plugin/Block/CaseDetails.php | 58 ++++++++++++++++++++++++++++ src/Plugin/Block/InvolvedParties.php | 40 ------------------- 2 files changed, 58 insertions(+), 40 deletions(-) create mode 100644 src/Plugin/Block/CaseDetails.php delete mode 100644 src/Plugin/Block/InvolvedParties.php diff --git a/src/Plugin/Block/CaseDetails.php b/src/Plugin/Block/CaseDetails.php new file mode 100644 index 0000000..c7430b7 --- /dev/null +++ b/src/Plugin/Block/CaseDetails.php @@ -0,0 +1,58 @@ +getParameter('case_entity')->id(); + $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); + $markup .= $this->renderInvolvedParties($case); + $markup .= $this->renderEntity($case); + $markup .= $this->renderEditLink($case_id); + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => $markup + ]; + + } + + private function renderEditLink($case_id) { + return ""; + } + + private function renderEntity($case) { + $view_builder = \Drupal::entityTypeManager()->getViewBuilder('case_entity'); + $build = $view_builder->view($case, 'default'); + return render($build); + } + + private function renderInvolvedParties($case) { + $markup = "

Involved Parties

"; + $hats_involved = $case->hats_involved->referencedEntities(); + foreach($hats_involved as $hat) { + $person_id = $hat->person->first()->getValue()['target_id']; + error_log($person_id); + $markup .= "

" . $hat->name->getString() . "

"; + } + return ""; + } + +} diff --git a/src/Plugin/Block/InvolvedParties.php b/src/Plugin/Block/InvolvedParties.php deleted file mode 100644 index ce40a1f..0000000 --- a/src/Plugin/Block/InvolvedParties.php +++ /dev/null @@ -1,40 +0,0 @@ -getParameter('case_entity')->id(); - $markup = ""; - - $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); - $hats_involved = $case->hats_involved->referencedEntities(); - foreach($hats_involved as $hat) { - $person_id = $hat->person->first()->getValue()['target_id']; - $markup .= "

" . $hat->name->getString() . "

"; - } - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => "" - ]; - - } - -} From 368c355ce5ed90a1b483290a2f8b0b37a61a1d17 Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 14 Apr 2018 18:52:04 +0200 Subject: [PATCH 72/94] Fixed edit link on case details block --- src/Plugin/Block/CaseDetails.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Plugin/Block/CaseDetails.php b/src/Plugin/Block/CaseDetails.php index c7430b7..902361d 100644 --- a/src/Plugin/Block/CaseDetails.php +++ b/src/Plugin/Block/CaseDetails.php @@ -35,7 +35,7 @@ class CaseDetails extends BlockBase { } private function renderEditLink($case_id) { - return ""; + return ""; } private function renderEntity($case) { @@ -49,7 +49,6 @@ class CaseDetails extends BlockBase { $hats_involved = $case->hats_involved->referencedEntities(); foreach($hats_involved as $hat) { $person_id = $hat->person->first()->getValue()['target_id']; - error_log($person_id); $markup .= "

" . $hat->name->getString() . "

"; } return ""; From feaaa6cbb885433945b97d0e3ab2adcb589596f4 Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 10:22:55 +0200 Subject: [PATCH 73/94] Added CSS and Javascript. --- css/opencase.css | 64 ++++++++++++++++++++++ js/opencase.js | 4 ++ modules/zencrm_entities/src/Entity/Hat.php | 2 +- zencrm.info.yml | 2 + zencrm.libraries.yml | 7 +++ zencrm.module | 4 ++ 6 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 css/opencase.css create mode 100644 js/opencase.js create mode 100644 zencrm.libraries.yml diff --git a/css/opencase.css b/css/opencase.css new file mode 100644 index 0000000..29b3e88 --- /dev/null +++ b/css/opencase.css @@ -0,0 +1,64 @@ +/* this part is for the wider theme and will be removed */ +a.site-branding__logo img { + max-width: 100px; +} + +/* Module-specific from here. */ +div.region.region-primary-menu { + display:none; +} + +.field--name-contact-details a { + border-bottom: none; +} + +.region-sidebar-second .view-content li, .region-sidebar-second .views-row { + border-bottom: 1px solid lightgrey; + padding-bottom: 20px; + padding-top: 20px; +} + +.sidebar .region-sidebar-second h2 { + font-size: 1.6em; + text-align: center; + border-bottom: 1px solid grey; +} + +.sidebar .views-field.views-field-type, .field--name-type{ + padding-bottom: 12px; + font-size: 1.4em; + text-align: center; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.sidebar .field__label, .sidebar .field--type-entity-reference .field__label { + font-size: 1em; + font-weight: bold; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.sidebar .views-element-container .field { + padding-bottom: 15px; +} + +.sidebar .views-element-container .field .field__item { + font-size: 1.1em; +} + +.region-sidebar-second .view-content li, .region-sidebar-second .views-row { + border-bottom: 10px solid #e6e6d3; + padding-bottom: 20px; + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + background: #eeeedb; +} + +.region-sidebar-second .views-element-container.block { + padding-right: 10px; + padding-left: 10px; +} + +.zencrm_creationlinks { + padding: 10px 10px 10px 20px; +} diff --git a/js/opencase.js b/js/opencase.js new file mode 100644 index 0000000..7086516 --- /dev/null +++ b/js/opencase.js @@ -0,0 +1,4 @@ +(function ($, Drupal) { + $(".field--name-contact-details a").contents().unwrap(); + $('#edit-search-api-fulltext').attr('autocomplete', 'off'); +})(jQuery, Drupal); diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index f1e73e9..a5e180a 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -190,7 +190,7 @@ class Hat extends ContentEntityBase implements HatInterface { 'display_name' => 'entity_reference_1' ]]) ->setDisplayOptions('view', [ - 'label' => 'inline', + 'label' => 'above', 'weight' => 0, 'settings' => ['link' => 'false'] ]) diff --git a/zencrm.info.yml b/zencrm.info.yml index e41cab6..2378539 100644 --- a/zencrm.info.yml +++ b/zencrm.info.yml @@ -6,3 +6,5 @@ package: 'Zen CRM' dependencies: - zencrm_entities - zencrm_search +libraries: + - zencrm/opencase-lib diff --git a/zencrm.libraries.yml b/zencrm.libraries.yml new file mode 100644 index 0000000..de55277 --- /dev/null +++ b/zencrm.libraries.yml @@ -0,0 +1,7 @@ +opencase-lib: + version: 1.x + css: + theme: + css/opencase.css: {} + js: + js/opencase.js: {} diff --git a/zencrm.module b/zencrm.module index 20421e4..d5ece5e 100644 --- a/zencrm.module +++ b/zencrm.module @@ -33,3 +33,7 @@ function zencrm_theme() { ], ]; } + +function zencrm_page_attachments(array &$page) { + $page['#attached']['library'][] = 'zencrm/opencase-lib'; +} From fae90205a41adcc7d42780c32b09ea16bbcb2421 Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 12:44:07 +0200 Subject: [PATCH 74/94] Styling --- css/opencase.css | 56 +++++++++++++++++-- .../zencrm_entities/src/Entity/CaseEntity.php | 2 +- .../templates/case_entity.html.twig | 2 +- src/Plugin/Block/ActivityCreator.php | 2 +- src/Plugin/Block/CaseDetails.php | 13 +++-- src/Plugin/Block/HatCreator.php | 2 +- 6 files changed, 62 insertions(+), 15 deletions(-) diff --git a/css/opencase.css b/css/opencase.css index 29b3e88..31879f1 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -12,10 +12,19 @@ div.region.region-primary-menu { border-bottom: none; } -.region-sidebar-second .view-content li, .region-sidebar-second .views-row { - border-bottom: 1px solid lightgrey; +.region-sidebar-second .view-content li, .region-sidebar-second .views-row, .region-sidebar-second .zencrm_inner_sidebar_block { + border-bottom: 10px solid #e6e6d3; padding-bottom: 20px; - padding-top: 20px; + padding-top: 10px; + padding-right: 10px; + padding-left: 10px; + background: #eeeedb; + border: 1px solid lightgrey; + margin-bottom: 10px; +} + +.region-sidebar-second .view-content li .zencrm_editlink , .region-sidebar-second .views-row .zencrm_editlink, .region-sidebar-second .zencrm_inner_sidebar_block .zencrm_editlink{ + margin-top: -20px; } .sidebar .region-sidebar-second h2 { @@ -24,14 +33,19 @@ div.region.region-primary-menu { border-bottom: 1px solid grey; } -.sidebar .views-field.views-field-type, .field--name-type{ +.sidebar .views-field.views-field-type, .field--name-type, .zencrm_inner_sidebar_block .zencrm_title { padding-bottom: 12px; font-size: 1.4em; text-align: center; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } -.sidebar .field__label, .sidebar .field--type-entity-reference .field__label { +.zencrm_inner_sidebar_block .zencrm_title { + font-size: 1.2em; + padding-bottom: 5px; +} + +.sidebar .field__label, .sidebar .field--type-entity-reference .field__label, .form-item label { font-size: 1em; font-weight: bold; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -46,7 +60,6 @@ div.region.region-primary-menu { } .region-sidebar-second .view-content li, .region-sidebar-second .views-row { - border-bottom: 10px solid #e6e6d3; padding-bottom: 20px; padding-top: 10px; padding-right: 10px; @@ -61,4 +74,35 @@ div.region.region-primary-menu { .zencrm_creationlinks { padding: 10px 10px 10px 20px; + font-size: 1.2em; + +} + +.sidebar .zencrm_links { + font-size: 1.2em; +} + +.sidebar .zencrm_links p, .sidebar .zencrm_creationlinks p { + margin-bottom: 0.5em; +} + +.zencrm_creationlinks p { + margin-bottom: 0.5em; +} + +.sidebar .zencrm_creationlinks { + padding: 5px; + font-size: 1.3em; + +} + +.sidebar .zencrm_editlink { + font-size: 1.2em; + text-align: right; +} + +#block-hatcreator { + padding: 0; + border: none; + margin: 0; } diff --git a/modules/zencrm_entities/src/Entity/CaseEntity.php b/modules/zencrm_entities/src/Entity/CaseEntity.php index d463a71..e2d4aaf 100644 --- a/modules/zencrm_entities/src/Entity/CaseEntity.php +++ b/modules/zencrm_entities/src/Entity/CaseEntity.php @@ -225,7 +225,7 @@ class CaseEntity extends ContentEntityBase implements CaseEntityInterface { ->setLabel(t('Created')) ->setDescription(t('The time that the entity was created.')) ->setDisplayOptions('view', [ - 'label' => 'inline', + 'label' => 'above', 'type' => 'string', 'weight' => 0, ]); diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig index 41f7a76..bce3352 100644 --- a/modules/zencrm_entities/templates/case_entity.html.twig +++ b/modules/zencrm_entities/templates/case_entity.html.twig @@ -17,6 +17,6 @@ #} {% if content %} - {{- content -}} +
{{- content -}}
{% endif %} diff --git a/src/Plugin/Block/ActivityCreator.php b/src/Plugin/Block/ActivityCreator.php index 9c8067b..de9ebce 100644 --- a/src/Plugin/Block/ActivityCreator.php +++ b/src/Plugin/Block/ActivityCreator.php @@ -32,7 +32,7 @@ class ActivityCreator extends BlockBase { '#cache' => [ 'max-age' => 0, ], - '#markup' => "" + '#markup' => "" ]; } diff --git a/src/Plugin/Block/CaseDetails.php b/src/Plugin/Block/CaseDetails.php index 902361d..5697b68 100644 --- a/src/Plugin/Block/CaseDetails.php +++ b/src/Plugin/Block/CaseDetails.php @@ -35,23 +35,26 @@ class CaseDetails extends BlockBase { } private function renderEditLink($case_id) { - return ""; + return ""; } private function renderEntity($case) { $view_builder = \Drupal::entityTypeManager()->getViewBuilder('case_entity'); $build = $view_builder->view($case, 'default'); - return render($build); + $markup = render($build); + return "
$markup
"; } private function renderInvolvedParties($case) { - $markup = "

Involved Parties

"; + $markup = "

Involved Parties

"; $hats_involved = $case->hats_involved->referencedEntities(); + $links_markup = ""; foreach($hats_involved as $hat) { $person_id = $hat->person->first()->getValue()['target_id']; - $markup .= "

" . $hat->name->getString() . "

"; + $links_markup .= "

" . $hat->name->getString() . "

"; } - return ""; + $markup .= ""; + return "
$markup
"; } } diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php index a29ed9f..cb6632d 100644 --- a/src/Plugin/Block/HatCreator.php +++ b/src/Plugin/Block/HatCreator.php @@ -38,7 +38,7 @@ class HatCreator extends BlockBase { '#cache' => [ 'max-age' => 0, ], - '#markup' => "" + '#markup' => "" ]; } From 58136ba2b4974615b6ea8149bf39451334f0ab0f Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 12:53:49 +0200 Subject: [PATCH 75/94] styling --- css/opencase.css | 5 +++++ modules/zencrm_entities/src/Entity/Activity.php | 2 +- modules/zencrm_entities/templates/case_entity.html.twig | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/css/opencase.css b/css/opencase.css index 31879f1..3450d2f 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -4,6 +4,11 @@ a.site-branding__logo img { } /* Module-specific from here. */ + +#content .zencrm_case_details { + display: none; /* don't show case as main content - it's shown in sidebar */ +} + div.region.region-primary-menu { display:none; } diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php index cba637a..3cdfc72 100644 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ b/modules/zencrm_entities/src/Entity/Activity.php @@ -196,7 +196,7 @@ class Activity extends ContentEntityBase implements ActivityInterface { ]) ->setDefaultValue('') ->setDisplayOptions('view', [ - 'label' => 'above', + 'label' => 'hidden', 'type' => 'string', 'weight' => -4, ]) diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig index bce3352..d8c3212 100644 --- a/modules/zencrm_entities/templates/case_entity.html.twig +++ b/modules/zencrm_entities/templates/case_entity.html.twig @@ -17,6 +17,6 @@ #} {% if content %} -
{{- content -}}
+
{{- content -}}
{% endif %} From 01b0a2c93f03379b35a72812645fc1522225ef98 Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 13:21:14 +0200 Subject: [PATCH 76/94] Styled the modal forms. --- css/opencase.css | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/css/opencase.css b/css/opencase.css index 3450d2f..eaef0af 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -5,6 +5,15 @@ a.site-branding__logo img { /* Module-specific from here. */ +.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons { + min-width: 550px; + border: 20px solid rgba(0, 0, 0, 0.51); +} + +.tabledrag-toggle-weight-wrapper { + display: none; +} + #content .zencrm_case_details { display: none; /* don't show case as main content - it's shown in sidebar */ } @@ -38,7 +47,7 @@ div.region.region-primary-menu { border-bottom: 1px solid grey; } -.sidebar .views-field.views-field-type, .field--name-type, .zencrm_inner_sidebar_block .zencrm_title { +.sidebar .views-field.views-field-type, .sidebar .field--name-type, .zencrm_inner_sidebar_block .zencrm_title { padding-bottom: 12px; font-size: 1.4em; text-align: center; From c34669afe619c00eecc26579bb32ced8775785fc Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 13:42:08 +0200 Subject: [PATCH 77/94] more css --- css/opencase.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/opencase.css b/css/opencase.css index eaef0af..b353599 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -81,7 +81,7 @@ div.region.region-primary-menu { background: #eeeedb; } -.region-sidebar-second .views-element-container.block { +.region-sidebar-second .views-element-container.block, #block-casedetails { padding-right: 10px; padding-left: 10px; } From ce80a00a4bcf4a4ac71b34c2098a052997e60d4c Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 13:46:28 +0200 Subject: [PATCH 78/94] Updated / added config for views and blocks --- .../optional/block.block.activitycreator.yml | 25 + config/optional/block.block.casedetails.yml | 25 + .../block.block.linkforcreatinganewperson.yml | 24 + ...k__single_case_with_activities_block_1.yml | 30 + ...views.view.single_case_with_activities.yml | 481 +++++++++++++++ ...ews.view.this_person_s_contact_details.yml | 564 ++++++++++++++++++ .../views.view.this_person_s_hats.yml | 11 +- 7 files changed, 1158 insertions(+), 2 deletions(-) create mode 100644 config/optional/block.block.activitycreator.yml create mode 100644 config/optional/block.block.casedetails.yml create mode 100644 config/optional/block.block.linkforcreatinganewperson.yml create mode 100644 config/optional/block.block.views_block__single_case_with_activities_block_1.yml create mode 100644 config/optional/views.view.single_case_with_activities.yml create mode 100644 config/optional/views.view.this_person_s_contact_details.yml diff --git a/config/optional/block.block.activitycreator.yml b/config/optional/block.block.activitycreator.yml new file mode 100644 index 0000000..7f78e46 --- /dev/null +++ b/config/optional/block.block.activitycreator.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + module: + - system + - zencrm + theme: + - bartik +id: activitycreator +theme: bartik +region: content +weight: -7 +provider: null +plugin: activity_creator +settings: + id: activity_creator + label: 'Activity creator' + provider: zencrm + label_display: '0' +visibility: + request_path: + id: request_path + pages: '/zencrm/case/*' + negate: false + context_mapping: { } diff --git a/config/optional/block.block.casedetails.yml b/config/optional/block.block.casedetails.yml new file mode 100644 index 0000000..16b0d65 --- /dev/null +++ b/config/optional/block.block.casedetails.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + module: + - system + - zencrm + theme: + - bartik +id: casedetails +theme: bartik +region: sidebar_second +weight: 0 +provider: null +plugin: case_details +settings: + id: case_details + label: 'Case Details' + provider: zencrm + label_display: visible +visibility: + request_path: + id: request_path + pages: '/zencrm/case/*' + negate: false + context_mapping: { } diff --git a/config/optional/block.block.linkforcreatinganewperson.yml b/config/optional/block.block.linkforcreatinganewperson.yml new file mode 100644 index 0000000..87ac474 --- /dev/null +++ b/config/optional/block.block.linkforcreatinganewperson.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + content: + - 'block_content:basic:8b172f25-b43d-4094-8c03-7e0aee97e057' + module: + - block_content + theme: + - bartik +id: linkforcreatinganewperson +theme: bartik +region: sidebar_first +weight: 0 +provider: null +plugin: 'block_content:8b172f25-b43d-4094-8c03-7e0aee97e057' +settings: + id: 'block_content:8b172f25-b43d-4094-8c03-7e0aee97e057' + label: 'Link for creating a new person' + provider: block_content + label_display: '0' + status: true + info: '' + view_mode: full +visibility: { } diff --git a/config/optional/block.block.views_block__single_case_with_activities_block_1.yml b/config/optional/block.block.views_block__single_case_with_activities_block_1.yml new file mode 100644 index 0000000..06e1b8f --- /dev/null +++ b/config/optional/block.block.views_block__single_case_with_activities_block_1.yml @@ -0,0 +1,30 @@ +langcode: en +status: true +dependencies: + config: + - views.view.single_case_with_activities + module: + - system + - views + theme: + - bartik +id: views_block__single_case_with_activities_block_1 +theme: bartik +region: content +weight: -5 +provider: null +plugin: 'views_block:single_case_with_activities-block_1' +settings: + id: 'views_block:single_case_with_activities-block_1' + label: '' + provider: views + label_display: '0' + views_label: '' + items_per_page: none + context_mapping: { } +visibility: + request_path: + id: request_path + pages: '/zencrm/case/*' + negate: false + context_mapping: { } diff --git a/config/optional/views.view.single_case_with_activities.yml b/config/optional/views.view.single_case_with_activities.yml new file mode 100644 index 0000000..229fce5 --- /dev/null +++ b/config/optional/views.view.single_case_with_activities.yml @@ -0,0 +1,481 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: single_case_with_activities +label: 'Single Case with Activities' +module: views +description: '' +tag: '' +base_table: activity_field_data +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + offset: 0 + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + override: true + sticky: false + caption: '' + summary: '' + description: '' + columns: + name: name + info: + name: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + default: '-1' + empty_table: false + row: + type: 'entity:activity' + fields: + id: + id: id + table: activity_field_data + field: id + relationship: none + group_type: group + admin_label: '' + label: ID + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: activity + entity_field: id + plugin_id: field + type: + id: type + table: activity_field_data + field: type + relationship: none + group_type: group + admin_label: '' + label: 'Activity type' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: activity + entity_field: type + plugin_id: field + subject: + id: subject + table: activity_field_data + field: subject + relationship: none + group_type: group + admin_label: '' + label: Subject + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: activity + entity_field: subject + plugin_id: field + created: + id: created + table: activity_field_data + field: created + relationship: none + group_type: group + admin_label: '' + label: Created + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: timestamp + settings: + date_format: long + custom_date_format: '' + timezone: '' + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: activity + entity_field: created + plugin_id: field + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: 'Custom text' + exclude: false + alter: + alter_text: true + text: 'View  Edit' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + filters: { } + sorts: + created: + id: created + table: activity_field_data + field: created + relationship: none + group_type: group + admin_label: '' + order: DESC + exposed: false + expose: + label: '' + granularity: second + entity_type: activity + entity_field: created + plugin_id: date + title: Activities + header: { } + footer: { } + empty: { } + relationships: + case_entity: + id: case_entity + table: activity_field_data + field: case_entity + relationship: none + group_type: group + admin_label: 'Case entity' + required: true + entity_type: activity + entity_field: case_entity + plugin_id: standard + arguments: + case_entity: + id: case_entity + table: activity_field_data + field: case_entity + relationship: none + group_type: group + admin_label: '' + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: raw + default_argument_options: + index: 2 + use_alias: false + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: activity + entity_field: case_entity + plugin_id: numeric + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } + block_1: + display_plugin: block + id: block_1 + display_title: 'Activity List' + position: 2 + display_options: + display_extenders: { } + display_description: '' + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml new file mode 100644 index 0000000..ae2977f --- /dev/null +++ b/config/optional/views.view.this_person_s_contact_details.yml @@ -0,0 +1,564 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: this_person_s_contact_details +label: 'Contact Details' +module: views +description: '' +tag: '' +base_table: contact_details +base_field: id +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: none + options: + offset: 0 + style: + type: default + options: + grouping: { } + row_class: '' + default_row_class: true + row: + type: fields + options: + default_field_elements: true + inline: { } + separator: '' + hide_empty: false + fields: + id: + id: id + table: contact_details + field: id + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: id + plugin_id: field + rendered_entity: + id: rendered_entity + table: contact_details + field: rendered_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + view_mode: default + entity_type: contact_details + plugin_id: rendered_entity + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: true + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + filters: { } + sorts: { } + title: 'Contact Details' + header: { } + footer: + area_text_custom: + id: area_text_custom + table: views + field: area_text_custom + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: true + content: '' + plugin_id: text_custom + empty: { } + relationships: { } + arguments: + person: + id: person + table: contact_details + field: person + relationship: none + group_type: group + admin_label: '' + default_action: default + exception: + value: all + title_enable: false + title: All + title_enable: false + title: '' + default_argument_type: raw + default_argument_options: + index: 2 + use_alias: false + default_argument_skip_url: false + summary_options: + base_path: '' + count: true + items_per_page: 25 + override: false + summary: + sort_order: asc + number_of_records: 0 + format: default_summary + specify_validation: false + validate: + type: none + fail: 'not found' + validate_options: { } + break_phrase: false + not: false + entity_type: contact_details + entity_field: person + plugin_id: numeric + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } + block_1: + display_plugin: block + id: block_1 + display_title: Block + position: 1 + display_options: + display_extenders: { } + block_hide_empty: true + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } + entity_reference_1: + display_plugin: entity_reference + id: entity_reference_1 + display_title: 'Entity Reference' + position: 2 + display_options: + display_extenders: { } + fields: + id: + id: id + table: contact_details + field: id + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: true + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: id + plugin_id: field + rendered_entity: + id: rendered_entity + table: contact_details + field: rendered_entity + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + view_mode: default + entity_type: contact_details + plugin_id: rendered_entity + nothing: + id: nothing + table: views + field: nothing + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: true + text: 'Edit' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: false + plugin_id: custom + type: + id: type + table: contact_details + field: type + relationship: none + group_type: group + admin_label: '' + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: false + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: contact_details + entity_field: type + plugin_id: field + defaults: + fields: false + style: + type: entity_reference + options: + search_fields: + type: type + id: '0' + rendered_entity: '0' + nothing: '0' + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + tags: { } diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml index d75fa87..22b1906 100644 --- a/config/optional/views.view.this_person_s_hats.yml +++ b/config/optional/views.view.this_person_s_hats.yml @@ -49,7 +49,14 @@ display: options: offset: 0 style: - type: grid + type: html_list + options: + grouping: { } + row_class: '' + default_row_class: true + type: ul + wrapper_class: item-list + class: '' row: type: fields fields: @@ -246,7 +253,7 @@ display: exclude: false alter: alter_text: true - text: '' + text: '' make_link: false path: '' absolute: false From 09bb49b6367a70fd7a4d61048c1c602662ce2418 Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 15:57:52 +0200 Subject: [PATCH 79/94] more css --- css/opencase.css | 8 ++++++-- modules/zencrm_entities/src/Entity/ContactDetails.php | 2 +- modules/zencrm_entities/src/Entity/Hat.php | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/css/opencase.css b/css/opencase.css index b353599..72b180f 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -26,6 +26,10 @@ div.region.region-primary-menu { border-bottom: none; } +.sidebar .field--type-entity-reference { + margin: 1em 0 0 0; +} + .region-sidebar-second .view-content li, .region-sidebar-second .views-row, .region-sidebar-second .zencrm_inner_sidebar_block { border-bottom: 10px solid #e6e6d3; padding-bottom: 20px; @@ -65,11 +69,11 @@ div.region.region-primary-menu { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } -.sidebar .views-element-container .field { +.sidebar .views-element-container .field, .sidebar .zencrm_inner_sidebar_block .field { padding-bottom: 15px; } -.sidebar .views-element-container .field .field__item { +.sidebar .views-element-container .field .field__item, .sidebar .zencrm_inner_sidebar_block .field__item { font-size: 1.1em; } diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 2eac59e..b8bcf2a 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -206,7 +206,7 @@ class ContactDetails extends ContentEntityBase implements ContactDetailsInterfac 'text_processing' => 0, )) ->setDisplayOptions('view', array( - 'label' => 'hidden', + 'label' => 'above', 'type' => 'string', 'weight' => 0, )) diff --git a/modules/zencrm_entities/src/Entity/Hat.php b/modules/zencrm_entities/src/Entity/Hat.php index a5e180a..2a8a757 100644 --- a/modules/zencrm_entities/src/Entity/Hat.php +++ b/modules/zencrm_entities/src/Entity/Hat.php @@ -181,7 +181,7 @@ class Hat extends ContentEntityBase implements HatInterface { ->setSetting('target_type', 'person'); $fields['contact_details'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Contact Details')) + ->setLabel(t('Contact Details to use for this Hat')) ->setDescription(t('The contact details to be used when communicating with this person in this capacity.')) ->setSetting('target_type', 'contact_details') ->setSetting('handler', 'views') @@ -191,7 +191,7 @@ class Hat extends ContentEntityBase implements HatInterface { ]]) ->setDisplayOptions('view', [ 'label' => 'above', - 'weight' => 0, + 'weight' => 100, 'settings' => ['link' => 'false'] ]) ->setDisplayOptions('form', [ From 36aadb4ef7d9bd069ca6cc5575b94e9287957ff5 Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 16:11:03 +0200 Subject: [PATCH 80/94] added a bunch of entity bundle configs example ones, for alpha demo --- config/optional/zencrm_entities.activity_type.case_note.yml | 5 +++++ .../zencrm_entities.activity_type.self_assessment.yml | 5 +++++ config/optional/zencrm_entities.case_entity_type.asylum.yml | 5 +++++ ...encrm_entities.case_entity_type.volunteer_recruitment.yml | 5 +++++ config/optional/zencrm_entities.hat_type.client.yml | 5 +++++ config/optional/zencrm_entities.hat_type.volunteer.yml | 5 +++++ 6 files changed, 30 insertions(+) create mode 100644 config/optional/zencrm_entities.activity_type.case_note.yml create mode 100644 config/optional/zencrm_entities.activity_type.self_assessment.yml create mode 100644 config/optional/zencrm_entities.case_entity_type.asylum.yml create mode 100644 config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml create mode 100644 config/optional/zencrm_entities.hat_type.client.yml create mode 100644 config/optional/zencrm_entities.hat_type.volunteer.yml diff --git a/config/optional/zencrm_entities.activity_type.case_note.yml b/config/optional/zencrm_entities.activity_type.case_note.yml new file mode 100644 index 0000000..aa326bb --- /dev/null +++ b/config/optional/zencrm_entities.activity_type.case_note.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: case_note +label: 'Case Note' diff --git a/config/optional/zencrm_entities.activity_type.self_assessment.yml b/config/optional/zencrm_entities.activity_type.self_assessment.yml new file mode 100644 index 0000000..01ae9b1 --- /dev/null +++ b/config/optional/zencrm_entities.activity_type.self_assessment.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: self_assessment +label: Self-assessment diff --git a/config/optional/zencrm_entities.case_entity_type.asylum.yml b/config/optional/zencrm_entities.case_entity_type.asylum.yml new file mode 100644 index 0000000..6f479c4 --- /dev/null +++ b/config/optional/zencrm_entities.case_entity_type.asylum.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: asylum +label: Asylum diff --git a/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml b/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml new file mode 100644 index 0000000..f4cdd52 --- /dev/null +++ b/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: volunteer_recruitment +label: 'Volunteer recruitment' diff --git a/config/optional/zencrm_entities.hat_type.client.yml b/config/optional/zencrm_entities.hat_type.client.yml new file mode 100644 index 0000000..a173379 --- /dev/null +++ b/config/optional/zencrm_entities.hat_type.client.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: client +label: Client diff --git a/config/optional/zencrm_entities.hat_type.volunteer.yml b/config/optional/zencrm_entities.hat_type.volunteer.yml new file mode 100644 index 0000000..f6284a3 --- /dev/null +++ b/config/optional/zencrm_entities.hat_type.volunteer.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: volunteer +label: Volunteer From 78fa86d7e76176c76b3956356d8ba4c0da477568 Mon Sep 17 00:00:00 2001 From: Naomi Date: Sun, 15 Apr 2018 18:04:00 +0300 Subject: [PATCH 81/94] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index accd9c9..e6f813f 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# Zen CRM +# OpenCase A simple, case-management-focused CRM for small altruistic organisations. ## Current Status -**April 2018** the very beginning. Hardly exists at all. +**15 April 2018** A demo site, with basic functionality is available at demo.opencase.org.uk. ## The Plan -Zen CRM will be available as: +OpenCase will be available as: * A Drupal module, on drupal.org * A Drupal install profile / distribution * A hosted service ## Find out more -* More details, including user stories, can be found in the [Zen CRM Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) +* More details, including user stories, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) From 6044a63646dd31adebe3a883c81c9bb8fced960f Mon Sep 17 00:00:00 2001 From: naomi Date: Sun, 15 Apr 2018 17:15:37 +0200 Subject: [PATCH 82/94] removed "add person" block config (not working) Also changed Person Search no results behaviour (to use the missing block, but that's ok - it should alert that it's missing, and it's easy to recreate. --- .../block.block.linkforcreatinganewperson.yml | 24 ----------------- .../optional/views.view.person_search.yml | 27 ++++++++++++++++++- 2 files changed, 26 insertions(+), 25 deletions(-) delete mode 100644 config/optional/block.block.linkforcreatinganewperson.yml diff --git a/config/optional/block.block.linkforcreatinganewperson.yml b/config/optional/block.block.linkforcreatinganewperson.yml deleted file mode 100644 index 87ac474..0000000 --- a/config/optional/block.block.linkforcreatinganewperson.yml +++ /dev/null @@ -1,24 +0,0 @@ -langcode: en -status: true -dependencies: - content: - - 'block_content:basic:8b172f25-b43d-4094-8c03-7e0aee97e057' - module: - - block_content - theme: - - bartik -id: linkforcreatinganewperson -theme: bartik -region: sidebar_first -weight: 0 -provider: null -plugin: 'block_content:8b172f25-b43d-4094-8c03-7e0aee97e057' -settings: - id: 'block_content:8b172f25-b43d-4094-8c03-7e0aee97e057' - label: 'Link for creating a new person' - provider: block_content - label_display: '0' - status: true - info: '' - view_mode: full -visibility: { } diff --git a/modules/zencrm_search/config/optional/views.view.person_search.yml b/modules/zencrm_search/config/optional/views.view.person_search.yml index 1cb218d..cf815e1 100644 --- a/modules/zencrm_search/config/optional/views.view.person_search.yml +++ b/modules/zencrm_search/config/optional/views.view.person_search.yml @@ -2,6 +2,7 @@ langcode: en status: true dependencies: config: + - block.block.linkforcreatinganewperson - search_api.index.person_index module: - search_api @@ -183,7 +184,31 @@ display: title: 'Person Search' header: { } footer: { } - empty: { } + empty: + area_text_custom: + id: area_text_custom + table: views + field: area_text_custom + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: false + content: 'No results.' + plugin_id: text_custom + entity_block: + id: entity_block + table: views + field: entity_block + relationship: none + group_type: group + admin_label: '' + empty: true + tokenize: true + target: linkforcreatinganewperson + view_mode: default + bypass_access: true + plugin_id: entity relationships: { } arguments: { } display_extenders: { } From 384dae27edaa43495b117e65970cdf527e1c937d Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 16 Apr 2018 11:13:23 +0200 Subject: [PATCH 83/94] Removed config that will go into features Also changed Hats view so as not to show the Hat Creator when there are no hats (because it shows in the person panel, which checks for the existence of contact details first) --- config/optional/views.view.this_person_s_hats.yml | 5 ++++- config/optional/zencrm_entities.activity_type.case_note.yml | 5 ----- .../zencrm_entities.activity_type.self_assessment.yml | 5 ----- config/optional/zencrm_entities.case_entity_type.asylum.yml | 5 ----- ...encrm_entities.case_entity_type.volunteer_recruitment.yml | 5 ----- config/optional/zencrm_entities.hat_type.client.yml | 5 ----- config/optional/zencrm_entities.hat_type.volunteer.yml | 5 ----- css/opencase.css | 4 ---- 8 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 config/optional/zencrm_entities.activity_type.case_note.yml delete mode 100644 config/optional/zencrm_entities.activity_type.self_assessment.yml delete mode 100644 config/optional/zencrm_entities.case_entity_type.asylum.yml delete mode 100644 config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml delete mode 100644 config/optional/zencrm_entities.hat_type.client.yml delete mode 100644 config/optional/zencrm_entities.hat_type.volunteer.yml diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml index 22b1906..59653ba 100644 --- a/config/optional/views.view.this_person_s_hats.yml +++ b/config/optional/views.view.this_person_s_hats.yml @@ -303,7 +303,7 @@ display: relationship: none group_type: group admin_label: '' - empty: true + empty: false tokenize: true target: hatcreator view_mode: default @@ -359,6 +359,7 @@ display: - url tags: - 'config:core.entity_view_display.hat.client.default' + - 'config:core.entity_view_display.hat.volunteer.default' block_1: display_plugin: block id: block_1 @@ -374,6 +375,7 @@ display: sort_fields: '0' disable_filters: '0' configure_sorts: '0' + block_hide_empty: false cache_metadata: max-age: -1 contexts: @@ -382,3 +384,4 @@ display: - url tags: - 'config:core.entity_view_display.hat.client.default' + - 'config:core.entity_view_display.hat.volunteer.default' diff --git a/config/optional/zencrm_entities.activity_type.case_note.yml b/config/optional/zencrm_entities.activity_type.case_note.yml deleted file mode 100644 index aa326bb..0000000 --- a/config/optional/zencrm_entities.activity_type.case_note.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: case_note -label: 'Case Note' diff --git a/config/optional/zencrm_entities.activity_type.self_assessment.yml b/config/optional/zencrm_entities.activity_type.self_assessment.yml deleted file mode 100644 index 01ae9b1..0000000 --- a/config/optional/zencrm_entities.activity_type.self_assessment.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: self_assessment -label: Self-assessment diff --git a/config/optional/zencrm_entities.case_entity_type.asylum.yml b/config/optional/zencrm_entities.case_entity_type.asylum.yml deleted file mode 100644 index 6f479c4..0000000 --- a/config/optional/zencrm_entities.case_entity_type.asylum.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: asylum -label: Asylum diff --git a/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml b/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml deleted file mode 100644 index f4cdd52..0000000 --- a/config/optional/zencrm_entities.case_entity_type.volunteer_recruitment.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: volunteer_recruitment -label: 'Volunteer recruitment' diff --git a/config/optional/zencrm_entities.hat_type.client.yml b/config/optional/zencrm_entities.hat_type.client.yml deleted file mode 100644 index a173379..0000000 --- a/config/optional/zencrm_entities.hat_type.client.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: client -label: Client diff --git a/config/optional/zencrm_entities.hat_type.volunteer.yml b/config/optional/zencrm_entities.hat_type.volunteer.yml deleted file mode 100644 index f6284a3..0000000 --- a/config/optional/zencrm_entities.hat_type.volunteer.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: volunteer -label: Volunteer diff --git a/css/opencase.css b/css/opencase.css index 72b180f..b17db83 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -41,10 +41,6 @@ div.region.region-primary-menu { margin-bottom: 10px; } -.region-sidebar-second .view-content li .zencrm_editlink , .region-sidebar-second .views-row .zencrm_editlink, .region-sidebar-second .zencrm_inner_sidebar_block .zencrm_editlink{ - margin-top: -20px; -} - .sidebar .region-sidebar-second h2 { font-size: 1.6em; text-align: center; From b92efc460097aaec01d4cc0d18bd4077c5c2f085 Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 16 Apr 2018 13:35:42 +0200 Subject: [PATCH 84/94] css for delete button safety. --- css/opencase.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/css/opencase.css b/css/opencase.css index b17db83..417d8ed 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -5,6 +5,19 @@ a.site-branding__logo img { /* Module-specific from here. */ +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + width: 100%; +} + +button.button--primary.js-form-submit.form-submit.ui-button.ui-corner-all.ui-widget { + margin-left: 73%; +} + +button.button.button--danger.ui-button.ui-corner-all.ui-widget { + float: left; + color: red; +} + .ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons { min-width: 550px; border: 20px solid rgba(0, 0, 0, 0.51); From c1cebcbdddfed764e72a4632d6c9670640ab0a15 Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 16 Apr 2018 13:36:13 +0200 Subject: [PATCH 85/94] Added features for example entity subtypes --- ...orm_display.activity.case_note.default.yml | 38 ++++++++++++++++++ ...splay.activity.self_assessment.default.yml | 32 +++++++++++++++ ...iew_display.activity.case_note.default.yml | 38 ++++++++++++++++++ ...splay.activity.self_assessment.default.yml | 37 +++++++++++++++++ ...ld.field.activity.case_note.field_file.yml | 26 ++++++++++++ ...d.field.activity.case_note.field_notes.yml | 18 +++++++++ ...sment.field_how_is_your_housing_situat.yml | 20 ++++++++++ ...sment.field_how_is_your_mental_health_.yml | 20 ++++++++++ ...sment.field_how_is_your_physical_healt.yml | 20 ++++++++++ .../field.storage.activity.field_file.yml | 22 ++++++++++ ...ivity.field_how_is_your_housing_situat.yml | 35 ++++++++++++++++ ...ivity.field_how_is_your_mental_health_.yml | 35 ++++++++++++++++ ...ivity.field_how_is_your_physical_healt.yml | 35 ++++++++++++++++ .../field.storage.activity.field_notes.yml | 18 +++++++++ ...encrm_entities.activity_type.case_note.yml | 5 +++ ...entities.activity_type.self_assessment.yml | 5 +++ ...lt_subtypes_activity_subtypes.features.yml | 6 +++ ...efault_subtypes_activity_subtypes.info.yml | 12 ++++++ ...orm_display.case_entity.asylum.default.yml | 29 ++++++++++++++ ...rm_display.case_entity.housing.default.yml | 20 ++++++++++ ...e_entity.volunteer_recruitment.default.yml | 20 ++++++++++ ...entity_form_display.hat.client.default.yml | 29 ++++++++++++++ ...ity_form_display.hat.volunteer.default.yml | 38 ++++++++++++++++++ ...iew_display.case_entity.asylum.default.yml | 29 ++++++++++++++ ...ew_display.case_entity.housing.default.yml | 26 ++++++++++++ ...e_entity.volunteer_recruitment.default.yml | 26 ++++++++++++ ...entity_view_display.hat.client.default.yml | 29 ++++++++++++++ ...ity_view_display.hat.volunteer.default.yml | 40 +++++++++++++++++++ ...ld.field.case_entity.asylum.field_asyl.yml | 18 +++++++++ ...eld.case_entity.asylum.field_home_offi.yml | 18 +++++++++ .../field.field.hat.client.field_country.yml | 18 +++++++++ .../field.field.hat.client.field_language.yml | 18 +++++++++ ...field.hat.volunteer.field_availability.yml | 18 +++++++++ ...field.hat.volunteer.field_date_started.yml | 23 +++++++++++ .../field.field.hat.volunteer.field_team.yml | 18 +++++++++ .../field.storage.case_entity.field_asyl.yml | 20 ++++++++++ ...ld.storage.case_entity.field_home_offi.yml | 20 ++++++++++ .../field.storage.hat.field_availability.yml | 18 +++++++++ .../field.storage.hat.field_country.yml | 20 ++++++++++ .../field.storage.hat.field_date_started.yml | 19 +++++++++ .../field.storage.hat.field_language.yml | 20 ++++++++++ .../install/field.storage.hat.field_team.yml | 20 ++++++++++ ...encrm_entities.case_entity_type.asylum.yml | 5 +++ ...ncrm_entities.case_entity_type.housing.yml | 5 +++ ...case_entity_type.volunteer_recruitment.yml | 5 +++ .../zencrm_entities.hat_type.client.yml | 5 +++ .../zencrm_entities.hat_type.volunteer.yml | 5 +++ ...efault_subtypes_case_subtypes.features.yml | 6 +++ ...se_default_subtypes_case_subtypes.info.yml | 11 +++++ 49 files changed, 1018 insertions(+) create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml create mode 100644 features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml create mode 100644 features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml new file mode 100644 index 0000000..4c372b0 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml @@ -0,0 +1,38 @@ +langcode: en +status: true +dependencies: + config: + - field.field.activity.case_note.field_file + - field.field.activity.case_note.field_notes + - zencrm_entities.activity_type.case_note + module: + - file +id: activity.case_note.default +targetEntityType: activity +bundle: case_note +mode: default +content: + field_file: + weight: 4 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content + field_notes: + weight: 3 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content + name: + type: string_textfield + weight: -4 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml new file mode 100644 index 0000000..bab5606 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml @@ -0,0 +1,32 @@ +langcode: en +status: true +dependencies: + config: + - field.field.activity.self_assessment.field_how_is_your_housing_situat + - field.field.activity.self_assessment.field_how_is_your_mental_health_ + - field.field.activity.self_assessment.field_how_is_your_physical_healt + - zencrm_entities.activity_type.self_assessment +id: activity.self_assessment.default +targetEntityType: activity +bundle: self_assessment +mode: default +content: + field_how_is_your_housing_situat: + weight: 5 + settings: { } + third_party_settings: { } + type: options_buttons + region: content + field_how_is_your_mental_health_: + weight: 4 + settings: { } + third_party_settings: { } + type: options_buttons + region: content + field_how_is_your_physical_healt: + weight: 3 + settings: { } + third_party_settings: { } + type: options_buttons + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml new file mode 100644 index 0000000..7f9c26e --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml @@ -0,0 +1,38 @@ +langcode: en +status: true +dependencies: + config: + - field.field.activity.case_note.field_file + - field.field.activity.case_note.field_notes + - zencrm_entities.activity_type.case_note + module: + - file +id: activity.case_note.default +targetEntityType: activity +bundle: case_note +mode: default +content: + field_file: + weight: -2 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + field_notes: + weight: -3 + label: above + settings: { } + third_party_settings: { } + type: basic_string + region: content + name: + label: above + type: string + weight: -4 + region: content + settings: + link_to_entity: false + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml new file mode 100644 index 0000000..8828b8a --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml @@ -0,0 +1,37 @@ +langcode: en +status: true +dependencies: + config: + - field.field.activity.self_assessment.field_how_is_your_housing_situat + - field.field.activity.self_assessment.field_how_is_your_mental_health_ + - field.field.activity.self_assessment.field_how_is_your_physical_healt + - zencrm_entities.activity_type.self_assessment + module: + - options +id: activity.self_assessment.default +targetEntityType: activity +bundle: self_assessment +mode: default +content: + field_how_is_your_housing_situat: + weight: -1 + label: above + settings: { } + third_party_settings: { } + type: list_default + region: content + field_how_is_your_mental_health_: + weight: -2 + label: above + settings: { } + third_party_settings: { } + type: list_default + region: content + field_how_is_your_physical_healt: + weight: -3 + label: above + settings: { } + third_party_settings: { } + type: list_default + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml new file mode 100644 index 0000000..d52bbc8 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.activity.field_file + - zencrm_entities.activity_type.case_note + module: + - file +id: activity.case_note.field_file +field_name: field_file +entity_type: activity +bundle: case_note +label: Files +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: 'txt jpg rtf doc png pdf' + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml new file mode 100644 index 0000000..cf61b70 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.activity.field_notes + - zencrm_entities.activity_type.case_note +id: activity.case_note.field_notes +field_name: field_notes +entity_type: activity +bundle: case_note +label: Notes +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml new file mode 100644 index 0000000..dcf708f --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.activity.field_how_is_your_housing_situat + - zencrm_entities.activity_type.self_assessment + module: + - options +id: activity.self_assessment.field_how_is_your_housing_situat +field_name: field_how_is_your_housing_situat +entity_type: activity +bundle: self_assessment +label: 'How is your housing situation?' +description: '' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml new file mode 100644 index 0000000..392489a --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.activity.field_how_is_your_mental_health_ + - zencrm_entities.activity_type.self_assessment + module: + - options +id: activity.self_assessment.field_how_is_your_mental_health_ +field_name: field_how_is_your_mental_health_ +entity_type: activity +bundle: self_assessment +label: 'How is your mental health?' +description: '' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml new file mode 100644 index 0000000..79c9fbe --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.activity.field_how_is_your_physical_healt + - zencrm_entities.activity_type.self_assessment + module: + - options +id: activity.self_assessment.field_how_is_your_physical_healt +field_name: field_how_is_your_physical_healt +entity_type: activity +bundle: self_assessment +label: 'How is your physical health?' +description: '' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: list_string diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml new file mode 100644 index 0000000..a4d9c91 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + module: + - file + - zencrm_entities +id: activity.field_file +field_name: field_file +entity_type: activity +type: file +settings: + display_field: false + display_default: false + uri_scheme: private + target_type: file +module: file +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml new file mode 100644 index 0000000..2df19c9 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - zencrm_entities +id: activity.field_how_is_your_housing_situat +field_name: field_how_is_your_housing_situat +entity_type: activity +type: list_string +settings: + allowed_values: + - + value: Excellent + label: Excellent + - + value: Good + label: Good + - + value: OK + label: OK + - + value: Bad + label: Bad + - + value: Terrible + label: Terrible + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml new file mode 100644 index 0000000..dbf9b71 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - zencrm_entities +id: activity.field_how_is_your_mental_health_ +field_name: field_how_is_your_mental_health_ +entity_type: activity +type: list_string +settings: + allowed_values: + - + value: Excellent + label: Excellent + - + value: Good + label: Good + - + value: OK + label: OK + - + value: Bad + label: Bad + - + value: Terrible + label: Terrible + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml new file mode 100644 index 0000000..e1f522c --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml @@ -0,0 +1,35 @@ +langcode: en +status: true +dependencies: + module: + - options + - zencrm_entities +id: activity.field_how_is_your_physical_healt +field_name: field_how_is_your_physical_healt +entity_type: activity +type: list_string +settings: + allowed_values: + - + value: Excellent + label: Excellent + - + value: Good + label: Good + - + value: OK + label: OK + - + value: Bad + label: Bad + - + value: Terrible + label: Terrible + allowed_values_function: '' +module: options +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml new file mode 100644 index 0000000..c569774 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: activity.field_notes +field_name: field_notes +entity_type: activity +type: string_long +settings: + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml new file mode 100644 index 0000000..aa326bb --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: case_note +label: 'Case Note' diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml b/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml new file mode 100644 index 0000000..01ae9b1 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: self_assessment +label: Self-assessment diff --git a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml b/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml new file mode 100644 index 0000000..5e04606 --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml @@ -0,0 +1,6 @@ +bundle: opencase_default_subtypes +excluded: + - block.block.views_block__single_case_with_activities_block_1 + - block.block.views_block__this_person_s_contact_details_block_1 + - block.block.views_block__this_person_s_hats_block_1 +required: true diff --git a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml b/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml new file mode 100644 index 0000000..58f242e --- /dev/null +++ b/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml @@ -0,0 +1,12 @@ +name: 'Activity Subtypes' +type: module +core: 8.x +dependencies: + - block + - field + - file + - options + - system + - views + - zencrm_entities +package: 'OpenCase Default Subtypes' diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml new file mode 100644 index 0000000..7598ade --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - field.field.case_entity.asylum.field_asyl + - field.field.case_entity.asylum.field_home_offi + - zencrm_entities.case_entity_type.asylum +id: case_entity.asylum.default +targetEntityType: case_entity +bundle: asylum +mode: default +content: + field_asyl: + weight: 6 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + field_home_offi: + weight: 7 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml new file mode 100644 index 0000000..e689b63 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - zencrm_entities.case_entity_type.housing +id: case_entity.housing.default +targetEntityType: case_entity +bundle: housing +mode: default +content: + user_id: + type: entity_reference_autocomplete + weight: 5 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + region: content + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml new file mode 100644 index 0000000..495859d --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - zencrm_entities.case_entity_type.volunteer_recruitment +id: case_entity.volunteer_recruitment.default +targetEntityType: case_entity +bundle: volunteer_recruitment +mode: default +content: + user_id: + type: entity_reference_autocomplete + weight: 5 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + region: content + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml new file mode 100644 index 0000000..d225155 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - field.field.hat.client.field_country + - field.field.hat.client.field_language + - zencrm_entities.hat_type.client +id: hat.client.default +targetEntityType: hat +bundle: client +mode: default +content: + field_country: + weight: 3 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + field_language: + weight: 4 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml new file mode 100644 index 0000000..08167aa --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml @@ -0,0 +1,38 @@ +langcode: en +status: true +dependencies: + config: + - field.field.hat.volunteer.field_availability + - field.field.hat.volunteer.field_date_started + - field.field.hat.volunteer.field_team + - zencrm_entities.hat_type.volunteer + module: + - datetime +id: hat.volunteer.default +targetEntityType: hat +bundle: volunteer +mode: default +content: + field_availability: + weight: 6 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content + field_date_started: + weight: 5 + settings: { } + third_party_settings: { } + type: datetime_default + region: content + field_team: + weight: 4 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml new file mode 100644 index 0000000..4fcbfe3 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - field.field.case_entity.asylum.field_asyl + - field.field.case_entity.asylum.field_home_offi + - zencrm_entities.case_entity_type.asylum +id: case_entity.asylum.default +targetEntityType: case_entity +bundle: asylum +mode: default +content: + field_asyl: + weight: 1 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + field_home_offi: + weight: 2 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml new file mode 100644 index 0000000..6eef6cd --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - zencrm_entities.case_entity_type.housing +id: case_entity.housing.default +targetEntityType: case_entity +bundle: housing +mode: default +content: + name: + label: above + type: string + weight: -4 + region: content + settings: + link_to_entity: false + third_party_settings: { } + user_id: + label: hidden + type: author + weight: 0 + region: content + settings: { } + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml new file mode 100644 index 0000000..cd380cb --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - zencrm_entities.case_entity_type.volunteer_recruitment +id: case_entity.volunteer_recruitment.default +targetEntityType: case_entity +bundle: volunteer_recruitment +mode: default +content: + name: + label: above + type: string + weight: -4 + region: content + settings: + link_to_entity: false + third_party_settings: { } + user_id: + label: hidden + type: author + weight: 0 + region: content + settings: { } + third_party_settings: { } +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml new file mode 100644 index 0000000..2bf10c4 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - field.field.hat.client.field_country + - field.field.hat.client.field_language + - zencrm_entities.hat_type.client +id: hat.client.default +targetEntityType: hat +bundle: client +mode: default +content: + field_country: + weight: 1 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + field_language: + weight: 2 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml new file mode 100644 index 0000000..fc938f3 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.field.hat.volunteer.field_availability + - field.field.hat.volunteer.field_date_started + - field.field.hat.volunteer.field_team + - zencrm_entities.hat_type.volunteer + module: + - datetime +id: hat.volunteer.default +targetEntityType: hat +bundle: volunteer +mode: default +content: + field_availability: + weight: 104 + label: above + settings: { } + third_party_settings: { } + type: basic_string + region: content + field_date_started: + weight: 103 + label: above + settings: + format_type: medium + timezone_override: '' + third_party_settings: { } + type: datetime_default + region: content + field_team: + weight: 102 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content +hidden: { } diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml new file mode 100644 index 0000000..ec002d3 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.case_entity.field_asyl + - zencrm_entities.case_entity_type.asylum +id: case_entity.asylum.field_asyl +field_name: field_asyl +entity_type: case_entity +bundle: asylum +label: 'Asylum status when taken on' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml new file mode 100644 index 0000000..c1b1949 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.case_entity.field_home_offi + - zencrm_entities.case_entity_type.asylum +id: case_entity.asylum.field_home_offi +field_name: field_home_offi +entity_type: case_entity +bundle: asylum +label: 'Home Office Number' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml new file mode 100644 index 0000000..687e8c8 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.hat.field_country + - zencrm_entities.hat_type.client +id: hat.client.field_country +field_name: field_country +entity_type: hat +bundle: client +label: 'Country of Origin' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml new file mode 100644 index 0000000..4f96025 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.hat.field_language + - zencrm_entities.hat_type.client +id: hat.client.field_language +field_name: field_language +entity_type: hat +bundle: client +label: Language +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml new file mode 100644 index 0000000..e15e8d7 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.hat.field_availability + - zencrm_entities.hat_type.volunteer +id: hat.volunteer.field_availability +field_name: field_availability +entity_type: hat +bundle: volunteer +label: Availability +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml new file mode 100644 index 0000000..f70fa6c --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml @@ -0,0 +1,23 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.hat.field_date_started + - zencrm_entities.hat_type.volunteer + module: + - datetime +id: hat.volunteer.field_date_started +field_name: field_date_started +entity_type: hat +bundle: volunteer +label: 'Date Started' +description: '' +required: false +translatable: false +default_value: + - + default_date_type: now + default_date: now +default_value_callback: '' +settings: { } +field_type: datetime diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml new file mode 100644 index 0000000..1201afe --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.hat.field_team + - zencrm_entities.hat_type.volunteer +id: hat.volunteer.field_team +field_name: field_team +entity_type: hat +bundle: volunteer +label: Team +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml new file mode 100644 index 0000000..89296e4 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: case_entity.field_asyl +field_name: field_asyl +entity_type: case_entity +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml new file mode 100644 index 0000000..8109d99 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: case_entity.field_home_offi +field_name: field_home_offi +entity_type: case_entity +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml new file mode 100644 index 0000000..534afed --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: hat.field_availability +field_name: field_availability +entity_type: hat +type: string_long +settings: + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml new file mode 100644 index 0000000..f1e2293 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: hat.field_country +field_name: field_country +entity_type: hat +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml new file mode 100644 index 0000000..e9c6f1e --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - datetime + - zencrm_entities +id: hat.field_date_started +field_name: field_date_started +entity_type: hat +type: datetime +settings: + datetime_type: date +module: datetime +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml new file mode 100644 index 0000000..610f623 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: hat.field_language +field_name: field_language +entity_type: hat +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml new file mode 100644 index 0000000..f5951fb --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - zencrm_entities +id: hat.field_team +field_name: field_team +entity_type: hat +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml new file mode 100644 index 0000000..6f479c4 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: asylum +label: Asylum diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml new file mode 100644 index 0000000..58a164c --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: housing +label: Housing diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml new file mode 100644 index 0000000..f4cdd52 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: volunteer_recruitment +label: 'Volunteer recruitment' diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml new file mode 100644 index 0000000..a173379 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: client +label: Client diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml new file mode 100644 index 0000000..f6284a3 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml @@ -0,0 +1,5 @@ +langcode: en +status: true +dependencies: { } +id: volunteer +label: Volunteer diff --git a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml b/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml new file mode 100644 index 0000000..5e04606 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml @@ -0,0 +1,6 @@ +bundle: opencase_default_subtypes +excluded: + - block.block.views_block__single_case_with_activities_block_1 + - block.block.views_block__this_person_s_contact_details_block_1 + - block.block.views_block__this_person_s_hats_block_1 +required: true diff --git a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml b/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml new file mode 100644 index 0000000..1079eb3 --- /dev/null +++ b/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml @@ -0,0 +1,11 @@ +name: 'Hat Subtypes' +type: module +core: 8.x +dependencies: + - block + - datetime + - field + - system + - views + - zencrm_entities +package: 'OpenCase Default Subtypes' From b0431c29269a955119879b5fba2011960e4623ab Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 16 Apr 2018 13:48:36 +0200 Subject: [PATCH 86/94] Redirects to home page after login. --- zencrm.module | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zencrm.module b/zencrm.module index d5ece5e..f094f22 100644 --- a/zencrm.module +++ b/zencrm.module @@ -37,3 +37,16 @@ function zencrm_theme() { function zencrm_page_attachments(array &$page) { $page['#attached']['library'][] = 'zencrm/opencase-lib'; } + +/** + * Implements hook_user_login(). + */ +function zencrm_user_login(\Drupal\user\UserInterface $account) { + // Default login destination to the dashboard. + $current_request = \Drupal::service('request_stack')->getCurrentRequest(); + if (!$current_request->query->get('destination')) { + $current_request->query->set( + 'destination', '/' + ); + } +} From 7da5c8a4b1f753ba6d04b34e57c46bad009f3923 Mon Sep 17 00:00:00 2001 From: naomi Date: Mon, 16 Apr 2018 14:12:24 +0200 Subject: [PATCH 87/94] Person Search restricted to authenticated users. --- .../config/optional/views.view.person_search.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/zencrm_search/config/optional/views.view.person_search.yml b/modules/zencrm_search/config/optional/views.view.person_search.yml index cf815e1..5eea4f1 100644 --- a/modules/zencrm_search/config/optional/views.view.person_search.yml +++ b/modules/zencrm_search/config/optional/views.view.person_search.yml @@ -4,8 +4,10 @@ dependencies: config: - block.block.linkforcreatinganewperson - search_api.index.person_index + - user.role.authenticated module: - search_api + - user id: person_search label: 'Person Search' module: views @@ -22,8 +24,10 @@ display: position: 0 display_options: access: - type: none - options: { } + type: role + options: + role: + authenticated: authenticated cache: type: tag options: { } @@ -220,6 +224,7 @@ display: - 'languages:language_interface' - url - url.query_args + - user.roles tags: { } block_1: display_plugin: block @@ -235,6 +240,7 @@ display: - 'languages:language_interface' - url - url.query_args + - user.roles tags: { } page_1: display_plugin: page @@ -252,4 +258,5 @@ display: - 'languages:language_interface' - url - url.query_args + - user.roles tags: { } From 6418adfadd5fca30217095060747f758e577f45a Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 24 Apr 2018 18:46:47 +0200 Subject: [PATCH 88/94] Added features, added module numbers to info files --- css/opencase.css | 17 +++++++++++++++++ .../config/install/user.role.anonymous.yml | 7 +++++++ .../opencase_user_config_anonymous.features.yml | 6 ++++++ .../opencase_user_config_anonymous.info.yml | 9 +++++++++ .../zencrm_entities/zencrm_entities.info.yml | 2 +- modules/zencrm_search/zencrm_search.info.yml | 1 + zencrm.info.yml | 1 + 7 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml create mode 100644 features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml create mode 100644 features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml diff --git a/css/opencase.css b/css/opencase.css index 417d8ed..0e792e6 100644 --- a/css/opencase.css +++ b/css/opencase.css @@ -3,6 +3,23 @@ a.site-branding__logo img { max-width: 100px; } +/* a hack to show different links in sidebar - temporary */ +.zencrm_creationlinks.authorised_only { + display: none; +} + +.user-logged-in .zencrm_creationlinks.authorised_only { + display: block; +} + +.zencrm_creationlinks.anonymous_only { + display: block; +} + +.user-logged-in .zencrm_creationlinks.anonymous_only { + display: none; +} + /* Module-specific from here. */ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { diff --git a/features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml b/features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml new file mode 100644 index 0000000..f5d0936 --- /dev/null +++ b/features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml @@ -0,0 +1,7 @@ +langcode: en +status: true +dependencies: { } +id: anonymous +label: 'Anonymous user' +weight: 0 +is_admin: false diff --git a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml b/features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml new file mode 100644 index 0000000..96f8ceb --- /dev/null +++ b/features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml @@ -0,0 +1,6 @@ +bundle: opencase_user_config +excluded: + - block.block.views_block__single_case_with_activities_block_1 + - block.block.views_block__this_person_s_contact_details_block_1 + - block.block.views_block__this_person_s_hats_block_1 +required: true diff --git a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml b/features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml new file mode 100644 index 0000000..6e240f9 --- /dev/null +++ b/features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml @@ -0,0 +1,9 @@ +name: anonymous +type: module +core: 8.x +dependencies: + - block + - system + - user + - views +package: 'OpenCase User Config' diff --git a/modules/zencrm_entities/zencrm_entities.info.yml b/modules/zencrm_entities/zencrm_entities.info.yml index 34ab4af..cce5cb2 100644 --- a/modules/zencrm_entities/zencrm_entities.info.yml +++ b/modules/zencrm_entities/zencrm_entities.info.yml @@ -4,5 +4,5 @@ description: 'Zen CRM Entities' core: 8.x package: 'Zen CRM' mtime: 1522776761 -version: null +version: 0.1.1 php: 5.5.9 diff --git a/modules/zencrm_search/zencrm_search.info.yml b/modules/zencrm_search/zencrm_search.info.yml index c7c650c..eb9d744 100644 --- a/modules/zencrm_search/zencrm_search.info.yml +++ b/modules/zencrm_search/zencrm_search.info.yml @@ -3,6 +3,7 @@ type: module description: 'Provides search functionality for Zen CRM' core: 8.x package: 'Zen CRM' +version: 0.1.1 dependencies: - zencrm_entities - search_api diff --git a/zencrm.info.yml b/zencrm.info.yml index 2378539..7932717 100644 --- a/zencrm.info.yml +++ b/zencrm.info.yml @@ -3,6 +3,7 @@ type: module description: 'Zen CRM' core: 8.x package: 'Zen CRM' +version: 0.1.1 dependencies: - zencrm_entities - zencrm_search From aed0aa7b07cb5dbdc6d7c7814225598850d36909 Mon Sep 17 00:00:00 2001 From: naomi Date: Tue, 24 Apr 2018 18:56:13 +0200 Subject: [PATCH 89/94] Changed file structure of features Now there are just two features - default_user_config and default_subtypes --- ...ntity_form_display.activity.case_note.default.yml | 0 ...form_display.activity.self_assessment.default.yml | 0 ...ntity_form_display.case_entity.asylum.default.yml | 0 ...tity_form_display.case_entity.housing.default.yml | 0 ...lay.case_entity.volunteer_recruitment.default.yml | 0 .../core.entity_form_display.hat.client.default.yml | 0 ...ore.entity_form_display.hat.volunteer.default.yml | 0 ...ntity_view_display.activity.case_note.default.yml | 0 ...view_display.activity.self_assessment.default.yml | 0 ...ntity_view_display.case_entity.asylum.default.yml | 0 ...tity_view_display.case_entity.housing.default.yml | 0 ...lay.case_entity.volunteer_recruitment.default.yml | 0 .../core.entity_view_display.hat.client.default.yml | 0 ...ore.entity_view_display.hat.volunteer.default.yml | 0 .../field.field.activity.case_note.field_file.yml | 0 .../field.field.activity.case_note.field_notes.yml | 0 ...f_assessment.field_how_is_your_housing_situat.yml | 0 ...f_assessment.field_how_is_your_mental_health_.yml | 0 ...f_assessment.field_how_is_your_physical_healt.yml | 0 .../field.field.case_entity.asylum.field_asyl.yml | 0 ...ield.field.case_entity.asylum.field_home_offi.yml | 0 .../install/field.field.hat.client.field_country.yml | 0 .../field.field.hat.client.field_language.yml | 0 .../field.field.hat.volunteer.field_availability.yml | 0 .../field.field.hat.volunteer.field_date_started.yml | 0 .../install/field.field.hat.volunteer.field_team.yml | 0 .../install/field.storage.activity.field_file.yml | 0 ...age.activity.field_how_is_your_housing_situat.yml | 0 ...age.activity.field_how_is_your_mental_health_.yml | 0 ...age.activity.field_how_is_your_physical_healt.yml | 0 .../install/field.storage.activity.field_notes.yml | 0 .../install/field.storage.case_entity.field_asyl.yml | 0 .../field.storage.case_entity.field_home_offi.yml | 0 .../install/field.storage.hat.field_availability.yml | 0 .../install/field.storage.hat.field_country.yml | 0 .../install/field.storage.hat.field_date_started.yml | 0 .../install/field.storage.hat.field_language.yml | 0 .../config/install/field.storage.hat.field_team.yml | 0 .../zencrm_entities.activity_type.case_note.yml | 0 ...zencrm_entities.activity_type.self_assessment.yml | 0 .../zencrm_entities.case_entity_type.asylum.yml | 0 .../zencrm_entities.case_entity_type.housing.yml | 0 ...tities.case_entity_type.volunteer_recruitment.yml | 0 .../install/zencrm_entities.hat_type.client.yml | 0 .../install/zencrm_entities.hat_type.volunteer.yml | 0 .../opencase_default_subtypes.features.yml} | 2 +- .../opencase_default_subtypes.info.yml} | 4 ++-- ...ncase_default_subtypes_activity_subtypes.info.yml | 12 ------------ ...ncase_default_subtypes_case_subtypes.features.yml | 6 ------ .../config/install/user.role.anonymous.yml | 0 .../opencase_default_user_config.features.yml} | 2 +- .../opencase_default_user_config.info.yml} | 4 ++-- 52 files changed, 6 insertions(+), 24 deletions(-) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.activity.case_note.default.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.activity.self_assessment.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.case_entity.asylum.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.case_entity.housing.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.hat.client.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_form_display.hat.volunteer.default.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.activity.case_note.default.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.activity.self_assessment.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.case_entity.asylum.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.case_entity.housing.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.hat.client.default.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/core.entity_view_display.hat.volunteer.default.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.field.activity.case_note.field_file.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.field.activity.case_note.field_notes.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.case_entity.asylum.field_asyl.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.case_entity.asylum.field_home_offi.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.hat.client.field_country.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.hat.client.field_language.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.hat.volunteer.field_availability.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.hat.volunteer.field_date_started.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.field.hat.volunteer.field_team.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.storage.activity.field_file.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.storage.activity.field_how_is_your_housing_situat.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.storage.activity.field_how_is_your_mental_health_.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.storage.activity.field_how_is_your_physical_healt.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/field.storage.activity.field_notes.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.case_entity.field_asyl.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.case_entity.field_home_offi.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.hat.field_availability.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.hat.field_country.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.hat.field_date_started.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.hat.field_language.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/field.storage.hat.field_team.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.activity_type.case_note.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.activity_type.self_assessment.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.case_entity_type.asylum.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.case_entity_type.housing.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.hat_type.client.yml (100%) rename features/{opencase_default_subtypes_case_subtypes => opencase_default_subtypes}/config/install/zencrm_entities.hat_type.volunteer.yml (100%) rename features/{opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml => opencase_default_subtypes/opencase_default_subtypes.features.yml} (88%) rename features/{opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml => opencase_default_subtypes/opencase_default_subtypes.info.yml} (65%) delete mode 100644 features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml delete mode 100644 features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml rename features/{opencase_user_config_anonymous => opencase_default_user_config}/config/install/user.role.anonymous.yml (100%) rename features/{opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml => opencase_default_user_config/opencase_default_user_config.features.yml} (86%) rename features/{opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml => opencase_default_user_config/opencase_default_user_config.info.yml} (61%) diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.client.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.client.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml rename to features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml b/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_file.yml rename to features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml b/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.case_note.field_notes.yml rename to features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml rename to features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml rename to features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml rename to features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml b/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml rename to features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml b/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml rename to features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml b/features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_country.yml rename to features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml b/features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.client.field_language.yml rename to features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_availability.yml rename to features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml rename to features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.field.hat.volunteer.field_team.yml rename to features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_file.yml rename to features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml rename to features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml rename to features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml rename to features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/field.storage.activity.field_notes.yml rename to features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml b/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_asyl.yml rename to features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml b/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.case_entity.field_home_offi.yml rename to features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_availability.yml rename to features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_country.yml rename to features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_date_started.yml rename to features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_language.yml rename to features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/field.storage.hat.field_team.yml rename to features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.case_note.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml similarity index 100% rename from features/opencase_default_subtypes_activity_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.client.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml diff --git a/features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml similarity index 100% rename from features/opencase_default_subtypes_case_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml rename to features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml diff --git a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml b/features/opencase_default_subtypes/opencase_default_subtypes.features.yml similarity index 88% rename from features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml rename to features/opencase_default_subtypes/opencase_default_subtypes.features.yml index 96f8ceb..50fe1db 100644 --- a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.features.yml +++ b/features/opencase_default_subtypes/opencase_default_subtypes.features.yml @@ -1,4 +1,4 @@ -bundle: opencase_user_config +bundle: opencase excluded: - block.block.views_block__single_case_with_activities_block_1 - block.block.views_block__this_person_s_contact_details_block_1 diff --git a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml b/features/opencase_default_subtypes/opencase_default_subtypes.info.yml similarity index 65% rename from features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml rename to features/opencase_default_subtypes/opencase_default_subtypes.info.yml index 1079eb3..51fe2cf 100644 --- a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.info.yml +++ b/features/opencase_default_subtypes/opencase_default_subtypes.info.yml @@ -1,4 +1,4 @@ -name: 'Hat Subtypes' +name: 'Default Subtypes' type: module core: 8.x dependencies: @@ -8,4 +8,4 @@ dependencies: - system - views - zencrm_entities -package: 'OpenCase Default Subtypes' +package: 'OpenCase' diff --git a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml b/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml deleted file mode 100644 index 58f242e..0000000 --- a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.info.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Activity Subtypes' -type: module -core: 8.x -dependencies: - - block - - field - - file - - options - - system - - views - - zencrm_entities -package: 'OpenCase Default Subtypes' diff --git a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml b/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml deleted file mode 100644 index 5e04606..0000000 --- a/features/opencase_default_subtypes_case_subtypes/opencase_default_subtypes_case_subtypes.features.yml +++ /dev/null @@ -1,6 +0,0 @@ -bundle: opencase_default_subtypes -excluded: - - block.block.views_block__single_case_with_activities_block_1 - - block.block.views_block__this_person_s_contact_details_block_1 - - block.block.views_block__this_person_s_hats_block_1 -required: true diff --git a/features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml b/features/opencase_default_user_config/config/install/user.role.anonymous.yml similarity index 100% rename from features/opencase_user_config_anonymous/config/install/user.role.anonymous.yml rename to features/opencase_default_user_config/config/install/user.role.anonymous.yml diff --git a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml b/features/opencase_default_user_config/opencase_default_user_config.features.yml similarity index 86% rename from features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml rename to features/opencase_default_user_config/opencase_default_user_config.features.yml index 5e04606..50fe1db 100644 --- a/features/opencase_default_subtypes_activity_subtypes/opencase_default_subtypes_activity_subtypes.features.yml +++ b/features/opencase_default_user_config/opencase_default_user_config.features.yml @@ -1,4 +1,4 @@ -bundle: opencase_default_subtypes +bundle: opencase excluded: - block.block.views_block__single_case_with_activities_block_1 - block.block.views_block__this_person_s_contact_details_block_1 diff --git a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml b/features/opencase_default_user_config/opencase_default_user_config.info.yml similarity index 61% rename from features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml rename to features/opencase_default_user_config/opencase_default_user_config.info.yml index 6e240f9..35eea3f 100644 --- a/features/opencase_user_config_anonymous/opencase_user_config_anonymous.info.yml +++ b/features/opencase_default_user_config/opencase_default_user_config.info.yml @@ -1,4 +1,4 @@ -name: anonymous +name: default_user_config type: module core: 8.x dependencies: @@ -6,4 +6,4 @@ dependencies: - system - user - views -package: 'OpenCase User Config' +package: 'OpenCase' From 7097cac8638f1a8a070b6917b45ae10fa527181b Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 27 Apr 2018 16:09:38 +0200 Subject: [PATCH 90/94] Removed redirect to home page after login The way it was done, it didn't work with password reset --- zencrm.module | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/zencrm.module b/zencrm.module index f094f22..d9734d7 100644 --- a/zencrm.module +++ b/zencrm.module @@ -38,15 +38,3 @@ function zencrm_page_attachments(array &$page) { $page['#attached']['library'][] = 'zencrm/opencase-lib'; } -/** - * Implements hook_user_login(). - */ -function zencrm_user_login(\Drupal\user\UserInterface $account) { - // Default login destination to the dashboard. - $current_request = \Drupal::service('request_stack')->getCurrentRequest(); - if (!$current_request->query->get('destination')) { - $current_request->query->set( - 'destination', '/' - ); - } -} From d21109ebcad2fca907496ba2f3c8cbb14265bcd0 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 27 Apr 2018 16:10:10 +0200 Subject: [PATCH 91/94] Added hat types permission It kind of works, as it allows the user to add, "edit" and delete hat types - but it does not allow administrating fields --- modules/zencrm_entities/src/Entity/HatType.php | 2 +- modules/zencrm_entities/zencrm_entities.permissions.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/zencrm_entities/src/Entity/HatType.php b/modules/zencrm_entities/src/Entity/HatType.php index 5c7547c..d201c0b 100644 --- a/modules/zencrm_entities/src/Entity/HatType.php +++ b/modules/zencrm_entities/src/Entity/HatType.php @@ -23,7 +23,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase; * }, * }, * config_prefix = "hat_type", - * admin_permission = "administer site configuration", + * admin_permission = "add hat types", * bundle_of = "hat", * entity_keys = { * "id" = "id", diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml index 8f61d6c..47c1846 100644 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ b/modules/zencrm_entities/zencrm_entities.permissions.yml @@ -1,3 +1,6 @@ +add hat types: + title: 'Add Hat Types' + add person entities: title: 'Create new Person entities' From 0dceb8c38d35be8c451ba886df14c1adce07ec70 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 27 Apr 2018 19:18:14 +0200 Subject: [PATCH 92/94] Added an access role to views Just made it "authorised user" for now, to keep the security review happy --- .../views.view.single_case_with_activities.yml | 11 +++++++++-- config/optional/views.view.this_hat_s_cases.yml | 11 +++++++++-- .../views.view.this_person_s_contact_details.yml | 12 ++++++++++-- config/optional/views.view.this_person_s_hats.yml | 10 ++++++++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/config/optional/views.view.single_case_with_activities.yml b/config/optional/views.view.single_case_with_activities.yml index 229fce5..11a20bb 100644 --- a/config/optional/views.view.single_case_with_activities.yml +++ b/config/optional/views.view.single_case_with_activities.yml @@ -1,7 +1,10 @@ langcode: en status: true dependencies: + config: + - user.role.authenticated module: + - user - zencrm_entities id: single_case_with_activities label: 'Single Case with Activities' @@ -19,8 +22,10 @@ display: position: 0 display_options: access: - type: none - options: { } + type: role + options: + role: + authenticated: authenticated cache: type: tag options: { } @@ -463,6 +468,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } block_1: display_plugin: block @@ -478,4 +484,5 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } diff --git a/config/optional/views.view.this_hat_s_cases.yml b/config/optional/views.view.this_hat_s_cases.yml index ebb1beb..94c3e54 100644 --- a/config/optional/views.view.this_hat_s_cases.yml +++ b/config/optional/views.view.this_hat_s_cases.yml @@ -1,7 +1,10 @@ langcode: en status: true dependencies: + config: + - user.role.authenticated module: + - user - zencrm_entities id: this_hat_s_cases label: 'This hat''s cases' @@ -19,8 +22,10 @@ display: position: 0 display_options: access: - type: none - options: { } + type: role + options: + role: + authenticated: authenticated cache: type: tag options: { } @@ -377,6 +382,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } block_1: display_plugin: block @@ -391,4 +397,5 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml index ae2977f..32fa297 100644 --- a/config/optional/views.view.this_person_s_contact_details.yml +++ b/config/optional/views.view.this_person_s_contact_details.yml @@ -1,7 +1,10 @@ langcode: en status: true dependencies: + config: + - user.role.authenticated module: + - user - zencrm_entities id: this_person_s_contact_details label: 'Contact Details' @@ -19,8 +22,10 @@ display: position: 0 display_options: access: - type: none - options: { } + type: role + options: + role: + authenticated: authenticated cache: type: tag options: { } @@ -290,6 +295,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } block_1: display_plugin: block @@ -305,6 +311,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } entity_reference_1: display_plugin: entity_reference @@ -561,4 +568,5 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: { } diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml index 59653ba..ab2fc8b 100644 --- a/config/optional/views.view.this_person_s_hats.yml +++ b/config/optional/views.view.this_person_s_hats.yml @@ -3,7 +3,9 @@ status: true dependencies: config: - block.block.hatcreator + - user.role.authenticated module: + - user - zencrm_entities id: this_person_s_hats label: Hats @@ -21,8 +23,10 @@ display: position: 0 display_options: access: - type: none - options: { } + type: role + options: + role: + authenticated: authenticated cache: type: tag options: { } @@ -357,6 +361,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: - 'config:core.entity_view_display.hat.client.default' - 'config:core.entity_view_display.hat.volunteer.default' @@ -382,6 +387,7 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - user.roles tags: - 'config:core.entity_view_display.hat.client.default' - 'config:core.entity_view_display.hat.volunteer.default' From 57a797ba6d2c1e3b1b44f72c9fb1f286b02ee063 Mon Sep 17 00:00:00 2001 From: Naomi Date: Sun, 13 May 2018 14:25:09 +0300 Subject: [PATCH 93/94] deleted all the things. backup is in old_code branch --- README.md | 17 - composer.json | 14 - .../optional/block.block.activitycreator.yml | 25 - config/optional/block.block.casedetails.yml | 25 - config/optional/block.block.hatcreator.yml | 25 - config/optional/block.block.personpanel.yml | 25 - ...k__single_case_with_activities_block_1.yml | 30 - ..._this_person_s_contact_details_block_1.yml | 29 - ...iews_block__this_person_s_hats_block_1.yml | 30 - ...views.view.single_case_with_activities.yml | 488 --------------- .../optional/views.view.this_hat_s_cases.yml | 401 ------------ ...ews.view.this_person_s_contact_details.yml | 572 ------------------ .../views.view.this_person_s_hats.yml | 393 ------------ css/opencase.css | 152 ----- ...orm_display.activity.case_note.default.yml | 38 -- ...splay.activity.self_assessment.default.yml | 32 - ...orm_display.case_entity.asylum.default.yml | 29 - ...rm_display.case_entity.housing.default.yml | 20 - ...e_entity.volunteer_recruitment.default.yml | 20 - ...entity_form_display.hat.client.default.yml | 29 - ...ity_form_display.hat.volunteer.default.yml | 38 -- ...iew_display.activity.case_note.default.yml | 38 -- ...splay.activity.self_assessment.default.yml | 37 -- ...iew_display.case_entity.asylum.default.yml | 29 - ...ew_display.case_entity.housing.default.yml | 26 - ...e_entity.volunteer_recruitment.default.yml | 26 - ...entity_view_display.hat.client.default.yml | 29 - ...ity_view_display.hat.volunteer.default.yml | 40 -- ...ld.field.activity.case_note.field_file.yml | 26 - ...d.field.activity.case_note.field_notes.yml | 18 - ...sment.field_how_is_your_housing_situat.yml | 20 - ...sment.field_how_is_your_mental_health_.yml | 20 - ...sment.field_how_is_your_physical_healt.yml | 20 - ...ld.field.case_entity.asylum.field_asyl.yml | 18 - ...eld.case_entity.asylum.field_home_offi.yml | 18 - .../field.field.hat.client.field_country.yml | 18 - .../field.field.hat.client.field_language.yml | 18 - ...field.hat.volunteer.field_availability.yml | 18 - ...field.hat.volunteer.field_date_started.yml | 23 - .../field.field.hat.volunteer.field_team.yml | 18 - .../field.storage.activity.field_file.yml | 22 - ...ivity.field_how_is_your_housing_situat.yml | 35 -- ...ivity.field_how_is_your_mental_health_.yml | 35 -- ...ivity.field_how_is_your_physical_healt.yml | 35 -- .../field.storage.activity.field_notes.yml | 18 - .../field.storage.case_entity.field_asyl.yml | 20 - ...ld.storage.case_entity.field_home_offi.yml | 20 - .../field.storage.hat.field_availability.yml | 18 - .../field.storage.hat.field_country.yml | 20 - .../field.storage.hat.field_date_started.yml | 19 - .../field.storage.hat.field_language.yml | 20 - .../install/field.storage.hat.field_team.yml | 20 - ...encrm_entities.activity_type.case_note.yml | 5 - ...entities.activity_type.self_assessment.yml | 5 - ...encrm_entities.case_entity_type.asylum.yml | 5 - ...ncrm_entities.case_entity_type.housing.yml | 5 - ...case_entity_type.volunteer_recruitment.yml | 5 - .../zencrm_entities.hat_type.client.yml | 5 - .../zencrm_entities.hat_type.volunteer.yml | 5 - .../opencase_default_subtypes.features.yml | 6 - .../opencase_default_subtypes.info.yml | 11 - .../config/install/user.role.anonymous.yml | 7 - .../opencase_default_user_config.features.yml | 6 - .../opencase_default_user_config.info.yml | 9 - js/opencase.js | 4 - modules/zencrm_entities/activity.page.inc | 30 - modules/zencrm_entities/case_entity.page.inc | 30 - modules/zencrm_entities/composer.json | 14 - .../config/install/views.view.persons.yml | 369 ----------- ...ews.view.this_person_s_contact_details.yml | 560 ----------------- .../config/schema/activity_type.schema.yml | 12 - .../config/schema/case_entity_type.schema.yml | 12 - .../config/schema/hat_type.schema.yml | 12 - .../zencrm_entities/contact_details.page.inc | 30 - modules/zencrm_entities/hat.page.inc | 30 - modules/zencrm_entities/person.page.inc | 30 - .../src/ActivityAccessControlHandler.php | 47 -- .../src/ActivityHtmlRouteProvider.php | 56 -- .../src/ActivityListBuilder.php | 40 -- .../src/ActivityTranslationHandler.php | 14 - .../src/ActivityTypeHtmlRouteProvider.php | 28 - .../src/ActivityTypeListBuilder.php | 32 - .../src/CaseEntityAccessControlHandler.php | 47 -- .../src/CaseEntityHtmlRouteProvider.php | 56 -- .../src/CaseEntityListBuilder.php | 40 -- .../src/CaseEntityTranslationHandler.php | 14 - .../src/CaseEntityTypeHtmlRouteProvider.php | 28 - .../src/CaseEntityTypeListBuilder.php | 32 - .../ContactDetailsAccessControlHandler.php | 47 -- .../src/ContactDetailsHtmlRouteProvider.php | 56 -- .../src/ContactDetailsListBuilder.php | 40 -- .../zencrm_entities/src/Entity/Activity.php | 229 ------- .../src/Entity/ActivityInterface.php | 77 --- .../src/Entity/ActivityType.php | 58 -- .../src/Entity/ActivityTypeInterface.php | 13 - .../src/Entity/ActivityViewsData.php | 24 - .../zencrm_entities/src/Entity/CaseEntity.php | 240 -------- .../src/Entity/CaseEntityInterface.php | 77 --- .../src/Entity/CaseEntityType.php | 58 -- .../src/Entity/CaseEntityTypeInterface.php | 13 - .../src/Entity/CaseEntityViewsData.php | 24 - .../src/Entity/ContactDetails.php | 313 ---------- .../src/Entity/ContactDetailsInterface.php | 77 --- .../src/Entity/ContactDetailsViewsData.php | 24 - modules/zencrm_entities/src/Entity/Hat.php | 231 ------- .../src/Entity/HatInterface.php | 77 --- .../zencrm_entities/src/Entity/HatType.php | 58 -- .../src/Entity/HatTypeInterface.php | 13 - .../src/Entity/HatViewsData.php | 24 - modules/zencrm_entities/src/Entity/Person.php | 241 -------- .../src/Entity/PersonInterface.php | 77 --- .../src/Entity/PersonViewsData.php | 24 - .../src/Form/ActivityDeleteForm.php | 15 - .../zencrm_entities/src/Form/ActivityForm.php | 50 -- .../src/Form/ActivitySettingsForm.php | 53 -- .../src/Form/ActivityTypeDeleteForm.php | 53 -- .../src/Form/ActivityTypeForm.php | 65 -- .../src/Form/CaseEntityDeleteForm.php | 15 - .../src/Form/CaseEntityForm.php | 50 -- .../src/Form/CaseEntitySettingsForm.php | 53 -- .../src/Form/CaseEntityTypeDeleteForm.php | 53 -- .../src/Form/CaseEntityTypeForm.php | 65 -- .../src/Form/ContactDetailsDeleteForm.php | 15 - .../src/Form/ContactDetailsForm.php | 50 -- .../src/Form/ContactDetailsSettingsForm.php | 53 -- .../src/Form/HatDeleteForm.php | 15 - modules/zencrm_entities/src/Form/HatForm.php | 50 -- .../src/Form/HatSettingsForm.php | 53 -- .../src/Form/HatTypeDeleteForm.php | 53 -- .../zencrm_entities/src/Form/HatTypeForm.php | 65 -- .../src/Form/PersonDeleteForm.php | 15 - .../zencrm_entities/src/Form/PersonForm.php | 50 -- .../src/Form/PersonSettingsForm.php | 53 -- .../src/HatAccessControlHandler.php | 47 -- .../src/HatHtmlRouteProvider.php | 56 -- .../zencrm_entities/src/HatListBuilder.php | 40 -- .../src/HatTranslationHandler.php | 14 - .../src/HatTypeHtmlRouteProvider.php | 28 - .../src/HatTypeListBuilder.php | 32 - .../src/PersonAccessControlHandler.php | 47 -- .../src/PersonHtmlRouteProvider.php | 56 -- .../zencrm_entities/src/PersonListBuilder.php | 40 -- .../activity-content-add-list.html.twig | 23 - .../templates/activity.html.twig | 22 - .../case-entity-content-add-list.html.twig | 23 - .../templates/case_entity.html.twig | 22 - .../templates/contact_details.html.twig | 22 - .../templates/hat-content-add-list.html.twig | 23 - .../zencrm_entities/templates/hat.html.twig | 22 - .../templates/person.html.twig | 22 - .../templates/zencrm-entities.html.twig | 1 - .../tests/src/Functional/LoadTest.php | 46 -- .../zencrm_entities/zencrm_entities.info.yml | 8 - .../zencrm_entities.links.action.yml | 54 -- .../zencrm_entities.links.menu.yml | 110 ---- .../zencrm_entities.links.task.yml | 142 ----- .../zencrm_entities/zencrm_entities.module | 143 ----- .../zencrm_entities.permissions.yml | 159 ----- ...k.block.exposedformperson_searchpage_1.yml | 22 - .../search_api.index.person_index.yml | 42 -- .../search_api.server.zencrm_server.yml | 16 - .../optional/views.view.person_search.yml | 262 -------- .../templates/zen-crm-search.html.twig | 1 - .../tests/src/Functional/LoadTest.php | 46 -- modules/zencrm_search/zencrm_search.info.yml | 10 - modules/zencrm_search/zencrm_search.module | 35 -- src/Controller/ActivityController.php | 35 -- src/Controller/CaseController.php | 34 -- src/Controller/ContactDetailsController.php | 31 - src/Controller/HatController.php | 54 -- src/Plugin/Block/ActivityCreator.php | 40 -- src/Plugin/Block/CaseDetails.php | 60 -- src/Plugin/Block/HatCreator.php | 46 -- src/Plugin/Block/PersonPanel.php | 89 --- templates/zencrm.html.twig | 1 - tests/src/Functional/LoadTest.php | 46 -- zencrm.info.yml | 11 - zencrm.libraries.yml | 7 - zencrm.module | 40 -- zencrm.routing.yml | 40 -- 180 files changed, 10044 deletions(-) delete mode 100644 README.md delete mode 100644 composer.json delete mode 100644 config/optional/block.block.activitycreator.yml delete mode 100644 config/optional/block.block.casedetails.yml delete mode 100644 config/optional/block.block.hatcreator.yml delete mode 100644 config/optional/block.block.personpanel.yml delete mode 100644 config/optional/block.block.views_block__single_case_with_activities_block_1.yml delete mode 100644 config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml delete mode 100644 config/optional/block.block.views_block__this_person_s_hats_block_1.yml delete mode 100644 config/optional/views.view.single_case_with_activities.yml delete mode 100644 config/optional/views.view.this_hat_s_cases.yml delete mode 100644 config/optional/views.view.this_person_s_contact_details.yml delete mode 100644 config/optional/views.view.this_person_s_hats.yml delete mode 100644 css/opencase.css delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml delete mode 100644 features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml delete mode 100644 features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml delete mode 100644 features/opencase_default_subtypes/opencase_default_subtypes.features.yml delete mode 100644 features/opencase_default_subtypes/opencase_default_subtypes.info.yml delete mode 100644 features/opencase_default_user_config/config/install/user.role.anonymous.yml delete mode 100644 features/opencase_default_user_config/opencase_default_user_config.features.yml delete mode 100644 features/opencase_default_user_config/opencase_default_user_config.info.yml delete mode 100644 js/opencase.js delete mode 100644 modules/zencrm_entities/activity.page.inc delete mode 100644 modules/zencrm_entities/case_entity.page.inc delete mode 100644 modules/zencrm_entities/composer.json delete mode 100644 modules/zencrm_entities/config/install/views.view.persons.yml delete mode 100644 modules/zencrm_entities/config/optional/views.view.this_person_s_contact_details.yml delete mode 100644 modules/zencrm_entities/config/schema/activity_type.schema.yml delete mode 100644 modules/zencrm_entities/config/schema/case_entity_type.schema.yml delete mode 100644 modules/zencrm_entities/config/schema/hat_type.schema.yml delete mode 100644 modules/zencrm_entities/contact_details.page.inc delete mode 100644 modules/zencrm_entities/hat.page.inc delete mode 100644 modules/zencrm_entities/person.page.inc delete mode 100644 modules/zencrm_entities/src/ActivityAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/ActivityHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/ActivityListBuilder.php delete mode 100644 modules/zencrm_entities/src/ActivityTranslationHandler.php delete mode 100644 modules/zencrm_entities/src/ActivityTypeHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/ActivityTypeListBuilder.php delete mode 100644 modules/zencrm_entities/src/CaseEntityAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/CaseEntityListBuilder.php delete mode 100644 modules/zencrm_entities/src/CaseEntityTranslationHandler.php delete mode 100644 modules/zencrm_entities/src/CaseEntityTypeHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/CaseEntityTypeListBuilder.php delete mode 100644 modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/ContactDetailsListBuilder.php delete mode 100644 modules/zencrm_entities/src/Entity/Activity.php delete mode 100644 modules/zencrm_entities/src/Entity/ActivityInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/ActivityType.php delete mode 100644 modules/zencrm_entities/src/Entity/ActivityTypeInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/ActivityViewsData.php delete mode 100644 modules/zencrm_entities/src/Entity/CaseEntity.php delete mode 100644 modules/zencrm_entities/src/Entity/CaseEntityInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/CaseEntityType.php delete mode 100644 modules/zencrm_entities/src/Entity/CaseEntityTypeInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/CaseEntityViewsData.php delete mode 100644 modules/zencrm_entities/src/Entity/ContactDetails.php delete mode 100644 modules/zencrm_entities/src/Entity/ContactDetailsInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/ContactDetailsViewsData.php delete mode 100644 modules/zencrm_entities/src/Entity/Hat.php delete mode 100644 modules/zencrm_entities/src/Entity/HatInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/HatType.php delete mode 100644 modules/zencrm_entities/src/Entity/HatTypeInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/HatViewsData.php delete mode 100644 modules/zencrm_entities/src/Entity/Person.php delete mode 100644 modules/zencrm_entities/src/Entity/PersonInterface.php delete mode 100644 modules/zencrm_entities/src/Entity/PersonViewsData.php delete mode 100644 modules/zencrm_entities/src/Form/ActivityDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ActivityForm.php delete mode 100644 modules/zencrm_entities/src/Form/ActivitySettingsForm.php delete mode 100644 modules/zencrm_entities/src/Form/ActivityTypeDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ActivityTypeForm.php delete mode 100644 modules/zencrm_entities/src/Form/CaseEntityDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/CaseEntityForm.php delete mode 100644 modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php delete mode 100644 modules/zencrm_entities/src/Form/CaseEntityTypeDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/CaseEntityTypeForm.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsForm.php delete mode 100644 modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php delete mode 100644 modules/zencrm_entities/src/Form/HatDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/HatForm.php delete mode 100644 modules/zencrm_entities/src/Form/HatSettingsForm.php delete mode 100644 modules/zencrm_entities/src/Form/HatTypeDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/HatTypeForm.php delete mode 100644 modules/zencrm_entities/src/Form/PersonDeleteForm.php delete mode 100644 modules/zencrm_entities/src/Form/PersonForm.php delete mode 100644 modules/zencrm_entities/src/Form/PersonSettingsForm.php delete mode 100644 modules/zencrm_entities/src/HatAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/HatHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/HatListBuilder.php delete mode 100644 modules/zencrm_entities/src/HatTranslationHandler.php delete mode 100644 modules/zencrm_entities/src/HatTypeHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/HatTypeListBuilder.php delete mode 100644 modules/zencrm_entities/src/PersonAccessControlHandler.php delete mode 100644 modules/zencrm_entities/src/PersonHtmlRouteProvider.php delete mode 100644 modules/zencrm_entities/src/PersonListBuilder.php delete mode 100644 modules/zencrm_entities/templates/activity-content-add-list.html.twig delete mode 100644 modules/zencrm_entities/templates/activity.html.twig delete mode 100644 modules/zencrm_entities/templates/case-entity-content-add-list.html.twig delete mode 100644 modules/zencrm_entities/templates/case_entity.html.twig delete mode 100644 modules/zencrm_entities/templates/contact_details.html.twig delete mode 100644 modules/zencrm_entities/templates/hat-content-add-list.html.twig delete mode 100644 modules/zencrm_entities/templates/hat.html.twig delete mode 100644 modules/zencrm_entities/templates/person.html.twig delete mode 100644 modules/zencrm_entities/templates/zencrm-entities.html.twig delete mode 100644 modules/zencrm_entities/tests/src/Functional/LoadTest.php delete mode 100644 modules/zencrm_entities/zencrm_entities.info.yml delete mode 100644 modules/zencrm_entities/zencrm_entities.links.action.yml delete mode 100644 modules/zencrm_entities/zencrm_entities.links.menu.yml delete mode 100644 modules/zencrm_entities/zencrm_entities.links.task.yml delete mode 100644 modules/zencrm_entities/zencrm_entities.module delete mode 100644 modules/zencrm_entities/zencrm_entities.permissions.yml delete mode 100644 modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml delete mode 100644 modules/zencrm_search/config/optional/search_api.index.person_index.yml delete mode 100644 modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml delete mode 100644 modules/zencrm_search/config/optional/views.view.person_search.yml delete mode 100644 modules/zencrm_search/templates/zen-crm-search.html.twig delete mode 100644 modules/zencrm_search/tests/src/Functional/LoadTest.php delete mode 100644 modules/zencrm_search/zencrm_search.info.yml delete mode 100644 modules/zencrm_search/zencrm_search.module delete mode 100644 src/Controller/ActivityController.php delete mode 100644 src/Controller/CaseController.php delete mode 100644 src/Controller/ContactDetailsController.php delete mode 100644 src/Controller/HatController.php delete mode 100644 src/Plugin/Block/ActivityCreator.php delete mode 100644 src/Plugin/Block/CaseDetails.php delete mode 100644 src/Plugin/Block/HatCreator.php delete mode 100644 src/Plugin/Block/PersonPanel.php delete mode 100644 templates/zencrm.html.twig delete mode 100644 tests/src/Functional/LoadTest.php delete mode 100644 zencrm.info.yml delete mode 100644 zencrm.libraries.yml delete mode 100644 zencrm.module delete mode 100644 zencrm.routing.yml diff --git a/README.md b/README.md deleted file mode 100644 index e6f813f..0000000 --- a/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# OpenCase -A simple, case-management-focused CRM for small altruistic organisations. - -## Current Status -**15 April 2018** A demo site, with basic functionality is available at demo.opencase.org.uk. - -## The Plan -OpenCase will be available as: -* A Drupal module, on drupal.org -* A Drupal install profile / distribution -* A hosted service - -## Find out more -* More details, including user stories, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) - - - diff --git a/composer.json b/composer.json deleted file mode 100644 index 70d917a..0000000 --- a/composer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "drupal/zencrm", - "type": "drupal-module", - "description": "Zen CRM", - "keywords": ["Drupal"], - "license": "GPL-2.0+", - "homepage": "https://www.drupal.org/project/zencrm", - "minimum-stability": "dev", - "support": { - "issues": "https://www.drupal.org/project/issues/zencrm", - "source": "http://cgit.drupalcode.org/zencrm" - }, - "require": { } -} diff --git a/config/optional/block.block.activitycreator.yml b/config/optional/block.block.activitycreator.yml deleted file mode 100644 index 7f78e46..0000000 --- a/config/optional/block.block.activitycreator.yml +++ /dev/null @@ -1,25 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - system - - zencrm - theme: - - bartik -id: activitycreator -theme: bartik -region: content -weight: -7 -provider: null -plugin: activity_creator -settings: - id: activity_creator - label: 'Activity creator' - provider: zencrm - label_display: '0' -visibility: - request_path: - id: request_path - pages: '/zencrm/case/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.casedetails.yml b/config/optional/block.block.casedetails.yml deleted file mode 100644 index 16b0d65..0000000 --- a/config/optional/block.block.casedetails.yml +++ /dev/null @@ -1,25 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - system - - zencrm - theme: - - bartik -id: casedetails -theme: bartik -region: sidebar_second -weight: 0 -provider: null -plugin: case_details -settings: - id: case_details - label: 'Case Details' - provider: zencrm - label_display: visible -visibility: - request_path: - id: request_path - pages: '/zencrm/case/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.hatcreator.yml b/config/optional/block.block.hatcreator.yml deleted file mode 100644 index b9cd32f..0000000 --- a/config/optional/block.block.hatcreator.yml +++ /dev/null @@ -1,25 +0,0 @@ -langcode: en -status: false -dependencies: - module: - - system - - zencrm - theme: - - bartik -id: hatcreator -theme: bartik -region: sidebar_second -weight: -6 -provider: null -plugin: hat_creator -settings: - id: hat_creator - label: '' - provider: zencrm - label_display: visible -visibility: - request_path: - id: request_path - pages: '/zencrm/person/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.personpanel.yml b/config/optional/block.block.personpanel.yml deleted file mode 100644 index 8da71f5..0000000 --- a/config/optional/block.block.personpanel.yml +++ /dev/null @@ -1,25 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - system - - zencrm - theme: - - bartik -id: personpanel -theme: bartik -region: content -weight: 0 -provider: null -plugin: person_panel -settings: - id: person_panel - label: 'Person Panel' - provider: zencrm - label_display: '0' -visibility: - request_path: - id: request_path - pages: '/zencrm/person/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.views_block__single_case_with_activities_block_1.yml b/config/optional/block.block.views_block__single_case_with_activities_block_1.yml deleted file mode 100644 index 06e1b8f..0000000 --- a/config/optional/block.block.views_block__single_case_with_activities_block_1.yml +++ /dev/null @@ -1,30 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - views.view.single_case_with_activities - module: - - system - - views - theme: - - bartik -id: views_block__single_case_with_activities_block_1 -theme: bartik -region: content -weight: -5 -provider: null -plugin: 'views_block:single_case_with_activities-block_1' -settings: - id: 'views_block:single_case_with_activities-block_1' - label: '' - provider: views - label_display: '0' - views_label: '' - items_per_page: none - context_mapping: { } -visibility: - request_path: - id: request_path - pages: '/zencrm/case/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml b/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml deleted file mode 100644 index 81039c7..0000000 --- a/config/optional/block.block.views_block__this_person_s_contact_details_block_1.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - views.view.this_person_s_contact_details - module: - - system - - views - theme: - - bartik -id: views_block__this_person_s_contact_details_block_1 -theme: bartik -region: sidebar_second -weight: -7 -provider: null -plugin: 'views_block:this_person_s_contact_details-block_1' -settings: - id: 'views_block:this_person_s_contact_details-block_1' - label: '' - provider: views - label_display: visible - views_label: '' - items_per_page: none -visibility: - request_path: - id: request_path - pages: '/zencrm/person/*' - negate: false - context_mapping: { } diff --git a/config/optional/block.block.views_block__this_person_s_hats_block_1.yml b/config/optional/block.block.views_block__this_person_s_hats_block_1.yml deleted file mode 100644 index 026110f..0000000 --- a/config/optional/block.block.views_block__this_person_s_hats_block_1.yml +++ /dev/null @@ -1,30 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - views.view.this_person_s_hats - module: - - system - - views - theme: - - bartik -id: views_block__this_person_s_hats_block_1 -theme: bartik -region: sidebar_second -weight: -8 -provider: null -plugin: 'views_block:this_person_s_hats-block_1' -settings: - id: 'views_block:this_person_s_hats-block_1' - label: '' - provider: views - label_display: visible - views_label: '' - items_per_page: none - context_mapping: { } -visibility: - request_path: - id: request_path - pages: '/zencrm/person/*' - negate: false - context_mapping: { } diff --git a/config/optional/views.view.single_case_with_activities.yml b/config/optional/views.view.single_case_with_activities.yml deleted file mode 100644 index 11a20bb..0000000 --- a/config/optional/views.view.single_case_with_activities.yml +++ /dev/null @@ -1,488 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - user.role.authenticated - module: - - user - - zencrm_entities -id: single_case_with_activities -label: 'Single Case with Activities' -module: views -description: '' -tag: '' -base_table: activity_field_data -base_field: id -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: role - options: - role: - authenticated: authenticated - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: none - options: - offset: 0 - style: - type: table - options: - grouping: { } - row_class: '' - default_row_class: true - override: true - sticky: false - caption: '' - summary: '' - description: '' - columns: - name: name - info: - name: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - default: '-1' - empty_table: false - row: - type: 'entity:activity' - fields: - id: - id: id - table: activity_field_data - field: id - relationship: none - group_type: group - admin_label: '' - label: ID - exclude: true - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: activity - entity_field: id - plugin_id: field - type: - id: type - table: activity_field_data - field: type - relationship: none - group_type: group - admin_label: '' - label: 'Activity type' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: false - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: activity - entity_field: type - plugin_id: field - subject: - id: subject - table: activity_field_data - field: subject - relationship: none - group_type: group - admin_label: '' - label: Subject - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: false - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: activity - entity_field: subject - plugin_id: field - created: - id: created - table: activity_field_data - field: created - relationship: none - group_type: group - admin_label: '' - label: Created - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: timestamp - settings: - date_format: long - custom_date_format: '' - timezone: '' - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: activity - entity_field: created - plugin_id: field - nothing: - id: nothing - table: views - field: nothing - relationship: none - group_type: group - admin_label: '' - label: 'Custom text' - exclude: false - alter: - alter_text: true - text: 'View  Edit' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - filters: { } - sorts: - created: - id: created - table: activity_field_data - field: created - relationship: none - group_type: group - admin_label: '' - order: DESC - exposed: false - expose: - label: '' - granularity: second - entity_type: activity - entity_field: created - plugin_id: date - title: Activities - header: { } - footer: { } - empty: { } - relationships: - case_entity: - id: case_entity - table: activity_field_data - field: case_entity - relationship: none - group_type: group - admin_label: 'Case entity' - required: true - entity_type: activity - entity_field: case_entity - plugin_id: standard - arguments: - case_entity: - id: case_entity - table: activity_field_data - field: case_entity - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: raw - default_argument_options: - index: 2 - use_alias: false - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: false - not: false - entity_type: activity - entity_field: case_entity - plugin_id: numeric - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: 'Activity List' - position: 2 - display_options: - display_extenders: { } - display_description: '' - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } diff --git a/config/optional/views.view.this_hat_s_cases.yml b/config/optional/views.view.this_hat_s_cases.yml deleted file mode 100644 index 94c3e54..0000000 --- a/config/optional/views.view.this_hat_s_cases.yml +++ /dev/null @@ -1,401 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - user.role.authenticated - module: - - user - - zencrm_entities -id: this_hat_s_cases -label: 'This hat''s cases' -module: views -description: '' -tag: '' -base_table: case_entity_field_data -base_field: id -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: role - options: - role: - authenticated: authenticated - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: none - options: - offset: 0 - style: - type: table - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - columns: { } - default: '' - info: { } - override: true - sticky: false - order: asc - caption: '' - summary: '' - description: '' - empty_table: false - row: - type: 'entity:case_entity' - fields: - name: - id: name - table: case_entity_field_data - field: name - relationship: none - group_type: group - admin_label: '' - label: Case - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: false - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: null - entity_field: name - plugin_id: field - type: - id: type - table: case_entity_field_data - field: type - relationship: none - group_type: group - admin_label: '' - label: Type - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: false - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: case_entity - entity_field: type - plugin_id: field - hats_involved_target_id: - id: hats_involved_target_id - table: case_entity__hats_involved - field: hats_involved_target_id - relationship: none - group_type: group - admin_label: '' - label: 'Involved Parties' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: false - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: case_entity - entity_field: hats_involved - plugin_id: field - view_case_entity: - id: view_case_entity - table: case_entity - field: view_case_entity - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - text: 'Go to case' - output_url_as_text: false - absolute: false - entity_type: case_entity - plugin_id: entity_link - filters: { } - sorts: { } - title: 'This hat''s cases' - header: { } - footer: { } - empty: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: false - content: '

This person is not involved in any cases in this capacity.

' - plugin_id: text_custom - relationships: { } - arguments: - hats_involved_target_id: - id: hats_involved_target_id - table: case_entity__hats_involved - field: hats_involved_target_id - relationship: none - group_type: group - admin_label: '' - default_action: empty - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: fixed - default_argument_options: - argument: '' - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: false - not: false - entity_type: case_entity - entity_field: hats_involved - plugin_id: numeric - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 1 - display_options: - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } diff --git a/config/optional/views.view.this_person_s_contact_details.yml b/config/optional/views.view.this_person_s_contact_details.yml deleted file mode 100644 index 32fa297..0000000 --- a/config/optional/views.view.this_person_s_contact_details.yml +++ /dev/null @@ -1,572 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - user.role.authenticated - module: - - user - - zencrm_entities -id: this_person_s_contact_details -label: 'Contact Details' -module: views -description: '' -tag: '' -base_table: contact_details -base_field: id -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: role - options: - role: - authenticated: authenticated - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: none - options: - offset: 0 - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - row: - type: fields - options: - default_field_elements: true - inline: { } - separator: '' - hide_empty: false - fields: - id: - id: id - table: contact_details - field: id - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: true - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: contact_details - entity_field: id - plugin_id: field - rendered_entity: - id: rendered_entity - table: contact_details - field: rendered_entity - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - view_mode: default - entity_type: contact_details - plugin_id: rendered_entity - nothing: - id: nothing - table: views - field: nothing - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: true - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - filters: { } - sorts: { } - title: 'Contact Details' - header: { } - footer: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: true - content: '' - plugin_id: text_custom - empty: { } - relationships: { } - arguments: - person: - id: person - table: contact_details - field: person - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: raw - default_argument_options: - index: 2 - use_alias: false - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: false - not: false - entity_type: contact_details - entity_field: person - plugin_id: numeric - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 1 - display_options: - display_extenders: { } - block_hide_empty: true - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } - entity_reference_1: - display_plugin: entity_reference - id: entity_reference_1 - display_title: 'Entity Reference' - position: 2 - display_options: - display_extenders: { } - fields: - id: - id: id - table: contact_details - field: id - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: true - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: contact_details - entity_field: id - plugin_id: field - rendered_entity: - id: rendered_entity - table: contact_details - field: rendered_entity - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - view_mode: default - entity_type: contact_details - plugin_id: rendered_entity - nothing: - id: nothing - table: views - field: nothing - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: true - text: 'Edit' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - type: - id: type - table: contact_details - field: type - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: false - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: contact_details - entity_field: type - plugin_id: field - defaults: - fields: false - style: - type: entity_reference - options: - search_fields: - type: type - id: '0' - rendered_entity: '0' - nothing: '0' - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: { } diff --git a/config/optional/views.view.this_person_s_hats.yml b/config/optional/views.view.this_person_s_hats.yml deleted file mode 100644 index ab2fc8b..0000000 --- a/config/optional/views.view.this_person_s_hats.yml +++ /dev/null @@ -1,393 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - block.block.hatcreator - - user.role.authenticated - module: - - user - - zencrm_entities -id: this_person_s_hats -label: Hats -module: views -description: '' -tag: '' -base_table: hat_field_data -base_field: id -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: role - options: - role: - authenticated: authenticated - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: none - options: - offset: 0 - style: - type: html_list - options: - grouping: { } - row_class: '' - default_row_class: true - type: ul - wrapper_class: item-list - class: '' - row: - type: fields - fields: - id: - id: id - table: hat_field_data - field: id - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: true - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: hat - entity_field: id - plugin_id: field - type: - id: type - table: hat_field_data - field: type - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: false - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: hat - entity_field: type - plugin_id: field - rendered_entity: - id: rendered_entity - table: hat - field: rendered_entity - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - view_mode: default - entity_type: hat - plugin_id: rendered_entity - nothing: - id: nothing - table: views - field: nothing - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: true - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - filters: { } - sorts: { } - title: Hats - header: { } - footer: - entity_block: - id: entity_block - table: views - field: entity_block - relationship: none - group_type: group - admin_label: '' - empty: false - tokenize: true - target: hatcreator - view_mode: default - bypass_access: true - plugin_id: entity - empty: { } - relationships: { } - arguments: - person: - id: person - table: hat_field_data - field: person - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: raw - default_argument_options: - index: 2 - use_alias: false - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: false - not: false - entity_type: hat - entity_field: person - plugin_id: numeric - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: - - 'config:core.entity_view_display.hat.client.default' - - 'config:core.entity_view_display.hat.volunteer.default' - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 1 - display_options: - display_extenders: { } - allow: - items_per_page: false - offset: '0' - pager: '0' - hide_fields: '0' - sort_fields: '0' - disable_filters: '0' - configure_sorts: '0' - block_hide_empty: false - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - user.roles - tags: - - 'config:core.entity_view_display.hat.client.default' - - 'config:core.entity_view_display.hat.volunteer.default' diff --git a/css/opencase.css b/css/opencase.css deleted file mode 100644 index 0e792e6..0000000 --- a/css/opencase.css +++ /dev/null @@ -1,152 +0,0 @@ -/* this part is for the wider theme and will be removed */ -a.site-branding__logo img { - max-width: 100px; -} - -/* a hack to show different links in sidebar - temporary */ -.zencrm_creationlinks.authorised_only { - display: none; -} - -.user-logged-in .zencrm_creationlinks.authorised_only { - display: block; -} - -.zencrm_creationlinks.anonymous_only { - display: block; -} - -.user-logged-in .zencrm_creationlinks.anonymous_only { - display: none; -} - -/* Module-specific from here. */ - -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { - width: 100%; -} - -button.button--primary.js-form-submit.form-submit.ui-button.ui-corner-all.ui-widget { - margin-left: 73%; -} - -button.button.button--danger.ui-button.ui-corner-all.ui-widget { - float: left; - color: red; -} - -.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons { - min-width: 550px; - border: 20px solid rgba(0, 0, 0, 0.51); -} - -.tabledrag-toggle-weight-wrapper { - display: none; -} - -#content .zencrm_case_details { - display: none; /* don't show case as main content - it's shown in sidebar */ -} - -div.region.region-primary-menu { - display:none; -} - -.field--name-contact-details a { - border-bottom: none; -} - -.sidebar .field--type-entity-reference { - margin: 1em 0 0 0; -} - -.region-sidebar-second .view-content li, .region-sidebar-second .views-row, .region-sidebar-second .zencrm_inner_sidebar_block { - border-bottom: 10px solid #e6e6d3; - padding-bottom: 20px; - padding-top: 10px; - padding-right: 10px; - padding-left: 10px; - background: #eeeedb; - border: 1px solid lightgrey; - margin-bottom: 10px; -} - -.sidebar .region-sidebar-second h2 { - font-size: 1.6em; - text-align: center; - border-bottom: 1px solid grey; -} - -.sidebar .views-field.views-field-type, .sidebar .field--name-type, .zencrm_inner_sidebar_block .zencrm_title { - padding-bottom: 12px; - font-size: 1.4em; - text-align: center; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} - -.zencrm_inner_sidebar_block .zencrm_title { - font-size: 1.2em; - padding-bottom: 5px; -} - -.sidebar .field__label, .sidebar .field--type-entity-reference .field__label, .form-item label { - font-size: 1em; - font-weight: bold; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} - -.sidebar .views-element-container .field, .sidebar .zencrm_inner_sidebar_block .field { - padding-bottom: 15px; -} - -.sidebar .views-element-container .field .field__item, .sidebar .zencrm_inner_sidebar_block .field__item { - font-size: 1.1em; -} - -.region-sidebar-second .view-content li, .region-sidebar-second .views-row { - padding-bottom: 20px; - padding-top: 10px; - padding-right: 10px; - padding-left: 10px; - background: #eeeedb; -} - -.region-sidebar-second .views-element-container.block, #block-casedetails { - padding-right: 10px; - padding-left: 10px; -} - -.zencrm_creationlinks { - padding: 10px 10px 10px 20px; - font-size: 1.2em; - -} - -.sidebar .zencrm_links { - font-size: 1.2em; -} - -.sidebar .zencrm_links p, .sidebar .zencrm_creationlinks p { - margin-bottom: 0.5em; -} - -.zencrm_creationlinks p { - margin-bottom: 0.5em; -} - -.sidebar .zencrm_creationlinks { - padding: 5px; - font-size: 1.3em; - -} - -.sidebar .zencrm_editlink { - font-size: 1.2em; - text-align: right; -} - -#block-hatcreator { - padding: 0; - border: none; - margin: 0; -} diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml deleted file mode 100644 index 4c372b0..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.case_note.default.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.activity.case_note.field_file - - field.field.activity.case_note.field_notes - - zencrm_entities.activity_type.case_note - module: - - file -id: activity.case_note.default -targetEntityType: activity -bundle: case_note -mode: default -content: - field_file: - weight: 4 - settings: - progress_indicator: throbber - third_party_settings: { } - type: file_generic - region: content - field_notes: - weight: 3 - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - type: string_textarea - region: content - name: - type: string_textfield - weight: -4 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml deleted file mode 100644 index bab5606..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.activity.self_assessment.default.yml +++ /dev/null @@ -1,32 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.activity.self_assessment.field_how_is_your_housing_situat - - field.field.activity.self_assessment.field_how_is_your_mental_health_ - - field.field.activity.self_assessment.field_how_is_your_physical_healt - - zencrm_entities.activity_type.self_assessment -id: activity.self_assessment.default -targetEntityType: activity -bundle: self_assessment -mode: default -content: - field_how_is_your_housing_situat: - weight: 5 - settings: { } - third_party_settings: { } - type: options_buttons - region: content - field_how_is_your_mental_health_: - weight: 4 - settings: { } - third_party_settings: { } - type: options_buttons - region: content - field_how_is_your_physical_healt: - weight: 3 - settings: { } - third_party_settings: { } - type: options_buttons - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml deleted file mode 100644 index 7598ade..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.asylum.default.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.case_entity.asylum.field_asyl - - field.field.case_entity.asylum.field_home_offi - - zencrm_entities.case_entity_type.asylum -id: case_entity.asylum.default -targetEntityType: case_entity -bundle: asylum -mode: default -content: - field_asyl: - weight: 6 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content - field_home_offi: - weight: 7 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml deleted file mode 100644 index e689b63..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.housing.default.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - zencrm_entities.case_entity_type.housing -id: case_entity.housing.default -targetEntityType: case_entity -bundle: housing -mode: default -content: - user_id: - type: entity_reference_autocomplete - weight: 5 - settings: - match_operator: CONTAINS - size: 60 - placeholder: '' - region: content - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml deleted file mode 100644 index 495859d..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.case_entity.volunteer_recruitment.default.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - zencrm_entities.case_entity_type.volunteer_recruitment -id: case_entity.volunteer_recruitment.default -targetEntityType: case_entity -bundle: volunteer_recruitment -mode: default -content: - user_id: - type: entity_reference_autocomplete - weight: 5 - settings: - match_operator: CONTAINS - size: 60 - placeholder: '' - region: content - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml deleted file mode 100644 index d225155..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.client.default.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.hat.client.field_country - - field.field.hat.client.field_language - - zencrm_entities.hat_type.client -id: hat.client.default -targetEntityType: hat -bundle: client -mode: default -content: - field_country: - weight: 3 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content - field_language: - weight: 4 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml b/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml deleted file mode 100644 index 08167aa..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_form_display.hat.volunteer.default.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.hat.volunteer.field_availability - - field.field.hat.volunteer.field_date_started - - field.field.hat.volunteer.field_team - - zencrm_entities.hat_type.volunteer - module: - - datetime -id: hat.volunteer.default -targetEntityType: hat -bundle: volunteer -mode: default -content: - field_availability: - weight: 6 - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - type: string_textarea - region: content - field_date_started: - weight: 5 - settings: { } - third_party_settings: { } - type: datetime_default - region: content - field_team: - weight: 4 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml deleted file mode 100644 index 7f9c26e..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.case_note.default.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.activity.case_note.field_file - - field.field.activity.case_note.field_notes - - zencrm_entities.activity_type.case_note - module: - - file -id: activity.case_note.default -targetEntityType: activity -bundle: case_note -mode: default -content: - field_file: - weight: -2 - label: above - settings: - use_description_as_link_text: true - third_party_settings: { } - type: file_default - region: content - field_notes: - weight: -3 - label: above - settings: { } - third_party_settings: { } - type: basic_string - region: content - name: - label: above - type: string - weight: -4 - region: content - settings: - link_to_entity: false - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml deleted file mode 100644 index 8828b8a..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.activity.self_assessment.default.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.activity.self_assessment.field_how_is_your_housing_situat - - field.field.activity.self_assessment.field_how_is_your_mental_health_ - - field.field.activity.self_assessment.field_how_is_your_physical_healt - - zencrm_entities.activity_type.self_assessment - module: - - options -id: activity.self_assessment.default -targetEntityType: activity -bundle: self_assessment -mode: default -content: - field_how_is_your_housing_situat: - weight: -1 - label: above - settings: { } - third_party_settings: { } - type: list_default - region: content - field_how_is_your_mental_health_: - weight: -2 - label: above - settings: { } - third_party_settings: { } - type: list_default - region: content - field_how_is_your_physical_healt: - weight: -3 - label: above - settings: { } - third_party_settings: { } - type: list_default - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml deleted file mode 100644 index 4fcbfe3..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.asylum.default.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.case_entity.asylum.field_asyl - - field.field.case_entity.asylum.field_home_offi - - zencrm_entities.case_entity_type.asylum -id: case_entity.asylum.default -targetEntityType: case_entity -bundle: asylum -mode: default -content: - field_asyl: - weight: 1 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content - field_home_offi: - weight: 2 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml deleted file mode 100644 index 6eef6cd..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.housing.default.yml +++ /dev/null @@ -1,26 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - zencrm_entities.case_entity_type.housing -id: case_entity.housing.default -targetEntityType: case_entity -bundle: housing -mode: default -content: - name: - label: above - type: string - weight: -4 - region: content - settings: - link_to_entity: false - third_party_settings: { } - user_id: - label: hidden - type: author - weight: 0 - region: content - settings: { } - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml deleted file mode 100644 index cd380cb..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.case_entity.volunteer_recruitment.default.yml +++ /dev/null @@ -1,26 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - zencrm_entities.case_entity_type.volunteer_recruitment -id: case_entity.volunteer_recruitment.default -targetEntityType: case_entity -bundle: volunteer_recruitment -mode: default -content: - name: - label: above - type: string - weight: -4 - region: content - settings: - link_to_entity: false - third_party_settings: { } - user_id: - label: hidden - type: author - weight: 0 - region: content - settings: { } - third_party_settings: { } -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml deleted file mode 100644 index 2bf10c4..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.client.default.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.hat.client.field_country - - field.field.hat.client.field_language - - zencrm_entities.hat_type.client -id: hat.client.default -targetEntityType: hat -bundle: client -mode: default -content: - field_country: - weight: 1 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content - field_language: - weight: 2 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml b/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml deleted file mode 100644 index fc938f3..0000000 --- a/features/opencase_default_subtypes/config/install/core.entity_view_display.hat.volunteer.default.yml +++ /dev/null @@ -1,40 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.hat.volunteer.field_availability - - field.field.hat.volunteer.field_date_started - - field.field.hat.volunteer.field_team - - zencrm_entities.hat_type.volunteer - module: - - datetime -id: hat.volunteer.default -targetEntityType: hat -bundle: volunteer -mode: default -content: - field_availability: - weight: 104 - label: above - settings: { } - third_party_settings: { } - type: basic_string - region: content - field_date_started: - weight: 103 - label: above - settings: - format_type: medium - timezone_override: '' - third_party_settings: { } - type: datetime_default - region: content - field_team: - weight: 102 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content -hidden: { } diff --git a/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml b/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml deleted file mode 100644 index d52bbc8..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_file.yml +++ /dev/null @@ -1,26 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.activity.field_file - - zencrm_entities.activity_type.case_note - module: - - file -id: activity.case_note.field_file -field_name: field_file -entity_type: activity -bundle: case_note -label: Files -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - file_directory: '[date:custom:Y]-[date:custom:m]' - file_extensions: 'txt jpg rtf doc png pdf' - max_filesize: '' - description_field: false - handler: 'default:file' - handler_settings: { } -field_type: file diff --git a/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml b/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml deleted file mode 100644 index cf61b70..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.activity.case_note.field_notes.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.activity.field_notes - - zencrm_entities.activity_type.case_note -id: activity.case_note.field_notes -field_name: field_notes -entity_type: activity -bundle: case_note -label: Notes -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string_long diff --git a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml deleted file mode 100644 index dcf708f..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_housing_situat.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.activity.field_how_is_your_housing_situat - - zencrm_entities.activity_type.self_assessment - module: - - options -id: activity.self_assessment.field_how_is_your_housing_situat -field_name: field_how_is_your_housing_situat -entity_type: activity -bundle: self_assessment -label: 'How is your housing situation?' -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: list_string diff --git a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml deleted file mode 100644 index 392489a..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_mental_health_.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.activity.field_how_is_your_mental_health_ - - zencrm_entities.activity_type.self_assessment - module: - - options -id: activity.self_assessment.field_how_is_your_mental_health_ -field_name: field_how_is_your_mental_health_ -entity_type: activity -bundle: self_assessment -label: 'How is your mental health?' -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: list_string diff --git a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml deleted file mode 100644 index 79c9fbe..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.activity.self_assessment.field_how_is_your_physical_healt.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.activity.field_how_is_your_physical_healt - - zencrm_entities.activity_type.self_assessment - module: - - options -id: activity.self_assessment.field_how_is_your_physical_healt -field_name: field_how_is_your_physical_healt -entity_type: activity -bundle: self_assessment -label: 'How is your physical health?' -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: list_string diff --git a/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml b/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml deleted file mode 100644 index ec002d3..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_asyl.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.case_entity.field_asyl - - zencrm_entities.case_entity_type.asylum -id: case_entity.asylum.field_asyl -field_name: field_asyl -entity_type: case_entity -bundle: asylum -label: 'Asylum status when taken on' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml b/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml deleted file mode 100644 index c1b1949..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.case_entity.asylum.field_home_offi.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.case_entity.field_home_offi - - zencrm_entities.case_entity_type.asylum -id: case_entity.asylum.field_home_offi -field_name: field_home_offi -entity_type: case_entity -bundle: asylum -label: 'Home Office Number' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml b/features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml deleted file mode 100644 index 687e8c8..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.hat.client.field_country.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.hat.field_country - - zencrm_entities.hat_type.client -id: hat.client.field_country -field_name: field_country -entity_type: hat -bundle: client -label: 'Country of Origin' -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml b/features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml deleted file mode 100644 index 4f96025..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.hat.client.field_language.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.hat.field_language - - zencrm_entities.hat_type.client -id: hat.client.field_language -field_name: field_language -entity_type: hat -bundle: client -label: Language -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml deleted file mode 100644 index e15e8d7..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_availability.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.hat.field_availability - - zencrm_entities.hat_type.volunteer -id: hat.volunteer.field_availability -field_name: field_availability -entity_type: hat -bundle: volunteer -label: Availability -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string_long diff --git a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml deleted file mode 100644 index f70fa6c..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_date_started.yml +++ /dev/null @@ -1,23 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.hat.field_date_started - - zencrm_entities.hat_type.volunteer - module: - - datetime -id: hat.volunteer.field_date_started -field_name: field_date_started -entity_type: hat -bundle: volunteer -label: 'Date Started' -description: '' -required: false -translatable: false -default_value: - - - default_date_type: now - default_date: now -default_value_callback: '' -settings: { } -field_type: datetime diff --git a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml b/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml deleted file mode 100644 index 1201afe..0000000 --- a/features/opencase_default_subtypes/config/install/field.field.hat.volunteer.field_team.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.hat.field_team - - zencrm_entities.hat_type.volunteer -id: hat.volunteer.field_team -field_name: field_team -entity_type: hat -bundle: volunteer -label: Team -description: '' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml deleted file mode 100644 index a4d9c91..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.activity.field_file.yml +++ /dev/null @@ -1,22 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - file - - zencrm_entities -id: activity.field_file -field_name: field_file -entity_type: activity -type: file -settings: - display_field: false - display_default: false - uri_scheme: private - target_type: file -module: file -locked: false -cardinality: -1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml deleted file mode 100644 index 2df19c9..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_housing_situat.yml +++ /dev/null @@ -1,35 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - options - - zencrm_entities -id: activity.field_how_is_your_housing_situat -field_name: field_how_is_your_housing_situat -entity_type: activity -type: list_string -settings: - allowed_values: - - - value: Excellent - label: Excellent - - - value: Good - label: Good - - - value: OK - label: OK - - - value: Bad - label: Bad - - - value: Terrible - label: Terrible - allowed_values_function: '' -module: options -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml deleted file mode 100644 index dbf9b71..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_mental_health_.yml +++ /dev/null @@ -1,35 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - options - - zencrm_entities -id: activity.field_how_is_your_mental_health_ -field_name: field_how_is_your_mental_health_ -entity_type: activity -type: list_string -settings: - allowed_values: - - - value: Excellent - label: Excellent - - - value: Good - label: Good - - - value: OK - label: OK - - - value: Bad - label: Bad - - - value: Terrible - label: Terrible - allowed_values_function: '' -module: options -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml deleted file mode 100644 index e1f522c..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.activity.field_how_is_your_physical_healt.yml +++ /dev/null @@ -1,35 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - options - - zencrm_entities -id: activity.field_how_is_your_physical_healt -field_name: field_how_is_your_physical_healt -entity_type: activity -type: list_string -settings: - allowed_values: - - - value: Excellent - label: Excellent - - - value: Good - label: Good - - - value: OK - label: OK - - - value: Bad - label: Bad - - - value: Terrible - label: Terrible - allowed_values_function: '' -module: options -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml b/features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml deleted file mode 100644 index c569774..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.activity.field_notes.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: activity.field_notes -field_name: field_notes -entity_type: activity -type: string_long -settings: - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml b/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml deleted file mode 100644 index 89296e4..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_asyl.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: case_entity.field_asyl -field_name: field_asyl -entity_type: case_entity -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml b/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml deleted file mode 100644 index 8109d99..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.case_entity.field_home_offi.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: case_entity.field_home_offi -field_name: field_home_offi -entity_type: case_entity -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml deleted file mode 100644 index 534afed..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.hat.field_availability.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: hat.field_availability -field_name: field_availability -entity_type: hat -type: string_long -settings: - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml deleted file mode 100644 index f1e2293..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.hat.field_country.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: hat.field_country -field_name: field_country -entity_type: hat -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml deleted file mode 100644 index e9c6f1e..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.hat.field_date_started.yml +++ /dev/null @@ -1,19 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - datetime - - zencrm_entities -id: hat.field_date_started -field_name: field_date_started -entity_type: hat -type: datetime -settings: - datetime_type: date -module: datetime -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml deleted file mode 100644 index 610f623..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.hat.field_language.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: hat.field_language -field_name: field_language -entity_type: hat -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml b/features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml deleted file mode 100644 index f5951fb..0000000 --- a/features/opencase_default_subtypes/config/install/field.storage.hat.field_team.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - zencrm_entities -id: hat.field_team -field_name: field_team -entity_type: hat -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml deleted file mode 100644 index aa326bb..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.case_note.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: case_note -label: 'Case Note' diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml deleted file mode 100644 index 01ae9b1..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.activity_type.self_assessment.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: self_assessment -label: Self-assessment diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml deleted file mode 100644 index 6f479c4..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.asylum.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: asylum -label: Asylum diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml deleted file mode 100644 index 58a164c..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.housing.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: housing -label: Housing diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml deleted file mode 100644 index f4cdd52..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.case_entity_type.volunteer_recruitment.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: volunteer_recruitment -label: 'Volunteer recruitment' diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml deleted file mode 100644 index a173379..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.client.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: client -label: Client diff --git a/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml b/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml deleted file mode 100644 index f6284a3..0000000 --- a/features/opencase_default_subtypes/config/install/zencrm_entities.hat_type.volunteer.yml +++ /dev/null @@ -1,5 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: volunteer -label: Volunteer diff --git a/features/opencase_default_subtypes/opencase_default_subtypes.features.yml b/features/opencase_default_subtypes/opencase_default_subtypes.features.yml deleted file mode 100644 index 50fe1db..0000000 --- a/features/opencase_default_subtypes/opencase_default_subtypes.features.yml +++ /dev/null @@ -1,6 +0,0 @@ -bundle: opencase -excluded: - - block.block.views_block__single_case_with_activities_block_1 - - block.block.views_block__this_person_s_contact_details_block_1 - - block.block.views_block__this_person_s_hats_block_1 -required: true diff --git a/features/opencase_default_subtypes/opencase_default_subtypes.info.yml b/features/opencase_default_subtypes/opencase_default_subtypes.info.yml deleted file mode 100644 index 51fe2cf..0000000 --- a/features/opencase_default_subtypes/opencase_default_subtypes.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'Default Subtypes' -type: module -core: 8.x -dependencies: - - block - - datetime - - field - - system - - views - - zencrm_entities -package: 'OpenCase' diff --git a/features/opencase_default_user_config/config/install/user.role.anonymous.yml b/features/opencase_default_user_config/config/install/user.role.anonymous.yml deleted file mode 100644 index f5d0936..0000000 --- a/features/opencase_default_user_config/config/install/user.role.anonymous.yml +++ /dev/null @@ -1,7 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: anonymous -label: 'Anonymous user' -weight: 0 -is_admin: false diff --git a/features/opencase_default_user_config/opencase_default_user_config.features.yml b/features/opencase_default_user_config/opencase_default_user_config.features.yml deleted file mode 100644 index 50fe1db..0000000 --- a/features/opencase_default_user_config/opencase_default_user_config.features.yml +++ /dev/null @@ -1,6 +0,0 @@ -bundle: opencase -excluded: - - block.block.views_block__single_case_with_activities_block_1 - - block.block.views_block__this_person_s_contact_details_block_1 - - block.block.views_block__this_person_s_hats_block_1 -required: true diff --git a/features/opencase_default_user_config/opencase_default_user_config.info.yml b/features/opencase_default_user_config/opencase_default_user_config.info.yml deleted file mode 100644 index 35eea3f..0000000 --- a/features/opencase_default_user_config/opencase_default_user_config.info.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: default_user_config -type: module -core: 8.x -dependencies: - - block - - system - - user - - views -package: 'OpenCase' diff --git a/js/opencase.js b/js/opencase.js deleted file mode 100644 index 7086516..0000000 --- a/js/opencase.js +++ /dev/null @@ -1,4 +0,0 @@ -(function ($, Drupal) { - $(".field--name-contact-details a").contents().unwrap(); - $('#edit-search-api-fulltext').attr('autocomplete', 'off'); -})(jQuery, Drupal); diff --git a/modules/zencrm_entities/activity.page.inc b/modules/zencrm_entities/activity.page.inc deleted file mode 100644 index b625101..0000000 --- a/modules/zencrm_entities/activity.page.inc +++ /dev/null @@ -1,30 +0,0 @@ -Edit' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - filters: { } - sorts: { } - title: 'Contact Details' - header: { } - footer: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: true - content: '' - plugin_id: text_custom - empty: { } - relationships: { } - arguments: - person: - id: person - table: contact_details - field: person - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: raw - default_argument_options: - index: 2 - use_alias: false - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: false - validate: - type: none - fail: 'not found' - validate_options: { } - break_phrase: false - not: false - entity_type: contact_details - entity_field: person - plugin_id: numeric - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 1 - display_options: - display_extenders: { } - block_hide_empty: true - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - tags: { } - entity_reference_1: - display_plugin: entity_reference - id: entity_reference_1 - display_title: 'Entity Reference' - position: 2 - display_options: - display_extenders: { } - fields: - id: - id: id - table: contact_details - field: id - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: true - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: contact_details - entity_field: id - plugin_id: field - rendered_entity: - id: rendered_entity - table: contact_details - field: rendered_entity - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - view_mode: default - entity_type: contact_details - plugin_id: rendered_entity - nothing: - id: nothing - table: views - field: nothing - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: true - text: 'Edit' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: false - plugin_id: custom - type: - id: type - table: contact_details - field: type - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: false - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: contact_details - entity_field: type - plugin_id: field - defaults: - fields: false - style: - type: entity_reference - options: - search_fields: - type: type - id: '0' - rendered_entity: '0' - nothing: '0' - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - tags: { } diff --git a/modules/zencrm_entities/config/schema/activity_type.schema.yml b/modules/zencrm_entities/config/schema/activity_type.schema.yml deleted file mode 100644 index 12cf7ba..0000000 --- a/modules/zencrm_entities/config/schema/activity_type.schema.yml +++ /dev/null @@ -1,12 +0,0 @@ -zencrm_entities.activity_type.*: - type: config_entity - label: 'Activity type config' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - uuid: - type: string diff --git a/modules/zencrm_entities/config/schema/case_entity_type.schema.yml b/modules/zencrm_entities/config/schema/case_entity_type.schema.yml deleted file mode 100644 index 9745b16..0000000 --- a/modules/zencrm_entities/config/schema/case_entity_type.schema.yml +++ /dev/null @@ -1,12 +0,0 @@ -zencrm_entities.case_entity_type.*: - type: config_entity - label: 'Case entity type config' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - uuid: - type: string diff --git a/modules/zencrm_entities/config/schema/hat_type.schema.yml b/modules/zencrm_entities/config/schema/hat_type.schema.yml deleted file mode 100644 index a35a59d..0000000 --- a/modules/zencrm_entities/config/schema/hat_type.schema.yml +++ /dev/null @@ -1,12 +0,0 @@ -zencrm_entities.hat_type.*: - type: config_entity - label: 'Hat type config' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - uuid: - type: string diff --git a/modules/zencrm_entities/contact_details.page.inc b/modules/zencrm_entities/contact_details.page.inc deleted file mode 100644 index f0e4278..0000000 --- a/modules/zencrm_entities/contact_details.page.inc +++ /dev/null @@ -1,30 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished activity entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published activity entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit activity entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete activity entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add activity entities'); - } - -} diff --git a/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php b/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php deleted file mode 100644 index 995afa5..0000000 --- a/modules/zencrm_entities/src/ActivityHtmlRouteProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -id(); - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\ActivitySettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/ActivityListBuilder.php b/modules/zencrm_entities/src/ActivityListBuilder.php deleted file mode 100644 index 5a46cd9..0000000 --- a/modules/zencrm_entities/src/ActivityListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Activity ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\Activity */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.activity.edit_form', - ['activity' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/ActivityTranslationHandler.php b/modules/zencrm_entities/src/ActivityTranslationHandler.php deleted file mode 100644 index 97653bd..0000000 --- a/modules/zencrm_entities/src/ActivityTranslationHandler.php +++ /dev/null @@ -1,14 +0,0 @@ -t('Activity type'); - $header['id'] = $this->t('Machine name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - $row['label'] = $entity->label(); - $row['id'] = $entity->id(); - // You probably want a few more properties here... - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/CaseEntityAccessControlHandler.php b/modules/zencrm_entities/src/CaseEntityAccessControlHandler.php deleted file mode 100644 index 10560e5..0000000 --- a/modules/zencrm_entities/src/CaseEntityAccessControlHandler.php +++ /dev/null @@ -1,47 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished case entity entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published case entity entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit case entity entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete case entity entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add case entity entities'); - } - -} diff --git a/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php b/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php deleted file mode 100644 index cf151ad..0000000 --- a/modules/zencrm_entities/src/CaseEntityHtmlRouteProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -id(); - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\CaseEntitySettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/CaseEntityListBuilder.php b/modules/zencrm_entities/src/CaseEntityListBuilder.php deleted file mode 100644 index d6c1bd2..0000000 --- a/modules/zencrm_entities/src/CaseEntityListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Case entity ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\CaseEntity */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.case_entity.edit_form', - ['case_entity' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/CaseEntityTranslationHandler.php b/modules/zencrm_entities/src/CaseEntityTranslationHandler.php deleted file mode 100644 index 37f20bb..0000000 --- a/modules/zencrm_entities/src/CaseEntityTranslationHandler.php +++ /dev/null @@ -1,14 +0,0 @@ -t('Case entity type'); - $header['id'] = $this->t('Machine name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - $row['label'] = $entity->label(); - $row['id'] = $entity->id(); - // You probably want a few more properties here... - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php b/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php deleted file mode 100644 index cc3f87a..0000000 --- a/modules/zencrm_entities/src/ContactDetailsAccessControlHandler.php +++ /dev/null @@ -1,47 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished contact details entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published contact details entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit contact details entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete contact details entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add contact details entities'); - } - -} diff --git a/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php b/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php deleted file mode 100644 index 3aaed44..0000000 --- a/modules/zencrm_entities/src/ContactDetailsHtmlRouteProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -id(); - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\ContactDetailsSettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/ContactDetailsListBuilder.php b/modules/zencrm_entities/src/ContactDetailsListBuilder.php deleted file mode 100644 index da9264f..0000000 --- a/modules/zencrm_entities/src/ContactDetailsListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Contact details ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\ContactDetails */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.contact_details.edit_form', - ['contact_details' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/Entity/Activity.php b/modules/zencrm_entities/src/Entity/Activity.php deleted file mode 100644 index 3cdfc72..0000000 --- a/modules/zencrm_entities/src/Entity/Activity.php +++ /dev/null @@ -1,229 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Activity entity.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') -# ->setDisplayOptions('view', [ -# 'label' => 'hidden', -# 'type' => 'author', -# 'weight' => 0, -# ]) -# ->setDisplayOptions('form', [ -# 'type' => 'entity_reference_autocomplete', -# 'weight' => 5, -# 'settings' => [ -# 'match_operator' => 'CONTAINS', -# 'size' => '60', -# 'autocomplete_type' => 'tags', -# 'placeholder' => '', -# ], -# ]) -# ->setDisplayConfigurable('form', TRUE) -# ->setDisplayConfigurable('view', TRUE); - ->setTranslatable(TRUE); - - // This field is always implied from the context, - // so has no form or view display. - $fields['case_entity'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Case')) - ->setDescription(t('The case this activity belongs to.')) - ->setSetting('target_type', 'case_entity'); - - $fields['subject'] = BaseFieldDefinition::create('string') - ->setLabel(t('Subject')) - ->setDescription(t('The purpose of the Activity.')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'hidden', - 'type' => 'string', - 'weight' => -4, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setRequired(TRUE); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Activity is published.')) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/ActivityInterface.php b/modules/zencrm_entities/src/Entity/ActivityInterface.php deleted file mode 100644 index 2529255..0000000 --- a/modules/zencrm_entities/src/Entity/ActivityInterface.php +++ /dev/null @@ -1,77 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Case entity entity.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - # ->setDisplayOptions('view', [ - # 'label' => 'hidden', - # 'type' => 'author', - # 'weight' => 0, - # ]) - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 5, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]) - ->setTranslatable(TRUE); - - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Title')) - ->setDescription(t('A name for this case')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDefaultValue('') - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setRequired(TRUE); - - - $fields['hats_involved'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Involved Parties')) - ->setDescription(t('People involved in this case, in their various capacities')) - ->setSetting('target_type', 'hat') - ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setCardinality(-1) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setRequired(TRUE); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Case entity is published.')) -# ->setDisplayOptions('form', [ -# 'type' => 'boolean_checkbox', -# 'weight' => -3, -# ]) - ->setDefaultValue(TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => 0, - ]); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/CaseEntityInterface.php b/modules/zencrm_entities/src/Entity/CaseEntityInterface.php deleted file mode 100644 index 7521202..0000000 --- a/modules/zencrm_entities/src/Entity/CaseEntityInterface.php +++ /dev/null @@ -1,77 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Contact Details entity.')) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - # ->setDisplayOptions('view', [ - # 'label' => 'inline', - # 'type' => 'author', - # 'weight' => 100, - # ]) - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 100, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]) - ->setTranslatable(TRUE); - - - // Type field is used in entity reference fields etc - // so it is not exposed to user configuration. - $fields['type'] = BaseFieldDefinition::create('string') - ->setLabel(t('Type')) - ->setDescription(t('E.g. Home, Business, Temporary')) - ->setDisplayOptions('form', [ - 'label' => 'hidden', - 'type' => 'text', - 'weight' => 0, - ]) - ->setDisplayOptions('view', array( - 'label' => 'hidden', - 'type' => 'string', - 'weight' => 0, - )) - ->setRequired(TRUE); - - - // Person field is always set from the context so no form or display required. - $fields['person'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Person')) - ->setDescription(t('The person this set of contact details is for.')) - ->setSetting('target_type', 'person') - ->setRequired(TRUE); - - // Type field is used for mailings, - // so it is not exposed to user configuration. - $fields['email'] = BaseFieldDefinition::create('string') - ->setLabel(t('Email Address')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 30, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 0, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 0, - )); - - $fields['phone'] = BaseFieldDefinition::create('string') - ->setLabel(t('Main Phone Number')) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 20, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 2, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 2, - )); - - $fields['phone2'] = BaseFieldDefinition::create('string') - ->setLabel(t('Alternative Phone Number')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 20, - 'text_processing' => 0, - )) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 3, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 3, - )); - - $fields['postal_address'] = BaseFieldDefinition::create('string_long') - ->setLabel(t('Postal Address')) - ->setDescription(t('Full address, apart from post code.')) - ->setDisplayConfigurable('view', TRUE) - ->setDisplayConfigurable('form', TRUE) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 255, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'text', - 'weight' => 5, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textarea', - 'weight' => 5, - )); - - $fields['post_code'] = BaseFieldDefinition::create('string') - ->setLabel(t('Post Code')) - ->setSettings(array( - 'default_value' => '', - 'max_length' => 10, - 'text_processing' => 0, - )) - ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => 6, - )) - ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => 6, - )); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Enabled')) - ->setDescription(t('If this is ticked then this set of contact details is active.')) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php b/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php deleted file mode 100644 index bf304ff..0000000 --- a/modules/zencrm_entities/src/Entity/ContactDetailsInterface.php +++ /dev/null @@ -1,77 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of the author.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - ->setTranslatable(TRUE); - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 5, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]); - - // This field is always implied from the context, - // so has no form or view display. - $fields['person'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Person')) - ->setDescription(t('The person this hat is of.')) - ->setSetting('target_type', 'person'); - - $fields['contact_details'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Contact Details to use for this Hat')) - ->setDescription(t('The contact details to be used when communicating with this person in this capacity.')) - ->setSetting('target_type', 'contact_details') - ->setSetting('handler', 'views') - ->setSetting('handler_settings', ['view' => [ - 'view_name' => 'this_person_s_contact_details', - 'display_name' => 'entity_reference_1' - ]]) - ->setDisplayOptions('view', [ - 'label' => 'above', - 'weight' => 100, - 'settings' => ['link' => 'false'] - ]) - ->setDisplayOptions('form', [ - 'type' => 'options_buttons', - 'weight' => 0, - ]) - ->setRequired(TRUE) - ->setTranslatable(TRUE); - - // This field is computed in a presave hook, and used for entity reference - // options when selecting a person for involvement in a case etc. - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of this hat instance as it appears in entity reference fields.')); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Hat is published.')) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); - - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/HatInterface.php b/modules/zencrm_entities/src/Entity/HatInterface.php deleted file mode 100644 index 477a903..0000000 --- a/modules/zencrm_entities/src/Entity/HatInterface.php +++ /dev/null @@ -1,77 +0,0 @@ - \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Person entity.')) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - # ->setDisplayOptions('view', [ - # 'label' => 'hidden', - # 'type' => 'author', - # 'weight' => 0, - # ]) - # ->setDisplayOptions('form', [ - # 'type' => 'entity_reference_autocomplete', - # 'weight' => 5, - # 'settings' => [ - # 'match_operator' => 'CONTAINS', - # 'size' => '60', - # 'autocomplete_type' => 'tags', - # 'placeholder' => '', - # ], - # ]) - ->setTranslatable(TRUE); - - - // This field is computed in a presave hook. - $fields['full_name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Full Name')) - ->setDescription(t('The full name of the person.')); - - $fields['first_name'] = BaseFieldDefinition::create('string') - ->setLabel(t('First Name')) - ->setDescription(t('First Name.')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setRequired(TRUE); - - $fields['middle_names'] = BaseFieldDefinition::create('string') - ->setLabel(t('Middle Names')) - ->setDescription(t('Middle Names.')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE); - - - $fields['last_name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Last Name')) - ->setDescription(t('Last Name.')) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setRequired(TRUE); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Person is published.')) - # ->setDisplayOptions('form', [ - # 'type' => 'boolean_checkbox', - # 'weight' => -3, - # ]) - ->setDefaultValue(TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - return $fields; - } - -} diff --git a/modules/zencrm_entities/src/Entity/PersonInterface.php b/modules/zencrm_entities/src/Entity/PersonInterface.php deleted file mode 100644 index 90ceaff..0000000 --- a/modules/zencrm_entities/src/Entity/PersonInterface.php +++ /dev/null @@ -1,77 +0,0 @@ -entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Activity.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Activity.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.activity.canonical', ['activity' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/ActivitySettingsForm.php b/modules/zencrm_entities/src/Form/ActivitySettingsForm.php deleted file mode 100644 index 5eaf677..0000000 --- a/modules/zencrm_entities/src/Form/ActivitySettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.activity_type.collection'); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return $this->t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - - drupal_set_message( - $this->t('content @type: deleted @label.', - [ - '@type' => $this->entity->bundle(), - '@label' => $this->entity->label(), - ] - ) - ); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - -} diff --git a/modules/zencrm_entities/src/Form/ActivityTypeForm.php b/modules/zencrm_entities/src/Form/ActivityTypeForm.php deleted file mode 100644 index be3b89f..0000000 --- a/modules/zencrm_entities/src/Form/ActivityTypeForm.php +++ /dev/null @@ -1,65 +0,0 @@ -entity; - $form['label'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#maxlength' => 255, - '#default_value' => $activity_type->label(), - '#description' => $this->t("Label for the Activity type."), - '#required' => TRUE, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => $activity_type->id(), - '#machine_name' => [ - 'exists' => '\Drupal\zencrm_entities\Entity\ActivityType::load', - ], - '#disabled' => !$activity_type->isNew(), - ]; - - /* You will need additional form elements for your custom properties. */ - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $activity_type = $this->entity; - $status = $activity_type->save(); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Activity type.', [ - '%label' => $activity_type->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Activity type.', [ - '%label' => $activity_type->label(), - ])); - } - $form_state->setRedirectUrl($activity_type->toUrl('collection')); - } - -} diff --git a/modules/zencrm_entities/src/Form/CaseEntityDeleteForm.php b/modules/zencrm_entities/src/Form/CaseEntityDeleteForm.php deleted file mode 100644 index 979ff48..0000000 --- a/modules/zencrm_entities/src/Form/CaseEntityDeleteForm.php +++ /dev/null @@ -1,15 +0,0 @@ -entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Case entity.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Case entity.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.case_entity.canonical', ['case_entity' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php b/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php deleted file mode 100644 index 507c6f1..0000000 --- a/modules/zencrm_entities/src/Form/CaseEntitySettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.case_entity_type.collection'); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return $this->t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - - drupal_set_message( - $this->t('content @type: deleted @label.', - [ - '@type' => $this->entity->bundle(), - '@label' => $this->entity->label(), - ] - ) - ); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - -} diff --git a/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php b/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php deleted file mode 100644 index 783b980..0000000 --- a/modules/zencrm_entities/src/Form/CaseEntityTypeForm.php +++ /dev/null @@ -1,65 +0,0 @@ -entity; - $form['label'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#maxlength' => 255, - '#default_value' => $case_entity_type->label(), - '#description' => $this->t("Label for the Case entity type."), - '#required' => TRUE, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => $case_entity_type->id(), - '#machine_name' => [ - 'exists' => '\Drupal\zencrm_entities\Entity\CaseEntityType::load', - ], - '#disabled' => !$case_entity_type->isNew(), - ]; - - /* You will need additional form elements for your custom properties. */ - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $case_entity_type = $this->entity; - $status = $case_entity_type->save(); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Case entity type.', [ - '%label' => $case_entity_type->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Case entity type.', [ - '%label' => $case_entity_type->label(), - ])); - } - $form_state->setRedirectUrl($case_entity_type->toUrl('collection')); - } - -} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php b/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php deleted file mode 100644 index b2801ae..0000000 --- a/modules/zencrm_entities/src/Form/ContactDetailsDeleteForm.php +++ /dev/null @@ -1,15 +0,0 @@ -entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Contact details.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Contact details.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.contact_details.canonical', ['contact_details' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php b/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php deleted file mode 100644 index 44685a7..0000000 --- a/modules/zencrm_entities/src/Form/ContactDetailsSettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Hat.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Hat.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.hat.canonical', ['hat' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/HatSettingsForm.php b/modules/zencrm_entities/src/Form/HatSettingsForm.php deleted file mode 100644 index 60a800b..0000000 --- a/modules/zencrm_entities/src/Form/HatSettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.hat_type.collection'); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return $this->t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - - drupal_set_message( - $this->t('content @type: deleted @label.', - [ - '@type' => $this->entity->bundle(), - '@label' => $this->entity->label(), - ] - ) - ); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - -} diff --git a/modules/zencrm_entities/src/Form/HatTypeForm.php b/modules/zencrm_entities/src/Form/HatTypeForm.php deleted file mode 100644 index 9ec51dd..0000000 --- a/modules/zencrm_entities/src/Form/HatTypeForm.php +++ /dev/null @@ -1,65 +0,0 @@ -entity; - $form['label'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#maxlength' => 255, - '#default_value' => $hat_type->label(), - '#description' => $this->t("Label for the Hat type."), - '#required' => TRUE, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => $hat_type->id(), - '#machine_name' => [ - 'exists' => '\Drupal\zencrm_entities\Entity\HatType::load', - ], - '#disabled' => !$hat_type->isNew(), - ]; - - /* You will need additional form elements for your custom properties. */ - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $hat_type = $this->entity; - $status = $hat_type->save(); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Hat type.', [ - '%label' => $hat_type->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Hat type.', [ - '%label' => $hat_type->label(), - ])); - } - $form_state->setRedirectUrl($hat_type->toUrl('collection')); - } - -} diff --git a/modules/zencrm_entities/src/Form/PersonDeleteForm.php b/modules/zencrm_entities/src/Form/PersonDeleteForm.php deleted file mode 100644 index 6da2301..0000000 --- a/modules/zencrm_entities/src/Form/PersonDeleteForm.php +++ /dev/null @@ -1,15 +0,0 @@ -entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = $this->entity; - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Person.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Person.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.person.canonical', ['person' => $entity->id()]); - } - -} diff --git a/modules/zencrm_entities/src/Form/PersonSettingsForm.php b/modules/zencrm_entities/src/Form/PersonSettingsForm.php deleted file mode 100644 index 402a0da..0000000 --- a/modules/zencrm_entities/src/Form/PersonSettingsForm.php +++ /dev/null @@ -1,53 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished hat entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published hat entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit hat entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete hat entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add hat entities'); - } - -} diff --git a/modules/zencrm_entities/src/HatHtmlRouteProvider.php b/modules/zencrm_entities/src/HatHtmlRouteProvider.php deleted file mode 100644 index 0cda5ca..0000000 --- a/modules/zencrm_entities/src/HatHtmlRouteProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -id(); - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\HatSettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/HatListBuilder.php b/modules/zencrm_entities/src/HatListBuilder.php deleted file mode 100644 index 68af059..0000000 --- a/modules/zencrm_entities/src/HatListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Hat ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\Hat */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.hat.edit_form', - ['hat' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/HatTranslationHandler.php b/modules/zencrm_entities/src/HatTranslationHandler.php deleted file mode 100644 index 63267a2..0000000 --- a/modules/zencrm_entities/src/HatTranslationHandler.php +++ /dev/null @@ -1,14 +0,0 @@ -t('Hat type'); - $header['id'] = $this->t('Machine name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - $row['label'] = $entity->label(); - $row['id'] = $entity->id(); - // You probably want a few more properties here... - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/src/PersonAccessControlHandler.php b/modules/zencrm_entities/src/PersonAccessControlHandler.php deleted file mode 100644 index 246098d..0000000 --- a/modules/zencrm_entities/src/PersonAccessControlHandler.php +++ /dev/null @@ -1,47 +0,0 @@ -isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished person entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published person entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit person entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete person entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add person entities'); - } - -} diff --git a/modules/zencrm_entities/src/PersonHtmlRouteProvider.php b/modules/zencrm_entities/src/PersonHtmlRouteProvider.php deleted file mode 100644 index c90219e..0000000 --- a/modules/zencrm_entities/src/PersonHtmlRouteProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -id(); - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\zencrm_entities\Form\PersonSettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/modules/zencrm_entities/src/PersonListBuilder.php b/modules/zencrm_entities/src/PersonListBuilder.php deleted file mode 100644 index e462a15..0000000 --- a/modules/zencrm_entities/src/PersonListBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ -t('Person ID'); - $header['name'] = $this->t('Name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\zencrm_entities\Entity\Person */ - $row['id'] = $entity->id(); - $row['name'] = Link::createFromRoute( - $entity->label(), - 'entity.person.edit_form', - ['person' => $entity->id()] - ); - return $row + parent::buildRow($entity); - } - -} diff --git a/modules/zencrm_entities/templates/activity-content-add-list.html.twig b/modules/zencrm_entities/templates/activity-content-add-list.html.twig deleted file mode 100644 index 0c627f6..0000000 --- a/modules/zencrm_entities/templates/activity-content-add-list.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Default theme implementation to present a list of custom content entity types/bundles. - * - * Available variables: - * - types: A collection of all the available custom entity types/bundles. - * Each type/bundle contains the following: - * - link: A link to add a content entity of this type. - * - description: A description of this content entity types/bundle. - * - * @see template_preprocess_activity_content_add_list() - * - * @ingroup themeable - */ -#} -{% spaceless %} -
- {% for type in types %} -
{{ type.link }}
- {% endfor %} -
-{% endspaceless %} diff --git a/modules/zencrm_entities/templates/activity.html.twig b/modules/zencrm_entities/templates/activity.html.twig deleted file mode 100644 index 682cbc6..0000000 --- a/modules/zencrm_entities/templates/activity.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file activity.html.twig - * Default theme implementation to present Activity data. - * - * This template is used when viewing Activity pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_activity() - * - * @ingroup themeable - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - diff --git a/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig b/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig deleted file mode 100644 index 2dbb6a8..0000000 --- a/modules/zencrm_entities/templates/case-entity-content-add-list.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Default theme implementation to present a list of custom content entity types/bundles. - * - * Available variables: - * - types: A collection of all the available custom entity types/bundles. - * Each type/bundle contains the following: - * - link: A link to add a content entity of this type. - * - description: A description of this content entity types/bundle. - * - * @see template_preprocess_case_entity_content_add_list() - * - * @ingroup themeable - */ -#} -{% spaceless %} -
- {% for type in types %} -
{{ type.link }}
- {% endfor %} -
-{% endspaceless %} diff --git a/modules/zencrm_entities/templates/case_entity.html.twig b/modules/zencrm_entities/templates/case_entity.html.twig deleted file mode 100644 index d8c3212..0000000 --- a/modules/zencrm_entities/templates/case_entity.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file case_entity.html.twig - * Default theme implementation to present Case entity data. - * - * This template is used when viewing Case entity pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_case_entity() - * - * @ingroup themeable - */ -#} - - {% if content %} -
{{- content -}}
- {% endif %} - diff --git a/modules/zencrm_entities/templates/contact_details.html.twig b/modules/zencrm_entities/templates/contact_details.html.twig deleted file mode 100644 index 64daa12..0000000 --- a/modules/zencrm_entities/templates/contact_details.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file contact_details.html.twig - * Default theme implementation to present Contact details data. - * - * This template is used when viewing Contact details pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_contact_details() - * - * @ingroup themeable - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - diff --git a/modules/zencrm_entities/templates/hat-content-add-list.html.twig b/modules/zencrm_entities/templates/hat-content-add-list.html.twig deleted file mode 100644 index 1ae94e5..0000000 --- a/modules/zencrm_entities/templates/hat-content-add-list.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Default theme implementation to present a list of custom content entity types/bundles. - * - * Available variables: - * - types: A collection of all the available custom entity types/bundles. - * Each type/bundle contains the following: - * - link: A link to add a content entity of this type. - * - description: A description of this content entity types/bundle. - * - * @see template_preprocess_hat_content_add_list() - * - * @ingroup themeable - */ -#} -{% spaceless %} -
- {% for type in types %} -
{{ type.link }}
- {% endfor %} -
-{% endspaceless %} diff --git a/modules/zencrm_entities/templates/hat.html.twig b/modules/zencrm_entities/templates/hat.html.twig deleted file mode 100644 index 827d6b5..0000000 --- a/modules/zencrm_entities/templates/hat.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file hat.html.twig - * Default theme implementation to present Hat data. - * - * This template is used when viewing Hat pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_hat() - * - * @ingroup themeable - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - diff --git a/modules/zencrm_entities/templates/person.html.twig b/modules/zencrm_entities/templates/person.html.twig deleted file mode 100644 index 18d7977..0000000 --- a/modules/zencrm_entities/templates/person.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file person.html.twig - * Default theme implementation to present Person data. - * - * This template is used when viewing Person pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - * @see template_preprocess_person() - * - * @ingroup themeable - */ -#} - - {% if content %} - {{- content -}} - {% endif %} - diff --git a/modules/zencrm_entities/templates/zencrm-entities.html.twig b/modules/zencrm_entities/templates/zencrm-entities.html.twig deleted file mode 100644 index 91e43c8..0000000 --- a/modules/zencrm_entities/templates/zencrm-entities.html.twig +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/zencrm_entities/tests/src/Functional/LoadTest.php b/modules/zencrm_entities/tests/src/Functional/LoadTest.php deleted file mode 100644 index 2b23546..0000000 --- a/modules/zencrm_entities/tests/src/Functional/LoadTest.php +++ /dev/null @@ -1,46 +0,0 @@ -user = $this->drupalCreateUser(['administer site configuration']); - $this->drupalLogin($this->user); - } - - /** - * Tests that the home page loads with a 200 response. - */ - public function testLoad() { - $this->drupalGet(Url::fromRoute('')); - $this->assertSession()->statusCodeEquals(200); - } - -} diff --git a/modules/zencrm_entities/zencrm_entities.info.yml b/modules/zencrm_entities/zencrm_entities.info.yml deleted file mode 100644 index cce5cb2..0000000 --- a/modules/zencrm_entities/zencrm_entities.info.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: 'Zen CRM Entities' -type: module -description: 'Zen CRM Entities' -core: 8.x -package: 'Zen CRM' -mtime: 1522776761 -version: 0.1.1 -php: 5.5.9 diff --git a/modules/zencrm_entities/zencrm_entities.links.action.yml b/modules/zencrm_entities/zencrm_entities.links.action.yml deleted file mode 100644 index 52962cd..0000000 --- a/modules/zencrm_entities/zencrm_entities.links.action.yml +++ /dev/null @@ -1,54 +0,0 @@ -entity.person.add_form: - route_name: entity.person.add_form - title: 'Add Person' - appears_on: - - entity.person.collection - -entity.contact_details.add_form: - route_name: entity.contact_details.add_form - title: 'Add Contact Details' - appears_on: - - entity.contact_details.collection -entity.person.add_form: - route_name: entity.person.add_form - title: 'Add Person' - appears_on: - - entity.person.collection -entity.contact_details.add_form: - route_name: entity.contact_details.add_form - title: 'Add Contact details' - appears_on: - - entity.contact_details.collection -entity.hat.add_form: - route_name: entity.hat.add_page - title: 'Add Hat' - appears_on: - - entity.hat.collection -entity.hat_type.add_form: - route_name: entity.hat_type.add_form - title: 'Add Hat type' - appears_on: - - entity.hat_type.collection - -entity.case_entity.add_form: - route_name: entity.case_entity.add_page - title: 'Add Case entity' - appears_on: - - entity.case_entity.collection -entity.case_entity_type.add_form: - route_name: entity.case_entity_type.add_form - title: 'Add Case entity type' - appears_on: - - entity.case_entity_type.collection - -entity.activity.add_form: - route_name: entity.activity.add_page - title: 'Add Activity' - appears_on: - - entity.activity.collection -entity.activity_type.add_form: - route_name: entity.activity_type.add_form - title: 'Add Activity type' - appears_on: - - entity.activity_type.collection - diff --git a/modules/zencrm_entities/zencrm_entities.links.menu.yml b/modules/zencrm_entities/zencrm_entities.links.menu.yml deleted file mode 100644 index 5c70787..0000000 --- a/modules/zencrm_entities/zencrm_entities.links.menu.yml +++ /dev/null @@ -1,110 +0,0 @@ - -# Person menu items definition -entity.person.collection: - title: 'Person list' - route_name: entity.person.collection - description: 'List Person entities' - parent: system.admin_structure - weight: 100 - -person.admin.structure.settings: - title: 'Person settings' - description: 'Configure Person entities' - route_name: person.settings - parent: system.admin_structure - -# Contact Details menu items definition -entity.contact_details.collection: - title: 'Contact Details list' - route_name: entity.contact_details.collection - description: 'List Contact Details entities' - parent: system.admin_structure - weight: 100 - -contact_details.admin.structure.settings: - title: 'Contact Details settings' - description: 'Configure Contact Details entities' - route_name: contact_details.settings - parent: system.admin_structure - -# Person menu items definition -entity.person.collection: - title: 'Person list' - route_name: entity.person.collection - description: 'List Person entities' - parent: system.admin_structure - weight: 100 - -person.admin.structure.settings: - title: 'Person settings' - description: 'Configure Person entities' - route_name: person.settings - parent: system.admin_structure - -# Contact details menu items definition -entity.contact_details.collection: - title: 'Contact details list' - route_name: entity.contact_details.collection - description: 'List Contact details entities' - parent: system.admin_structure - weight: 100 - -contact_details.admin.structure.settings: - title: 'Contact details settings' - description: 'Configure Contact details entities' - route_name: contact_details.settings - parent: system.admin_structure - -# Hat menu items definition -entity.hat.collection: - title: 'Hat list' - route_name: entity.hat.collection - description: 'List Hat entities' - parent: system.admin_structure - weight: 100 - - -# Hat type menu items definition -entity.hat_type.collection: - title: 'Hat type' - route_name: entity.hat_type.collection - description: 'List Hat type (bundles)' - parent: system.admin_structure - weight: 99 - - -# Case entity menu items definition -entity.case_entity.collection: - title: 'Case entity list' - route_name: entity.case_entity.collection - description: 'List Case entity entities' - parent: system.admin_structure - weight: 100 - - -# Case entity type menu items definition -entity.case_entity_type.collection: - title: 'Case entity type' - route_name: entity.case_entity_type.collection - description: 'List Case entity type (bundles)' - parent: system.admin_structure - weight: 99 - - -# Activity menu items definition -entity.activity.collection: - title: 'Activity list' - route_name: entity.activity.collection - description: 'List Activity entities' - parent: system.admin_structure - weight: 100 - - -# Activity type menu items definition -entity.activity_type.collection: - title: 'Activity type' - route_name: entity.activity_type.collection - description: 'List Activity type (bundles)' - parent: system.admin_structure - weight: 99 - diff --git a/modules/zencrm_entities/zencrm_entities.links.task.yml b/modules/zencrm_entities/zencrm_entities.links.task.yml deleted file mode 100644 index c9d127f..0000000 --- a/modules/zencrm_entities/zencrm_entities.links.task.yml +++ /dev/null @@ -1,142 +0,0 @@ -# Person routing definition -person.settings_tab: - route_name: person.settings - title: 'Settings' - base_route: person.settings - -entity.person.canonical: - route_name: entity.person.canonical - base_route: entity.person.canonical - title: 'View' - -entity.person.edit_form: - route_name: entity.person.edit_form - base_route: entity.person.canonical - title: 'Edit' - -entity.person.delete_form: - route_name: entity.person.delete_form - base_route: entity.person.canonical - title: Delete - weight: 10 - -# Contact Details routing definition -contact_details.settings_tab: - route_name: contact_details.settings - title: 'Settings' - base_route: contact_details.settings - -entity.contact_details.canonical: - route_name: entity.contact_details.canonical - base_route: entity.contact_details.canonical - title: 'View' - -entity.contact_details.edit_form: - route_name: entity.contact_details.edit_form - base_route: entity.contact_details.canonical - title: 'Edit' - -entity.contact_details.delete_form: - route_name: entity.contact_details.delete_form - base_route: entity.contact_details.canonical - title: Delete - weight: 10 - -# Person routing definition -person.settings_tab: - route_name: person.settings - title: 'Settings' - base_route: person.settings - -entity.person.canonical: - route_name: entity.person.canonical - base_route: entity.person.canonical - title: 'View' - -entity.person.edit_form: - route_name: entity.person.edit_form - base_route: entity.person.canonical - title: 'Edit' - -entity.person.delete_form: - route_name: entity.person.delete_form - base_route: entity.person.canonical - title: Delete - weight: 10 - -# Contact details routing definition -contact_details.settings_tab: - route_name: contact_details.settings - title: 'Settings' - base_route: contact_details.settings - -entity.contact_details.canonical: - route_name: entity.contact_details.canonical - base_route: entity.contact_details.canonical - title: 'View' - -entity.contact_details.edit_form: - route_name: entity.contact_details.edit_form - base_route: entity.contact_details.canonical - title: 'Edit' - -entity.contact_details.delete_form: - route_name: entity.contact_details.delete_form - base_route: entity.contact_details.canonical - title: Delete - weight: 10 - -# Hat routing definition - -entity.hat.canonical: - route_name: entity.hat.canonical - base_route: entity.hat.canonical - title: 'View' - -entity.hat.edit_form: - route_name: entity.hat.edit_form - base_route: entity.hat.canonical - title: 'Edit' - -entity.hat.delete_form: - route_name: entity.hat.delete_form - base_route: entity.hat.canonical - title: Delete - weight: 10 - -# Case entity routing definition - -entity.case_entity.canonical: - route_name: entity.case_entity.canonical - base_route: entity.case_entity.canonical - title: 'View' - -entity.case_entity.edit_form: - route_name: entity.case_entity.edit_form - base_route: entity.case_entity.canonical - title: 'Edit' - -entity.case_entity.delete_form: - route_name: entity.case_entity.delete_form - base_route: entity.case_entity.canonical - title: Delete - weight: 10 - -# Activity routing definition - -entity.activity.canonical: - route_name: entity.activity.canonical - base_route: entity.activity.canonical - title: 'View' - -entity.activity.edit_form: - route_name: entity.activity.edit_form - base_route: entity.activity.canonical - title: 'Edit' - -entity.activity.delete_form: - route_name: entity.activity.delete_form - base_route: entity.activity.canonical - title: Delete - weight: 10 - diff --git a/modules/zencrm_entities/zencrm_entities.module b/modules/zencrm_entities/zencrm_entities.module deleted file mode 100644 index 064515a..0000000 --- a/modules/zencrm_entities/zencrm_entities.module +++ /dev/null @@ -1,143 +0,0 @@ -first_name->getString(); - $middle_names = $entity->middle_names->getString(); - $last_name = $entity->last_name->getString(); - if ($middle_names) { - $middle_names .= ' '; - } - $full_name = $first_name . ' ' . $middle_names . $last_name; - $entity->set('full_name', $full_name); -} - - -/** - * Implements hook_ENTITY_TYPE_presave(). - * Computes the name field from the full name of the referenced person - * plus the hat type. - */ -function zencrm_entities_hat_presave($entity) { - $person_id = $entity->person->first()->getValue()['target_id']; - $person = \Drupal\zencrm_entities\Entity\Person::load($person_id); - $full_name = $person->full_name->getString(); - $bundle_name = $entity->type->entity->label(); - $entity->set('name', $full_name . ' - ' . $bundle_name); -} - - -/** - * Implements hook_help(). - */ -function zencrm_entities_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - // Main module help for the zencrm_entities module. - case 'help.page.zencrm_entities': - $output = ''; - $output .= '

' . t('About') . '

'; - $output .= '

' . t('Zen CRM Entities') . '

'; - return $output; - - default: - } -} - -/** - * Implements hook_theme(). - */ -function zencrm_entities_theme() { - $theme = []; - $theme['zencrm_entities'] = [ - 'render element' => 'children', - ]; - $theme['hat'] = [ - 'render element' => 'elements', - 'file' => 'hat.page.inc', - 'template' => 'hat', - ]; - $theme['hat_content_add_list'] = [ - 'render element' => 'content', - 'variables' => ['content' => NULL], - 'file' => 'hat.page.inc', - ]; - $theme['case_entity'] = [ - 'render element' => 'elements', - 'file' => 'case_entity.page.inc', - 'template' => 'case_entity', - ]; - $theme['case_entity_content_add_list'] = [ - 'render element' => 'content', - 'variables' => ['content' => NULL], - 'file' => 'case_entity.page.inc', - ]; - $theme['activity'] = [ - 'render element' => 'elements', - 'file' => 'activity.page.inc', - 'template' => 'activity', - ]; - $theme['activity_content_add_list'] = [ - 'render element' => 'content', - 'variables' => ['content' => NULL], - 'file' => 'activity.page.inc', - ]; - return $theme; -} - -/** -* Implements hook_theme_suggestions_HOOK(). -*/ -function zencrm_entities_theme_suggestions_hat(array $variables) { - $suggestions = []; - $entity = $variables['elements']['#hat']; - $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); - - $suggestions[] = 'hat__' . $sanitized_view_mode; - $suggestions[] = 'hat__' . $entity->bundle(); - $suggestions[] = 'hat__' . $entity->bundle() . '__' . $sanitized_view_mode; - $suggestions[] = 'hat__' . $entity->id(); - $suggestions[] = 'hat__' . $entity->id() . '__' . $sanitized_view_mode; - return $suggestions; -} - -/** -* Implements hook_theme_suggestions_HOOK(). -*/ -function zencrm_entities_theme_suggestions_case_entity(array $variables) { - $suggestions = []; - $entity = $variables['elements']['#case_entity']; - $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); - - $suggestions[] = 'case_entity__' . $sanitized_view_mode; - $suggestions[] = 'case_entity__' . $entity->bundle(); - $suggestions[] = 'case_entity__' . $entity->bundle() . '__' . $sanitized_view_mode; - $suggestions[] = 'case_entity__' . $entity->id(); - $suggestions[] = 'case_entity__' . $entity->id() . '__' . $sanitized_view_mode; - return $suggestions; -} - -/** -* Implements hook_theme_suggestions_HOOK(). -*/ -function zencrm_entities_theme_suggestions_activity(array $variables) { - $suggestions = []; - $entity = $variables['elements']['#activity']; - $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); - - $suggestions[] = 'activity__' . $sanitized_view_mode; - $suggestions[] = 'activity__' . $entity->bundle(); - $suggestions[] = 'activity__' . $entity->bundle() . '__' . $sanitized_view_mode; - $suggestions[] = 'activity__' . $entity->id(); - $suggestions[] = 'activity__' . $entity->id() . '__' . $sanitized_view_mode; - return $suggestions; -} diff --git a/modules/zencrm_entities/zencrm_entities.permissions.yml b/modules/zencrm_entities/zencrm_entities.permissions.yml deleted file mode 100644 index 47c1846..0000000 --- a/modules/zencrm_entities/zencrm_entities.permissions.yml +++ /dev/null @@ -1,159 +0,0 @@ -add hat types: - title: 'Add Hat Types' - -add person entities: - title: 'Create new Person entities' - -administer person entities: - title: 'Administer Person entities' - description: 'Allow to access the administration form to configure Person entities.' - restrict access: true - -delete person entities: - title: 'Delete Person entities' - -edit person entities: - title: 'Edit Person entities' - -view published person entities: - title: 'View published Person entities' - -view unpublished person entities: - title: 'View unpublished Person entities' - -view all person revisions: - title: 'View all Person revisions' - -revert all person revisions: - title: 'Revert all Person revisions' - description: 'Role requires permission view Person revisions and edit rights for person entities in question or administer person entities.' - -delete all person revisions: - title: 'Delete all revisions' - description: 'Role requires permission to view Person revisions and delete rights for person entities in question or administer person entities.' -add contact details entities: - title: 'Create new Contact Details entities' - -administer contact details entities: - title: 'Administer Contact Details entities' - description: 'Allow to access the administration form to configure Contact Details entities.' - restrict access: true - -delete contact details entities: - title: 'Delete Contact Details entities' - -edit contact details entities: - title: 'Edit Contact Details entities' - -view published contact details entities: - title: 'View published Contact Details entities' - -view unpublished contact details entities: - title: 'View unpublished Contact Details entities' - -view all contact details revisions: - title: 'View all Contact Details revisions' - -revert all contact details revisions: - title: 'Revert all Contact Details revisions' - description: 'Role requires permission view Contact Details revisions and edit rights for contact details entities in question or administer contact details entities.' - -delete all contact details revisions: - title: 'Delete all revisions' - description: 'Role requires permission to view Contact Details revisions and delete rights for contact details entities in question or administer contact details entities.' -add person entities: - title: 'Create new Person entities' - -administer person entities: - title: 'Administer Person entities' - description: 'Allow to access the administration form to configure Person entities.' - restrict access: true - -delete person entities: - title: 'Delete Person entities' - -edit person entities: - title: 'Edit Person entities' - -view published person entities: - title: 'View published Person entities' - -view unpublished person entities: - title: 'View unpublished Person entities' -add contact details entities: - title: 'Create new Contact details entities' - -administer contact details entities: - title: 'Administer Contact details entities' - description: 'Allow to access the administration form to configure Contact details entities.' - restrict access: true - -delete contact details entities: - title: 'Delete Contact details entities' - -edit contact details entities: - title: 'Edit Contact details entities' - -view published contact details entities: - title: 'View published Contact details entities' - -view unpublished contact details entities: - title: 'View unpublished Contact details entities' - -add hat entities: - title: 'Create new Hat entities' - -administer hat entities: - title: 'Administer Hat entities' - description: 'Allow to access the administration form to configure Hat entities.' - restrict access: true - -delete hat entities: - title: 'Delete Hat entities' - -edit hat entities: - title: 'Edit Hat entities' - -view published hat entities: - title: 'View published Hat entities' - -view unpublished hat entities: - title: 'View unpublished Hat entities' -add case entity entities: - title: 'Create new Case entity entities' - -administer case entity entities: - title: 'Administer Case entity entities' - description: 'Allow to access the administration form to configure Case entity entities.' - restrict access: true - -delete case entity entities: - title: 'Delete Case entity entities' - -edit case entity entities: - title: 'Edit Case entity entities' - -view published case entity entities: - title: 'View published Case entity entities' - -view unpublished case entity entities: - title: 'View unpublished Case entity entities' -add activity entities: - title: 'Create new Activity entities' - -administer activity entities: - title: 'Administer Activity entities' - description: 'Allow to access the administration form to configure Activity entities.' - restrict access: true - -delete activity entities: - title: 'Delete Activity entities' - -edit activity entities: - title: 'Edit Activity entities' - -view published activity entities: - title: 'View published Activity entities' - -view unpublished activity entities: - title: 'View unpublished Activity entities' diff --git a/modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml b/modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml deleted file mode 100644 index c544140..0000000 --- a/modules/zencrm_search/config/optional/block.block.exposedformperson_searchpage_1.yml +++ /dev/null @@ -1,22 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - views.view.person_search - module: - - views - theme: - - bartik -id: exposedformperson_searchpage_1 -theme: bartik -region: sidebar_first -weight: 0 -provider: null -plugin: 'views_exposed_filter_block:person_search-page_1' -settings: - id: 'views_exposed_filter_block:person_search-page_1' - label: '' - provider: views - label_display: visible - views_label: '' -visibility: { } diff --git a/modules/zencrm_search/config/optional/search_api.index.person_index.yml b/modules/zencrm_search/config/optional/search_api.index.person_index.yml deleted file mode 100644 index 65dc376..0000000 --- a/modules/zencrm_search/config/optional/search_api.index.person_index.yml +++ /dev/null @@ -1,42 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - search_api.server.zencrm_server - module: - - search_api - - zencrm_entities -id: person_index -name: 'Person Index' -description: '' -read_only: false -field_settings: - full_name: - label: 'Full Name' - datasource_id: 'entity:person' - property_path: full_name - type: text -datasource_settings: - 'entity:person': - languages: - default: true - selected: { } -processor_settings: -processor_settings: - rendered_item: { } - aggregated_field: { } - add_url: { } - ignorecase: - all_fields: true - fields: - - full_name - weights: - preprocess_index: -20 - preprocess_query: -20 -tracker_settings: - default: - indexing_order: fifo -options: - index_directly: true - cron_limit: 50 -server: zencrm_server diff --git a/modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml b/modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml deleted file mode 100644 index e61f3e6..0000000 --- a/modules/zencrm_search/config/optional/search_api.server.zencrm_server.yml +++ /dev/null @@ -1,16 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - search_api_db -id: zencrm_server -name: 'Zen CRM Server' -description: '' -backend: search_api_db -backend_config: - database: 'default:default' - min_chars: 3 - partial_matches: false - autocomplete: - suggest_suffix: true - suggest_words: true diff --git a/modules/zencrm_search/config/optional/views.view.person_search.yml b/modules/zencrm_search/config/optional/views.view.person_search.yml deleted file mode 100644 index 5eea4f1..0000000 --- a/modules/zencrm_search/config/optional/views.view.person_search.yml +++ /dev/null @@ -1,262 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - block.block.linkforcreatinganewperson - - search_api.index.person_index - - user.role.authenticated - module: - - search_api - - user -id: person_search -label: 'Person Search' -module: views -description: '' -tag: '' -base_table: search_api_index_person_index -base_field: search_api_id -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: role - options: - role: - authenticated: authenticated - cache: - type: tag - options: { } - query: - type: views_query - options: - bypass_access: false - skip_access: false - exposed_form: - type: basic - options: - submit_button: Search - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: mini - options: - items_per_page: 20 - offset: 0 - id: 0 - total_pages: null - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - tags: - previous: ‹‹ - next: ›› - style: - type: default - row: - type: fields - fields: - full_name: - id: full_name - table: search_api_index_person_index - field: full_name - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: string - settings: - link_to_entity: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - field_rendering: true - fallback_handler: search_api - fallback_options: - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - entity_type: null - entity_field: null - plugin_id: search_api_field - filters: - search_api_fulltext: - id: search_api_fulltext - table: search_api_index_person_index - field: search_api_fulltext - relationship: none - group_type: group - admin_label: '' - operator: or - value: '' - group: 1 - exposed: true - expose: - operator_id: search_api_fulltext_op - label: 'Search for People' - description: '' - use_operator: false - operator: search_api_fulltext_op - identifier: search_api_fulltext - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - administrator: '0' - standard_user: '0' - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - parse_mode: terms - min_length: null - fields: { } - plugin_id: search_api_fulltext - sorts: { } - title: 'Person Search' - header: { } - footer: { } - empty: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: false - content: 'No results.' - plugin_id: text_custom - entity_block: - id: entity_block - table: views - field: entity_block - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: true - target: linkforcreatinganewperson - view_mode: default - bypass_access: true - plugin_id: entity - relationships: { } - arguments: { } - display_extenders: { } - use_ajax: true - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - url.query_args - - user.roles - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 2 - display_options: - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - url.query_args - - user.roles - tags: { } - page_1: - display_plugin: page - id: page_1 - display_title: Page - position: 1 - display_options: - display_extenders: { } - path: person-search - exposed_block: true - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - url.query_args - - user.roles - tags: { } diff --git a/modules/zencrm_search/templates/zen-crm-search.html.twig b/modules/zencrm_search/templates/zen-crm-search.html.twig deleted file mode 100644 index 91e43c8..0000000 --- a/modules/zencrm_search/templates/zen-crm-search.html.twig +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/zencrm_search/tests/src/Functional/LoadTest.php b/modules/zencrm_search/tests/src/Functional/LoadTest.php deleted file mode 100644 index ca6137b..0000000 --- a/modules/zencrm_search/tests/src/Functional/LoadTest.php +++ /dev/null @@ -1,46 +0,0 @@ -user = $this->drupalCreateUser(['administer site configuration']); - $this->drupalLogin($this->user); - } - - /** - * Tests that the home page loads with a 200 response. - */ - public function testLoad() { - $this->drupalGet(Url::fromRoute('')); - $this->assertSession()->statusCodeEquals(200); - } - -} diff --git a/modules/zencrm_search/zencrm_search.info.yml b/modules/zencrm_search/zencrm_search.info.yml deleted file mode 100644 index eb9d744..0000000 --- a/modules/zencrm_search/zencrm_search.info.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 'Zen CRM Search' -type: module -description: 'Provides search functionality for Zen CRM' -core: 8.x -package: 'Zen CRM' -version: 0.1.1 -dependencies: - - zencrm_entities - - search_api - - search_api_db diff --git a/modules/zencrm_search/zencrm_search.module b/modules/zencrm_search/zencrm_search.module deleted file mode 100644 index 382110b..0000000 --- a/modules/zencrm_search/zencrm_search.module +++ /dev/null @@ -1,35 +0,0 @@ -' . t('About') . ''; - $output .= '

' . t('Provides search functionality for Zen CRM') . '

'; - return $output; - - default: - } -} - -/** - * Implements hook_theme(). - */ -function zencrm_search_theme() { - return [ - 'zencrm_search' => [ - 'render element' => 'children', - ], - ]; -} diff --git a/src/Controller/ActivityController.php b/src/Controller/ActivityController.php deleted file mode 100644 index a611c06..0000000 --- a/src/Controller/ActivityController.php +++ /dev/null @@ -1,35 +0,0 @@ - $activity_type_id, - 'case_entity' => $case_id, - ); - - $activity = \Drupal::entityTypeManager() - ->getStorage('activity') - ->create($values); - - $form = \Drupal::entityTypeManager() - ->getFormObject('activity', 'default') - ->setEntity($activity); - - return \Drupal::formBuilder()->getForm($form); - } -} diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php deleted file mode 100644 index cdf5cf2..0000000 --- a/src/Controller/CaseController.php +++ /dev/null @@ -1,34 +0,0 @@ - $case_type_id, - ); - - $case = \Drupal::entityTypeManager() - ->getStorage('case_entity') - ->create($values); - - $case->hats_involved->appendItem($hat_id); - - $form = \Drupal::entityTypeManager() - ->getFormObject('case_entity', 'default') - ->setEntity($case); - return \Drupal::formBuilder()->getForm($form); - } -} diff --git a/src/Controller/ContactDetailsController.php b/src/Controller/ContactDetailsController.php deleted file mode 100644 index 17401f7..0000000 --- a/src/Controller/ContactDetailsController.php +++ /dev/null @@ -1,31 +0,0 @@ - $person_id - ); - - $node = \Drupal::entityTypeManager() - ->getStorage('contact_details') - ->create($values); - - $form = \Drupal::entityTypeManager() - ->getFormObject('contact_details', 'default') - ->setEntity($node); - return \Drupal::formBuilder()->getForm($form); - } - -} diff --git a/src/Controller/HatController.php b/src/Controller/HatController.php deleted file mode 100644 index f4439d4..0000000 --- a/src/Controller/HatController.php +++ /dev/null @@ -1,54 +0,0 @@ - $hat_type_id, - 'person' => $person_id - ); - - $hat = \Drupal::entityTypeManager() - ->getStorage('hat') - ->create($values); - - $form = \Drupal::entityTypeManager() - ->getFormObject('hat', 'default') - ->setEntity($hat); - return \Drupal::formBuilder()->getForm($form); - } - - /** - * Displays a form for editing a hat. - * The reason it is here is that the URL needs to have the person id in it - * in order to filter the contact details entity reference view to only show ones for that person. - * (The intuitive way to bring this about - changing the edit route for the entity itself - causes problems with the delete route) - * - * @return form for editing a hat - */ - public function editHatForPerson($person_id, $hat_id) { - - $hat = \Drupal::entityTypeManager() - ->getStorage('hat') - ->load($hat_id); - - $form = \Drupal::entityTypeManager() - ->getFormObject('hat', 'default') - ->setEntity($hat); - return \Drupal::formBuilder()->getForm($form); - } - -} diff --git a/src/Plugin/Block/ActivityCreator.php b/src/Plugin/Block/ActivityCreator.php deleted file mode 100644 index de9ebce..0000000 --- a/src/Plugin/Block/ActivityCreator.php +++ /dev/null @@ -1,40 +0,0 @@ -getParameter('case_entity')->id(); - $markup = ""; - - $activity_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('activity'); - foreach($activity_types as $activity_type_id => $type) { - $label = $type['label']; - $markup .= "

Add a $label

"; - } - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => "" - ]; - - } - -} diff --git a/src/Plugin/Block/CaseDetails.php b/src/Plugin/Block/CaseDetails.php deleted file mode 100644 index 5697b68..0000000 --- a/src/Plugin/Block/CaseDetails.php +++ /dev/null @@ -1,60 +0,0 @@ -getParameter('case_entity')->id(); - $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); - $markup .= $this->renderInvolvedParties($case); - $markup .= $this->renderEntity($case); - $markup .= $this->renderEditLink($case_id); - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => $markup - ]; - - } - - private function renderEditLink($case_id) { - return ""; - } - - private function renderEntity($case) { - $view_builder = \Drupal::entityTypeManager()->getViewBuilder('case_entity'); - $build = $view_builder->view($case, 'default'); - $markup = render($build); - return "
$markup
"; - } - - private function renderInvolvedParties($case) { - $markup = "

Involved Parties

"; - $hats_involved = $case->hats_involved->referencedEntities(); - $links_markup = ""; - foreach($hats_involved as $hat) { - $person_id = $hat->person->first()->getValue()['target_id']; - $links_markup .= "

" . $hat->name->getString() . "

"; - } - $markup .= ""; - return "
$markup
"; - } - -} diff --git a/src/Plugin/Block/HatCreator.php b/src/Plugin/Block/HatCreator.php deleted file mode 100644 index cb6632d..0000000 --- a/src/Plugin/Block/HatCreator.php +++ /dev/null @@ -1,46 +0,0 @@ -getParameter('person')->id(); - $markup = ""; - - // Only offer hat creation on hats they don't already have. - $hat_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('hat'); - foreach($hat_types as $hat_type_id => $type) { - $hats = \Drupal::entityTypeManager() - ->getStorage('hat') - ->loadByProperties(['type' => $hat_type_id, 'person' => $person_id]); - if (!reset($hats)) { - $label = $type['label']; - $markup .= "

Add a $label Hat

"; - } - } - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => "" - ]; - - } - -} diff --git a/src/Plugin/Block/PersonPanel.php b/src/Plugin/Block/PersonPanel.php deleted file mode 100644 index d67b2b7..0000000 --- a/src/Plugin/Block/PersonPanel.php +++ /dev/null @@ -1,89 +0,0 @@ -getParameter('person')->id(); - $markup = ""; - $person = \Drupal::entityTypeManager()->getStorage('person')->load($person_id); - - - // If the person has no contact details, suggest they create some - $link_to_add = "/zencrm/contact_details/$person_id/add?destination=/zencrm/person/$person_id"; - $contact_details = \Drupal::entityTypeManager() - ->getStorage('contact_details') - ->loadByProperties(['person' => $person_id]); - if (!reset($contact_details)) { - $markup .= "

This person has no contact details yet. To get started, "; - $markup .= "Add a set of contact details"; - $markup .= "

"; - - } else { - // They have contact details, so they are able to create hats. - // If the person has no hats, suggest they create one, by rendering the hat creator block - $link_to_add = "/zencrm/hat/$person_id/add?destination=/zencrm/person/$person_id"; - $hats = \Drupal::entityTypeManager() - ->getStorage('hat') - ->loadByProperties(['person' => $person_id]); - if (!reset($hats)) { - $markup .= "

This person has no hats yet. A hat is a role that the person plays in the organisation. To get started, add a hat for this person.

"; - $plugin_manager = \Drupal::service('plugin.manager.block'); - $block = $plugin_manager->createInstance('hat_creator', array()); - $markup .= render($block->build()); - } else { - - // they have hats, so display the case view for each hat. - foreach($hats as $hat) { - $markup .= $this->showCases($hat); - $markup .= $this->showCaseCreationLinks($hat, $person_id); - } - } - } - - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => "
$markup
" - ]; - - } - - // Renders a view showing cases that hat is involved in. - private function showCases($hat) { - $markup = ''; - $markup .= "

" . $hat->name->getString() . "

"; - $markup .= drupal_render(views_embed_view('this_hat_s_cases', 'block_1', $hat->id())); - return "
$markup
"; - } - - // Provides links to create different types of cases, passing in the hat id. - private function showCaseCreationLinks($hat, $person_id) { - $hat_id = $hat->id(); - $case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('case_entity'); - foreach($case_types as $case_type_id => $type) { - $label = $type['label']; - $markup .= "

Add a $label Case

"; - } - return ""; - } -} diff --git a/templates/zencrm.html.twig b/templates/zencrm.html.twig deleted file mode 100644 index 91e43c8..0000000 --- a/templates/zencrm.html.twig +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/src/Functional/LoadTest.php b/tests/src/Functional/LoadTest.php deleted file mode 100644 index b3c682b..0000000 --- a/tests/src/Functional/LoadTest.php +++ /dev/null @@ -1,46 +0,0 @@ -user = $this->drupalCreateUser(['administer site configuration']); - $this->drupalLogin($this->user); - } - - /** - * Tests that the home page loads with a 200 response. - */ - public function testLoad() { - $this->drupalGet(Url::fromRoute('')); - $this->assertSession()->statusCodeEquals(200); - } - -} diff --git a/zencrm.info.yml b/zencrm.info.yml deleted file mode 100644 index 7932717..0000000 --- a/zencrm.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'Zen CRM' -type: module -description: 'Zen CRM' -core: 8.x -package: 'Zen CRM' -version: 0.1.1 -dependencies: - - zencrm_entities - - zencrm_search -libraries: - - zencrm/opencase-lib diff --git a/zencrm.libraries.yml b/zencrm.libraries.yml deleted file mode 100644 index de55277..0000000 --- a/zencrm.libraries.yml +++ /dev/null @@ -1,7 +0,0 @@ -opencase-lib: - version: 1.x - css: - theme: - css/opencase.css: {} - js: - js/opencase.js: {} diff --git a/zencrm.module b/zencrm.module deleted file mode 100644 index d9734d7..0000000 --- a/zencrm.module +++ /dev/null @@ -1,40 +0,0 @@ -' . t('About') . ''; - $output .= '

' . t('Zen CRM') . '

'; - return $output; - - default: - } -} - -/** - * Implements hook_theme(). - */ -function zencrm_theme() { - return [ - 'zencrm' => [ - 'render element' => 'children', - ], - ]; -} - -function zencrm_page_attachments(array &$page) { - $page['#attached']['library'][] = 'zencrm/opencase-lib'; -} - diff --git a/zencrm.routing.yml b/zencrm.routing.yml deleted file mode 100644 index 54e5717..0000000 --- a/zencrm.routing.yml +++ /dev/null @@ -1,40 +0,0 @@ -zencrm.hat.create: - path: '/zencrm/hat/{person_id}/add/{hat_type_id}' - defaults: - _controller: '\Drupal\zencrm\Controller\HatController::createHatForPerson' - _title: 'Add New Hat' - requirements: - _permission: 'access content' - -zencrm.hat.edit: - path: '/zencrm/hat/{person_id}/{hat_id}/edit' - defaults: - _controller: '\Drupal\zencrm\Controller\HatController::editHatForPerson' - _title: 'Edit Hat' - requirements: - _permission: 'access content' - -zencrm.contact_details.create: - path: '/zencrm/contact_details/{person_id}/add' - defaults: - _controller: '\Drupal\zencrm\Controller\ContactDetailsController::createContactDetailsForPerson' - _title: 'Add New Contact Details' - requirements: - _permission: 'access content' - -zencrm.case.create: - path: '/zencrm/case/{hat_id}/add/{case_type_id}' - defaults: - _controller: '\Drupal\zencrm\Controller\CaseController::createCaseForHat' - _title: 'Add New Case' - requirements: - _permission: 'access content' - -zencrm.activity.create: - path: '/zencrm/activity/{case_id}/add/{activity_type_id}' - defaults: - _controller: '\Drupal\zencrm\Controller\ActivityController::createActivityForCase' - _title: 'Add New Activity' - requirements: - _permission: 'access content' - From c31706467ab015c66130183be9cc05cd6d03b039 Mon Sep 17 00:00:00 2001 From: Naomi Date: Sun, 13 May 2018 14:42:03 +0300 Subject: [PATCH 94/94] updated readme --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b38023 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# OpenCase +A simple, case-management-focused CRM for small altruistic organisations. + +## Current Status +**13 May 2018** A demo site, with basic functionality is available at demo.opencase.org.uk. If you are interested, raise an issue and I will get the login to you somehow. + +## The Plan +OpenCase will be available as: +* A Drupal module, on drupal.org +* A Drupal install profile / distribution +* A hosted service + +## Find out more +* More details, including user stories for future development, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/) +* Use the feedback form on the demo site to contact the developer. + +