-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
@@ -153,7 +153,7 @@ TemplateLibraryCollectionView = Marionette.CompositeView.extend( { | |||
}, | |||
|
|||
setFiltersUI() { | |||
if ( ! this.select2Instance ) { | |||
if ( ! this.select2Instance && this.$( this.ui.selectFilter ).length ) { |
There was a problem hiding this comment.
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.
…entor-collaboration into feature/contacts-page-doc
@@ -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 ], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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; | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@louiswol94 yes
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; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
PR Checklist
PR Type
What kind of change does this PR introduce?
Summary
This PR can be summarized in the following changelog entry:
Description
An explanation of what is done in this PR
Test instructions
This PR can be tested by following these steps:
Quality assurance
Fixes #