Taitava\CMSEditLink\CMSEditLink::via
Instructs to chain our link AFTER the link defined as a parameter. An example: ```php class Library extends DataObject { private static $has_many = ['Books' => Book::class], }
class Book extends DataObject { private static $has_one = ['Library' => Library::class]; public function CMSEditLinkProvider() { return Taitava\CMSEditLink\CMSEditLink::LinkFor($this)->via($this->Library(), 'Books'); // via() Indicates that to be able to edit a Book in the CMS, the CMS should seek the Book via the Library where the Book belongs to. // Or the same result can be achieved by using hereon() like this: (note the swapped positions of $this and $this->Library()!) return Taitava\CMSEditLink\CMSEditLink::LinkFor($this->Library())->hereon($this, 'Books'); } } ```
Signature
public function via(DataObject|CMSEditLink
$data_object_or_link,
string
$relation_name )
Parameters
$data_object_or_link
— object
$relation_name
— string- A has_one/has_many/many_many/belongs_to/belongs_many_many relation name. Note that this should be the name of the relation that the given $data_object_or_link uses when referring to the current DataObject. See the example above.
Returns
- CMSEditLink