texts: Get the taxonomy term field in Views 3 override title

texts:
Is it possible to get a taxonomy term field in the title of a view, using the override title in the contextual filters? I know I can get taxonomy fields using relationships, but is there an argument or something similar that I can use in the override title?

I am asking for Drupal 7.


texts: Entity Browser Widget for Video Embed Media Entity

texts:
I have a few different Entity Browsers setup for uploading or selecting Media Entities on my Drupal 8.3.x site.

I have Image, Document & Video media bundles setup on the site.

The Image & Document providers include widgets to add to an Entity Browser.

Video bundle is setup via the video_embed module through media_entity module.

I can not find any documentation or method of adding an 'Add New Video' type of widget for Entity Browser – ie. A simple text field in which you paste in the URL of a Vimeo/Youtube video to create an entity for it.

My Video Entity is working fine on the standalone creation form.

I also have a View (Entity browser widget plugin) I'm using for selecting Existing videos on the site, and that works fine.

Are there any existing methods for an 'Add Video'


texts: How to tell if a Webform field has been hidden by conditional rule

texts:
I maintain a contrib module that implements hook_webform_submission_presave. It does some complex stuff which boils down to taking the submitted values and storing them in another database.

Here's the problem: if the field was hidden we want to treat it differently. As of Webform 4, conditional fields are built-in to the core webform module. But looking at the submission object, I can't tell the difference between a field that is blank because it was intentionally left blank by the user vs a field that is blank because it was hidden by a conditional rule. In the latter case, we don't want to overwrite an existing value in the other database, because the user wasn't telling us "I want this field to be blank" they were in fact telling us nothing about the field because they didn't even see it.

For more information about the scenario see the original issue.


texts:
I am trying to create a checkbox element for the webform in D8.
There is an example module, for creating and element, "webform_example_element" that actuly creates a text field element for the webform. Which works fine.

I just duplicated that module, to use it to create a checkbox element.

namespace Drupal\se_webform_element\Element;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement;
use Drupal\Core\Form\FormStateInterface;

class SEWebformElement extends FormElement {

  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    $class = get_class($this);
    return [
      '#input' => TRUE,
      '#type' => 'checkbox',
      //'#size' => 60,

      '#process' => [
        [$class, 'processWebformElementExample'],
        [$class, 'processAjaxForm'],
      ],
      '#element_validate' => [
        [$class, 'validateSEWebformElement'],
      ],
      '#pre_render' => [
        [$class, 'preRenderSEWebformElement'],
      ],
      '#theme' => 'input__se_webform_element',
      '#theme_wrappers' => ['form_element'],
    ];
  }

  /**
   * Processes a 'se_webform_element' element.
   */
  public static function processWebformElementExample(&$element, FormStateInterface $form_state, &$complete_form) {
    // Here you can add and manipulate your element's properties and callbacks.
    return $element;
  }

  /**
   * Webform element validation handler for #type 'se_webform_element'.
   */
  public static function validateSEWebformElement(&$element, FormStateInterface $form_state, &$complete_form) {
    // Here you can add custom validation logic.
  }

  /**
   * Prepares a #type 'email_multiple' render element for theme_element().
   *
   * @param array $element
   *   An associative array containing the properties of the element.
   *   Properties used: #title, #value, #description, #size, #maxlength,
   *   #placeholder, #required, #attributes.
   *
   * @return array
   *   The $element with prepared variables ready for theme_element().
   */
  public static function preRenderSEWebformElement(array $element) {

    $element['#attributes']['type'] = 'checkbox';
    Element::setAttributes($element, ['id', 'name', 'options']);
    return $element;
  }

}

Which is not working as needed.
It is saving the value, but when you edit the form, it does not reload it for the checkbox field.
 What am I missing here?


texts:
I am trying to update via Composer following what reported in Update core via Composer, but when I do composer update drupal/core --with-dependencies, I get the following output.

  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Nothing to install or update
  Generating autoload files

I checked /admin/report/updates, and I can see that Drupal 8.5 is available. The content of composer.json is the following.

    "repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    }
]

Why isn't Composer updating core?


texts:
I need to add the Templates plugin into Drupal8 CKeditor. So far it is available on the editor configuration page, but not on a node edit page. The code:

namespace Drupal\module_name\Plugin\CKEditorPlugin;

use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\Component\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;

class ContentTemplates extends PluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface {

  public function getButtons() {
    return array(
      'ContentTemplates' => array(
        'label' => t('Content templates'),
        'image' => drupal_get_path('module', 'module_name') . '/js/CKeditor/Plugin/templates/icons/templates.png',
        'image_rtl' => drupal_get_path('module', 'module_name') . '/js/CKeditor/Plugin/templates/icons/templates-rtl.png',
      ),
    );
  }

  public function isInternal() {
    return FALSE;
  }

  public function getDependencies(Editor $editor) {
    return array('dialog', 'dialogui');
  }

  public function getLibraries(Editor $editor) {
    return array();
  }

  public function getFile() {
    return drupal_get_path('module', 'module_name') . '/js/CKeditor/Plugin/templates/plugin.js';
  }

  public function getConfig(Editor $editor) {
    return array();
  }

  // TODO: to be sure, should be removed and served by config
  function isEnabled(Editor $editor) {
    return TRUE;
  }
}

I also could see the methods injected by templates/dialogs/templates.js while inspecting the CKEditor object, but the file is not listed in the Chrome's resources inspector. I also don't see any code changes in this file takes effect (browser and drupal cache disabled, aggregation disabled).


texts: Getting child term's Tid not the parent's

texts:
I created a form via Drupal 8 API, and I am creating a dropdown of a taxonomy terms which has a parent-child hierarchy. But when i select the taxonomy term, it displays term's parent's tid. This is how i try to display the dropdown:

$option = [];
$terms = \Drupal::service('entity_type.manager')->getStorage("taxonomy_term")->loadTree('collections', $parent = 0, $max_depth = 3, $load_entities = FALSE);

foreach ($terms as $term) {
  if($term->depth == 0){
    $term = $term->name;
  }
  elseif ($term->depth == 1) {
    $term = '-'.$term->name;
  }
  elseif ($term->depth == 2){
   $term = '--'.$term->name;
  }
  elseif ($term->depth == 3){
    $term = '---'.$term->name;
  }
  elseif ($term->depth == 4){
    $term = '----'.$term->name;
  }
  $option[] = $term;
}

$form['collection'] = array(
  '#type' => 'select',
  '#title' => t('In Collection:'),
  '#empty_option' => t(' '),
  '#options' => $option,
);

I have been trying to get the term's tid not the parent's tid, can anyone point out what am doing wrong? Note:I am not super experienced with drupal 8


texts: Assigned block system to an invalid region

texts:
I've renamed a region in my .info file by mistake.
After clearing the cache with drush, the block I've attached to that region was disabled.
Drush printed the following message:

The block Nivo Slider was assigned to the invalid region slider and has been disabled.

I corrected the false region, but still the block seems to be "disabled" somehow, see picture from structure -> blocks, below.

Already enabled/disabled Nivo Slider Module, cleared cache with drush.


texts: How to populate an Entity Reference field from a modal AjaxResponse?

texts:
I have an entity ref autocomplete field (reference to bundle A) in one of my bundles (bundle B). I want to add a button below this field which will open a modal for a bundle A create form.

This code works great:

  $form['#attached']['library'][] = 'core/jquery.form';
  $form['#attached']['library'][] = 'core/drupal.ajax';
  $form['field_ref_to_bundle_a']['#suffix'] = '

' .
        t('Add New Bundle A') .
    '
';

When I hit Create in the modal, the new entity is created; but I need to assign this new entity to the field on the parent form (bundle B). I have added a #submit callback with a form alter on the modal form and in that callback I have:

  $response = new AjaxResponse();
  $response->addCommand(new CloseModalDialogCommand());
  $form_state->setResponse($response);

which closes the modal. In this call i know the NID of the newly created entity and I am guessing there must be some way to set the value on that field in the parent form.

Although i don't think it should be necessary, i have seen code suggesting i can use a $response->addCommand(new ReplaceCommand()) to swap out the entire original field with one that is populated with the default value; but i have had no luck in doing this. I have been able to use this $response call to swap out the entire autocomplete with a text string; so does seem like i am on the right path. All i really need to do is set the default value of the autocomplete field; but not sure how to do this through ajax.

Going with the idea that i need to replace the entire field (as opposed to just setting the default value); i found this code:

  $node = Node::load($nid);
  $elem = [
    '#type' => 'entity_autocomplete',
    '#target_type' => 'node',
    '#default_value' => $node,
    '#attributes' => [
      'id' => ['#edit-field-ref-to-bundle-a-0-target-id'],
    ],
  ];
  $renderer = \Drupal::service('renderer');
  $renderedField = $renderer->render($elem);

Although this does render something:

<input id="#edit-field-ref-to-bundle-a-0-target-id" type="text" size="60" maxlength="128" class="form-text" />

It doesn't have a default value set. But perhaps I am close??


texts: Addressfield entries not showing up when entityform sends an email

texts: I have an Entityform that uses the Address Field module. Viewing a submission in the interface is fine. However, when the admin email goes out, only labels are shown; the address fields are empty. Has anyone had this problem?


texts: How can i redirect the path from the product save button?

texts:
In my drupal commerce installation are two roles and one of them havn`t the permission for the admin/commerce/products path. They get an "access denied". Thats not so nice. How can i overwrite the path from the submit button in the product form to another site (maybe to a views page)?

I`m little bit confused, is it not possible to show only the products from the current logged in user on the admin/commerce/products path? I be really convinced that i give all the right permission.

Thx! Bruno


texts:
I have a multisite configuration with Drupal7, my prod site is mysite.example.mydomain.com and dev is mysitedev.example.mydomain.com I have set in sites/sites.php :

$sites = array('mysite.example.mydomain.com' => 'mysitedev.example.mydomain.com',
);

so searching for sites/mysite.example.mydomain.com would result as sites/mysite.dev. example mydomain.com, but I have a background Image Url:

background: url("/sites/mysite.example.mydomain.com/files/myimage.jpg");

if the Url is /sites/mysitedev.example.mydomain.com/files it works, otherwise with /sites/mysite.example.mydomain.com/files it don't!
What am I missing???

Thanks.


