10
10
use Magento \Store \Model \StoreManagerInterface ;
11
11
12
12
/**
13
- * Catalog product media config
13
+ * Catalog product media config.
14
14
*
15
15
* @api
16
- *
17
- * @author Magento Core Team <core@magentocommerce.com>
18
16
* @since 100.0.2
19
17
*/
20
18
class Config implements ConfigInterface
@@ -45,8 +43,7 @@ public function __construct(StoreManagerInterface $storeManager)
45
43
}
46
44
47
45
/**
48
- * Filesystem directory path of product images
49
- * relatively to media folder
46
+ * Get filesystem directory path for product images relative to the media directory.
50
47
*
51
48
* @return string
52
49
*/
@@ -56,8 +53,7 @@ public function getBaseMediaPathAddition()
56
53
}
57
54
58
55
/**
59
- * Web-based directory path of product images
60
- * relatively to media folder
56
+ * Get web-based directory path for product images relative to the media directory.
61
57
*
62
58
* @return string
63
59
*/
@@ -67,15 +63,15 @@ public function getBaseMediaUrlAddition()
67
63
}
68
64
69
65
/**
70
- * @return string
66
+ * @inheritdoc
71
67
*/
72
68
public function getBaseMediaPath ()
73
69
{
74
70
return 'catalog/product ' ;
75
71
}
76
72
77
73
/**
78
- * @return string
74
+ * @inheritdoc
79
75
*/
80
76
public function getBaseMediaUrl ()
81
77
{
@@ -84,8 +80,7 @@ public function getBaseMediaUrl()
84
80
}
85
81
86
82
/**
87
- * Filesystem directory path of temporary product images
88
- * relatively to media folder
83
+ * Filesystem directory path of temporary product images relative to the media directory.
89
84
*
90
85
* @return string
91
86
*/
@@ -95,6 +90,8 @@ public function getBaseTmpMediaPath()
95
90
}
96
91
97
92
/**
93
+ * Get temporary base media URL.
94
+ *
98
95
* @return string
99
96
*/
100
97
public function getBaseTmpMediaUrl ()
@@ -105,24 +102,24 @@ public function getBaseTmpMediaUrl()
105
102
}
106
103
107
104
/**
108
- * @param string $file
109
- * @return string
105
+ * @inheritdoc
110
106
*/
111
107
public function getMediaUrl ($ file )
112
108
{
113
109
return $ this ->getBaseMediaUrl () . '/ ' . $ this ->_prepareFile ($ file );
114
110
}
115
111
116
112
/**
117
- * @param string $file
118
- * @return string
113
+ * @inheritdoc
119
114
*/
120
115
public function getMediaPath ($ file )
121
116
{
122
117
return $ this ->getBaseMediaPath () . '/ ' . $ this ->_prepareFile ($ file );
123
118
}
124
119
125
120
/**
121
+ * Get temporary media URL.
122
+ *
126
123
* @param string $file
127
124
* @return string
128
125
*/
@@ -132,8 +129,7 @@ public function getTmpMediaUrl($file)
132
129
}
133
130
134
131
/**
135
- * Part of URL of temporary product images
136
- * relatively to media folder
132
+ * Part of URL of temporary product images relative to the media directory.
137
133
*
138
134
* @param string $file
139
135
* @return string
@@ -144,7 +140,7 @@ public function getTmpMediaShortUrl($file)
144
140
}
145
141
146
142
/**
147
- * Part of URL of product images relatively to media folder
143
+ * Part of URL of product images relatively to media folder.
148
144
*
149
145
* @param string $file
150
146
* @return string
@@ -155,6 +151,8 @@ public function getMediaShortUrl($file)
155
151
}
156
152
157
153
/**
154
+ * Get path to the temporary media.
155
+ *
158
156
* @param string $file
159
157
* @return string
160
158
*/
@@ -164,6 +162,8 @@ public function getTmpMediaPath($file)
164
162
}
165
163
166
164
/**
165
+ * Process file path.
166
+ *
167
167
* @param string $file
168
168
* @return string
169
169
*/
@@ -173,18 +173,23 @@ protected function _prepareFile($file)
173
173
}
174
174
175
175
/**
176
+ * Get codes of media attribute.
177
+ *
176
178
* @return array
177
179
* @since 100.0.4
178
180
*/
179
181
public function getMediaAttributeCodes ()
180
182
{
181
183
if (!isset ($ this ->mediaAttributeCodes )) {
184
+ // the in-memory object-level caching allows to prevent unnecessary calls to the DB
182
185
$ this ->mediaAttributeCodes = $ this ->getAttributeHelper ()->getAttributeCodesByFrontendType ('media_image ' );
183
186
}
184
187
return $ this ->mediaAttributeCodes ;
185
188
}
186
189
187
190
/**
191
+ * Get attribute helper.
192
+ *
188
193
* @return Attribute
189
194
*/
190
195
private function getAttributeHelper ()
0 commit comments