/**
  * @access protected
  * @return array
  */
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('seoTitleUnparsed' => array(AttributeType::String, 'default' => ''), 'seoDescriptionUnparsed' => array(AttributeType::String, 'default' => ''), 'seoKeywordsUnparsed' => array(AttributeType::String, 'default' => ''), 'seoTitleSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'field'), 'seoTitleSourceField' => array(AttributeType::String, 'default' => 'title'), 'seoDescriptionSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoDescriptionSourceField' => array(AttributeType::String, 'default' => ''), 'seoKeywordsSource' => array(AttributeType::Enum, 'values' => "custom,keywords,field", 'default' => 'custom'), 'seoKeywordsSourceField' => array(AttributeType::String, 'default' => ''), 'seoImageIdSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoImageIdSourceField' => array(AttributeType::String, 'default' => ''), 'seoTwitterImageIdSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoTwitterImageIdSourceField' => array(AttributeType::String, 'default' => ''), 'seoFacebookImageIdSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoFacebookImageIdSourceField' => array(AttributeType::String, 'default' => ''), 'seoCommerceVariants' => array(AttributeType::Mixed)));
 }
Ejemplo n.º 2
0
 /**
  * @access protected
  * @return array
  */
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('seoTitleSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'field'), 'seoTitleSourceField' => array(AttributeType::String, 'default' => 'title'), 'seoDescriptionSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoDescriptionSourceField' => array(AttributeType::String, 'default' => ''), 'seoKeywordsSource' => array(AttributeType::Enum, 'values' => "custom,keywords,field", 'default' => 'custom'), 'seoKeywordsSourceField' => array(AttributeType::String, 'default' => ''), 'seoImageIdSource' => array(AttributeType::Enum, 'values' => "custom,field", 'default' => 'custom'), 'seoImageIdSourceField' => array(AttributeType::String, 'default' => '')));
 }
Ejemplo n.º 3
0
 public function actionSaveMeta()
 {
     $this->requirePostRequest();
     $metaId = craft()->request->getPost('metaId');
     $locale = craft()->request->getPost('locale');
     /*
     $elementId = craft()->request->getPost('elementId');
     */
     if ($metaId) {
         $model = craft()->seomatic->getMetaById($metaId, $locale);
         if (!$model) {
             /*
             $model = new Seomatic_MetaModel();
             $elementId = $metaId;
             */
             throw new Exception(Craft::t('No meta exists with the ID “{id}”', array('id' => $metaId)));
         }
     } else {
         $model = new Seomatic_MetaModel();
     }
     /* -- Set the Meta attributes, defaulting to the existing values for whatever is missing from the post data */
     $model->locale = craft()->request->getPost('locale', $locale);
     $model->elementId = $metaId;
     $model->metaType = craft()->request->getPost('metaType', $model->metaType);
     $model->metaPath = craft()->request->getPost('metaPath', $model->metaPath);
     $model->seoTitle = craft()->request->getPost('seoTitle', $model->seoTitle);
     $model->seoDescription = craft()->request->getPost('seoDescription', $model->seoDescription);
     $model->seoKeywords = craft()->request->getPost('seoKeywords', $model->seoKeywords);
     $model->twitterCardType = craft()->request->getPost('twitterCardType', $model->twitterCardType);
     $model->openGraphType = craft()->request->getPost('openGraphType', $model->openGraphType);
     $model->robots = craft()->request->getPost('robots', $model->robots);
     $model->seoImageId = craft()->request->getPost('seoImageId', $model->seoImageId);
     $model->enabled = (bool) craft()->request->getPost('enabled', $model->enabled);
     $model->getContent()->title = craft()->request->getPost('title', $model->title);
     if (craft()->seomatic->saveMeta($model)) {
         craft()->userSession->setNotice(Craft::t('SEOmatic Meta saved.'));
         $this->redirectToPostedUrl($model);
     } else {
         craft()->userSession->setError(Craft::t('Couldn’t save SEOmatic Meta.'));
         /* -- Send the Meta back to the template */
         craft()->urlManager->setRouteVariables(array('meta' => $meta));
     }
 }
 /**
  * Populates an element model based on a query result.
  *
  * @param array $row
  * @return array
  */
 public function populateElementModel($row)
 {
     return Seomatic_MetaModel::populateModel($row);
 }