texts:
I have duplicated Drupal Commerce module "Cash on delivery", from which I am trying to make custom module, where if customer choose as payment method my new payment, it will simply print out text with tokens inside.
(This is because client needs to be able to pair orders with payments sent by credit card directly to his account, he will pair them with commerce order number)

I have successfully made a textarea in rules UI even with token field under this area, now I have to print them.

Working code for making textarea:

function bankovy_prevod_settings_form($settings = NULL) {

  $settings = (array) $settings + array(
    'information' => '',
    'var_symbol' => ''
  );

  $form = array();

  $form['information'] = array(
    '#type' => 'textarea',
    '#title' => t('Information'),
    '#description' => t('Informácie, ktoré chcete zobraziť zákazníkom, keď si navolia túto možnosť platby.'),
    '#default_value' => $settings['information']
  );

  $form['var_symbol'] = array(
    '#type' => 'textarea',
    '#title' => t('Variabilný symbol'),
    '#description' => t('Sem vložte token, na základe ktorého sa bude generovať variabilný symbol.'),
    '#default_value' => $settings['var_symbol']
  );

    if (module_exists('token')) {
      $form['token_help'] = array(
        '#theme' => 'token_tree',
        '#token_types' => array('commerce-order'),
      );
    }

  return $form;
}

Code for displaying the output on commerce order:

function bankovy_prevod_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
  $form = array();

  $var_symbol = "";
  if (!empty($payment_method['settings']['var_symbol'])) {
      $var_symbol = token_replace($payment_method['settings']['var_symbol'], array('node' => $form['commerce_checkout_form']));
  }

  if (!empty($payment_method['settings']['information'])) {
    $form['grafeon_bankovy_prevod_description'] = array(
      '#markup' => $payment_method['settings']['information'] . "<br/>" . $var_symbol
    );
  }

  // Need to create a dummy value to solve http://drupal.org/node/1230666
  // Probably an issue in the main commerce module
  $form['dummy'] = array(
    '#type' => 'hidden',
    '#value' => 'dummy'
  );

  return $form;
}

Now I have to somehow replace tokens, trying to use function token_replace, but it does not seem to work with "node" as checkout is not node, so I tried various different "commerce_checkout_form" strings but neither of them worked. Can anyone please help me out to solve this?

Thats the part I have problem with:

$var_symbol = token_replace($payment_method['settings']['var_symbol'], array('node' => $form['commerce_checkout_form']));

Any advice would be greatly appreciated.


texts: Enabling a new content type in the add new content

texts: i have created a new content type but when i go to add content, it does not appear but only appears under content types. I have even tried to clear the caches but all in vein, what could be the cause? i will glad for your help


texts: How woud you plan a sector directory with Drupal?

texts:
I have to realize a sector directory, a directory of restaurants, bars, wineyardsm, carpenter...

So each sector has it's own properties like the menu card or something else. But there are properties like the name, address, telephone number etc. which are the same in for each sector.

I thougt to realize it so: 1 node type: Business (Fields: title, address, city, telephone number...); for each sector one content type with the special fields like the menu card or the wine list; to connect these two nodes i thougt to use the Relation module

What do you think of my plan? Is it used to do it like this or are there other solutions? One problem of my plan would be the backend. I have to edit/create two nodes for one business. For the normal user it would be too complicate. Is there a way to edit the connected node on the same page?

Thanks


texts: How to create a customizable group of hierarchical structure of strings and show it on a page?

texts:
I have a group of strings which are to be shown in a hierarchical structure on a Page. They are not related to navigation but I am trying to create them like a menu so that the structure can be edited from the admin panel. I have two questions:

1) What is it called in Drupal's language (whatever I try to write it ends looking for menu navigation only)? That's why I am explicitly mentioning it that it is not related to navigation of a the site.

2) Is there a module which can help me create a tree like structure to show it a page? I have to show it using nested accordions.


texts: How does Drupal select default domain for relative links?

texts:
In one of our Drupal sites (core 7.14) links in two blocks displayed on the front page recently started using one of the alternate domains defined in the Apache config for the site instead of the primary domain. Neither block was changed recently. There are other blocks on the front page, and throughout the site, that were not affected.

The links in the block were of the style href="node/123" (without a leading slash). After investigating any modules or settings that seemed related to blocks or links, we added a leading slash to the links (i.e. href="/node/123") just to see if that had any effect. It did. The links using a leading slash selected the primary domain while the ones without a leading slash choose one of the alternate domains.

Any links in the block without a leading slash used the same alternate domain, so Drupal wasn't randomly selecting domains for each link.

The site launched using 7.10 and this odd behavior didn't start until we upgraded to 7.14. This only appeared in one site (so far); our other Drupal sites don't do this.

So my question is, how does Drupal choose the domain to use when rendering links and did that change somehow in 7.14? Does Drupal read the Apache config file?

Thanks for taking the time to read and consider my question.


texts: I would like to use Organic Groups in a way that would make each group a company. Is there an expeditious way to do a mass modification of the label "group" wherever it appears on the UI? I'd like the references to "group" to be changed to "company".


texts:
I am trying to find a way I can cluster nodes on a Google Map from a custom entity according to particular regions in a country. I have been using the Geocoder module to geocode addresses but I now want to group these addresses into regional clusters. I need a way I can implement Google Map clustering in Drupal 8.

If there is a way to do it programtically please do not hesitate to illustrate.


texts: My 960 grid system has wider columns that standard. 55px instead 40px for 16 columns

texts:
I was surprised to discover my website is wider than is supposed to be.

I am using Drupal + Omega Theme that uses 960 grid system.

The total width of the site is 1180 instead 960.

The columns are wider:

On 16 columns options: they are supposed to be and 40px they are 55px
On 12 columns options: they are supposed to be 60px and they are 80px.

The gutter is 20px and is ok.

What is the problem?


texts: Can't add assets to my Bootstrap sub-theme

texts:
I'm currently struggling to include *.css and *.js files to my Bootstrap sub-theme.

I use Drupal 8 and the Bootstrap 3 base theme. I followed the instructions of the official documentation and went to create a custom SASS sub-theme for my site.

I could quickly use my newly created sub-theme in the admin panel. Great.

However it seems none of the assets registered in my *.libraries.yml are included in any page.

My SUBTHEME.info.yml file:

core:       8.x
type:       theme
base theme: bootstrap

name:         'My custom sub-theme'
description:  'This is a sub-theme of Bootstrap, using the Sass starter kit.'
package:      'Bootstrap'
version:      'alpha'

regions:
  navigation:             'Navigation'
  navigation_collapsible: 'Navigation (Collapsible)'
  header:                 'Top Bar'
  highlighted:            'Highlighted'
  help:                   'Help'
  content:                'Content'
  sidebar_first:          'Primary'
  sidebar_second:         'Secondary'
  footer:                 'Footer'
  page_top:               'Page top'
  page_bottom:            'Page bottom'

libraries:
  - 'SUBTHEME/global-styling'
  - 'SUBTHEME/bootstrap-scripts'

My SUBTHEME.libraries.yml file (unchanged):

global-styling:
  css:
    theme:
      css/style.css: {}

bootstrap-scripts:
  js:
    bootstrap/assets/javascripts/bootstrap/affix.js: {}
    bootstrap/assets/javascripts/bootstrap/alert.js: {}
    bootstrap/assets/javascripts/bootstrap/button.js: {}
    bootstrap/assets/javascripts/bootstrap/carousel.js: {}
    bootstrap/assets/javascripts/bootstrap/collapse.js: {}
    bootstrap/assets/javascripts/bootstrap/dropdown.js: {}
    bootstrap/assets/javascripts/bootstrap/modal.js: {}
    bootstrap/assets/javascripts/bootstrap/tooltip.js: {}
    bootstrap/assets/javascripts/bootstrap/popover.js: {}
    bootstrap/assets/javascripts/bootstrap/scrollspy.js: {}
    bootstrap/assets/javascripts/bootstrap/tab.js: {}
    bootstrap/assets/javascripts/bootstrap/transition.js: {}

I strongly believe my folder hierarchy is right ; I use the base bootstrap themes/bootstrap/templates/system/html.html.twig which embarks the following header:

<head>
  <head-placeholder token="{{ placeholder_token|raw }}">
  <title>{{ head_title|safe_join(' | ') }}</title>
  <css-placeholder token="{{ placeholder_token|raw }}">
  <js-placeholder token="{{ placeholder_token|raw }}">
</head>

The CSS / JS aggregation option in the admin/config/development panel is disabled.

I compiled sass/style.scss and I do have a corresponding css/style.css file, however it never shows up on my pages. Even worse, it seems none of the libraries assets are included either.

No, I didn't forget to clear the cache. I also tried to solve my problem by reading other questions, like this one or this one ; however the questions are either not resolved or do not apply to my case.

I tried to add the following lines to my SUBTHEME.info.yml, unfortunately it doesn't work either:

stylesheets:
  - 'css/style.css'

I tried to use the Drupal/Twig tag attach_library with no success.

Interestingly, assets added from third-party modules are successfully added in a way almost identical to what I'm trying.

I'm quite sure I'm missing something simple here. Any help deeply appreciated.


texts:
My drupal site uses normal cache system, as you'll probably know, the cache_page table is updated using as primary key the REQUEST_URI. This is great because when an anonymous user requests a page, drupal serves it to the client from the cache_page, and the best part is that all variables in the GET request are part of the cache id for serving that page.

So for example if I have these URL's

http://domain.com/gallery
http://domain.com/gallery?list_mode=thumbs

Both url's are different in the cache_page table.

The problem comes here, I want anonymous users to remember the last option that selected as "list_mode", so the next time they come they'll get one or another list mode by default. So I added list_mode as a SESSION var.
The problem is that accessing

http://domain.com/gallery

as anonymous, the page is served from cache with the default list_mode. (whose value is not "thumbs")

I don't want to stop using cache_page for this url (this was a possible solution), and the ideal thing would be adding some way this SESSION variable to the REQUEST_URI so the page will be served as it should , in this case would consist of translating:

http://domain.com/gallery  TO  http://domain.com/gallery?list_mode=thumbs

before checking the cache, so the user gets the second URL served instead of the first.

hook_boot would be a good place to do that, but I don't think that hacking the request_uri is a good idea, so, is there any other way to do this approach ?

Thanks for your help.

PS: I found a similar issue, the user makes use of the RewriteCond to achieve what he wants, and asks for a better solution, but the only answer advises to disable caching for that pages:
Cache page based on cookie value and URL


