public function link($destination, $args = []) { return parent::link($destination, array_merge($this->defaultLinkParams, $args)); }
/** * @see PresenterComponent::link($destination, $args = array()) */ public function link($destination, $args = array()) { $args[self::CSRF_IDENTIFIER] = $this->generateCsrfLinkToken(); return parent::link($destination, $args); }
public function link($destination, $args = []) { $absolute = $args === TRUE; $scalarArgs = []; if (is_array($args)) { foreach ($args as $key => $arg) { if (!is_object($arg) && $arg !== NULL) { $scalarArgs[$key] = $arg; } } } if ($destination instanceof Rme\Schema) { $args = ['schemaId' => $destination->id] + $scalarArgs; $presenter = 'Schema:'; } else { if ($destination instanceof Rme\Block) { /** @var Rme\Schema $schema */ $schema = NULL; if (isset($args[0]) && $args[0] instanceof Rme\Schema) { $schema = $args[0]; } $args = ['blockId' => $destination->id, 'schemaId' => $schema ? $schema->id : NULL] + $scalarArgs; $presenter = 'Block:'; } else { if ($destination instanceof Rme\Content) { /** @var Rme\Content $destination */ /** @var Rme\Block $block */ $block = NULL; if (isset($args[0]) && $args[0] instanceof Rme\Block) { $block = $args[0]; } /** @var Rme\Schema $schema */ $schema = NULL; if (isset($args[1]) && $args[1] instanceof Rme\Schema) { $schema = $args[1]; } $id = $destination->id; if ($destination instanceof Rme\Video) { $idKey = 'videoId'; $presenter = 'Video:'; } else { if ($destination instanceof Rme\Blueprint) { $idKey = 'blueprintId'; $presenter = 'Blueprint:'; } else { if ($destination instanceof Rme\Blackboard) { $idKey = 'blackboardId'; $presenter = 'Blackboard:'; } else { throw new NotImplementedException(); } } } $args = [$idKey => $id, 'blockId' => $block ? $block->id : NULL, 'schemaId' => $schema ? $schema->id : NULL] + $scalarArgs; } else { $presenter = $destination; } } } if ($destination instanceof TitledEntity) { $args['slug'] = $destination->slug; } if ($destination instanceof Entity && $absolute) { $presenter = "//{$presenter}"; } /** @noinspection PhpDynamicAsStaticMethodCallInspection */ return NControl::link($presenter, $args); }