Taitava\CMSEditLink\CMSEditLink::action
Gets or sets the 'action' part of the link. 'Action' is the last part of the link and in CMS links it's usually 'edit'. Note that if you are using chained links, then only the **last** link's action in the chain is used and all others discarded! See these examples:
```php $book = Book::get()->byID(1); $book->CMSEditLink()->via($book->Library(), 'Books')->action('customAction'); // Wrong because the action would be set to the Library part of the link $book->CMSEditLink()->action('customAction')->via($book->Library(), 'Books'); // Correct because the Book part will the last one when the link chain will be rendered ``` Another example: ```php $library = Library::get()->byID(1); $library->CMSEditLink()->hereon($library->Books()->first(), 'Books')->action('customAction'); // Correct because the Book part will the last one when the link chain will be rendered $library->CMSEditLink()->action('customAction')->hereon($library->Books()->first(), 'Books'); // Wrong because the action would be set to the Library part of the link ```
Signature
private function action([string|null
$set_action = NULL] )
Parameters
$set_action
— object- If defined, will set the link's 'action' to the specified string value.
Returns
- string|$this
- Returns the link's 'action', but only if $set_action is left null. If $set_action is something else than null, $this link is returned to make it possible to fluently continue calling methods after calling this method.