texts: How do I get a javascript library to work inside the CKEditor module?

texts:
My content administrators want to be able to toggle back and forth between bootstrap nav-pills inside of the CKEditor instance. Out of the box, CKEditor doesn't seem to allow javascript to function in the editor. An example is below - I need to be able to click on the different pills to edit the associated content:

I have found an associated question that seem to answer this issue but I cannot get it to work in Drupal - I don't know how to implement the code. I would add a comment to that question but I do not have sufficient reputation points.


texts: How to force drupal 7 to load HTTPS assets?

texts:
Environment:
apache + ssl + domain access

Our drupal 7 site uses domain access multiple sub domains
our server is SSL enabled

if I do not set $base_url in settings.php then all of our assets our loaded via HTTP and the user receives a mixed content error

If I DO set $base_url users are redirected to the default subdomain (e.g. foo.blah.com) instead of their current domain (e.g. bar.blah.com)

My question is, how do I force drupal to load all assets via HTTPS?

That way I can uncomment the #base_url


texts: How do I load a field collection from a node?

texts:
I have a node that has a few field collections on it.

When I look at node_load() output, I see:

[field_rich_text_group] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 6
                        )

                    [1] => Array
                        (
                            [value] => 7
                        )

                    [2] => Array
                        (
                            [value] => 8
                        )

                )

        )

What API function can I use to actually load the field data contained in the collection that has an entity_id of 6, 7, 8, etc?


texts:
What I want to do is checking whether a link is exist on frontpage.

I've set up a content with with node id 5 as my frontpage.

But when testing it, and see the verbose message (http://screencast.com/t/ldWSBwJNcO)
different page appear. The default drupal frontpage appear instead of the content that I've set up.

My test code:

class MyUserManagementTestCase extends DrupalWebTestCase {

  // Some says this improve tests performance
  protected $profile = 'test';

  public static function getInfo() {
    return array(
      'name' => 'My User Management Test Case',
      'description' => 'Ensure that the My functionality for user management works.',
      'group' => 'My',
    );
  }

  public function setUp() {
    parent::setUp();
  }

  public function testFrontpage() {
    $this->drupalGet('');
    $this->assertResponse(200, t('Frontpage page is accessible'));
    $this->assertLinkByHref('user/register');
    $this->assertLinkByHref('user/login');
  }
}


texts: How to make a user choose male or female and keep a default image on a specific content?

texts:
How can I make a user choose male or female and keep a default image on a specific content?

I mean I want two defaults pictures (for male and female), but only for default image in case user want to upload a different image this should be accept as normal.

And all this for one specific type of content.

I want this, just because this field must captures a photo but for the ones who don't want to upload a photo show a default profile image.


texts: Show all nodes in the Getlocations map with diffrent marker colors per Content Type?

texts:
I have three content types with Getlocations Fields and try to get a map with views (type: Getlocations) showing all nodes as marker in the map with different marker colors with "Content Type Markers" activated in admin/config/services/getlocations. I get only blue markers, this is the "Default Content Map marker". What is the trick?

Thanks for help.


texts: url redirections not working for anonymous users

texts:
I have set a redirect rule in EventSubscriber. So according to rule, when I hit example.com/my-page in browser, it should redirect to example.com/success or some external url also.

But issue is(for anonymous user):

On hitting first time this url "example.com/my-page", REDIRECT SUCCESS!! But on second time it does not redirect. It remains "example.com/my-page" only.

Now If I logged in, flush all cache, then again log out and check "example.com/my-page", it again works -- REDIRECT SUCCESS!! But again after redirecting first time when accessed the same, it stops redirecting.


texts: How do I insert a   tag outside the   tag on my main menu

texts:
I have been scouring the web trying to find a way to get a  tag just AFTER each of my main menu items. Looking at this solution I am able to get a  tag in there, but it's INSIDE the link. I just don't want it to be a link.

I'm pulling my hair out trying to figure this out. I just don't know enough PHP to place it outside the link. This is what I have so far in my template.php:

function motg_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';
  $element['#localized_options']['html'] = TRUE;

if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}

if ($element['#original_link']['menu_name'] == "main-menu"){

$element['#title'] .= ''.$element['#localized_options']['attributes']['title'].'';
}

$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '
' . $output . $sub_menu . "
\n";
}

Any help would be great!


texts: User generated review site where users are matched when they review products similarly

texts:
On my site users will be able to give a 1 to 5 rating for various different products. I want to show users other users that have rated products in a similar way.

So in simplistic terms, if the followong users rated a prodcut like so:

User A - 5 stars
User B - 4 stars
User C - 1 stars
User D - 0 stars

Then User A and User B would be matched, and User C and User D would also be matched.

How sophisticated an algorithm is achievable with only drupal modules and minimal php? Ideally a point system would find the similarity / difference between users’ ratings for all the products that they have both rated, and then find the top 5 closest matches and rank them accordingly.
Thanks


texts:
I'm using the Drupal Commerce module.

I want to make a discount rule where if there are 3 or more products of type X, you get a discount of 40% on all type X products. I don't know how I can do this without affecting type Y. Can this be done by pricing rules?


texts: How to create flagged nodes views that show up to colorbox using custom link

texts: I Have flagged nodes, but because there are many flagged list with user, I want to show flagged list if user click on the text link as I describe on the picture. How to figure out this stuff?


texts:
I have installed Date module since i made drupal installation, i built many date fields but Suddenly this message show up when i go to my content type's manage field page "Inactive fields are not shown unless their providing modules are enabled.

The following fields are not enabled:(here my date field and tell me date module is not enabled)"

When open modules page can't find date module but other sub modules exist like (date tools, date views ....)

I tried to recopy the date module and nothing change, date module still lost.

All my date fields disabled please help, thanks.


texts:
I am doing a migration right now and have a need to maintain how entities are related in a way that the core entity reference field does not seem to support.

Lets say I have two content types, Foo and Bar. I am migrating Foo first, and Bar gets stubbed.

I need to relate Foo to Bar, but the relationship is not one way. Bar is also related to Foo, but there is no way (when editing Bar) to see this relationship. If Foo or Bar are deleted, it needs to unlink that.

Does Drupal 8 do that yet? How would you effectively do this? Do you need to create a custom entity to hold links?

I looked at the Dynamic Entity Reference module and it does not seem to do this. I also looked at the Corresponding Entity Reference module and it looks dead with a lot of logged bugs (last release 2017).


texts: How to make taxonomy terms link to an external site?

texts:
I am using the Lexicon module to automatically insert links to a vocabulary with information about words in the lexicon.

But the vocabularies I am using are owned and hosted by a completely different organisation, which means that hosting the information on my website would result in duplicated and outdated information. Therefore I need to link my terms in the taxonomy to an external site (instead of this website).

I tried using the Redirect module but it doesn't manage tokens to external websites.

My question: how to make my taxonomy terms link to an external site?


texts: Is there a way to figure out the block machine name?

texts:
In Drupal 8, is there a way to figure out what current block or view machine name you should use?

For example, with the following code, I noticed that 'machine_name_to_determine' could change depending on how many times you have used your block.

$block_id = 'machine_name_to_determine';
$block_config = \Drupal\block\Entity\Block::load($block_id);

I need a way to retrieve this at run-time. How can I retrieve it?


texts:
I want to define a session in contributed module (field collection module) in drupal 7 when the page is loaded.

This session takes a value from the URL and fill one of the field that depend on it. I defined a session in the form_alter function but I need to refresh the page to let the session take the value? So, could anyone tell me where I can define it? In which function of the module?


texts: Context omega with Omega 4 not rendering block

texts: I have Omega 4 installed along with the Context omega module. I am trying to add a context based on my path to add two blocks to the template. I am working on a development server and based my context off one already working on the server, so I know the issue isn't with the path. However, when I save the context and go to the path, the two blocks that should appear in the header and first sidebar are not being pulled. I checked the code and it isn't there so it's not a styling issue. I flushed all caches and still nothing. Anyone have any pointers or suggestions?


texts:
I am grouping some shared functionality that will be used across multiple template files within a custom theme. I would like certain methods within this module to be accessible to the theme (ie. public) and certain modules only available to the module itself (ie. private).

I understand that modules in Drupal aren't classes, but I hate the idea of the modules 'private' functions being available across the site - it seems to unnecessarily pollute the global namespace.

Is there a way to hide/make private certain methods/functions within a module?


texts: Passing the Node Object ($node) to another Drupal Site (Instance)?

texts:
Can i pass the Node Object $node to another Drupal Instance (another Drupal Site) ?

Lets just forget about Node Conflictions .. and problems etc..
And lets assume i have a $node in a Script
Then ..
Is it POSSIBLE to pass a Drupal Node Object $node to another Drupal Instance? (to continue working on that $node at the destination Instance end)
How can i pass a $node to another Drupal Site?


texts: Pull in all child libraries of a library/module/theme with dependencies in yml

texts:
I have one contrib module and a custom module. The contrib module defines a lot of sub libraries and I want to depend all of it. Example:

Contrib module module_contrib.libraries.yml

module_contrib_lib: [...]
module_contrib_lib.sub1: [...]
module_contrib_lib.sub2: [...]
module_contrib_lib.sub3: [...]
module_contrib_lib.sub4: [...]
module_contrib_lib.sub5: [...]
module_contrib_lib.sub6: [...]
[...]

And in my  custom.libraries.yml

custom:
  [...]
  dependencies:
    - module_contrib/module_contrib_lib

But this doesn't pull in the subs, I tried with - module_contrib/module_contrib_lib.*, but it doesn't do anything. If I put - module_contrib/module_contrib_lib.sub1 ect it works. There's no any wildchar to pull in all of the sub libs?


texts: Display count of nodes from the parent terms of a taxonomy where dummy nodes are based on the child terms of the parent terms of taxonomy

texts:
'State' is the vocabulary of my taxonomy where North, South, East & West are parent terms with child terms like Montana, Texas, New York, Washington respectively which are states of USA.

I've created some dummy nodes on based of the child terms from taxonomy, is there any way to display the count of nodes from the parent terms of that taxonomy, so that the result would be something like North 10, South 5 and so on


texts: Adding Content to Drupal 7 through a remote PHP script

texts:
In our system, the content is generated by a standalone PHP script that runs from command line. Is there a way to add this content programmatically to a remote Drupal 7 CMS from this standalone PHP script?

