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

Add Attribute Support #186

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion lib/BladeOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -4149,6 +4149,64 @@ protected function compileJSon($expression): string
return $this->phpTagEcho . "json_encode($parts[0], $options, $depth); ?>";
}
//</editor-fold>
//<editor-fold desc="attributes">
/**
* Compile the checked statements into valid PHP.
*
* @param string $expression
* @return string
*/
protected function compileChecked($expression): string
{
return $this->phpTag . "if$expression echo 'checked'; ?>";
}

/**
* Compile the selected statements into valid PHP.
*
* @param string $expression
* @return string
*/
protected function compileSelected($expression): string
{
return $this->phpTag . "if$expression echo 'selected'; ?>";
}

/**
* Compile the disabled statements into valid PHP.
*
* @param string $expression
* @return string
*/

protected function compileDisabled($expression): string
{
return $this->phpTag . "if$expression echo 'disabled'; ?>";
}

/**
* Compile the readonly statements into valid PHP.
*
* @param string $expression
* @return string
*/

protected function compileReadonly($expression): string
{
return $this->phpTag . "if$expression echo 'readonly'; ?>";
}

/**
* Compile the required statements into valid PHP.
*
* @param string $expression
* @return string
*/
protected function compileRequired($expression): string
{
return $this->phpTag . "if$expression echo 'required'; ?>";
}
//</editor-fold>
// <editor-fold desc='language'>
protected function compileIsset($expression): string
{
Expand Down Expand Up @@ -4220,7 +4278,6 @@ protected function compile_n($expression): string
{
return $this->phpTagEcho . "\$this->_n$expression; ?>";
}

// </editor-fold>
//<editor-fold desc="cli">
public static function isCli(): bool
Expand Down
Loading