Skip to content

Commit

Permalink
MDL-69454 core_search: consistent tag search
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Brands committed Sep 21, 2020
1 parent ae0f81f commit fb61341
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions tag/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,27 @@
// Tag collection is specified. Manage tags in this collection.
echo $OUTPUT->heading(core_tag_collection::display_name($tagcoll));

// Form to filter tags.
print('<form class="tag-filter-form" method="get" action="'.$CFG->wwwroot.'/tag/manage.php">');
print('<div class="tag-management-form generalbox"><label class="accesshide" for="id_tagfilter">'. get_string('search') .'</label>'.
'<input type="hidden" name="tc" value="'.$tagcollid.'" />'.
'<input type="hidden" name="perpage" value="'.$perpage.'" />'.
'<input id="id_tagfilter" name="filter" type="text" value="' . s($filter) . '">'.
'<input value="'. s(get_string('search')) .'" type="submit" class="btn btn-secondary"> '.
($filter !== '' ? html_writer::link(new moodle_url($PAGE->url, array('filter' => null)),
get_string('resetfilter', 'tag'), array('class' => 'resetfilterlink')) : '').
'</div>');
print('</form>');
$hiddenfields = [
(object) ['type' => 'hidden', 'name' => 'tc', 'value' => $tagcollid],
(object) ['type' => 'hidden', 'name' => 'perpage', 'value' => $perpage]
];

$otherfields = '';
if ($filter !== '') {
$otherfields = html_writer::link(new moodle_url($PAGE->url, ['filter' => null]),
get_string('resetfilter', 'tag'));
}

$data = [
'action' => new moodle_url('/tag/manage.php'),
'hiddenfields' => $hiddenfields,
'inputname' => 'filter',
'searchstring' => get_string('search'),
'query' => s($filter),
'extraclasses' => 'mb-2',
'otherfields' => $otherfields
];
echo $OUTPUT->render_from_template('core/search_input', $data);

// Link to add an standard tags.
$img = $OUTPUT->pix_icon('t/add', '');
Expand Down

0 comments on commit fb61341

Please sign in to comment.