I am not able to find such information on drupal.org. I have found the following code:

$node = new stdClass();

// Set content type
$node->type = 'article';

// Prepare defaults
node_object_prepare($node);

// Define language (currently language neutral)
$node->language = LANGUAGE_NONE;

// Basic content
$node->title = 'Test';
$node->body[$node->language][0]['value'] = 'Body text';

// Example if using custom fields
$node->field_CUSTOM_FIELD[$node->language][0]['value'] = 'Value';
// Example if using fields that are taxonomy type
$node->field_CUSTOM_FIELD_TAXONOMY[$node->language][0]['tid'] = 1;

// Save node
node_save($node);

But this code has to run from Drupal 7 server process only. This code cannot be used in a standalone PHP script that runs remotely. Another option is Entity API but that code too has to run on Drupal Server only. Do I need to create my own module and code my standalone PHP script to connect to API exposed by this module?


texts: ogmailing list + mailgun, getting error: PHPMailer error: Invalid address

texts:
Organic Groups - 7.x-2.6
Drupal 7.26
OG Mailinglist - 7.x-1.1-alpha2
Domain Access - 7.x-3.11

Hello, I am attempting to get Organic Groups configured with OG Mailinglist.
I am trying to set OG Mailinglist up to use MailGun. I have a local copy of drupal running on my dev machine.

When I try and configure it all and send a message by creating a new Group posting I get this error:
    PHPMailer error: Invalid address: @smtp.mailgun.org

OG Mailinglist comes with a submodule for MailGun, but there I didn't find any documentation on it.
Despite the fact that I did not find any documentation I gave a go at configuring.

Here is the OG Mailinglist configuration page. I got the smtp.mailgun.org from my mailgun account page. The Message validation string was already there and I did not change it.

Here are the mailgun settings for OG Mailinglist. I obtained the configuration info again from my MailGun account page.

These are my MailGun account pages. I obtained all of the configuration info for Drupal OG Mailinglist from these 2 pages.

The PHPMailer error does not show up in the reports section until after I try and create a new posting content. It then tries to send the mail to each person in the group, which fails.

Anyone know what I am doing wrong?

Thanks a mizzillion!!!


texts: How is the user logout process supposed to work?

texts:
I’ve built a complete private site. Everything seems to work. When users wants to  log out, they are redirect from /user/logout /user/login?destination=/, which seems the normal behavior, for what I understand.

A client told me he is not redirected to /user/login?destination=/ but stays on /user/logout, getting an Access Denied error.

I can’t reproduce this issue.

How is the logout supposed to work? Is the redirect from /user/logout to /user/login?destination=/ the normal behavior?


texts: Rules help to get contact_id from crm-core

texts:
Having a hard time trying to create a rule to 'Clear URL(s) from the page cache.'

Specifically I want to clear the path - crm-core/contact/[contact_id]/activity/[activity_id]
example: crm-core/contact/17/activity/39

My rule is like this.

Event: After updating an existing field collection item (which is attached to crm-activity)

Conditions - Entity has field

Parameter: Entity: [crm-core-activity], Field: field_activity_participants

here is what my url path looks like

  crm-core/contact/[field-collection-item:host-entity:field-activity-participants:0:uid]/activity/[field-collection-item:host-entity:activity-id]

I am thinking the 'participants:0:uid is NOT the same as crm-core's [contact_id]..also not sure How I can expose it - have tried many variation of 'entity has field' to see if contact_id is displayed somewhere with no luck.


texts:
I am trying to figure out the structure of a fieldable entity.
I can see the main table in to install file, however it has various fields attached to it. How can I get an grand overview of the structure programmatically?


texts: How do I create different user registration pages?

texts:
In my project, I need to have two types of user: normal user (who can buy products) and merchant user (who can upload products).

I made the registration page by creating the user_register.tpl.php template file.
I don't have any idea about how to make another registration page which will be used for merchant users.

Is there a contributed module available for this?


texts: How to omit form's validation at AJAX button click?

texts:
I have an AJAX button that should update form fields according to data already provided by user:

 'ajax_button' => array(
    '#type' => 'button',
    '#value' => t("Scan for tags"),
    '#ajax' => array(
      'callback' => 'ajax_tag',
      'wrapper' => 'dynamic-tags-fieldset',
      'method' => 'replace',
      'event' => 'click',
      'prevent' => 'submit click mousedown',
    ),
  ),

It works, but only if form is valid. Of course I do not want to validate it just yet. I don't care if all fields are filled, I only need my form to be updated at this very moment. How can I make form api not to invoke hook_form_validate() and not test #required fields?


texts: Update Filtered HTML 'Allowed HTML tags' for current content

texts:
I have a lot of content currently added to my site which is using the Filtered HTML text format.
It seems that the <p> tag was not present in the list of allowed tags when the content was first created and was displaying as plain text.

I have updated the list of allowed tags to include <p> but my content is still displaying it as plain text. I know I can just edit the content and save it again which will correct the issue but there are thousands of pieces of content of different content types.

How do I rebuild all content without going into each one and updating?


texts: How to add 1000 nodes of the same content type in just one step?

texts:
I need some advice with the following situation:

I have a content type called: "Flats".

I have to add 1000 nodes for this content type.

The only field I need to complete for all of them is the 'title'

I have the 1000 titles in a comma-separated-value format file called: title.csv

Is there any way to upload this file and add all the nodes in just one step.

Thanks


texts:
All,

I have been reading and experimenting, but have not been able to achieve the desired result - please offer some guidance.

My site has two content types: meeting and presenter. At each meeting, there are zero, one, or two presenters. Content type Meeting has a field type of Node reference whose 'number of values' is set to 2. When a Meeting content item is created, it is very simple to link the associated presenter.

The challenge is properly configuring the view. I would like to show each meeting's presenter(s) with the meeting information, whether I am showing just next month's meeting or an archive of past meetings.

I created a view based on Content type Meeting and created a relationship to the linked Presenter (by checking the box Content: Presenter (field_presenter_ref)). Where I am getting stuck, I think, is with the contextual filter. Based on my reading, I should be using Content: NID, but this does not seem to be doing anything for me. Specifically, if I remove date filters, the View shows all presenters from all meetings, not just the one associated with a specific meeting.

Looking forward to learning how to do this correctly - thanks.


texts:
I turned on Devel query log and at the bottom of my pages it shows the log with the number of executed queries and ms. When i visit any admin page for example /admin/appearance i have following entries in my query log:

 _update_cache_clear 73ms DELETE FROM cache_update WHERE (cid = :db_condition_placeholder_0)

DrupalDatabaseCache::clear 81.9ms DELETE FROM cache_bootstrap WHERE (cid = :db_condition_placeholder_0)

As i know, it shouldn't be more than a 5ms. I am using Xcache on my server with 16gb RAM. What's the culprit?

PS when i am visiting non-admin pages they all are loading very fast.


texts: Why doesn't my custom OutboundPathProcessorInterface work anymore?

texts:
I wrote my own implementation of OutboundPathProcessorInterface to rewrite the URL of nodes to use the content of their field_project_url field.

namespace Drupal\mymodule\PathProcessor;

use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\PathProcessor;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\node\Entity\Node;
use Symfony\Component\HttpFoundation\Request;

class MymoduleFieldRedirectPathProcessor implements OutboundPathProcessorInterface {

  public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {

    if (isset($options['entity']) && is_object($options['entity']) && method_exists($options['entity'], 'hasField')) {
      $node = $options['entity'];

      if ($node->hasField('field_project_url') && !$node->field_project_url->isEmpty()) {
        $project_url = $node->field_project_url->getValue();

        if (preg_match("/^\/node\/[0-9]+\/(edit|translate|delete|translations)$/i", $path)) {
          // dont alter operational paths
        }
        else {
          $path = $project_url[0]['uri'];

          dpm($project_url[0]['uri']); // 'http://url.com'

          $options['absolute'] = TRUE;
          $options['external'] = TRUE;
          $options['base_url'] = null;
          $options['prefix'] = null;
        }

        if ($bubbleable_metadata) {
          $bubbleable_metadata->addCacheableDependency($node);
        }
      }
    }
    return $path;
  }

}

The teaser of that view has a title, an image linked to the content, and smart trimmed version of the body field, also linking to the content.

The value is appended, giving (for example) http://localhost:8888/myprojecthttp%3A//url.com.

This used to work, but I can't even get this right with older Drupal 8 versions.

What am I doing wrong?


texts:
In Drupal, there are two different kinds of blocks: content blocks and plugin blocks.

We get content blocks like this:

\Drupal\block\Entity\Block::load('block_id');

and plugin blocks like this:

\Drupal::service('plugin.manager.block')->createInstance(
    'plugin_id',
    $config
);

I have a scenario where I don't know whether the block I'm looking for is a content or a plugin. I simply want to obtain the block given its id.

Of course, I can first try one version, test if I found something, an then try the other version.

But the problem to obtain a block by its id should be very common. So, I would expect that there's some builtin Drupal function that I should use. Which one?


texts: What are bundles? Can we create custom bundles?

texts: Does all nodes have bundles? Also can we create custom  bundles?


texts: Writing a news ticker module. It works, but it's sloppy as hell. Is there a better way to do this query?

texts:
I've got three pre-existing websites that use the story module, the path module, and CCK to produce customized news stories in Drupal 6. I wanted to create a news ticker module, to consolidate the news from all three sites, and replace the per site views based approach we're using now.

Studied the entire schema that the sites use, and dissected Drupal to see if there was a relatively straight forward way to do this. Turns out, there isn't. Architecturally, Drupal is all over the place.

So what I came up with was a situation where I do a crazy join between the nodes table and the the url_alias table, then union the whole thing together because the tables are identical between schemas.

Like this:

            SELECT
                   'site1' as disposition,
                   url_alias.dst as destination_url,
                   node.sticky,
                   node.promote,
                   node.created
              FROM    site1.node node
                   INNER JOIN
                      site1.url_alias url_alias

                   ON (node.nid = substring(url_alias.src,6,15) )

              WHERE substring(url_alias.dst,1,5) = 'news/'

              UNION

              SELECT
              'site2'  as disposition,
              url_alias.dst as destination_url,
                   node.sticky,
                   node.promote,
                   node.created
              FROM    site2.node node
                   INNER JOIN
                      site2.url_alias url_alias

                   ON (node.nid = substring(url_alias.src,6,15) )

              WHERE substring(url_alias.dst,1,5) = 'news/'

              UNION

              SELECT

              'site3'  as disposition,
              url_alias.dst as destination_url,
                   node.sticky,
                   node.promote,
                   node.created
              FROM    site3.node node
                   INNER JOIN
                      site3.url_alias url_alias

                   ON (node.nid = substring(url_alias.src,6,15) )

              WHERE substring(url_alias.dst,1,5) = 'news/'

              ORDER BY 4 DESC

