c' => false,
'label' => esc_html__( 'Single', 'elementor-pro' ),
'edit_in_content' => true,
],
];
}
public function inspector_log( $args ) {
$inspector_enabled = method_exists( Plugin::elementor()->inspector, 'is_enabled' ) && Plugin::elementor()->inspector->is_enabled();
if ( ! $inspector_enabled ) {
return;
}
$title = [];
$url = '';
if ( isset( $args['location'] ) ) {
$location_settings = $this->get_location( $args['location'] );
if ( $location_settings ) {
$args['location'] = $location_settings['label'];
}
$title[] = 'Location: ' . $args['location'];
}
if ( isset( $args['description'] ) ) {
$title[] = $args['description'];
}
if ( ! empty( $args['document'] ) ) {
$title[] = esc_html( $args['document']->get_post()->post_title );
$url = $args['document']->get_edit_url();
}
if ( isset( $args['template'] ) ) {
$title[] = Plugin::elementor()->inspector->parse_template_path( $args['template'] );
}
$title = implode( ' > ', $title );
Plugin::elementor()->inspector->add_log( 'Theme', $title, $url );
}
private function filter_page_template_locations( array $locations ) {
$templates_to_filter = [
PageTemplatesModule::TEMPLATE_CANVAS,
PageTemplatesModule::TEMPLATE_HEADER_FOOTER,
];
if ( ! in_array( $this->current_page_template, $templates_to_filter, true ) ) {
return $locations;
}
if ( PageTemplatesModule::TEMPLATE_CANVAS === $this->current_page_template ) {
$allowed_core = [];
} else {
$allowed_core = [ 'header', 'footer' ];
}
foreach ( $locations as $location => $settings ) {
if ( ! empty( $settings['is_core'] ) && ! in_array( $location, $allowed_core, true ) ) {
unset( $locations[ $location ] );
}
}
return $locations;
}
}