Пример #1
0
 /**
  * Populate select options with page names (also add no page option)
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $parent = BlockSelectOption::where('block_id', '=', $this->_block->id)->where('option', '=', 'parent')->first();
     $parentPageId = !empty($parent) ? $parent->value : 0;
     $this->_editViewData['selectOptions'] = [0 => '-- No Page Selected --'] + Page::get_page_list(['parent' => $parentPageId]);
     return String_::edit($content);
 }
Пример #2
0
 /**
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $this->_editViewData['placeHolder'] = [];
     if ($this->_editViewData['videoInfo'] = $this->_cache($content)) {
         $this->_editViewData['placeHolder'][$content] = $this->_editViewData['videoInfo']->snippet->title;
     }
     return parent::edit($content);
 }
Пример #3
0
 /**
  * Edit link settings
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $content = $this->_defaultData($content);
     $link = str_replace('internal://', '', $content['link'], $count);
     $content['link'] = $count > 0 ? '' : $content['link'];
     $this->_editViewData['targetOptions'] = [0 => 'Target: Same Tab', '_blank' => 'Target: New Tab'];
     $this->_editViewData['selectedPage'] = $count > 0 ? $link : 0;
     $this->_editViewData['pageList'] = [0 => 'Custom Link: '] + Page::get_page_list();
     return parent::edit($content);
 }
Пример #4
0
 /**
  * Get colour option to select with text box
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $this->_editViewData['selectOptions'] = ['none' => 'No Colour'];
     $selectOptions = BlockSelectOption::where('block_id', '=', $this->_block->id)->get();
     foreach ($selectOptions as $selectOption) {
         $this->_editViewData['selectOptions'][$selectOption->value] = $selectOption->option;
     }
     $this->_editViewData['selectClass'] = 'select_colour';
     return parent::edit($this->_defaultData($content));
 }
Пример #5
0
 /**
  * Edit selectwprice data view
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $this->_editViewData['selectOptions'] = [];
     $selectOptions = BlockSelectOption::where('block_id', '=', $this->_block->id)->get();
     foreach ($selectOptions as $selectOption) {
         $this->_editViewData['selectOptions'][$selectOption->value] = $selectOption->option;
     }
     if (preg_match('/^#[a-f0-9]{6}$/i', key($selectOptions))) {
         $this->_editViewData['class'] = 'select_colour';
     }
     return parent::edit($this->_defaultData($content));
 }
Пример #6
0
 /**
  * Display form settings
  * Template selector should only should if custom template selected (otherwise deprecated)
  * @param string $postContent
  * @return string
  */
 public function edit($postContent)
 {
     $formData = $this->_defaultData($postContent);
     $formData->template = $formData->template == $this->_block->name ? 0 : $formData->template;
     $this->_editViewData['pageList'] = Page::get_page_list();
     $this->_editViewData['formTemplates'] = [0 => '-- Use view from template --'];
     $theme = Theme::find(config('coaster::frontend.theme'));
     if (!empty($theme)) {
         $forms = base_path('/resources/views/themes/' . $theme->theme . '/blocks/forms');
         if (is_dir($forms)) {
             foreach (scandir($forms) as $form) {
                 if (!is_dir($forms . DIRECTORY_SEPARATOR . $form)) {
                     $form_file = explode('.', $form);
                     if (!empty($form_file[0])) {
                         $this->_editViewData['formTemplates'][$form_file[0]] = $form_file[0] . (strpos(file_get_contents($forms . DIRECTORY_SEPARATOR . $form), 'captcha') ? ' (supports captcha)' : ' (does not support captcha)');
                     }
                 }
             }
         }
     }
     return parent::edit($formData);
 }
Пример #7
0
 /**
  * Load image block data with domain relative paths
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $imageData = $this->_defaultData($content);
     $imageData->file = str_replace(URL::to('/'), '', $imageData->file);
     return parent::edit($imageData);
 }
Пример #8
0
 /**
  * Convert content to jQuery datetime picker format
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     $content = DateTimeHelper::mysqlToJQuery($content);
     return parent::edit($content);
 }
Пример #9
0
 /**
  * Admin view for editing repeater data
  * Can return an individual repeater row with default block data)
  * @param string $content
  * @param bool $newRow
  * @return string
  */
 public function edit($content, $newRow = false)
 {
     // if no current repeater id, reserve next new repeater id for use on save
     $repeaterId = $content ?: PageBlockRepeaterRows::nextFreeRepeaterId();
     $this->_editViewData['renderedRows'] = '';
     if ($repeaterBlocks = BlockRepeater::getRepeaterBlocks($this->_block->id)) {
         // check if new or existing row needs displaying
         if ($newRow) {
             $renderedRow = '';
             $repeaterRowId = PageBlockRepeaterRows::nextFreeRepeaterRowId($repeaterId);
             foreach ($repeaterBlocks as $repeaterBlock) {
                 $renderedRow .= $repeaterBlock->setPageId($this->_block->getPageId())->setRepeaterData($repeaterId, $repeaterRowId)->getTypeObject()->edit('');
             }
             return (string) CmsBlockInput::make('repeater.row', ['repeater_id' => $repeaterId, 'row_id' => $repeaterRowId, 'blocks' => $renderedRow]);
         } else {
             $repeaterRowsData = PageBlockRepeaterData::loadRepeaterData($repeaterId, $this->_block->getVersionId());
             foreach ($repeaterRowsData as $repeaterRowId => $repeaterRowData) {
                 $renderedRow = '';
                 foreach ($repeaterBlocks as $repeaterBlockId => $repeaterBlock) {
                     $fieldContent = isset($repeaterRowData[$repeaterBlockId]) ? $repeaterRowData[$repeaterBlockId] : '';
                     $renderedRow .= $repeaterBlock->setPageId($this->_block->getPageId())->setRepeaterData($repeaterId, $repeaterRowId)->getTypeObject()->edit($fieldContent);
                 }
                 $this->_editViewData['renderedRows'] .= CmsBlockInput::make('repeater.row', ['repeater_id' => $repeaterId, 'row_id' => $repeaterRowId, 'blocks' => $renderedRow]);
             }
         }
     }
     $this->_editViewData['_repeaterId'] = $this->_block->getRepeaterId();
     $this->_editViewData['_repeaterRowId'] = $this->_block->getRepeaterRowId();
     return parent::edit($repeaterId);
 }
Пример #10
0
 /**
  * @param string $content
  * @return string
  */
 public function edit($content)
 {
     return parent::edit($this->_defaultData($content));
 }