But it seems to me that this is incredibly sloppy, and that there has to be a better way to do basically the same thing by depending on correctly formed relationships and keys, rather than using SUBSTRING to parse url aliases.

What do you think?


texts: Customise Webform Email Submission Data 2

texts:
I had read some info from this content: How to use [submission:values] in Email template in Webforms

Submitted on [submission:date:long]
Submitted by user: [submission:user]
Submitted values are:
[submission:values]

The results of this submission may be viewed at:
[submission:url]

Name: [submission:values:name:nolabel]
Address: [submission:values:address:nolabel]

I add last two code in the email setting, but it only print name: and address:

I also try this %email_values %email[name], but it print out as string.

What wrong with my code?

Many Thanks.


texts: Adding offline functionality to Commerce POS

texts:
I'm looking into using drupal commerce on drupal 8 to make a custom pos. I'm also using the commerce pos module. One of the features required is a limited offline functionality.
As mobile terminals frequently loose net connectivity having the ability to process orders offline and then push those orders to the central commerce site is a must.

Short of using an external pos application or completely removing the pos module and creating a react app is there a way to add some sort of offline functionality to the existing commerce pos ?


texts: Redirect to PayPal site without payments pane in checkout

texts:
On the checkout forms review pane when i select to pay with Paypal WPS and submit the form it get's redirected to an intermediary pane which is the payments pane.
And only after 10 seconds it redirects to the PayPal site, there's a button as well..

Could this step be left out? If so, what is the right configuration.

So when selecting PayPal WPS payment and submitting the form it should automatically redirect to the PayPal site.


texts: In Drupal 8 Javascript is not enabled by default on all pages? How can I enable it for specific pages?

texts:
How can I enable the javascript or jQuery in certain pages in Drupal 8? Any example will be really helpful.

Thank you.


texts: How can a field be rendered as a  element?

texts:
The problem:

I would like to be able to manage custom <meta> elements, on a per-item basis in a custom theme. An example would be for adding open graph and schema tags, but I'm really looking for a generic solution.

I'm aware of custom modules, such as Meta Tags, but I'd rather avoid relying on other modules at this point.

What I've Tried:

After looking at them_field it looked as though I should create a custom theme function for my custom field (field_test being used for this example). The theme function could add a <meta> tag and not return any content to be rendered.

In template.php:

<?php
//I *did* actually use my theme name instead of THEMENAME
function THEMENAME_field__field_test($vars) {
    drupal_add_html_head(array(
        '#tag' => 'meta',
        '#attributes' => array(
            'content' => drupal_render($vars['items'][0]),
            'name' => 'test'
        )
    ), 'test');

    //I figured this would prevent the field from being rendered inline
    return '';
}

Using that code the custom <meta> element was correctly added to the <head>. Nevertheless, the field was still rendered on the page.

If I changed the output to:

return ' ';

The content was no longer rendered to the page, but an unnecessary space character would be output where the field was to be rendered.

Is there a better way to render a field as a <meta> element?
-or-
How can I prevent this themed field from rendering inline?


texts: How to do Domain site name translation (DA module)

texts:
I just want to translate site name to different language - so when users browse a domain in english they see English site name, and when they browse in polish for example, they see Polska nazwa strony.

I got all modules (Domain Access, i18n, Variable) and I had enabled two languages, checked variable (site name) in admin/config/regional/i18n/variable - but I can't translate the site name.

I try to translate it on admin/config/system/site-information page - different name for en patch and different for pl - no results, and on admin/structure/domain/view/X/config - also without any results.

Any idea how to menage to translate site name? Am I doing something wrong?

I have tried the Domain Variable module also already (as suggested in one of the answers), with no avail. I have read this nice article by Jose, but it just doesn't work on my site (Drupal 7.38, Domain Access 3.11 and latest version of the Variable module). I did set everything step by step, but I can't figure out what is going on and why this doesn't work.


texts: PluralTranslatableMarkup does not return plural value

texts:
The code bellow should return plural.

use Drupal\Core\StringTranslation\PluralTranslatableMarkup;

$trans = new PluralTranslatableMarkup(12, 'singular', 'plural');
$output = '' . $trans;
$output1 = $trans->render();

Both $output and $output1 returns singular;

Any clues why? Thank you.


texts: Emails sent via a Rules action contain arbitrary line breaks

texts:
I have an email sent by Rules. Here is the text of the email in the Rules action:

  Welcome to x! As a professional user, you can now showcase your
  business on x by creating a Professional Profile and uploading photos
  of your best x.

Here is what the user gets (note line breaks):

Welcome to x! As a professional user, you can now showcase your
business
on x by creating a Professional Profile and uploading photos of your
best x.

I'm not sure why there are arbitrary line breaks being inserted in the text when sent via email. I've excluded the RTE on email field in the rule, and included only plain text.


texts: EntityFieldQuery select entity if at least one tid is in the array?

texts:
This seems like it would be a common need but I don't see how it can be done with the operators available. I have a taxonomy reference field that allows multiple values. I would like to construct an EntityFieldQuery that selects the entity if at least one of the tid's is in the given array.

$query->fieldCondition('field_tags', 'tid', $tid_array, 'CONTAINS_ONE');


texts: Drupal Content Updates Not Visible to Public Without Login Attempt

texts:
New to Drupal picking up an existing prototype site design from another newbie.

Installed version = 7.28

Whenever I make any updates to contents or even site name and tagline, as Administrator I see the updates listed as "published".

If I log out and reload the web page, it does not display any of my updates, until I click the user login button on the homepage. (The button was part of the existing Homepage design.) It does not matter whether the login attempt authenticated or not, the web page would refresh and the updated content loads and displays correctly. However, without the login attempt, the site content remains at the revision before the last update, same behavior whether browsing in Firefox or IE.

The permissions for viewing contents is enabled for Administrator, Authenticated User, and Anonymous User. The Drupal site seems to treat an unauthenticated log in attempt to be an Anonymous User. What about when the site URL is entered in the browser, and the public is viewing the site? What is the "role" of the viewer of the site before a login attempt is made?

Where is the site content being pulled from to display in browser when the site URL is first loaded?

Where is the site content being pulled from after a login attempt?

Thanks for any help to point me in the right direction to debug this!


texts: Change the default selection for a Views 2 exposed filter

texts: I have an exposed filter in my View that allows users to choose between two different content types. The default value for the exposed filter seems to be chosen by whichever content type comes first alphabetically. So, if I let users choose between "Band" and "Song" content types, the default is "Band". I want to change this default value to a different content type ("Song" in the example here). I can't find an option in the Views interface for this. Do I have to do this via hook_form_alter? If so, how exactly would I do that?


texts:
I am a new vibe drupal developer and I have created content type as an event which displays on home page upcoming event as blogs
i have created a simple blog event using view home page but I don't know how to achieve these using view or other modules. plz correct me if i am wrong thanks in advance
Expected result
when a user clicks these of any event it displays image and title description main square

image
event title

One
event description

title: 1 jan(Date)
description:event description
title: 2 jan(Date)
description:event description
title: 3 jan(Date)
description:event description


texts:
Hello  I am using drupal 7  and yslow tool in ff.

it shows me grade B

Grade F on Make fewer HTTP requests

This page has 11 external Javascript scripts. Try combining them into one.
This page has 5 external stylesheets. Try combining them into one.

As i am not able to combine all javascript and  css files.

I also enabled cache . but i don't know how it work.

Grade F on Add Expires headers

There are 75 static components without a far-future expiration date.

i also made changes in .htacess file still not working .. Please let me know

Grade C on Put JavaScript at bottom

i am using iframe in my website . How to include javascript at bottom for this?

Anybody have idea please let me know.

Thanks


texts: How to make global math expresssion in views searchable?

texts:
I did manipulation calculation on webform submission data in Views by using Global Math Expression. I need to use filter of this Math Expression field, but I could not find it in the filter field. I tried to define in relationship also not available.

How can I use the global math expression in view filter?


texts: Destination fields not filled from custom migration process plugin

texts:
I'm working on a D6 -> D8 migration, and my destination has a custom video upload field (field_video_upload) that contains three pieces of data: video, thumbnail, and poster (field_video_upload_video, field_video_upload_thumbnail, field_video_upload_poster respectively in the db). I'm attempting to migrate that data from my source table (actually a MySQL view) that has the data in a serialized format, and I'm using a custom source plugin to get the data.

  public function prepareRow(Row $row) {
    //TODO: Extract url from video_data field and video_thumb from thumbnail_data.
    $video_data = get_object_vars(unserialize($row->getSourceProperty('video_data')));
    $thumbnail_data = unserialize($row->getSourceProperty('thumbnail_data'));
    // Get the array values. Seems to be the best way to work around having an
    // array key of 0000000.
    $video_data = reset($video_data);
    $video_url = $video_data->url;
    $video_thumb = $thumbnail_data['video_thumb'];

    // Set the source properties.
    $row->setSourceProperty('video_url', $video_url);
    $row->setSourceProperty('video_thumb', $video_thumb);
  }
}

Here is the relevant portion of the migration configuration .yml file:

  field_video_upload:
    plugin: video_upload
    source:
      - video_url
      - video_thumb

and here is the custom process plugin video_upload to get the data:

namespace Drupal\migrate_mrctv\Plugin\migrate\process;

use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;

/**
 * This plugin gets values for the video upload field.
 *
 * @MigrateProcessPlugin(
 *   id = "video_upload"
 * )
 */
class videoUpload extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $video = array();

    list($video_url, $video_thumb)  = $value;

    $video['video'] = $video_url;
    // Use the same source thumb value for poster and thumb.
    $video['thumbnail'] = $video_thumb;
    $video['poster'] = $video_thumb;

    return $video;
  }
}

The source plugin works fine, and the data from the plugin is available in $value in videoUpload::transform(). However, none of the data is getting into this field in the node itself. The main node data is there, but no data for this field.

