Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14053 from jdalsem/4.3-features
feat(groups): moved group tool field into its own view
- Loading branch information
Showing
4 changed files
with
55 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* This view displays a single group tool | ||
* | ||
* @uses $vars['tool'] \Elgg\Groups\Tool | ||
* @uses $vars['entity'] \ElggGroup | ||
* @uses $vars['value'] (optional) tool value | ||
* @uses $vars['class'] (optional) field class | ||
*/ | ||
|
||
$tool = elgg_extract('tool', $vars); | ||
if (!$tool instanceof \Elgg\Groups\Tool) { | ||
return; | ||
} | ||
|
||
echo elgg_view_field([ | ||
'#type' => 'checkbox', | ||
'#label' => $tool->getLabel(), | ||
'#help' => $tool->getDescription(), | ||
'#class' => elgg_extract_class($vars), | ||
'name' => $tool->mapMetadataName(), | ||
'value' => 'yes', | ||
'default' => 'no', | ||
'switch' => true, | ||
'checked' => elgg_extract('value', $vars) === 'yes', | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters