Skip to content

Commit

Permalink
rename edit function
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Mar 17, 2021
1 parent 931b8b9 commit a1de12d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/loginout/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n';
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
import ServerSideRender from '@wordpress/server-side-render';

export default function ArchivesEdit( { attributes, setAttributes } ) {
export default function LoginOutEdit( { attributes, setAttributes } ) {
const { displayLoginAsForm, redirectToCurrent } = attributes;

return (
Expand Down
16 changes: 8 additions & 8 deletions packages/block-library/src/loginout/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ function render_block_core_loginout( $attributes ) {
? get_permalink( get_the_ID() )
: '';

// Build the classes for this block.
$classes = 'wp-block-loginout';
$classes .= is_user_logged_in() ? ' logged-in' : ' logged-out';
if ( ! empty( $attributes['displayLoginAsForm'] ) ) {
$classes .= ' has-login-form';
}
$classes = is_user_logged_in() ? 'logged-in' : 'logged-out';
$contents = wp_loginout( $redirect_url, false );

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$contents = wp_loginout( $redirect_url, false );
// If logged-out and displayLoginAsForm is true, show the login form.
if ( ! is_user_logged_in() && ! empty( $attributes['displayLoginAsForm'] ) ) {
// Add a class.
$classes .= ' has-login-form';

// Get the form.
$contents = wp_login_form(
array(
'echo' => false,
Expand All @@ -38,6 +36,8 @@ function render_block_core_loginout( $attributes ) {
);
}

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );

return '<div ' . $wrapper_attributes . '>' . $contents . '</div>';
}

Expand Down

0 comments on commit a1de12d

Please sign in to comment.