Sub-issue for meta issue #1880976: [meta] Port examples (including submodules) to D9.4+

Problem/Motivation

D8 all the things!

Proposed resolution

Start with D7 version and figure out how to port ;)

CommentFileSizeAuthor
#14 interdiff.txt7.46 KBmarvil07
#14 0001-Issue-2102621-by-pferlito-marvil07-Port-email_exampl.patch13.08 KBmarvil07
#8 email_example-2102621-8.patch11.43 KBAnonymous (not verified)
#5 email_example-2102621-5.patch9.22 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kristen Pol’s picture

Title: Update email example module for D8 » Port email example module to Drupal 8
Kristen Pol’s picture

Issue summary: View changes

Updated issue summary.

Kristen Pol’s picture

Title: Port email example module to Drupal 8 » Port email_example module to Drupal 8
Anonymous’s picture

Assigned: Unassigned »
Mile23’s picture

Rock on, pferlito. :-)

Anonymous’s picture

Status: Active » Needs review
FileSize
9.22 KB

First attempt.

Mile23’s picture

Nice start. Just a few things...

  1. +++ b/email_example/email_example.info.yml
    @@ -0,0 +1,6 @@
    +package: Custom
    +version: 8.x-1.0
    

    package: Examples

    and

    version: 8.x-1.x

  2. +++ b/email_example/email_example.module
    @@ -0,0 +1,164 @@
    +///// Supporting functions ////
    

    We want to avoid these kinds of comments. Put documentation in the docblocks so api.drupal.org can find them, or inline with the code so people can read them.

  3. +++ b/email_example/email_example.module
    @@ -0,0 +1,164 @@
    +function email_example_menu() {
    +  $items['/examples/email_example'] = array(
    +		'title' => 'E-mail Example: contact form',
    +		'description' => 'Callback for generating form.',
    +		'route_name' => 'email_example',
    +    'type' => MENU_NORMAL_ITEM, // Default.
    +	);
    +  return $items;
    

    Spaces not tabs. :-)

  4. +++ b/email_example/lib/Drupal/email_example/Form/EmailExampleGetFormPage.php
    @@ -0,0 +1,62 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    

    Examples is more of a documentation project than a code one. We want to explain the hows and whys of implementing stuff, so as a rule of thumb, @inheritdoc should be replaced with 'We're overriding this method because....'

Also, no tests. Even a functional SimpleTest to make sure the module can be enabled without blowing up would be good.

Thanks.

Mile23’s picture

Status: Needs review » Needs work
Anonymous’s picture

Tahnks @Mile23. Here is an updated patch. I made the corrections and added a test.

Anonymous’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, email_example-2102621-8.patch, failed testing.

Anonymous’s picture

Status: Needs review » Needs work

Looking at the details here looks like my code passed testing. The error is coming from the page example module.

Anonymous’s picture

Status: Needs work » Needs review
marvil07’s picture

Status: Needs work » Needs review

#8: email_example-2102621-8.patch queued for re-testing.

marvil07’s picture

Issue summary: View changes

Updated issue summary.

marvil07’s picture

Issue summary: View changes
FileSize
13.08 KB
7.46 KB

@pferlito: Thanks for the patches!

What is new in this patch:

  • Replace Implement with Implements on hook implementation comments.
  • drupal_mail() expects langcode, no language object.
  • Update documentation to reflect new way of retrieving the language codes.
  • Do not use deprecated functions.
  • Minor formating errors.
  • Improve test to reflect most of what D7 was doing.
  • Added defgroup end block.

I will add this after testbot agrees.

marvil07’s picture

Status: Needs review » Fixed

Mail example added!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.