What do I need to change to get the data to import into my custom field?

Thanks.

UPDATE: In stepping through the Migrate code, I came across this line in Row->setDestinationProperty:

NestedArray::setValue($this->destination, explode(static::PROPERTY_SEPARATOR, $property), $value, TRUE);

and since PROPERTY_SEPARATOR = '/', I tried this in my configuration:

'field_video_upload/video': video_url
'field_video_upload/thumbnail': video_thumb
'field_video_upload/poster': video_thumb

but no difference.

UPDATE 2: Based on the answer from @heddn below, I'm using the iterator plugin as part of a pipeline, since this is a multivalue field, even though it's set to only allow one value.

  field_video_upload:
    -
      plugin: video_upload
      source:
        - video_url
        - video_thumb
    -
      plugin: iterator
      process:
        video: video
        thumbnail: thumbnail
        poster: thumbnail

and modifying my plugin:

  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $video = array();

    list($video_url, $video_thumb)  = $value;

    $video[] = array(
      'video' => $video_url,
    // Use the same source thumb value for poster and thumb.
      'thumbnail' => $video_thumb,
       'poster' => $video_thumb
    );

    return $video;
  }
}

This appears to work in that I the array from the video_upload plugin is passed as $value to the iterator plugin, but I'm still not getting values in field_video_upload.  What else am I missing?


texts: Issue with attaching an existing file while creating node using RESTWS

texts:
I am trying to create a new node using the restws drupal module. My content type has just two fields: title and a file. However, when i send the request with following payload, i get an error. The file which i am referring in the payload is already existing on my drupal server.

URL : CMS_BASE_URL/node
Method : POST

Payload:

<?xml version="1.0" encoding="utf-8"?>
<data>
      <field_my_file>
                <file resource="file" id="24">CMS_BASE_URL/file/24</file>
      </field_my_file>
      <type>filetest</type>
      <title>My 1st file test</title>
      <language>en</language>
      <author resource="user" id="5">
      </author>
</data>

Error - 406 Not Acceptable: Invalid data value given. Be sure it matches the required data type and format.

Is there any problem in the way i am sending the payload? If i remove the "file" part from the payload, it is able to create node.Please guide me if this is not correct.


texts: I have a content page contain three field. Number A: Number B and Total Number. During add content page, I fill up Number A: 20 and Number B: 30. How to let Total Number auto display 20 + 30 = 50?


texts: Figure out the difference between loaded JS, CSS files, and files needed to be loaded for new content

texts:
I'm looking for a way to figure out what CSS and JavaScript files are loaded, and what else CSS and JavaScript files needed to be loaded for new content I'm injecting with AJAX.

I've am module file, where I load my my_ajax.js file with hook_init(). Also there's a hook_preprocess_page() function that is looking for an AJAX request. When there's an AJAX request, I use another page.tpl.php to output only $content and the entire head of the requested content.
This is not really a clean solution, but many contents needs additional CSS and JS files, for working properly. So, I decided to put the needed CSS and JS files, in kind of, inline to the body.
As I mentioned above, that is not a clean solution, but it works for me. The problem is when I inject new content with its head, into the body; every time I load the content through AJAX, all files are getting reloaded, and not from cache as it should be.

Because of that, I think I could only load the missing JS and CSS files, which are not already loaded. For that way, I have to find out what files are already loaded in regular head, what additional files does the new content need, and then only load the needed one.

Here are my module's files.

my_ajax.module

function my_ajax_init() {
  drupal_add_js(drupal_get_path('module', 'my_ajax') . '/my_ajax.js');
}

function acquia_slate_preprocess_page(&$vars, $hook) {
  if ( isset($_GET['ajax']) && $_GET['ajax'] == 1 ) {
    $vars['template_files'][] = 'page-ajax';
    $variables['loaded_js'][] = $variables['scripts'];
  }
}

my_ajax.js

Drupal.behaviors.my_ajax = function (context) {
  $('#content-group-inner a').live('click', function (e) {
    $('#content-group-inner a').addClass('my_ajax-processed');
    var url = $(this).attr('href');
    $('#content-region-inner').empty().html('');
    $('#content-region-inner').load(url,'ajax=1',function() {
      Drupal.attachBehaviors('#content-region-inner');
    });

    return false;
  });
};

page-ajax.tpl.php

<?php print $styles; ?>
<?php print $setting_styles; ?>

<?php if ($local_styles): ?>
  <?php print $local_styles; ?>
<?php endif; ?>

<?php print $scripts; ?>
<title><?php print $head_title; ?></title>
<?php if (arg(0) != 'admin') { ?>

<?php } ?>
<?php print $scripts; ?>

<?php print theme('grid_block', $tabs, 'content-tabs'); ?>

    <?php if ($title): ?>

<?php print $title; ?>

    <?php endif; ?>
    <?php if ($content): ?>

        <?php print $content; ?>
        <?php print $feed_icons; ?>

    <?php endif; ?>

<?php print $closure; ?>


texts: Webform Custom URL ?sid=[submission:sid] does not pick up sid

texts:
We have redeveloped a website for a company in Wordpress. However, they have a complex Drupal 7 webform that must be used on the website. We have chosen to place the Drupal installation with webform in a subfolder of the Wordpress website.
This works fine on the 2 test servers. However, on the main server where the website is being deployed, the Drupal webform is not working correctly. So the issue is specific to a server.
Here is a summary of the problem:

The user fills out the webform and submits.
Calculations are done, and all user data is correctly registered in the Drupal back-end in Content/ Webforms/ Submissions. (ok to this point)
However, the front-end should then redirect to a results page. This is done by setting the Custom URL field to: node/177?sid=[submission:sid]. As far as I can see, the sid value is not being picked up (it is empty).
A confirmation email is also sent to the user, but calculated values in the email are unpopulated.

