Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $pageHasTemplates = $this->getPageHasTemplates($template['id'], $variation['id']);
- foreach ($pageHasTemplates as $pageHasTemplate) {
- $groups = $this->getGroups();
- foreach ($groups as $group) {
- $hookValues = $this->getRealHookValues($group['id']);
- $buttonValue = [
- $hookVariationCtaAlign['select_value'],
- $hookVariationCtaLink['link_value'],
- $hookVariationCtaStyle['select_value'],
- $hookVariationCtaText['text_value']
- ];
- $overwrited = false;
- foreach ($hookValues as $hookValue) {
- if ($hookValue['hook_variation_id'] == $hookVariationCtaAlign['id']) {
- $buttonValue[0] = $hookValue['select_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaLink['id']) {
- $buttonValue[1] = $hookValue['link_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaStyle['id']) {
- $buttonValue[2] = $hookValue['select_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaText['id']) {
- $buttonValue[3] = $hookValue['text_value'];
- $overwrited = true;
- }
- }
- if ($overwrited) {
- $this->addHookValue([
- 'page_id' => $pageHasTemplate['page_id'],
- 'creation_date' => $this->getTimestamp(),
- 'hook_id' => $hookButton,
- 'hook_variation_id' => $hookVariationButton,
- 'button_value' => json_encode($buttonValue),
- 'account_id' => 1
- ]);
- }
- $buttonHookValue = $buttonValue;
- $hookValuesWithPage = $this->getRealHookValues($group['id'], $pageHasTemplate['page_id']);
- $buttonValue = $buttonHookValue;
- $overwrited = false;
- foreach ($hookValuesWithPage as $hookValue) {
- if ($hookValue['hook_variation_id'] == $hookVariationCtaAlign['id']) {
- $buttonValue[0] = $hookValue['select_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaLink['id']) {
- $buttonValue[1] = $hookValue['link_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaStyle['id']) {
- $buttonValue[2] = $hookValue['select_value'];
- $overwrited = true;
- }
- if ($hookValue['hook_variation_id'] == $hookVariationCtaText['id']) {
- $buttonValue[3] = $hookValue['text_value'];
- $overwrited = true;
- }
- if ($overwrited) {
- $this->addHookValue([
- 'page_id' => $hookValue['page_id'],
- 'creation_date' => $this->getTimestamp(),
- 'hook_id' => $hookButton,
- 'hook_variation_id' => $hookVariationButton,
- 'button_value' => json_encode($buttonValue),
- 'account_id' => 1
- ]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement