Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Internal: Conversion Center - add contact button document #27341

Merged
merged 20 commits into from
May 22, 2024

Conversation

nicoladj77
Copy link
Contributor

PR Checklist

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Summary

This PR can be summarized in the following changelog entry:

  • Implement Contact Button Document

Description

An explanation of what is done in this PR

  • Implement Contact Button Document

Test instructions

This PR can be tested by following these steps:

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended
  • Docs have been added / updated (for bug fixes / features)

Fixes #

@@ -153,7 +153,7 @@ TemplateLibraryCollectionView = Marionette.CompositeView.extend( {
},

setFiltersUI() {
if ( ! this.select2Instance ) {
if ( ! this.select2Instance && this.$( this.ui.selectFilter ).length ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louiswol94 this avoids error when categories are not returned.

@nicoladj77 nicoladj77 changed the title Feature/contacts page doc Internal: Conversion Center - add contact button document May 15, 2024
@@ -81,7 +81,8 @@ public static function get_registered_cpt_names() {
unset(
$post_types[ Landing_Pages_Module::CPT ],
$post_types[ Source_Local::CPT ],
$post_types[ Conversion_Center_Module::CPT_LINKS_PAGES ]
$post_types[ Conversion_Center_Module::CPT_LINKS_PAGES ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoladj77 Will there be a separate PR to remove CPT_LINKS_PAGES?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louiswol94 yes I have it ready when this is merged.

Comment on lines +174 to +195
public static function get_labels() : array {
$plural_label = static::get_plural_title();
$singular_label = static::get_title();

$labels = [
'name' => $plural_label, // Already translated.
'singular_name' => $singular_label, // Already translated.
'all_items' => sprintf( __( 'All %s', 'elementor' ), $plural_label ),
'add_new' => esc_html__( 'Add New', 'elementor' ),
'add_new_item' => sprintf( __( 'Add New %s', 'elementor' ), $singular_label ),
'edit_item' => sprintf( __( 'Edit %s', 'elementor' ), $singular_label ),
'new_item' => sprintf( __( 'New %s', 'elementor' ), $singular_label ),
'view_item' => sprintf( __( 'View %s', 'elementor' ), $singular_label ),
'search_items' => sprintf( __( 'Search %s', 'elementor' ), $plural_label ),
'not_found' => sprintf( __( 'No %s found.', 'elementor' ), strtolower( $plural_label ) ),
'not_found_in_trash' => sprintf( __( 'No %s found in Trash.', 'elementor' ), strtolower( $plural_label ) ),
'parent_item_colon' => '',
'menu_name' => $plural_label,
];

return $labels;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoladj77 Why did you have to add this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louiswol94 this is to streamline adding CPTs in modules. It's always the same so I thought it mades sense to have it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels risky :)

@@ -27,16 +25,39 @@ export default class LinksPagesHandler extends AdminMenuHandler {
const settings = this.getSettings(),
isLinksPagesTablePage = !! window.location.href.includes( settings.paths.linksPagesTablePage ),
isLinksPagesTrashPage = !! window.location.href.includes( settings.paths.linksPagesTrashPage ),
isLinksPagesCreateYourFirstPage = !! window.location.href.includes( settings.paths.linksPagesAddNewPage );
isLinksPagesCreateYourFirstPage = !! window.location.href.includes( settings.paths.linksPagesAddNewPage ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoladj77 Should we rename this file if it handles the CB as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louiswol94 it will be renamed in the next PR where we will not have Link In bios doc anymore

@@ -15,7 +15,7 @@ export class OpenLibraryAfterDelete extends After {
type = args?.containers[ 0 ]?.document?.config?.type;
}

return 'links-page' === type;
return 'links-page' === type || 'contact-buttons' === type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we remove 'links-page' in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +433 to +444
private function has_contact_pages(): bool {
if ( null !== $this->has_contact_pages ) {
return $this->has_contact_pages;
}

$this->has_contact_pages = $this->has_pages(
self::CPT_CONTACT_PAGES,
self::CONTACT_PAGE_DOCUMENT_TYPE
);

return $this->has_contact_pages;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably split these into separate classes...
$this->register_contact_pages_cpt/$this->register_links_pages_cpt
-->

$this->links->register_cpt / $this->cb->register_cpt

And for others.

But we can do it if there's time left.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@louiswol94 I think this should be architectured in a way that can be re used throughout the code base. Happy to give it a shot if we have time. Probably should live more in the Document rather than in the module, but not sure how/when modules are initialized.

@nicoladj77 nicoladj77 merged commit 3b60199 into elementor:main May 22, 2024
52 checks passed
@nicoladj77 nicoladj77 deleted the feature/contacts-page-doc branch May 22, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants