/** * Assemble elements from the component and a Counter object and pass them along * to the view. */ public function render() { $fields = $this->component->getFields(); $selected = $fields->getVisibleFields()->getByQueryStringId($this->request->getQuery('group_field')); $counter = new Counter($selected, $fields, $this->component->getListing()); $renderer = $this->view->csvCellRenderer(); $this->component->setShouldRenderLayout(false); $this->view->assign(['title' => $this->component->getTitle(), 'selected' => $selected, 'fields' => $counter->buildRenderFields(), 'data' => $counter->fetchData($renderer), 'renderer' => $renderer]); return $this->renderView(); }
public function render() { $this->component->getPermissions()->haltIfNotAllowed('create'); $renderer = $this->view->editControlRenderer(); $rowEditor = $this->component->getRowEditor(); $field = $this->component->getFields()->get($this->request->getQuery('field')); $value = $this->request->getQuery('value'); $rowEditor->link(); if ($field instanceof ManyToManyField) { $field->setValue([$value]); } else { $field->setValue($value); } $this->component->setShouldRenderLayout(false); return $renderer->getControlRenderer()->render($field, 0); }
/** * Pass a bunch of dependencies to the View. */ public function render() { $listing = $this->component->getListing(); $id = $this->request->getQuery($listing->getPrimaryKey()->getName()); $fields = $this->component->getFields()->getVisibleFields(); $data = $this->component->getListing()->fetchRow($fields, $id); $primaryKey = $this->component->getPrimaryModel()->getPrimaryKey(); $params = array(); foreach ($primaryKey as $field) { $params[$field] = $this->request->getQuery($field); } $this->view->assign(['params' => $params, 'fields' => $fields, 'singularTitle' => $this->component->getPrimaryModel()->getSingularTitle(), 'data' => $data, 'id' => $id, 'groupingFilter' => $this->component->getFieldGroupsFilter(), 'permissions' => $this->component->getPermissions(), 'isAjax' => $this->request->isAjax()]); // When requested over XHR, turn off the layout (admin shell chrome) if ($this->request->isAjax()) { $this->component->setShouldRenderLayout(false); } return $this->renderView(); }
/** * Pass a bunch of dependencies to the View. */ public function render() { $listing = $this->component->getListing(); $id = $this->request->getQuery($listing->getPrimaryKey()->getName()); $fields = $this->component->getFields()->getVisibleFields(); if ($this->component->getPermissions()->can('restore') && $listing->hasSelectModifier('SelectDeletedRecords')) { /* @var $deletedRecordsModifier \Dewdrop\Fields\Helper\SelectDeletedRecords */ $deletedRecordsModifier = $listing->getSelectModifierByName('SelectDeletedRecords'); $deletedRecordsModifier->disable(); } $data = $listing->fetchRow($fields, $id); $primaryKey = $this->component->getPrimaryModel()->getPrimaryKey(); $params = array(); foreach ($primaryKey as $field) { $params[$field] = $this->request->getQuery($field); } $this->view->assign(['params' => $params, 'fields' => $fields, 'singularTitle' => $this->component->getPrimaryModel()->getSingularTitle(), 'data' => $data, 'id' => $id, 'groupingFilter' => $this->component->getFieldGroupsFilter(), 'permissions' => $this->component->getPermissions(), 'isAjax' => $this->request->isAjax()]); // When requested over XHR, turn off the layout (admin shell chrome) if ($this->request->isAjax()) { $this->component->setShouldRenderLayout(false); } return $this->renderView(); }
public function testCanConfigureTheComponentToNotRenderTheAdminLayout() { $this->assertTrue($this->component->shouldRenderLayout()); $this->component->setShouldRenderLayout(false); $this->assertFalse($this->component->shouldRenderLayout()); }
public function renderAjaxForm() { $this->assignDefaultViewArguments(); $this->component->setShouldRenderLayout(false); return $this->view->render('edit-fields-for-ajax.phtml'); }