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

Readonly callback ignored #8

Open
drsdre opened this issue Jun 11, 2019 · 1 comment
Open

Readonly callback ignored #8

drsdre opened this issue Jun 11, 2019 · 1 comment

Comments

@drsdre
Copy link
Contributor

drsdre commented Jun 11, 2019

When the readonly flag is set, DateRange still allows user to change the range. For example using a callback $is_readonly which returns true:

$is_readonly = function ( $NovaRequest ) {
	/** @var NovaRequest $NovaRequest */
	/** @var RoundModel $Round */
	if ( $NovaRequest->resource() == 'App\Nova\Round' && $Round = $NovaRequest->findModelQuery()->first() ) {
		return ! $Round->isEditable();
	} else {
		return false;
	}
};

DateRange::make( 'Match period', [ 'match_period_start', 'match_period_end' ] )
         ->nullable()
         ->readonly( $is_readonly ),
@drsdre drsdre changed the title Readonly ignored Readonly callback ignored Jun 11, 2019
@drsdre
Copy link
Contributor Author

drsdre commented Jun 12, 2019

Mapping was missing between isReadOnly and :disabled in this compenent. Fixed with #9

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

No branches or pull requests

1 participant