You are here

function sortableviews_help in Sortableviews 8

Implements hook_help().

File

./sortableviews.module, line 13
Hook implementations for Sortable Views.

Code

function sortableviews_help($route_name, RouteMatchInterface $route_match) {
  if ($route_name == 'help.page.sortableviews') {
    $output = '';
    $output .= '<h3>' . t('Sortableviews') . '</h3>';
    $output .= '<p>' . t('This is an alternative for the popular <a href=":draggable">Draggable module</a> module. The difference lies in that whereas Draggableviews uses it\'s own table to store weights, this module uses the Field API to store weights directly in entity tables.', [
      ':draggable' => 'https://www.drupal.org/project/draggableviews',
    ]) . '</p>';
    $output .= '<p>' . t('Here is how it works:') . '</p>';
    $output .= '<ol><li>' . t('Create a view of any entity and have its format be any of "Sortable HTML list", "Sortable Unformatted list" or "Sortable table".') . '</li>';
    $output .= '<li>' . t('Make sure the entity type has a spare integer field or base field.') . '</li>';
    $output .= '<li>' . t('In the view format settings, specify the field to use for storing weight.') . '</li>';
    $output .= '<li>' . t('Add your weight field as a sort criteria as well.') . '</li>';
    $output .= '<li>' . t('Finally, add the "Save Sortableviews changes" handler to either your view header of footer.') . '</li></ol>';
    $output .= '<p>' . t('Your view should now be sortable.') . '</p>';
    $output .= '<p>' . t('Be aware that the sorting process will always overwrite whatever weight an entity had. Also, weight conflicts may occur if using multiple sortableviews for the same entity type and bundle.') . '</p>';
    return $output;
  }
}