You are here

README.txt in Views Add Button 2.0.x

Same filename and directory in other branches
  1. 8 README.txt
#####################################################################
##                     Views Add Button README                     ##
#####################################################################

### INTRODUCTION ###

Have you ever wanted to create "add" buttons with tokens from your
contextual filters? Did you ever need a custom list of nodes with an
add button at the top that checks for entity create access, without
having to write a custom handler or put a view inside a view? Then
this module is for you!

Views Add Button lets you make an "add an entity" button of any
type, and you may specify CSS classes and destination parameters for
your link. You may also create multiple buttons with differing
parameters if needed: just add multiple instances of the button
field.

### REQUIREMENTS ###

 - Views

### INSTALLATION ###

Views Add Button installs like most Drupal modules:

# Composer

 - Go to your project root, and require drupal/views_add_button
   - composer require drupal/views_add_button
 - Go to your modules page (Extend) and enable. No further setup is
   needed

# Download

 - Download the tar or zip file to your modules/contrib directory,
   and extract
 - Go to your modules page (Extend) and enable. No further setup is
   needed


### CONFIGURATION ###

Once installed, in the Views header and footer "Global: Entity Add
Button" will be made available. The button has the following options,
and all options *except* Entity Type support tokens.

# Entity Type
Here, you may select the entity type and bundle you want to generate
an add button for.

# Entity Context
Certain entities require extra route parameters to be set. For
example, The Group module, handled by Views Add Button: Group, needs
the group ID to be set in this field. This is not used by most
entities.

# Button Text for the Add Button
The text to be shown for the generated link.

# Query String
A query string to add to the generated URL. Do not add the '?' to
the string.

# Button Classes
The VAB button is in fact an anchor tag (<a>), and this field appends
classes in order to style the link as a button. If nothing is added,
the link will merely render as a link.

# Additional options
Options common to other Views area plugins (destination parameter,
enabling the use of tokens, etc.) are also available for the Add
Button.

### Creating a Plugin ###

Please review the Node, Taxonomy, and User plugins found under
/src/Plugin/views_add_button to supplement this README.

# Placement
Views Add Button classes should go in /src/Plugin/views_add_button

# Annotation

Views Add Button Plugins are annotated as @ViewsAddButton, and have
these parameters:

 - id: textual ID of the plugin, usually views_add_button_[entity_type]
 - label = a translated (@Translation()) string of a human-readable
   label for the plugin
 - target_entity: The entity this plugin is written for. Should be
   unique: do not install two plugins with the same target entity

# Class Functions
Your plugin class should have the following two functions:
 - description: Provides a description of the plugin
 - generate_url: Generate a Drupal\Core\Url that points to the add
   link.

File

README.txt
View source
  1. #####################################################################
  2. ## Views Add Button README ##
  3. #####################################################################
  4. ### INTRODUCTION ###
  5. Have you ever wanted to create "add" buttons with tokens from your
  6. contextual filters? Did you ever need a custom list of nodes with an
  7. add button at the top that checks for entity create access, without
  8. having to write a custom handler or put a view inside a view? Then
  9. this module is for you!
  10. Views Add Button lets you make an "add an entity" button of any
  11. type, and you may specify CSS classes and destination parameters for
  12. your link. You may also create multiple buttons with differing
  13. parameters if needed: just add multiple instances of the button
  14. field.
  15. ### REQUIREMENTS ###
  16. - Views
  17. ### INSTALLATION ###
  18. Views Add Button installs like most Drupal modules:
  19. # Composer
  20. - Go to your project root, and require drupal/views_add_button
  21. - composer require drupal/views_add_button
  22. - Go to your modules page (Extend) and enable. No further setup is
  23. needed
  24. # Download
  25. - Download the tar or zip file to your modules/contrib directory,
  26. and extract
  27. - Go to your modules page (Extend) and enable. No further setup is
  28. needed
  29. ### CONFIGURATION ###
  30. Once installed, in the Views header and footer "Global: Entity Add
  31. Button" will be made available. The button has the following options,
  32. and all options *except* Entity Type support tokens.
  33. # Entity Type
  34. Here, you may select the entity type and bundle you want to generate
  35. an add button for.
  36. # Entity Context
  37. Certain entities require extra route parameters to be set. For
  38. example, The Group module, handled by Views Add Button: Group, needs
  39. the group ID to be set in this field. This is not used by most
  40. entities.
  41. # Button Text for the Add Button
  42. The text to be shown for the generated link.
  43. # Query String
  44. A query string to add to the generated URL. Do not add the '?' to
  45. the string.
  46. # Button Classes
  47. The VAB button is in fact an anchor tag (), and this field appends
  48. classes in order to style the link as a button. If nothing is added,
  49. the link will merely render as a link.
  50. # Additional options
  51. Options common to other Views area plugins (destination parameter,
  52. enabling the use of tokens, etc.) are also available for the Add
  53. Button.
  54. ### Creating a Plugin ###
  55. Please review the Node, Taxonomy, and User plugins found under
  56. /src/Plugin/views_add_button to supplement this README.
  57. # Placement
  58. Views Add Button classes should go in /src/Plugin/views_add_button
  59. # Annotation
  60. Views Add Button Plugins are annotated as @ViewsAddButton, and have
  61. these parameters:
  62. - id: textual ID of the plugin, usually views_add_button_[entity_type]
  63. - label = a translated (@Translation()) string of a human-readable
  64. label for the plugin
  65. - target_entity: The entity this plugin is written for. Should be
  66. unique: do not install two plugins with the same target entity
  67. # Class Functions
  68. Your plugin class should have the following two functions:
  69. - description: Provides a description of the plugin
  70. - generate_url: Generate a Drupal\Core\Url that points to the add
  71. link.