/** * Setup notification fields and pass various dependencies to the View. */ public function render() { $gateway = new NotificationGateway($this->component->getDb()); $select = $gateway->selectByComponent($this->component->getFullyQualifiedName()); $fields = $gateway->buildFields($this->component->url('notification-edit'), $this->component->getFields()); $this->view->assign(['fields' => $fields, 'listing' => new Listing($select, $gateway->field('dewdrop_notification_subscription_id')), 'component' => $this->component, 'componentModel' => $this->component->getPrimaryModel()]); return $this->renderView(); }
/** * Ensure the user has permissions to work with notifications in this component * and setup Fields and RowEditor objects. */ public function init() { $this->component->getPermissions()->haltIfNotAllowed('notifications'); $gateway = new NotificationGateway($this->component->getDb()); $this->fields = $gateway->buildFields($this->component->url('notification-edit'), $this->component->getFields()); $this->rowEditor = new RowEditor($this->fields, $this->request); $this->rowEditor->linkByQueryString('dewdrop_notification_subscriptions', 'dewdrop_notification_subscription_id'); $this->rowEditor->link(); }
public function testAddingParamsEvenWithSubmenuUsesRouteQueryParam() { $this->component->addToSubmenu('Test', 'Test'); $this->assertContains($this->isWp ? 'route=Test&id=3' : '/admin/animals/test?id=3', $this->component->url('Test', array('id' => 3))); $this->assertNotContains('page=Animals/Test', $this->component->url('Test', array('id' => 3))); }
/** * As the component this page belongs to for a URL matching the provided * page and query string parameters. This method should always be used for * generating URLs in your components so that it will play nicely with * various WP integration points like submenus. * * @param string $page * @param array $params * @return string */ public function url($page, array $params = array()) { return $this->component->url($page, $params); }