The code that is not picking up the sid is below (taken from a file called node--177.tpl.php ):
<?php
module_load_include('inc', 'webform', 'includes/webform.submissions');
if(isset($_GET['error'])){
    $error = 'Veuillez réessayer';
}else{
    if(isset($_GET['sid'])){
        $sid = $_GET['sid'];
...

So on test servers sid is populated. On the production server it is empty.
I have looked all over for the solution, and cannot find the problem. I can only think it is related to being in a sub-folder.
It may also be indicative of the problem, I observered that the  tag displays correctly on the test servers, but on the production server it is empty.
Has anyone come across an issue like this?
Thank you.


texts: Interface Translation: Separate Drupal interface strings from theme strings?

texts:
I want to translate all the t() strings in my theme but there's no way to filter those strings by your theme only. Instead they are bundled with Drupal interface strings which creates an excessively large export to deal with and potentially unwarranted translation requests from core strings such as:

!local-task-title!active

which is located in function theme_menu_local_task of includes/menu.inc

Is there a solution on how to filter your strings by ones in your theme only?


texts:
I've been searching and trying for two days to add the jQuizzy engine to my site with no luck!
I've successfully added some jQuery plugins to my site, but I can't seem to be add this one?!

I created a block. In the block is a link that calls a menu item. The menu item gets a drupal form. In the form I added all the JS and CSS ... Nothing is happening?!

Help!!!


texts:
I have an FAQ page, where in the title it has some html tags, I would like to show the title in the views. When the view is displayed, it is showing html tags as well. How can I get the html processed value.

Is it possible?


texts: How to make fields available to users in Drupal 7?

texts:
I want users to participate in creating some content. I allowed them (people/permissions)  to create own content on particular content type. The question is: how to provide them access to fields of content type, that are available to me as administrator? In other words, I can put content in fields through my admin panel, but how to make users possible to meet that fields, how to make fields  public?
Thanks in advance!


texts: Display all terms in the same lineage when user can save only the deepest level

texts:
I'm using D7. I have a vocaburaly. User are enforced to save the deepest term in the vocaburaly with SHS(Simple Hierarchical Select). And, by the setting of SHS, user can save only a term on the deepest level.

Now, I'd like to view not only the term on the deepest level but also all terms in the same lineage of it as plain text. So I tried this using Views module. With views, I set "Taxonomy term: Parent term" in relationship and add "(Parent) Taxonomy term: Name"" in fields. But, it only can display only the parent level of the deepest level. I'd like display all terms including great-grandparent and more above levels. Can anyone give me a tip to do it?

Thank you in advance.


texts: Unable to change product type field formats in Manage Presentation screen

texts:
In one of my Drupal 7 web I'm unable to change the product type field formats in the Content Type - Product - Manage Presentation screen. When changing from 'Visible' to 'Oculto(=Hidden)' I get a screen without overlay or just a white screen, the browser is like keeping loading. However I can change the 'Etiqueta' (=labels) on the same page without problem.
Screenshots of the problem:

After changing, during 2 seconds:
http://www.nauticdirect.es/files/Nauticdirect_problema_campo_product_typ...

After 2 seconds until infinity:
http://www.nauticdirect.es/files/Nauticdirect_problema_campo_product_typ...

I have 3 product types: Product, Anclas and Cabos. The problem occurs with all three types. However it has worked before as I have changed some of these fields one year ago.

I am strugling with this more than a week. I've tried different browers and computers. I have updated all Drupal (7.41 now) and modules to their latest version. Also I have contacted the hosting, they moved to another server and increased available memory size. On this same server I have an almost identical Drupal 7 site where I don't have this problem.

Today I found out the same problems occurrs when adding a condition to a Ubercart shipping quote.

I would be very glad if somebody knows the solution or can give me a hint where to look.

Thanks very much!

Regards,

Henk


texts: I use drupal 6 with rules. I have more than 200 scheduled tasks (updating node's field)waiting to be executed at one time. Do I need to worry about server crash or is there some kind of queue implemented in scheduler? Thank you.


texts:
My view have following "EXPOSED" filters with Industry. And Contextual filter of Taxonomy.  So when I do asia/agriculture. %1 should be Asia and it's coming along fine. But %2 should go to Exposed Filter and it should filter out all the nodes with "agricultural" term.

Is it possible in Drupal?


texts: How to properly sanitize the input from an admin form on save and when referenced in controller class?

texts:
We have an admin form that has two text fields ('pattern' and 'host'). In a ControllerClass we have to use the input to perform some logic.

How would we properly sanitize the input from the two text fields on save of text field values and when retrieving the value in a controller class?

Current code:

class MyModule extends ProviderPluginBase {
  public function _some_function($input) {
    $mymodule_config = \Drupal::config('mymodule.settings');
    $host = $mymodule_config->get('host');
    $pattern = $mymodule_config->get('pattern');

    /* we will need to use the $host and $pattern */
}

We initially thought that HTML::escape would work, but that is for output. Not sure how to sanitize the input.

Example of what we tried for the controller class:

$escapted_value = _some_sanitization_function($pattern);

When saving the text field value:

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->config('mymodule.settings');
  $config
    ->set('pattern', _some_sanitization_function($form_state->getValue('pattern'))
    ->set('host', _some_sanitization_function($form_state->getValue('host'))
    ->save();
}


texts: How to make Drupal 8 forget an old deleted field?

texts:
After deploying a Drupal 8 site to a new server, we have the problem of an old deleted field being remembered by some subsystem or other, leading to this error being thrown on whenever cron runs:

Drupal\Core\Database\DatabaseExceptionWrapper:
SQLSTATE[42S02]: Base table or view not found:
1146 Table 'drupal8_neu_default.field_deleted_data_1c89727af8' doesn't exist:
SELECT DISTINCT t.entity_id AS entity_id
FROM {field_deleted_data_1c89727af8} t
WHERE  (bundle = :db_condition_placeholder_0)
LIMIT 50 OFFSET 0; Array
(
    [:db_condition_placeholder_0] => video
)
in
Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge()
(line 1546 of /srv/www/neu.default.ch/builds/v1.0.0-alpha.7/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

I've spelunked all over the database, and I can't figure out where to expunge the reference to this long-dead table. It's not mentioned in config and the field_config table we knew from Drupal 7 is long gone. It's also not in the exported configuration.

Does anyone know how to fix this?


texts: WYSIWYG edit view of text is below image in content but node view isnt.

texts:
In my WYSIWYG edit view ive hit return to make some text apear below an image in the content. However when I save the text is alongside the image, half way down but below.

Why does the edit and node view look different? How can I solve this? Thanks


texts: How to implement entity-relationship model (sql like) and prevent deletion mantaining integrity?

texts:
I tried to search through a number of forum and google along, but I did not find any solution, yet.

I would like to implement on my drupal 7 site a set of entities related each other as you would do in a standard sql db:

I created three entities: person, city, country

The entity city has a field referenced to the entity country  (using entity reference module).
The entity person has a field referenced to the entity city.
I'm able now to create a person and select a city after I've selected the country (thanks to the entity relations).

I filled in some countries, cities and persons.

When I deleted (not for intention) a city that is used (related to) by many persons I discovered that Drupal deleted the city entity without warning me that som persons are related to such city. The persons related to such city, kept on existing with the field city set as blank...

I though entity relations could have a behaviour just like sql db, where there is integrity reference consistency (you cannot delete items in table if they're referenced as foreign key in another table)

Is there a way to prevent deletion of entities that are referenced by other entities?


texts: HTML tags after umlauts causing premature header sending - CK editor

texts:
I'm maintaining some old Drupal 7 site (not created by me) and since couple of months ago it started acting strange (I didn't make any change on site):
Inside some content type there is a formatted text field that is edited with CKEditor.
If field contains just a plain text and I try to save it (when editing the node) it works well.
If I make some text bold at beginning of the whole text and try to save it works well also.
But if I try to make some text bold after first umlaut character (site contains German text) and try to save I get 403 error - forbidden?!?
In drupal's error log I see the error:

Warning: Cannot modify header information - headers already sent by (output started at /home/www/project_name/includes/common.inc:2776) in drupal_goto() (line 705 of /home/www/project_name/includes/common.inc).

I even suspected that site has been hacked but I don't see any suspicious new files there.
Any idea?
/**
 * Performs end-of-request tasks.
 *
 * This function sets the page cache if appropriate, and allows modules to
 * react to the closing of the page by calling hook_exit().
 */
function drupal_page_footer() {
  global $user;

  module_invoke_all('exit');

  // Commit the user session, if needed.
  drupal_session_commit();

  if (variable_get('cache', 0) && ($cache = drupal_page_set_cache())) {
    drupal_serve_page_from_cache($cache);
  }
  else {
    ob_flush();
  }

  _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE);
  drupal_cache_system_paths();
  module_implements_write_cache();
  drupal_file_scan_write_cache();
  system_run_automated_cron();
}

That 2776 row is ob_flush() call. 705 is header() function call inside drupal_goto() function.


texts: How to NOT change the path/uri after applying a style?

texts:
I'm working on a module. It uses an API to serve images. One of it's features is calling for a custom resolution image by GET request. So for example

myapi.com/img4324342?w=22&h=55.

I'm currently abusing the style function from the Image module.

I call hook_preprocess_image() and if it detects my effect (my custom style that has my custom effect) it has to return a modified path. But the path get's malformed when I apply a style. I just want to have the original URI so I can use the information inside to construct a REST call. How to prevent that the URI changes after style a.k.a. how to return the original URI as Path?

Background:

It's a brand portal and I'm an intern making the drupal plugin. The company I work for doesn't want the images to be served from the Drupal hosting, only provided by the API. But they ALSO want that adding a different banner for example to every article is still done the same way you normally do: by adding a image style and adding it as a field to the content type

The $vars variabele from hook_preprocess_image() in json looks like this:

{
 "path":"?itok=D1zdawxe",
 "alt":null,
 "style_name":"thumbnail",
 "width":null,
 "height":null,
 "title":null,
 "attributes":[],
 "theme_hook_original":"image",
 "theme_hook_suggestions":[]
}

after applying any effect.

This means that when I don't apply any effect my Path (my Uri) is myscheme://img23423423432 and when I do apply ANY effect it get's malformed to random gibberish like ?itok=D1zdawxe


texts: Automatically choose specific option from select field attribute based on inbound link / previous page?

texts:
I have three pages that each describe a product that we sell. Each of those pages has a button/link that says "buy now". Those links all take you to a single Ubercart product page with a select list attribute where they can select the name of any of the three products that I mentioned previously and add that product to their cart.

I'd like to have the name of the product from which they came automatically selected in that attribute field. Is there a way to do this via some kind of URL string, or another method?

Thanks!


texts:
I've been using Display Suite for Drupal 7 (with Bamboo theme,) and I'm trying to build a layout template that contains 5 rows, so I can place the appropriate fields into each row, making all content nice and tidy.

I've followed the instructions here, but I'm doing something wrong: https://www.drupal.org/node/1098068

I'm guessing it has to do with the PHP code, because I'm getting errors involving my wrappers. Here is the PHP code for the tpl.php file:

<?php

/**
 * @file
 * Display Suite Bamboo custom template.
 */
?>
<<?php print $layout_wrapper; print $layout_attributes; ?> class="ds-bamboo <?php print $classes;?> clearfix">

  <?php if (isset($title_suffix['contextual_links'])): ?>
  <?php print render($title_suffix['contextual_links']); ?>
  <?php endif; ?>

  <<?php print $first_wrapper ?> class="introduction<?php print $first_classes; ?>">
    <?php print $first; ?>
  </<?php print $first_wrapper ?>>

  <<?php print $second_wrapper ?> class="entry1-group<?php print $second_classes; ?>">
    <?php print $second; ?>
  </<?php print $second_wrapper ?>>

  <<?php print $third_wrapper ?> class="entry2-group<?php print $third_classes; ?>">
    <?php print $third; ?>
  </<?php print $third_wrapper ?>>

<<?php print $fourth_wrapper ?> class="entry3-group<?php print $third_classes; ?>">
    <?php print $fourth; ?>
  </<?php print $fourth_wrapper ?>>

  <<?php print $footer_wrapper ?> class="group-footer<?php print $footer_classes; ?>">
    <?php print $footer; ?>
  </<?php print $footer_wrapper ?>>

</<?php print $layout_wrapper ?>>

<?php if (!empty($drupal_render_children)): ?>
  <?php print $drupal_render_children ?>
<?php endif; ?>

I think it is very possible I am also writing my .inc file incorrectly. Here is that code as well:

<?php
function ds_ds_bamboo () {
  return array(
    'label' => t('Bamboo DS'),
    'regions' => array(

        'introduction' => t('Introduction'),
    'entry1-group' => t('Entry 1'),
    'entry2-group' => t('Entry 2'),
    'entry3-group' => t('Entry 3'),
    'group-footer' => t('Footer'),
          ),
    // Add this line if there is a default css file.
    'css' => TRUE,
      );
}

I would be very appreciative if someone can set me in the right direction. Thank you!


texts: Is there a way to theme a user's profile but make it per user instead of globally on all users?


texts: How to save a new term with multiple fields while adding content?

texts:
Not only do I want to add terms as I create content through the UI, but I want to add terms that have multiple fields (i.e. more fields on the taxonomy besides the 'Name' that populates the list). How can this be done?

I'm mixing a few concepts here:

Add terms through the Add/Edit Content page
Display the different fields of a taxonomy on the Add/Edit Content page.


texts: How can CSS emulate content display with labels in one column and data in the other?

texts:
I have set the Manage Display option to make the field labels Inline, given them a fixed width so that all the data is lined up in a column.

.field-label-inline .field-label {
  margin-right: 6px;
  text-align: right;
  width: 110px;
}

The problem is that when the is long, the data it gets positioned below the label rather stay to the right of the label. I want as though it was a table with the right-aligned labels in the first column and the data in the second column.

Can that be accomplished via CSS?


texts: A relationship to the latest referencing entity in views

texts:
I am not quite sure how to do this. I have content type A and another content type B which references content type A using an entity reference field. So A can have multiple nodes of type B referencing it. Not B has a date field.

Now what I want to do is create a view that lists content of type A but sorted based on the date field of the latest node of type B that references it.

I am not really sure what is the best way to achieve that. Any help is highly appreciated.


texts:
I'm working on a custom module, and I'm building menu items using entries in a database. These are being cached, and the database is only really updated about once a month.

I'm having an issue getting wildcards to work with this menu.

Here's my menu structure that WORKS:

$dbconn = dbConnect();
$query = "SELECT TOP 3 id, title FROM table";
$q = mssql_query($query, $dbconn);
while($r = mssql_fetch_assoc($q)) {
    $title = $r['title'];
    $items[$title] = array(
        'title' => $r['title'],
        'description' => 'Page for ' . $r['title'],
        'page callback' => 'programs_page',
        'access callback' => TRUE,
        'type' => MENU_NORMAL_ITEM,
    );
}
mssql_close($dbconn);

But the moment I add the % into the array key, the menu items just disappear, like so:

$items[$title . "/%"];

Any suggestions on why drupal is tripping up on this? Even if I tack the ."/%" onto the $title variable, it doesn't work.


texts: Create content in chinese language in drupal 7?

texts: I want to create content in Chinese language manually in drupal 7 just by inserting translated text into body, without using any module like internationalization. Kindly suggest any solution ? Do I need to add language support for chines by using 'locale' module ?


texts: "Failed to set field" Problem with SimpleTest, testing a form

texts:
With SimpleTests, I want to test a form similar to :

  // Textfield :
  $form['fieldset_name']['test'] = array(
    '#type' => 'textfield',
    ...
  );
  // Submit :
  $form['fieldset_name']['submit_button'] = array(
    '#type' => 'submit',
    '#submit' => array('my_module_form_submit'),
    '#value' => 'Submit button',
  );

This form is accessed from 'admin/config/my_module'. So I add the following test in my_module.test :

  function testForm() {
    $path = 'admin/config/my_module';
    $edit['test'] = 'testing field\'s input';
    $this->drupalPost($path, $edit, t('Submit button'));
  }

When I run the test, it fails with these errors :

  Failed to set field test to testing field\'s input

  Found the Add button (failed)

Where am I wrong ?


texts: How to close overlay on background click

texts:
Please help me to make overlay closed on background click. I am trying with following code but it is not working:

jQuery('.overlay-modal-background').live('click', function(e) {
  Drupal.overlay.close();
});


texts: profile2_load_by_user Trying to get property of non-object

texts:
I use simple code to hide field from profile2 main profile based on another field inside the profile2 main profile. If field_testcheckbox is not checked, hide field_info.

function odbornik_fields_form_profile2_edit_main_form_alter(&$form, &$form_state){
global $user;
$profile = profile2_load_by_user($user->uid, 'main');
$checkbox = $profile->field_testcheckbox['und'][0]['value'];
  if ($checkbox == 0) {
     $form['profile_main']['field_info'][LANGUAGE_NONE][0]['#type'] = 'hidden';
    };
}

This code works ok for all users browsing their profiles, except admin user browsing own or others profiles, where I get error: Notice: Trying to get property of non-object on line with this code.

$checkbox = $profile->field_testcheckbox['und'][0]['value'];

Admin has the main profile as well and the checkbox field is there too. What can be the problem? Thank you.


texts:
I have an article type where a content admin role can Create an Article. There are 10 Content Admins in system. If one content admin creates the node, I can see eg: Submitted by username. If user2 edits the same article, I want to store who edited it and when in database and display the edited by: OR Updated by:

Its same like in SE websites, you can see who edited the post at what time. How do I do this in Drupal 7 ?

P.S. I am still new in Drupal and haven't explored all the big ocean of Modules in Drupal, so, there might be easy solutions for these things somewhere which I couldn't come across using Google Search.


texts:
I am worried about a big error found on my website.Yesterday it was working and today morning i found the issue.Please help me to solve it.

Error message:

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry '1532856' for key 'PRIMARY': INSERT INTO {watchdog}
  (uid, type, message, variables, severity, link, location, referer,
  hostname, timestamp) VALUES (:db_insert_placeholder_0,
  :db_insert_placeholder_1, :db_insert_placeholder_2,
  :db_insert_placeholder_3, :db_insert_placeholder_4,
  :db_insert_placeholder_5, :db_insert_placeholder_6,
  :db_insert_placeholder_7, :db_insert_placeholder_8,
  :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0
  [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type:
  !message in %function (line %line of %file).
  [:db_insert_placeholder_3] =>
  a:6:{s:5:"%type";s:6:"Notice";s:8:"!message";s:46:"Undefined index:
  field_enter_module_name_here";s:9:"%function";s:9:"include()";s:5:"%file";s:112:" example.com\sites\all\themes\nexus\templates\field-collection-item.tpl.php";s:5:"%line";i:37;s:14:"severity_level";i:5;} [:db_insert_placeholder_4] => 5 [:db_insert_placeholder_5] =>
  [:db_insert_placeholder_6] => http://example.com/
  [:db_insert_placeholder_7] => [:db_insert_placeholder_8] =>
  195.229.241.186 [:db_insert_placeholder_9] => 1432102144 ) in dblog_watchdog() (line 160 of
  example.com\modules\dblog\dblog.module).


texts: getting a notice in reports for Commerce Paypal EC. IPN for Order ignored:

texts:
I am using Commerce PayPal and specifically the submodule for Express Checkout.

When checking the reports, I see many different IPN connections happening. the last two, the user is marked as "anonymous" instead of user name. The first is "IPN Validated..." and the second is "IPN for Order 138 ignored: this operation was accommodated in the direct API response."

Is this normal? Is there something in my settings that needs to be changed so it isn't "ignored"?


texts:
We are due to move our website (a rather large charity site) and we would really like to make sure search is working as well as possible. We are currently working on tagging all our content using a controlled vocabulary taxonomy which we hope to be able to use in Drupal.

What I would like to know if there are any search modules for drupal, where search result would be displayed with visible taxonomy tags. So as for example if someone would search for "drugs" and "depression" a list of result would be displayed where you by the article also could see the taxonomy tags related to that article. So Search result one would have the tags "Drugs""Depression" and any other tags used so perhaps "stress", search result two "Drugs""Depression" and "Pain". I hope this makes sense? Does anybody know if this is possible and if so are there any website that uses something like this already?


texts:
I set path auto alias of content type page to:

  [language]/[title-raw]

I am using Content Translation module.

I created english version of selected page.
Alias was generated ok.

But even if I am admin, I have 404 when I want to view this page.

Could somebody give me any advice?

EDIT

I change pathauto alias setting to

  [title-raw]

still 404.

If I use raw address of page (node/232) it works.

EDIT 2

After recreate page, alias works ok (:


texts: Cannot display output view block under or after exposed filters block

texts:
I created few exposed filters in block. However when I hit 'apply', I get its output view displayed on top of the exposed filters in a separate block. Is their any way or code through which I can display the same output view under/after exposed filters, rather than on top of it.

I did change the sequence of 'Exposed form: view name' and 'View: view name' in block display region. i.e., I positioned the 'Exposed form: view name' on top of 'View: view name', yet still it didnt solve the problem. Any help or guideline will be greatly appreciated.


texts: How do I make a custom module trigger a function when content is unpublished?

texts:
In short:

Utilizing Drupal 8, I'm hoping to to "hook" into an entity update event for a specific content type so that I can then take further action when that event occurs. In this case, delete the node if it's unpublished.

In long:

The Scheduler module allows scheduling of nodes to publish and unpublish as scheduled. My goal is to then delete a specific-type node when it gets unpublished.

At first I tried to use the Rules module to trigger removal of the unpublished node. However, Rules is not working properly on my website currently (getting errors when attempting to configure unpublish event node type). It spurs interest to see how I can accomplish the same task with a small custom module. I'm moving forward with a goal to understand Drupal 8 modules and module development better.

As a result, I wish to move handling of unpublish events for my content type into module code. Other examples I'm finding relate to Drupal 7. I'm building a Drupal 8 module.

Here is my starting module code so far (rough, draft, untested as I work out logistics).

Module structure:

hour_helper
  hour_helper.info.yml
  hour_helper.services.yml
  src
    EventSubscriber
      HourUnpublishEventSubscriber.php

hour_helper.info.yml:

name: Hours of Operation Helper
type: module
description: 'Utilities to assist with hours of operation, starting with the removal of hour content once it is unpublished via the scheduler module.'
package: Custom
core: 8.x

hour_helper.services.yml:

services:
  hour_helper.node_subscriber:
    class: Drupal\hour_helper\EventSubscriber
    arguments: ['@entity.manager']
    tags:
      - { name: event_subscriber }

HourUnpublishEventSubscriber.php:

<?php

/**
 * @file
 * Event subscriber
 */

namespace Drupal\hour_helper\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

//!!! use (... something entity or node related, we want to subscribe to entity updates?)

/**
 * Remove hour of opperation nodes after/when they are scheduled to unsubscribe to prevent garbage accumulation
 */
class HourUnpublishSubscriber implements EventSubscriberInterface  {
  /**
   * {@inheritdoc}
   */
  public function getSubscribedEvents() {

    // Subscribe to node update events with priority 0.
    //!!! which event....
    $events[SomethingEvents::SOMETHING][] = array('checkForRemoveStatus');
    return $events;
  }

  /**
   * This method is called whenever the ????? event is dispatched.
   *
   * @param GetResponseEvent $event
   */
  public function checkForRemoveStatus(GetResponseEvent $event) {

    //print '<pre>';
    //print_r($event);
    //print '</pre>';

    die('Well, at least an event has been triggered to be handled here...');

  }

}

I continue to ponder
the Drupal events doc page...


texts: URL Alias does not work in Menu-Blocks with i18n (pathauto also installed)

texts:
I'm currently facing a problem with Internationalization and the main menu block on my page.

So when I created the page about-anna and navigating to /de/about-anna - it works great also with /node/27 it works. Thats ok.

But the menu-item is instead of /de/about-anna just /node/27

So I continued testing, added the english-translation and setabout-anna as path alias again. But the problem still exists.

I also looked up the internet and Drupal Answers and I found some good answers... but didn't fix my problem...


texts: Content exists in Drupal but unseen in PHPMYadmin?

texts:
I have a content type which I enter data to by means of a csv file. Everything works fine as I have multiple content-types set up like this.

However, I'm trying to clean-up the database and remove data that is from 2012 and before.

Within Drupal at the /admin/content/filter url, I set the parameters for the content-type and such as:

node type is Print Data
and is created before 2013-01-01
and node status is published

(note, I just used the code indicator to set-off the options for this post)

Upon return, I have pages of content with each page showing 500+ results. I can delete them from within Drupal, but only at 500 at a time so I went to phpMyadmin but in there, I can only see/find data that is from 2013.

So where is Drupal storing all that other data if not in the database?


texts:
I need go get the node author as plain text and the same goes for the body field.  So that means NO html markup. I cant find the right answer on google for drupal fields.

<?php print $name); ?>

gives it with html...