texts: How to create an unsortable Field with multiple values?

texts:
When a CCK field accepts more than one value, the widget will display a sortable table (usually with those cross-shaped handlers); this is the default behavior. I would rather have a non-sortable widget, since the order doesn't really matter. I hope this will avoid the usage of a table element, as well.

How can I achieve this? Do I need to use hook_form_alter()?


texts: Error saving custom field type module with "managed_file"

texts:
I have created a custom field type module (field plugin) containing four fields: title, description, address, image.
Drupal version: 8.02

This is the schema structure inside FieldType php file:

public static function schema(FieldStorageDefinitionInterface $field) {
    return array(
        'columns' => array(
            'title' => array(
                'type' => 'varchar',
                'length' => 255,
                'not null' => FALSE,
            ),
            'description' => array(
                'type' => 'varchar',
                'length' => 255,
                'not null' => FALSE,
            ),
            'address' => array(
                'type' => 'varchar',
                'length' => 255,
                'not null' => FALSE,
            ),
            'image' => array(
                'type' => 'int',
                'size' => 'small',
                'not null' => FALSE,
                'default' => 0,
            ),
        ),
    );
}

And this is the structure defined in FieldWidget php file:

$element['title'] = array(
    '#title' => t('Title'),
    '#type' => 'textfield',
    '#default_value' => isset($items[$delta]->title) ? $items[$delta]->title : NULL,
    '#attributes' => array(
        'data-title-delta' => $delta,
    ),
);

$element['description'] = array(
    '#title' => t('Description'),
    '#type' => 'textfield',
    '#default_value' => isset($items[$delta]->description) ? $items[$delta]->description : NULL,
    '#attributes' => array(
        'data-description-delta' => $delta,
    ),
);

$element['address'] = array(
    '#title' => t('Address'),
    '#type' => 'textfield',
    '#default_value' => isset($items[$delta]->address) ? $items[$delta]->address : NULL,
    '#attributes' => array(
        'data-address-delta' => $delta,
    ),
);

$element['image'] = array(
    '#title' => t('Image'),
    '#type' => 'managed_file',
    '#upload_validators' => array(
        'file_validate_extensions' => array('jpg jpeg png gif'),
    ),
);

The three textfields were working perfectly until I've added the managed_file field: now, if I fill the fields, choose an image file and save, I get this error message:

  This value should be of the correct primitive type.

And ALL the module fields are highlighted in red.
Nothing is saved.
I'm quite sure that the issue is related to the managed_field (image) field, but I can't understand how to solve this.


texts: Can I alter the behaviour of a core function?

texts:
To make content management easier, for a large website we have allowed the content administrators to put a pipe in the title of a piece of content. Anything before the pipe is ignored.

Is there a way I can alter Drupal's $node->getTitle() function so, whenever it is called, I can strip out the text and the pipe symbol (instead of having to remove the pipe in each place in code or templates individually).

I'm basically after a Drupal version of Magento's "after" plugins.


texts: Add class to ul element in views 3 unformatted list using templates or module code?

texts:
I'm contributing to the Radix theme in D7 for panopoly, which uses Twitter Bootstrap.

I'm seeking out ways to implement as many of twitter bootstrap's awesome capabilities as possible, and thus not have to rely on overriding theme css, and to make it work 'natively' and rely on cleaner CSS.

So, the 'unstlyed' list property in Twitter Bootstrap is a perfect example of this.

...

However, I can't figure out how I would add this class to the views unformatted style by default using the theme.  Is this possible with template files, template.php code or an include file?  I would prefer to do this within the radix theme.  Help!


texts: How can you prevent a Webform from going to a confirmation modal if remote post handler fails in a service response?

texts:
I have a webform with a single handler - an extended remote post handler that sends the submission to an external service. The entire form loads in a modal dialog and has two wizard steps.
This service can return a 200 (with confirmation id and date) or 400 (and any number of errors).
How can I either:

Prevent the submission on error from the service, and reload the form to try again (with values retained)
Change the confirmation message to reflect that something went wrong, and either reload the form fresh with that appended or just have a link in the modal that goes "back to form"

I have looked at a few other questions like:

Trigger redirect after Webform Remote Post Handler posted successfully
How do I pass a response from a Webform custom handler back to Drupal to display on the confirmation page
Override webform confirmation and email message if token data is missing

I can't get them to work. preprocessConfirmation() is never triggered in my handler, I don't see other examples or where that would be called. How are we supposed to implement that effectively? If there was an error saving the data to the remote service, I either want the user to try again, or just delete the webform submission in Drupal and start over.


texts: Views taxonomy listing of terms linked via contextual path

texts:
What this really boils down to is a contextual block view of terms with relative paths to a second taxonomy vocabulary, I'm just not sure on how to get there.

Here is what I'm trying to do:

I've created a basic block that contains links to taxonomy pages, but I need the links to which they point to be contextual based on the path that's in the current URL.

I have a content type that uses two different vocabularies on each node. One is a location type vocabulary of terms something like this:

Florida
USA
North America

Then I also have another vocabulary that contains a number of different award types something like this:

Award X
Award Y
Award Z

The same set of awards can be listed in each of the location type pages above as well.

By request we've created the Views to display the locations as pages, then the awards listed under each location.

So when we have visitor on the "Florida" page for example, we want to present a list of taxonomy links that point to awards by type, with the location included in the link contextually/dynamically. We don't want USA links showing on Florida pages, nor "Florida" links showing on "North America" pages.

Our path currently looks something like this from the Views Page displays:

domain.com/VIEW-PATH/term-name

domain.com/florida/award-x
domain.com/usa/award-x
domain.com/north-america/award-x
etc.

our taxonomy View pages look like this:

domain.com/term-name

domain.com/award-x
domain.com/award-y
domain.com/award-z

I need to find a way to contextually set the link in the taxonomy list block include that location vocabulary term, dynamically.

They NEED to look like the first set only with the location added dynamically:

domain.com/[florida]/award-x
domain.com/[usa]/award-x
domain.com/[north-america]/award-x

The problem is that we don't have the location term in the path. Any ideas on how to make this happen? Hope this makes sense.

Thanks in advance.

edited for clarification:

The end result I'm trying to achieve for the taxonomy link created by the View would look something like this:

domain.com/florida/award-x/node where florida

(the location) is added dynamically depending on the location taxonomy page that the visitor is on. I've not seen a way to set the location taxonomy term variable in to the path in admin/config/search/path/patterns which is where I've been looking the most for a solution. It seems I should be able to do it here, but I've not been able to figure it out due to the location being a different vocabulary that the award name.


texts:
I have a User field type of 'List (integer)' storing a list of nodes the User has subscribed to i.e. Forum items.
I need to setup a notifications like rule to email all users that have subscribed to a particular Forum item advising them of when a new comment has been posted.

Event = After saving a new comment (any user posting to a Forum
item)
Condition = Content is of type (Forum item)
Action = ??? basically email all subscribed Users of this Forum item
advising that a new comment has been posted

Logic something like:

Check each user -> field_list_of_followed_nodes[] where nid == 1 return TRUE

Don't know if this can be done in rules?


texts: Drupal 8 page manager and panels contextual filters for views_block

texts:
I'm working with Drupal 8(first project with 8) and trying to build page (via page manager) with taxonomy tid argument.

As a display variant I use panels and inside of panel I put block, generated by views and this views_block have contextual filter.

I haven't found the way for how to attach my contextual filter to views_block plugin from panel or associate context to anywhere.

From debug session I know what panels have my argument as a context.
But how to pass it to views_block plugin inside of panel?

Thank you for any help and information. I'm ready to digg inside of code(and contribute also, if needed) to solve this.


texts:
Is it possible to change the domain name when creating urls to the image:

file_create_url($file->uri)

I need the images to say they're coming from another domain, but I can't change the base_url, since we need to keep drupal accessible on origin.

Example

Origin: http://domain1.com/files...

When creating image urls, they will be http://domain2.com/files...


texts: Get taxonomy used for each year in a view

texts:
I created a view that list how many time a taxonomy terms (tags) was used on (articleS on) my site.

tag1  (236)
tag2  (200)
tag3  (157)
tag4  (161)
tag5  (10)
tag6  (90)
tag7  (86)
tag8  (50)
tag9  (15)

How can I modify that view to show how many time a taxonomy is used each year?

2016
tag1  (150)
tag2  (100)
tag3  (75)
tag4  (36)
tag6  (20)
2015
tag4  (125)
tag6  (70)
tag1  (50)
tag3  (50)
tag2  (45)
tag5  (10)
2014
tag7  (86)
tag2  (55)
tag1  (36)
tag3  (32)
tag8  (30)
tag9  (15)

Or any time interval? if possible.

update
Here is an image of my view setting


texts:
I am trying to add a new region to the Omega Hero template. I have duplicated the Hero template calling it SuperHero and this is working okay. ( I have created a sub-theme ).

In the tpl file I have added the new bottom_sidebar region:

<?php print render($page['sidebar_first']); ?>
<?php print render($page['sidebar_second']); ?>
<?php print render($page['sidebar_bottom']); ?>

In the .inc file I have added the region here:

regions[sidebar_first]  = First sidebar
regions[sidebar_second] = Second sidebar
regions[sidebar_bottom] = Bottom sidebar
regions[footer]         = Footer

I have create new stylesheets and they are working okay but the new sidebar isn't appearing in the HTML.

Any ideas on what I might be doing wrong?


texts: Replace \Drupal::service with Dependency injection in FieldWidget class

texts:
I have created an ajax callback inside a custom Field Widget plugin. In the Ajax callback I have called a custom service using

$service = \Drupal::service('service.name')

I am using phpmd to clean up the code and it suggested that the service should be called using dependency injection.

This means I should create a constructor for the Fieldwidget class and then get it as argument. I am not sure how to pass the argument when the Field widget is called. Not even sure what interface should be set for the Drupal service caller.

Any ideas on how to do that.


texts: Form, populate select lists values after unsuccessfull validation

texts:
I would like to have select values in my select lists that user poster to script. However when validation is not valid, those fields aren't populated with posted data, so user have to make the choice again. Could somebody give me any advice?

Code:

   for($i = 0; $i < 3; $i++) {
            $form['register']['cocktails']['cocktail']['bartender_cocktail['.$i.'][]'] = array(
                '#type' => 'select',
                '#default_value' => variable_get('bartender_cocktail['.$i.'][]', NULL),
                '#options' => $cocktails,
            );
        }


texts: How to add jquery lower version for a particular drupal page?

texts:
I have installed the jQuery Update module and set jQuery 1.10 as default jQuery version, but one of my previous functionality stop working.

I just want to use jQuery 1.8 for a specific page. How can I achieve this?


texts:
In my login form I have labels and other stuff I don't whant. But I'm having trouble removing them.

I already two buttons to add this in my template.php:

function xmed_form_user_login_alter(&$form, &$form_state, $form_id) {
    $form['register'] = array(
        '#markup' => 'NO ACCOUNT? REGISTER',
        '#weight' => 112
    );

    $form['password'] = array(
        '#markup' => '
FORGOT PASSWORD?
',
        '#weight' => 113
    );
}

And in page--user--login.tpl.php I have:

          <img class="class="img-responsive"" src="<?php print $logo; ?>" alt="logo" />

Xmed.be Stocksolutions

"We help you Xchange your stock"

          <?php print render($title_suffix); ?>
          <?php print $messages; ?>
          <?php if (!empty($page['help'])): ?>
              <?php print render($page['help']); ?>
          <?php endif; ?>
          <?php if (!empty($action_links)): ?>

<?php print render($action_links); ?>

          <?php endif; ?>
          <?php print render($page['content']); ?>

But how can I change the $content variable?


texts: Why doesn't my text filter strip out the tags I don't want?

texts:
I thought I understood text filters, but it appears I don't.

I am using a filter on my node's "body" field that is supposed to restrict tags. I have entered the allowed HTML tags as

<em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <br>

Yet in my WYSIWYG editor I can switch to source view and save text that includes  (or worse, ) tags.

Why aren't these tags stripped out when the node is saved?


texts: Create custom action for Views Bulk Operations

texts:
I'm trying to add some custom actions to my Views Bulk Operations, but for some reason, they don't appear in the list.
i want to add custom button to user can apply it and node DATE update to today...

This is my code (so I guess this is a working code...)

    /**
 * Implements hook_action_info().
 */
function custom_action_info() {
  return array(
    'custom_action_callback_name' => array(
      'type' => 'entity', // Can be file, term, user, etc.
      'label' => t('Your label'),
      'configurable' => FALSE, // Doesn't need config form
      'behavior' => array('view_property'), // Uses view access rights
      'triggers' => array('any'), // Works always
    ),
  );
}
/**
 * Add action callback where you perform the action.
 */
function custom_action_callback_name($entity, $context) {

  // I DONT KNOW .....................

}


texts: Drop-down Menus in Standard Drupal 7.4 Zen theme?

texts:
I'm new to Drupal so forgive me if I'm missing something obvious.
I'm trying to implement a drop-down menu in Drupal 7.4 in the Zen theme with only a standard install (I'm trying to avoid installing other modules).
There appears to be no easy way to do this.
Is the only option to manually code one of the CSS files in the subtheme directory for this effect?

Thanks!


texts: Drupal 7 with Media: YouTube only embeds static image

texts:
Using Media (7.x-1.3) and Media: Youtube (7.x-2.0-rc2) to embed a simple YouTube video on a page using the Media Browser in WYSIWYG.  I go to the "Web" tab in the browser, pasted the YouTube URL, and choose the "Default" option.

What gets put into the content is a static image.  What I'm expecting is an embedded video. Even a static image that uses the built-in lightbox capabilities would be fine.

Here's what I've already checked:

I was getting Lightbox2 errors in admin/config/media/file-types/manage/video/file-display.  Removed Lightbox2 module.
Went to admin/config/media/file-types/manage/video/file-display and confirmed that YouTube Video and YouTube Preview Image were selected for the "Default" option.
Went to admin/config/content/formats/full_html and ensured Convert Media tags to markup was enabled.  I also moved it to the top of the order.
Checked permissions for View media in admin/people/permissions

Suggestions are greatly appreciated.


texts: How to have multiple instances of a field collection on single content type?

texts:
I have a content type where I would like to use a field collection to group some fields (radio buttons and textfield). I need many of these on the content type with only the label being different.

I was hoping to make one field collection entity and have multiple instances of it on the one content type, but field collection does not support this.

Basically, I need many instances of a group of fields on a single content type. How can I accomplish this?


texts: How can I get the current user role in my web app?

texts:
I'm working on web app with a Drupal 8 back-end which is accessed by the D8 REST API.  I need to get the current user role so I can manage some options by role. Is there an existing REST route for getting the role and/or ID of the currently authenticated user.  I've had success with other REST routes like http://example.com/drupal/user/1?_format=hal_json, but this returns the user with id=1. What i'd like is http://example.com/cms/user/me?_format=hal_json
Any suggestions?


texts:
I'm trying to apply the security update for core by updating it to 8.9.10 with the following command:
composer update drupal/core

But this only brings back the following notice:

Nothing to install or update

What am I doing wrong? How can I update core to 8.9.10?


texts: How do I remove the blank space that remains after removing "logo" and "site name" and "site slogan"?

texts:
I have removed the "logo", "site name", and "site slogan" from the Theme Settings menu:

Home > Administration > Appearance > Settings > MyTheme

Unchecked: [Logo], [Site Name], and [Site Slogan] under "Toggle Display".

For some reason, these things appear above the header and not in the header, so I am disabling them.  But, there is still a small space left.  It appears to be coming from a small div containing an anchor tag:

    Jump to Navigation

Can someone help me to remove this the "right way".. or advise me if I'm doing something wrong?

If it helps, I'm using the Zen Theme.


texts: Views Path Settings is not redirecting to particular path?

texts:
I have been working on drupal 7.54 version.

I have created on sample view and trying to display the view in particular path.

Here, I have mentioned the path as comment-count, but its not getting redirected to the path, because its taking as query string.

How can I change this thing.

Is there any problem in latest instance or else guide me how to sort out this problem?


texts: Rule condition to check which language is used by the visitor?

texts:
I have a multilingual website (English, Spanish).

Is there any way to create a rule condition to compare the language used by the visitor against a fixed value?

The condition would something like: if language is English then go ahead with the actions.


texts: Why is the token in my custom module not replaced?

texts:
I want to use the token [user:name] in my module. This module contains a sample  ControllerBase class

In my class I test this:

class Page_test_Controller extends ControllerBase {

    /**
     * {@inheritdoc}
     */
    public function token() {
        $build = array(
            '#type' => 'markup',
            '#markup' => t('[user:name] hello'),
        );
        return $build;
    }

}

When I load my page the token isn't replaced as shown here:

What am I missing or doing wrong?


texts: Override Commerce Kickstart Features ( and Features Override module error)

texts:
I have the Drupal Commerce Kickstart bundle in my project. This bundle contains a bunch of Features. Most of them are overridden now. It's not good to have most of setting inside the DB instead of features, so I want to save my changes inside my features.

As far as I know, it's not a good idea to modify the Kickstart Features, so I tried to use the Features Override module.

But, unfortunately, got "white screen of death" on Feautures Override Tab. Also, it broke all of my Kickstart Features.

The only "evidence" is the message:

  Notice: Array to string conversion in
  features_override_features_export_render_addition()

PHP: 5.4.9
Commerce Kickstart: 7.x-2.9
Features Override: 7.x-2.0-rc1

Do you have any ideas how to fix this problem with Featuers Override, or just how can I move my settings from DB to code in my situation?


texts: Is there an easy way to move user data between 2 sites?

texts:
I am totally new in Drupal, and I am using Drupal 7. I was asked to move data between two sites that don't even have the same structure, and have different fields.

Can anything bei done with a tool like Drush, or with MySQL?


texts:
here is my template.php code:

function sizin_preprocess_page(&$variables){
  $search_box = drupal_render(drupal_get_form('search_form'));
  $variables['search_box'] = $search_box;
}

function sizin_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_form') {
      // HTML5 placeholder attribute
      $form['search_form']['#attributes']['placeholder'] = t('Search ...');
  }
}

and in my page.tpl code:

  <?php print $search_box; ?>

but I can't able to see placeholder. Any Idea?


texts: How to migrate tables in nodes from D6 to D7, created with the tablefield module

texts:
I am 90% done with my migration from D6 to D7. The last thing to figure out is how to map a table in certain nodes, created with the tablefield module in D6, into a table in D7, also created with tablefield. Just mapping the fields does not do the trick.

$this->addFieldMapping('field_D7_table', 'field_D6_table');

With the above mapping there are no error messages, the table is just empty after the migration. I can see that the data is stored in serialized form in the legacy database. Can anyone point me in the right direction?


texts: How to pass cookie value into Drupal View

texts:
We want to create some logic using JS that creates a cookie and set the node's taxonomy term id (preferred) or taxonomy term name as the cookie value. Then we want to use the cookie value to filter a View so that when a user visits a page, the view that is shown is filter based on the cookie value.

How can I pass a cookie value into the View?

/******************** Update - 9/23/2015 **************************/

I ended up using a mixture of a list block, javascript, and a custom module that on full node view, the taxonomy term id is stored into the browser's locale storage. I am no longer using a filter view based on cookie. Also, the custom module stores the taxonomy term ids into the block.


texts: Removing Anonymous DIV from search-block-form

texts:
I have created a sub theme under Bootstrap and am having issues removing the "anonymous" div from inside the form.

Here is the displayed code:

    <form class="form-search content-search form-search content-search" action="/" method="post" id="search-block-form" accept-charset="UTF-8">

                <input title="" placeholder="Search" class="form-control form-text form-search" type="search" id="edit-search-block-form--2" name="search_block_form" value="" size="5" maxlength="128">
                <button type="submit" class="btn btn-default">Search</button>

            <input type="hidden" name="form_build_id" value="form-XXXX">
            <input type="hidden" name="form_id" value="search_block_form">
            <button class="element-invisible element-invisible btn btn-primary form-submit" id="edit-submit" name="op" value="Search" type="submit">Search</button>

    </form>

I have my own versions of form-element.func.php and search-block-form.tpl.php and I have created my own theme wrapper to customize this as much as possible but I still cannot figure out a way to get rid of that stupid div!

How can I remove this div WITHOUT modifying the Bootstrap theme or the Drupal Core?

Edit: At the very least, I would be ok with adding the class input-group onto the div and getting rid of the current div.input-group


texts: How do I change the date format of a single result?

texts:
I have a view that gives me a list of nodes titles and when it was last updated.

I want to display the changed date with only time if it is today, otherwise I just want the date, e.g. 17.00 or 15 may 2016.

If I look at the result in views_pre_render it has a node_changed timestamp. It uses the date format set in the view. How do I change the format just for the first result?


texts: What is the difference between t() and @Translation()?

texts:
When writing a (translatable) plugin in Drupal 8, you have to use Drupal\Core\Annotation\Translation;, and then wrap your value in @Translation("value"), however when implementing the FormInterface, you can use t() freely as you would in Drupal 7.

I found Annotation-based plugins on Drupal.org, but it just mentions the fact that you should use it, and the Doctrine reference doesn't seem to include @Translation

I assume it is because the plugin system is part of doctrine, and not part of core, whereas t() is  -is this the correct assumption?

Basically, what is the difference between @Translation(); and t() - is it just because plugins are Doctrine based?


texts: who is responsible for printing [safe_value]

texts:
I would like to know who's responsible for printing ['safe_value']

$node->body['und'][0]['safe_value']

because for some reasons, it is missing when I checked it using dpm($node), I only see ['value'], ['summary'], and ['format'].

All my modules are up to date and I'm using i18n(multilingual).


texts: How to create text base field without format?

texts:
How to create base field without format surplus?

E.g. this

$fields['data'] = BaseFieldDefinition::create('text_long')
  ->setLabel(t('XML Data'))
  ->setDescription(t('The product XML data.'));

creates two columns in the table:

`data__value` longtext,
`data__format` varchar(255) CHARACTER SET ascii DEFAULT NULL,


texts: compare terms from userterm and node term

texts:
I have users and nodes.
bith have the same term referende field:

field_area

goal is to display a message in node.tpl.php when:
- user has term 'south'
- node has term 'south'

i have used the field extract module to get id term ID from the node.
$tid_node = field_extract_value('node', $node, 'field_bedrijf', 0, array('key' => 'tid'));
term id is .e.g: 5

Now i would like to find the term id using the user->field_area field.

I would utlimately have a code like:

if $tid_node == $tid_user {
print "a custom message" ;}


texts: Image styles - not functioning properly after migration

texts:
I have just created a site serving as an online gallery. In the gallery the user can create an album and add images to this album.

Originally when I am working on my localhost the image styles are working properly - under each image styles drupal can create a proper subfolder with the same id of the album and save the image related to the album in it.

For example if I have created an album with the node id 1 and uploaded an image named 123.jpg to this album, it will save the styled image as the following: styles/thumbnail/public/project/1/123.jpg

After I have migrated to the remote server, drupal is still able to create different image styles for an image. However it is no longer creating subfolder for the albums or saving the styled images into subfolder. Instead everything is just saved in the public folder as the following styles/thumbnail/public/123.jpg.

I am worried that such malfunction on the remote server will affect the management of the site.  I have already tried to disable clean urls, changing the permissions of the folder to 775/777.  However none of them seem to be the solution of this issue. How can I solve this?


texts:
I am trying to apply the example from [the Flag API page][1] to refresh a block dynamically via AJAX. I am looking into customised jQuery code because my block is created via a module, not a view.

I have implemented the callback in the .module file and it works. It is when I try to copy blockExistsOnPage() where I fail. It talks about a component module which is necessary for the execution of the code, but this module is obsolete for drupal 7. I think that I stumble on the definition of var domId. This is my JavaScript code.

(function ($) {
 $(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {
   alert('Object #' + data.contentId + ' (of type ' +
   data.contentType + ') has been ' + data.flagStatus +
   ' using flag "' + data.flagName + '"');

    if (data.flagName == 'myflag') {

        if (blockExistsOnPage('mymodule', 'mymodule_blockid')) {
            refreshBlock('mymodule', 'mymodule_blockid');
        }
    }
  });

// Attempt at refreshing the block
function blockExistsOnPage(module_name, block_id) {
  var domId = module_name + '/' + block_id;
  return $('#'+domId).length != 0;
}

function refreshBlock(module_name, block_id) {
  var domId = module_name + '/' + block_id;
  $.get(base_url + 'node/' + $nodeid + '/' + block_id, null, function(newHtml)  {
    // Replace the old block with the new one.
    var domElement = $(newHtml).insertAfter('#'+domId);
    $('#'+domId).remove();
    if (Drupal.attachBehaviors) {
       Drupal.attachBehaviors(domElement);
    }
 });
}

edit: I am trying to use a $.ajax request instead. It seems cleaner, but I am struggling to get my relative address of the type node/[nid]/module_name/block_id. Should I modify the block_id in the menu hook? Or should I find a way to create a url in the jquery:

module hook menu:
    function get_involved_menu() {

// Ajax Callback. Returns updated content of block
$items['block_id'] = array (
 'title' => 'Content of module_name block',
 'page callback' => 'module_name_createcontent',
 'access arguments' => array ('access content'),
 'type' => MENU_CALLBACK,
 );

return $items;
}

jquery:
    $(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {

  $.ajax({
     type: "POST",
     url: 'module_name/block_id',
     success: function (data){
        $('div.get-involved-divblock').html(data);
     }
   });
 });

the code below returns an empty block. If I am on node '57', and I put instead

 url: '57/module_name/block_id',

Then it returns the content. How can I make it a relative path? How do I obtain the node id in the jquery?


texts: Is it possible to combine several template files togather and make single integrated template instead?

texts:
For example to render a simple form like search block should be invoked 8 different templates like below and each of this template only has one or few line of code, see below:

region.html.twig
└─ block.html.twig
   └─ form.html.twig
      ├─ form-element.html.twig
      |  ├─ form-element-label.html.twig
      |  └─ input.html.twig
      └─ container.html.twig
          └─ input.html.twig

As you can see in below some of this files Just have a few line of code:
region.html.twig

{% if content %}

    {{ content }}

{% endif %}

form.html.twig

<form{{ attributes }}>
  {{ children }}
</form>

form-element.html.twig

{% if title is not empty or required -%}
  {{ title }}
{%- endif %}

input.html.twig

<input{{ attributes }} />{{ children }}

container.html.twig

{{ children }}

Some of this templates files are common with other parts of page and
editing each of them can affect to other parts and cause unwanted changes
. for example in this case drupal theme system for: "input.html.twig", suggest only input--submit.html.twig and this suggestion also common between search block and search form.
Editing and managing this template files is tedious and difficult and
make my theme folder busy.
Most of these templates have ambiguity and unclear content code

For this reason I'm looking for a method to combine this template files and make one template file like "form--search-block.html.twig" to I can edit all element needs for rendering a form in one special place
and with more flexibility and confidently.


texts: How to get children and parent book pages

texts:
I have nid of a book page. I need the nid of the parent and nid of all direct and indirect childs.

How to retrieve the parent and child IDs?


texts: Migrate user passwords from drupal 6 to already existing drupal 8 site

texts:
I have a drupal 6 site and a drupal 8 site. The drupal 8 site already exists and I do not want to do this on an empty drupal 8 install. Also I only want to migrate passwords. The users with their corresponding UIDs have already been brought over, and they do appear in the list of users, however their old passwords do not work on the new site. I'm assuming because drupal 8 uses a different encryption system.

I looked into using this method https://www.drupal.org/docs/8/upgrade/upgrading-from-drupal-6-or-7-to-drupal-8 based on the answers provided for this question How do I migrate user passwords?
But that seems to only apply to situations when the site does not exist and I want to perform a brand new install of Drupal 8. And it supposes that I want to migrate all data when I only want to migrate the users.

Upgrading and moving over all data (nodes, block layouts, etc.) is not an option. I do not want that data in the existing drupal 8 site. I need only the users (preferably just the user passwords).

I'm willing to make a custom module to perform this import. Is there a way to migrate only the user passwords from a drupal 6 site into a drupal 8 site?


texts: Getting terms for only one taxonomy from services module

texts:
I have the services module installed, and I have both taxonomy_term and taxonomy_vocabulary checked. However I'm having problems getting just the terms for one vocabulary. when I do curl -g "http://domain.com/endpoint/taxonomy_term?args[0]=machine_name_of_vocabulary" or curl -g "http://domain.com/endpoint/taxonomy_term?args[0]=2"

I get an xml result like this:

<result>
  <item>
    <tid>2</tid>
    <vid>2</vid>
    <name>Blue</name>
    <description/>
    <format>filtered_html</format>
    <weight>0</weight>
  </item>
  <item>
    <tid>1</tid>
    <vid>5</vid>
    <name>Apple</name>
    <description/>
    <format>filtered_html</format>
    <weight>0</weight>
  </item>
</result>

which is the terms of all the vocabularies. In other words, I have the argument wrong, or the request wrong, or something else wrong.

How do I configure services and make a request to it to get only one vocabulary?


texts:
I have 3 node types. A, B and C.

A has an entity reference to B. B has an entity reference to C.

A has a list field. One of the values is "4". I need to display all node of type C where the top parent of type A has the value 4 in this list field.

I created a 'relationship referencing entity:field_in_type_a_reference_to_type_b'. And I created a context filter 'provide default value:4' with the relationship.

This part works. Only nodes of type B with parent nodes with list value '4' are displayed.

But I need the filter for one reference level deeper, for nodes of type C. I created one more relationship referencing entity:field_in_type_b_reference_to_type_c with the relationship. I tried this relationship with and without the other relationship.

But with no success. Nodes of type C aren't displayed.

How can I get the relationship from C to A?


texts: '"entity_test" entity type does not exist' on attempted module uninstall

texts:
I'm in the process of replacing D8's core Search module with Search API. When I try uninstalling Search, I get this error:

  Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity_test" entity type does not exist. in /Applications/MAMP/htdocs/mysite/core/lib/Drupal/Core/Entity/EntityTypeManager.php:133

There is an entity_test table in the database, along with a number of related tables. I also have $settings['extension_discovery_scan_tests'] = FALSE; in the settings.local.php file.

How do I address this error?


texts: Why doesn't Rules Conditional recognize a hidden field value?

texts:
I'm using Drupal 7.

I have a simple "email confirmation" system set up using rules. The setup is this:

"Reservation" Content Type has a boolean check box for "confirmed".
"Reservation" Content Type has a hidden boolean check box for "confirmation email sent"
Both #1 and #2 are empty by default.

Here is the Rules flow once an Admin checks "confirmed":

Rules checks for "reservation" content type update.
Rules validates two conditions: (1) "confirmed" == true AND (2) "email sent" == empty
A confirmation email is sent to the user making the "reservation"
The "email sent" field is set = true.

The system works fine if I make the "email sent" field visible in the "reservation" Content Type, but if it is hidden then the system breaks. When working correctly it sends exactly one email. When broken it sends emails every time the content changes.

When it is hidden the Rules flow still changes the value of "email sent" = true. It just doesn't validate it during the conditional phase.

This flummoxes me. Why would it not validate hidden field values?

{ "rules_reservation_confirmed" : {
    "LABEL" : "Reservation Confirmed",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update--lc_space_reservation" : { "bundle" : "lc_space_reservation" } },
    "IF" : [
      { "data_is" : { "data" : [ "node:field-confirmed-" ], "value" : "1" } },
      { "AND" : [ { "data_is_empty" : { "data" : [ "node:field-email-sent" ] } } ] }
    ],
    "DO" : [
      { "mail" : {
          "to" : "[node:field-email-address]",
          "subject" : "Your Language Commons reservation [node:title] is now confirmed.",
          "message" : "Your Language Commons reservation \u003Cem\u003E[node:title]\u003C\/em\u003E is now confirmed. Please click on \u003Ca href=\u0022[node:url]\u0022\u003Ethis link\u003C\/a\u003E for more information about your reservation. Please reply to this email with questions. ",
          "from" : "languagecommons@virginia.edu",
          "language" : [ "" ]
        }
      },
      { "data_set" : { "data" : [ "node:field-email-sent" ], "value" : "1" } }
    ]
  }
}


texts: Install Drupal 8 on MAMP: can't detect version of Apache

texts:
I'm trying to install Drupal 8 on my mac using MAMP Pro. I get this error message when Drupal tries to verify I have the proper configuration:

Apache Version:
Due to the settings for ServerTokens in httpd.conf, it is impossible to accurately
determine the version of Apache running on this server. The reported value is
Apache, to run Drupal without mod_rewrite, a minimum version of 2.2.16 is needed.

I have the latest version of MAMP Pro which is running 2.2.29.


texts: /admin/modules and Views Edit pages take forever to load

texts:
I recently noticed that two specific sections of my site are taking forever to load, /admin/modules and /admin/structure/views/view/{any-view}/edit. Before I disabled the PHP max_execution_time (only temporarily), it kept timing out at 5 minutes.

Now that the timeout is disabled, the mysql server is going away. I've seen a lot of suggestions that max_allowed_packet should be 100M+, so I set it to 500M for some ridiculously high value. Last time I hit that page had to have been ~15-20 minutes ago, and it's still just sitting there.

The only thing I have done recently to it was moving a TON of images into sites/default/files from another web server. (~ 25Gb)

Does anyone know why admin/modules and the View Edit pages are taking forever? It's only those two sections. The public side of the site is fine, the other admin parts are fine, it's just those two places.


texts:
The Paragraphs module seems great, but it does not provide any API (I looked at the source). So I think that will be enough to use Drupal API and/or Entity API.

About this module: it provides a new entity type 'Paragraph' and field with same name. User can create via UI 'Paragraph types' (bundles) with fields and view display settings like node entity.

My question: What's the right way to define bundle type for this entity type with custom fields in a custom module?

I think I must create fields first, using field_create_field() and field_create_instance() in hook_enable(). But what's next?

I must create bundle for paragraphs entity and attach created field, but I don't know how and any searches always send me to documentation about how programmatically create entity itself.


texts:
I'm working on a site hosted on Acquia and we're using Varnish and Akamai.  We don't want anonymous sessions from being saved in the db, as it breaks the caching.  I've made a few tweaks, and I'm trying to track down where the sessions are coming from.  We're using simplesamlphp_auth for admin logins using Okta and LoginRadius module from /user/login, so it's not a default Drupal 8 installation in regards to login and sessions.

I'm trying to track down where the anonymous sessions are coming from.  But I was wondering if there's a way outside of fixing either of these modules to force Drupal 8 to NOT save anonymous sessions to the database.  Is there a hook or event that I could use to prevent the anonymous sessions from being saved?

If so, what are the implications?  I guess lost cookies that some contrib module may be trying to set?

I'm seeing sessions like this appear:

*************************** 333. row ***************************
      uid: 0
      sid: _oo8QqyuF4tMOIIWr-uCOj8aqsknzV1WWkmf0bHzlmQ
 hostname: 23.220.148.70
timestamp: 1557934618
  session: messages|a:1:{s:7:"warning";a:1:{i:0;O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:" * string";s:57:"Your session was deliberately ended from another session.";s:12:" * arguments";a:0:{}s:10:" * options";a:0:{}}}}
*************************** 334. row ***************************

or this:

          uid: 0
      sid: _VmVWTDsbgQYOcZFxN15Z5j-s4jt4YmsjSZGggphAIM
 hostname: 72.247.190.102
timestamp: 1557928795
  session: _symfony_flashes|a:1:{s:5:"error";a:1:{i:0;s:49:"Access denied. You must log in to view this page.";}}_sf2_meta|a:3:{s:1:"u";i:1557928795;s:1:"c";i:1557928795;s:1:"l";s:7:"2000000";}
*************************** 335. row ***************************

I think part of the issue may be that messages aren't getting displayed to the user on cached pages, so the anonymous sessions aren't being emptied of their _symfony_flashes

The most concerning one dumps a ton of user data, I think this from loginradius:

*************************** 332. row ***************************
      uid: 0
      sid: _2PXluVM2rAY29hE-HFkNQQ8_nPdP4QeU4Y3PoX40ws
 hostname: 184.25.157.170
timestamp: 1557870161
  session: _sf2_attributes|a:5:{s:12:"access_token";s:36:"fb98d952-f1a2-4ba3-820e-2db2c7313008";s:17:"user_profile_data";O:8:"stdClass":146: etc. (I'm not going to post the data here)


texts: Strict warning: Only variables should be passed by reference

texts:
I am getting this error on this line in my code. I'm guessing I need to break this line down a bit. Any comments would be great.

$promobox_id = reset(array_keys($result['fieldable_panels_pane']));


texts: How can I programmatically disable the "Preview" button in a content type?

texts: I have a content-type that has been created via hook_install. I want to set the "Preview" option to disabled. Currently it defaults to "optional". How can I change this in hook_install when I create the content type?


texts: Font Awesome not working when using HTTP

texts:
We have 2 subdomains for a website in order to test our development before moving to production. This is our structure:

subdomainA.mysite.com
subdomainB.mysite.com
mysite.com

When I enter to subdomainB.mysite using http protocol (http://subdomainB.mysite.com) the font awesome icons are not being displayed. Instead of that in the console shows up this:

  Font from origin http://subdomainB.othersubdomain.mysite.com has been blocked from loading by Cross-Origin Resource Sharing policy: The 'Access-Control-Allow-Origin' header has a value http://someWebService.ws that is not equal to the supplied origin. Origin http://subdomainB.mysite.com is therefore not allowed access.

With respect to "othersubdomain", that corresponds to another subdomain used for other applications and it shouldn't be interfering with subdomainB.

Now, if I enter the site using https (https://subdomainB.mysite.com) the icon fonts are being displayed and nothing goes on the console, which is good.

On the other hand, when I test in our first subdomain (subdomainA.mysite.com) either I am testing with http or https the iconfonts load fine.

We have the module CDN off in subdomainA and on in subdomainB. At first I thought this was the problem but I turned off the module in subdomainB, cleared registry and test for awhile and the problem remained the same.

Lastly, we have the font awesome library inside the core of our drupal installation so we are not calling this library from a remote location.


texts: How to hide the 'Format Options' / 'Help Text' Guideliness from the bottom of comments textarea?

texts: How can I remove or hide Format Options / Guideliness under the comments textarea in my theme?


texts: Taxonomy: allow "All values" choice, visible as "All values" in results

texts:
I'm looking for an "All values" choice in a taxonomy vocabulary.
It is about mobility regions, and some "contents" might be able to be tagged as "All regions". That is coming up new in the project and I already set up a taxonomy vocabulary before to categorize by regions.
Is there any simple way to do this?
In the results list, it should be refered at "All regions", and not region 1 - region 2 - etc.


texts: Converting my project's requirements to drupal's concepts

texts:
I am building a website for a client and I thought that Drupal is the best choice due to the plethora of choices that it gives me. However, this vast amount of choices made my job a lot harder. Let me describe the problem to you:

The client is selling a specific product, let's say VCRs. Every VCR is manufactured by a specific brand (e.g. Sony, LG etc). Every brand has also categories of VCRs that are similar to each other. So when we want to describe the product (the VCR) we basically have to provide the following information:

Brand (e.g. Sony)
Category (e.g. FGX ; notice that this is not unique. Another company may have the same name of category)
Model (e.g. 4523x)

I also want the users to be able to subscribe to specific brands and categories so that if Sony releases a new VCR they will be automatically notified (or if Sony releases a new VCR of a specific category).

When it came to converting all these to Drupal concepts I simply could not do it. The reason is that there are various different paths that I could use and I just don't know which one is the right one. For example:

Is the category a content type or a taxonomy term?
Is the brand a content type or a taxonomy term?
The model is obviously a content type but how do I associate it uniquely with taxonomy terms (if the answer to the questions above was "taxonomy term")?
What modules would I need to use in any case? I have checked the "Relation" module and it seems like it may contain some of the functionality that I need (along with the "rules" module, especially for the notification part).

PS: if you have any good suggestions for resources (blog posts, articles, books, videos etc) that explain how to break down every life requirements to drupal concepts I would really love if you could share them.


texts: Overriding permissions selectively via settings.php/settings.local.php

texts:
The use case is a development module that you would only have installed on a local environment.

My thought was to use $config in settings.php to do this:

$config['user.role.anonymous']['permissions'][] = 'use browsersync';
$config['user.role.authenticated']['permissions'][] = 'use browsersync';

When doing this everything looks good in the permissions UI but in practice the permissions seem to be clobbered and permissions like 'access content' are no longer enabled for these users.


texts:
My boss was interested in creating a sort of layaway program for our company. Problem is, I've never heard of anything that would allow this using ubercart. Anyone have some UC recipe for creating the ability to have layaway?

I'm still searching for a way to create this functionality but the closest i've found to be able to do that is Ubercart Funds. The problem is the module isn't stable and it doesn't seem to function correctly.

I've also seen UC Recurring and this seems like it might have potential. I still need to do some testing on this.


texts:
Basically I have created a page and it shows up fine.

When I do a arg or current_path on that page it shows as a 404 path, not the one defined in the page.

current_path() => error-404
$_GET[q] => error-404
arg() => array(0 => error-404)

Is there a function that returns the path/URL that is set in the Page?


texts:
When using node_save, how sure can one be that it did what it was supposed to do?

At the moment after any call to node_save I have been checking that the required property did succesfully update. For example:

$node->field_some_field['und'][0] = array('tid' => $some_taxonomy);
node_save($node);

if($node->field_some_field['und'][0]['tid'] == $some_taxonomy) {
    return TRUE;
} else {
    return FALSE;
}

Is this necessary? Or is there a better way to perform the check?

Edit: As an example, say I want to update a node's taxonomy programatically - it would be useful to know if it worked or not. I think it's just bad in general for things to fail silently.


texts:
I am theming a node for a specific content type and split the theme into whether the node is being displayed as a teaser or full. This error only comes up when you view the full node.

  Error: Cannot use string offset as an array in XXXXXX/node--event.tpl.php on line 100

The node displays fine as a teaser, which makes this error even more confusing as the problematic line is used during teaser display. The code below is the one for the teaser part of the template.

  <?php if ($teaser): ?>
  <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

        <h2<?php print $title_attributes; ?>>
      <a href="<?php print $node_url; ?>"><?php print $title; ?> -

        <?php print(substr($node->field_date[und][0][value], 0, -9));?>

  <div class="content clearfix"<?php print $content_attributes; ?>>
     <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['comments']);
      hide($content['links']);
      //*********LINE100**************
print($node->body[und][0][safe_value]);
    ?>

      <?php print $links; ?>

  <?php endif; ?>


texts:
I am trying to add a textfield to the bottom of a node (for a specific cck type), that once (an authenticated user) submits, stores the value as a term in a taxonomy vocabulary.

What is the best way to do so?

I have tried adding the form to my subtheme's node.tpl.php file for a custom cck type.

I am having trouble with form validation. I'm able to submit the form properly, but get the red borders around the field that needs to be validated, instead of the message; Until I resubmit and the cached error message then shows. I get why it's happening - code executing prior to node.tpl.php load. See - How do I use form_set_error() the right way?.

If Form Builders are not supposed to be called from within a template file, how else can I add a form to a page? I'm sort of working off this  form example tutorial

I started with this - Embed form inside a block - and since added this to my node.tpl - https://gist.github.com/1847060.

I'm still trying to wrap my head around using the forms api, so thanks for any advice.


texts: Group multiple times by day (multi-value date field)

texts:
So I have a date field that allows multiple values. In this particular case, I have something like:

[0] = Monday, 4pm
[1] = Monday, 6pm
[2] = Tuesday, 10am
[3] = Wednesday, 11am
[4] = Wednesday, 3pm

At the moment, all I can manage to do is get it to display all fields in whatever format I want, but each one is treated individually like this:

Monday, 4pm, Monday, 6pm, Tuesday, 10am, Wednesday, 11am, Wednesday, 3pm

What I need to to group them by day so they appear as:

Monday, 4pm, 6pm
Tuesday, 10am
Wednesday, 11am, 3pm

I'm currently trying to cobble together a custom theme_field__field-date() function to try and do it because I gave up on views.

Is this the correct way to do it? Is there a shortcut?


texts:
I was wondering if it is possible to bulk update the meta tags for a particular content type? I have set the default to this: [node:field_description]. But all of the content is in the site. I'd prefer to not go through every node to paste that in the Meta tags Description field.

Is there a bulk operation to put that placeholder token into all the nodes of a particular content type?

Using this module: https://drupal.org/project/metatag The Metatag module on Drupal 7.


texts: Multiple webforms: Show list of those user has submitted?

texts:
Is there a way to list all webform submissions user has submitted using views?

I have a site where there is hundreds of webforms. I need to create a block that contains all webforms by title current user has submitted.


texts: Drupal 7 View context filters with the URL (when used in a panel)

texts:
I am currently trying to get my view to display in a panel under certain contexts. Specifically, I want the view to take the end of my URL and use that as a key to find the taxonomy term that corresponds with it and then display the product information I have stored on a separate product datasheet.

For example, if I have a hypothetical taxonomy animals -> mammals -> cats (where cats has a panel page), and a URL example.com/mammals/cats, I want to take cats off the end of that URL use it as my term for the context filter, find the corresponding datasheet with that name, then pull the relevant information.

I can get the datasheet information to display fine, as well as get the right pages, if I input cat into the test filter on the view edit page. However, When I try to use it in a panel, I can not figure out how to get Drupal to take "cat" from the URL for use in the filter.

Any help would be greatly appreciated, as I have been working on this for a day using a bunch of different solutions with no success.


texts: Organic Group: Can not create group type content?

texts:
I have Organic Groups installed on my website. I have a content type with OG setting as Group. I had several contents of this type. And then all of a sudden, I started getting the following error when I try to create a content of this type:

Can't save entity as group, because user admin can't be subscribed to group and become a manager.

What may be causing this error?


texts: Error: Call to undefined function twig_render_template() when accessing website

texts:
Error when accessing drupal 8.

The website encountered an unexpected error. Please try again later.
Error: Call to undefined function twig_render_template() in Drupal\Core\Theme\ThemeManager->render() (line 384 of core/lib/Drupal/Core/Theme/ThemeManager.php).
Drupal\Core\Theme\ThemeManager->render('views_view', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 108)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Searched for twig_render_template function found in core/themes/engines/twig/twig.engine file.
I new to drupal 8 so I don't know what I did wrong? It just broke.

Here is the line this error occurs in ThemeManager.php:

$output = $render_function($template_file, $variables);

and here is $render_function defined also in ThemeManager.php:

$render_function = 'twig_render_template';
      $extension = '.html.twig';

      // The theme engine may use a different extension and a different
      // renderer.
      $theme_engine = $active_theme->getEngine();
      if (isset($theme_engine)) {
        if ($info['type'] != 'module') {
          if (function_exists($theme_engine . '_render_template')) {
            $render_function = $theme_engine . '_render_template';
          }
          $extension_function = $theme_engine . '_extension';
          if (function_exists($extension_function)) {
            $extension = $extension_function();
          }
        }
      }


texts: Hide comment box from node for Anonymous users

texts: I am trying to hide the comment box for anonymous users. Anonymous users should only be able to view the comments. How can I hide the comment form?


texts: How to close the overlay after form submission

texts:
In order to be able to quickly edit Fullcalendar items, I altered the node edit form of the specific content type so the events are saved with AJAX and the page doesn't have to reload.

However, I don't know how to close the overlay afterwards. I found overlay_close_dialog(), but how do I implement this in my functions (I'm very new to Drupal coding)?

Until now I have:

<?php
/**
* Implements hook_form().
*/
function fullcalendar_ajax_node_save_form_alter(&$form, &$form_state, $form_id) {
  if( $form_id == 'agenda_item_node_form') {
     $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add to Apple Form'),
    '#weight' => 50,
      '#ajax' => array(
        'wrapper' => 'agenda-item-node-form',
        'callback' => 'fullcalendar_ajax_node_save_callback',
        'effect' => 'fade'
        ),
    '#submit' =>
      array (
        0 => 'node_form_submit',
      ),
    );
  }
  return $form;
}

function fullcalendar_ajax_node_save_callback($form, &$form_state) {
  $form_state['rebuild'] = TRUE;
  return $form;
}
?>


texts: Access hook_preprocess_node variables from page controller

texts:
I have a custom controller created for a custom URL, where the URL is a URL for an existing node with an additional parameter. The display for the URL defined by the controller needs to use the the same template for the base node route, and the controller just uses a service to get additional data and merge it with the base node data.
To be more specific, I have a node type called product_group. It has an entity reference field called field_products that attaches commerce_product entities. The URL alias pattern for product_group nodes is /products/[node-title]. My controller is for the URL /products/[node-title]/[sku], where sku is the commerce_product sku. The controller gets the data from the URL, loads the base product_group node object, uses the sku value to get the commerce_product object, and then I have a custom service that gets a bunch of additional data from the product and associated variation.
The tricky part is that the display at the /products/[node-title]/[sku] URL is the same as the display at the /products/[node-title] URL, with some additional data from the product itself added in. Therefore, I need to get all of the $variables data that is available in hook_preprocess_node() function in my controller and add my new data on top of it. The problem is, I can't figure how to access it. From what I've seen, you can't access data in a preprocess hook directly from a controller, but I'm guessing there has to be some way I can render the product_group node and get the variables that are available in hook_preprocess_node. Am I correct, and if so, how do I do it?


texts: How to print date in image in Event List in Drupal

texts:
How can I print a date like JAN 28 in the provided Event list, using Drupal Views?

The example image taken from the Drupal website is attached below


texts:
I want to override the user registration page, but my code is not working like it used to for Drupal 6.

function mytheme_theme(&$existing, $type, $theme, $path) {
   $hooks['user_login_block'] = array(
     'template' => 'templates/user-login-block',
     'render element' => 'form',
   );
   $hooks['user_login'] = array(
     'template' => 'templates/user-login',
     'render element' => 'form',
   );
   $hooks['user_register'] = array(
     'template' => 'templates/user-register',
     'render element' => 'form',
   );

   return $hooks;
 }

Only the login block hook seems to work.

function mytheme_preprocess_user_login_block(&$vars) {
  $vars['name'] = render($vars['form']['name']);
  $vars['pass'] = render($vars['form']['pass']);
  $vars['submit'] = render($vars['form']['actions']['submit']);
  $vars['rendered'] = drupal_render_children($vars['form']);
}

function mytheme_preprocess_user_register(&$vars) {
  exit;
}

I need this to be a preprocess function so I can change/add variables to put into the template. The second function is never called.


texts: How to set advanced views setting in code? Specifically disabling SQL rewriting with webform_select_options

texts:
So, I'm having trouble with a little custom module that places a list of flagged items in a webform with: webform_select_options_info, views, and anonymous flag.

The issue I'm having is that the select list generated by my custom module doesn't appear for anonymous users. I suspect this has to with the issue of showing views to anonymous users by disabling SQL rewriting. I suspect this  because I'm using a view generated in code via the custom module and that the advanced settings aren't set and the function isn't being shown to anonymous users.

So, how do I set advanced options like disabling sql rewriting in code?

here's my custom function minimally adapted from drupal steve's tutorial:

<?php
function webform_hook_user_flag_sample_requests() {
   $view = views_get_view('webform_flag_views', TRUE);
   $view->set_display('webform_options');
   $view->execute();
   $options = array();
   if ($view->result) {
     $row_class = $view->style_options['row_class'];
     $attributes = $row_class ? " class='$row_class'" : '';
     foreach($view->result as $item) {
       $options[$item->product_id] = '<a' . $attributes . '>' . render($item->field_field_image[0]['rendered']) . ' ' . $item->field_title . ' (' . $item->commerce_product_title . ')' . '</a>';
     }
   }
   else {
     $options[0] = t("Nothing");
   }
   return $options;
 }
 function webform_hook_user_flag_sample_requests() {
   $view = views_get_view('webform_flag_views', TRUE);
   $view->set_display('webform_options');
   $view->execute();
   $options = array();
  foreach($view->result as $item){
      $options[$item->product_id]= $item->field_field_image[0]['rendered'];
      }
return $options;
 }

I have a block view which shows the flags of the current user, I can confirm that each anonymous users flags work and generate unique flag lists on a per user-agent basis.

So, how do I diable sql rewriting for this view in code? or is there another reason this is happening?

Thanks


texts:
I have many user profile fields created at admin/config/people/accounts/fields in my drupal 7 local (offline) site. I would like to transfer all fields configuration to my online drupal site.
Is there any way to do this like views export/import feature? I don't want to re-create all fields in my online site.


texts:
here's my plan to build a site w a mobile site:

1)  develop all my core modules with robust api's.
2)  build a pair of ui modules for each above module.  These ui modules are just ui's for the api's of the above module.  There will be two ui modules for each above module: one for the normal site and one for the mobile site.
3)  use a device detection library and if the client is a mobile device, then use the mobile ui/theme.

example:

I'll build a 'friends' module with an api that allows for adding friends, deleting friends, etc...  This module has no ui.  Then I'll build a normal site ui module and a mobile site ui module that will all for controlled interaction w the ui.

what do you guys think?  Anyone have a better way?


texts: Create an embeddable widget with site content

texts:
I would like to have a view with an exposed filter that can generate content + code that people can use to embed on their own websites.

http://drupal.org/project/web_widgets seems to be a little buggy, especially when it comes to using views.

Is there an alternate approach I can use?

Thanks.


texts: How can I add a taxonomy-based view to a page?

texts:
I created a taxonomy with a vocabulary called Series. The Series vocabulary contains a list of terms x, y, z.

I created a content type called Events, which has a field to tag the content with a term from the Series vocabulary.

I created a view to display the events on a page in ascending order beginning from today's date.

The view is set to display certain fields for each piece of Event content. One of the fields displayed is the Series term, which is set to be a link that goes to a page that contains a list of all events tagged with that term.

How can I make that resulting page into a view block that I can drop into a content panel?


texts: Help me to implement this plan - limit users to edit content

texts:
I have a plan that need your help to be implemented.

I am using Drupal 6.x

Let me describe it at first.

We have a content type called it Article

This content type has Title, Description, Link, Status & belongs_to fields.

Title : Title of article record.
Description : brief description of record
Link : the source link [HTML]
Status : the status of record. Available options are FREE , Finished, In progress [it is drop down menu]
Belongs to : it is the name of user that is working on this record.

At first Some article records are added by admin.
Note: Only admin of site can add new article record.
When the new record is added it has FREE status and doesn't belong to users.

Then a user can select one article record and edit it.
Note : user can edit only the article records that has FREE status .
Also the user is able to edit the record that it is belong to him/her

He/she is able to edit only Status. and set it to another case [in progress , finished or free]

After editing the specific article record, the other users are not able to edit this record.
but the last users who have edited this record is able to edit status field.

after editing a record, the belongs_to field is set to the name of user who has edited it.

For example user1 open a Free status article record and edit it's status to in progress , or finished.

Note: if a user edit his own record' status field from "in progress" to FREE , the belongs_to field is set to empty.

Note: The users are not allowed to edit the records that their status is Finished. [only admin can do it]

There is a page [created by view] that users can see the records. which article records are free, which articles are in progress ? which are finished. and also the users who are working on articles....

Now what is your suggestion to implement this plan?


texts: How can I extend the webform #states conditions to save a custom set of conditions for webform fields?

texts:
I need to store sets of conditions on the webform field level (these would then be evaluated according to the field's submitted values within a custom submit callback).
I would like these conditions to be editable on the webform field level just like #states conditions that honour the field type for value ranges, set values, boolean etc:

No new custom state is necessarily needed here as this new type of condition would not be related to interacting fields. I'm merely looking for a way to expand webforms and add a custom field to each element that will allow adding (on the UI) sets of conditions based on its value(s). These sets would be part of the field's properties and accessible in a validation / submit callback.


texts: Subdomain with shared database for users: subdomain not accessing primary database

texts:
I've successfully set up a multisite Drupal installation. I now have:

www.example.com --> main site
sub.example.com --> a secondary site

However, I want the users to be shared. I know about shared databases and prefixes, but according to the comments in the settings.php, you can also use the prefixes to access a different database. I'd like to choose that root.

So my main site goes to the primary database, the subdomain goes to the secondary database, except for the users.

This is relevant section of the settings.php of my subdomain:

$databases = array (
    'default' =>
        array (
            'default' =>
                array (
                    'database' => 'secondary_database',
                    'username' => 'username',
                    'password' => 'password',
                    'host' => 'localhost',
                    'port' => '',
                    'driver' => 'mysql',
                    'prefix' => array(
                        'default'   => '',
                        'users'     => 'primary_database.',
                        'sessions'  => 'primary_database.',
                        'role'      => 'primary_database.',
                        'authmap'   => 'primary_database.',
                        ),
                ),
        ),
);

My primary database already has many users, but when I log into my secondary site, I only see my admin user. Also, I cannot log in to my subdomain with any user of my primary database.

So my conclusion is that the subdomain is still using its own database.

Both databases are on the same server and I've given the username/password for the secondary database access to the primary database.

There are also no errors in the log.

Any suggestions on what I'm missing?


texts: Translatable paths with parameters in routing.yml

texts:
Given the following routing.yml:

my_module.my_route:
    path: 'some-path-in-english/{slug}'
    defaults:
         _controller: '\Drupal\my_module\Controller\MyController::__invoke'
    requirements:
         _permission: 'access content'

I want to be able to have custom paths by language. For example:

/some-path-in-english/{slug}
/es/mi-ruta-en-castellano/{slug}

I checked this answers but generating alias does not solve the problem of parameters in path (at least I could not get it working) and generating a route for each language and controller is not very maintainable an breaks language switcher.

Is there any way to achieve this in Drupal 8?


texts: How to change theme template for the same block that is loaded twice on the page?

texts:
We have created two menu blocks: main_menu (region=main nav) and main_menu_footer (region=footer) that are added to all pages. They both are displaying the same main navigation menu except main_menu_footer only displays the first level and main_menu displays all levels.

I have a custom module, mymodule that I am using to assign a custom twig template, menu--main.html.twig. This twig template is being assigned to both blocks.

How can I setup the twig templates so that the main_menu uses main--menu.html.twig template, but main_menu_footer uses main--menu--footer.html.twig?

Goal:

main_menu block uses main--menu.html.twig template
main_menu_footer block uses main--menu--footer.html.twig template

Current setup

function mymodule_theme($existing, $type, $theme, $path) {
  $items = [];
  $items['main__menu'] = [
    'base hook' => 'menu',
    'render element' => 'menu',
  ];

  return $items;
}


texts: I am unable to create a variable in template.php that I later want to use in node--content-type.tpl.php

texts:
In template.php I have created the following function.

function mytheme_preprocess_node__post_esl_material(&$variables){
  $variables['linking'] = 'yes baby';
}

In node--post-esl-material.tpl.php I am trying to print $linking, but it is not working. The reason I am trying this is because I heard from an expert in Drupal saying:

  Template files are usually used to change the CSS. You do not want to put too much PHP logic here. The PHP logic is typically included in your template.php file.

Therefore the objective, after getting the above code to work, would be to:

Create a $article variable in template.php.
Swap the following code from node--post-esl-material.tpl.php into template.php.

if (empty($content['field_article'])) {
  echo '';
}
else {
  echo '
';
  echo '
ARTICLE
';
  echo '
';
  print render($content['field_article']);
  echo '
';
  echo '
';
}

Print $article in node--post-esl-material.tpl.php and hence, have the PHP logic within template.php.

I am using Drupal 7 with the Stark theme.


texts: Oauth2, Duplicate entry '' for key 'name': INSERT INTO {users}

texts:
I'm trying to make an object to log user through oauth2. I need to put some conditionnal fields. Here is my code :

public function createUserLocally() {

    // Get user datas from api
    $user_infos = $this->getUserInfos();
    $user_society = $this->getUserSociety();
    $user_blabla_datas = $this->getUserBlaBlaInfos();

    // Create a list of user information.
    $user = array(
      'name'   => $this->username,
      'pass'   => $this->password,
      'mail'   => $user_infos['email'],
      'field_user_address' => array(
        LANGUAGE_NONE => array(
          0 => array(
            'first_name' => $user_infos['firstname'],
            'last_name' => $user_infos['lastname'],
            'phone_number' => $user_infos['phonenumber'],
            'country' => 'EN',
          ),
        ),
      ),
      'status' => 1,
      'init'   => $user_infos['email'],
      'roles'  => array(
        DRUPAL_AUTHENTICATED_RID => 'authenticated user',
      ),
    );

    if ($user_society) {
      $user = array(
        'field_user_society_id' => array(
          LANGUAGE_NONE => array(
            0 => array(
              'value' => $user_society['id'],
            ),
          ),
        ),
      );

    }
    if ($user_Blabla_datas) {
      $user = array(
        'field_user_blabla_locations' => array(
          LANGUAGE_NONE => array(
            0 => array(
              'lat' => $user_blabla_datas['Latitutde'],
              'lng' => $user_blabla_datas['Longitude'],
            ),
          ),
        ),
      );
    }

    // Save the new user.
    $user = user_save(NULL, $user);

Without the conditionnal fields, everything run smoothly but with some conditions (my two if), I'm getting this error message :

PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created)

Any idea on what I'm doing wrong ? I have to say that if I use a user without data in the "if" conditions, user is registered without problem.


texts: links from subdomain get redirected to other domains

texts:
i have setup domain access on drupal 7 ... everything seems to be working fine ...
today i encountered a problem ...
some links in subdomains (sub1.domain.com/link) gets redirected to either another subdomain or the main domain (sub2.domain.com/link OR domain.com/link)

subdomains in my system are kind of sub systems of the main domain with everything shared ...

this only happens when i'm logged in with a subdomain admin user ... everything works fine with user 1 ...

i dont have $base_url in settings (only 1 global setting file)...
i enabled to redirect www.domain to domain in htaccess ...

so have anybody seen this before ? what sould i do ?
i cant think of anything :(  ...


texts: How can I use user input to build the URL of a GET form submission?

texts:
As explained here, and based on the answer given to that previous question, I'm trying to build a custom form that will act as a filter to two separate views. As per the answer received, I'm trying to build the resulting URL based upon user input. Here is my function so far:

function my_search_form($form, &$form_state) {

  $form['search_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Search:'),
  );

  $form['area'] = array(
    '#type' => 'select',
    '#options' => array(
      'songbook' => t('Songbook'),
      'blog' => t('Blog'),
    ),
    '#default_value' => 'songbook',
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Search',
  );

  $form['#method'] = 'get';

  return $form;
}

So here's my problem: according to this comment on the forms api page, changing the #method to GET means that no submit or validate handler functions are called on form submission. How can I get access to the user submitted data if those handler functions aren't called?


texts: Get the most recently viewed product variations (commerce product entity) in a View

texts:
Pre-requisite knowledge:
I have a view of type Content which is meant to list the most recently viewed product variations (commerce product entities that the product node references) first. I am using the sort order criteria - Content statistics: Most recent view (desc).
I understand that this view should ideally have been of type Commerce Product and sort order criteria as Entity statistics: Most recent view (desc) (provided by Entity Statistics module).
Problem:
But the real problem is that only the product node page is viewed by the user, not the commerce product page. So the Statistics module (which comes with Drupal 7 core) logs the node view but Entity Statistics does not log the commerce product entity view. So even on using Entity Statistics - Most recent view (desc) sort criteria, the most recently viewed product variation doesn't appear first in view results.
Should I build a custom sort criteria for this purpose? If so, need help in how to do so and in which hook exactly.
Any workarounds or other suggestions are welcome as well!


texts: Restrict admin from disabling userprotect

texts:
I've installed the user protect module on a site to allow another user to have complete admin access to the site, without the ability to edit my own administrator account. The problem with this it, they need to be able to access pretty much absolutely everything else, except for the ability to circumvent user protect.
At the moment, it is set up to stop them from editing my user, which works fine, unfortunately they are easily able to simply disable user protect.

What can I do to let them do almost everything except lock me out? So they shouldn't be able to disable that module, and they shouldn't be able to change their own permissions to be able to access that module.


texts: Form is not calling custom submit function

texts:
From my understanding, and as I've seen it in other examples of code, all I need to do to call a custom submit function is include the "#submit" => array("myModule_submit");.

I use a drupal_set_message to post a message on the site so I can know if the myModule_Submit is being called from the form submit button:

function myModule_submit($form, &$form_state) {
  drupal_set_message($form_state['values']['name']);
}

When I click on the "Send" button nothing happens, and it seems the page just refreshes.

function myModule_form_builder($form, $form_state){
  $form['myModule_message'] = array(
    '#type' => 'textfield',
    '#title' => t("Outgoing Message"),
    '#size' => 150,
    '#maxlength' => 150,
    '#required' => TRUE,
    '#description' => t("Type your message"),
  );

  $form['buttons'] = array(
    '#type' => 'button',
    '#value' => t("Send"),
    '#submit' => array('myModule_submit'),
  );

  return $form;
}

function myModule_submit($form, &$form_state) {
  drupal_set_message($form_state['values']['name']);
}

To my understanding drupal_set_message() will display a message to the user on the current page somewhere given the parameters. When I put information in the fields and press submit though there are no messages. I have seen other examples on the web that use this method and they say it works.


texts:
I love the features the view provides in Drupal. Sortable tables, Filters, as well as ability to use external modules like views bulk export.
My problem is that I want to display a separate database (Call this X), using views. What would be the best way to go about it?

To get around this problem in Drupal 6, I created a content type with all fields that were in Database X, then I created view for that content type by frontend. After that I used hook_pre_render_view() to push data from X to the view. Right now I want to achieve similar results in Drupal 8. I could use this same approach but it doesn't feel very Drupally. I was wondering if there is a better way to achieve this.


texts: How to login into Drupal 8 using Ajax (REST API)

texts:
I want to login in my Site Drupal 8.2.3 from another application using Ajax,
but is returning error all the time.

$.ajax({
    url : "http://localhost/Drupal-tuto-test/user/login",
    type : 'POST',
    data: {
        'username' : 'admin',
        'password' : 'admin'
    },
    dataType : 'json',
    error : function(data) {
        console.log('Error ',data);
    },
    success : function(data) {
        console.log('Success ',data);
    }
});


texts: Taxonomy Term Page is showing the same body for all nodes

texts:
I'm converting my old site to drupal and updating my Teaser view mode so that the nodes appear as I want them on the Taxonomy Term page.

http://dev.inadaydevelopment.com/tags/ipad

The problem is that the Body field for all of the nodes is showing up with the same text. The nodes do not have the same body text, so I have no idea how or why all of these Teasers are showing the same body text.

Any idea?


texts: Create custom search page with solr and facet-api

texts:
I am building a custom search page, and so I have installed :

Apache Solr Access (apachesolr_access)
Apache Solr framework (apachesolr)
Apache Solr search (apachesolr_search)
Current Search Blocks (current_search)
Facet API (facetapi)

All works fine but my search page is simply formatted like this :
1.results
2.current search
3.sort
4.filters

My question is how easily theme my search page as I want ?

In my theme I want to override search-results.tpl.php but how call the current search and sorts and after filters like I want to put them ??
Is this a good solution ?

Thanks to answer ;)

Ju


texts: How do I update programmatically some display_options of my view?

texts:
In a custom module (sel), I have a View displaying a custom content entity (Exchange):

Here is the corresponding configuration file (views.view.sel_echanges.yml):

id: sel_echanges
label: SÉL-Échanges
module: views
description: ''
tag: ''
base_table: exchange
base_field: id
core: 8.x
display:
  default:
    some code...
  page_1:
    some code...
  page_2:
    display_plugin: page
    id: page_2
    display_title: 'My exchanges'
    position: 1
    display_options:
      display_extenders: {  }
      path: sel/exchanges/myexchanges
      menu:
        type: tab
        title: 'Mes échanges'
        description: ''
        expanded: false
        parent: ''
        weight: 0
        context: '0'
        menu_name: main
      tab_options:
        type: none
        title: ''
        description: ''
        weight: 0
      display_description: ''
      fields:
etc.

I'd like to change the menu title ('Mes échanges' by default) in sel_views_post_execute:

function sel_views_post_execute(ViewExecutable $view)
{
  switch ($view->id()) {
    case 'sel_selistes':
      if ($view->current_display == 'page_1') {
some stuff...
      }
      break;

    case 'sel_echanges':
      if ($view->current_display == 'page_2') {
Code to be done...
      }
      break;
    default:

  }
}

I was looking at $view->setHandlerOption but I couldn't find how to write the code :-(
Any help?


texts: Show the latest post titles for posts using a specific category

texts:
I want to get the latest post titles for posts using a specific category, in Drupal 6.

How can I achieve this?


texts: Edit profile page redirect to desktop theme

texts:
I have two themes in my Drupal website, one for desktop resolution and second one for mobile(iPhone) resolution. When I browse website on mobile, all pages working fine except edit profile page.

Edit profile page in Mobile renders same as Desktop resolution theme.

I already have user-profile.tpl.php in mobile theme folder.

Any suggestions on how to make Edit Profile page compatible with Mobile ?

Thanks,


texts: When I flag a user with a rule, how can I set the value of a flagging field?

texts:
I have a rules action component that I use in VBO to flag users with a punish flag.  The punish flag has a reason long text field.

In rules, the component is an action set that consists of the action Flag a user.  However, the Flag a user action does not include an option to set the value of any of the flagging fields (in this case, reason).

I want to somehow set the reason field when I evaluate this component.  My first thought was to create another rule that triggers on the event  When a user is flagged, but this does not work in my case because the flag can be triggered multiple ways, and the value of reason should be different in each case.  (This was suggested here.)

So, I want to somehow access the flagging that is created by the Flag a user action and then change the value of reason, but I don't see any obvious way of doing that in rules other than making a loop that goes through all the flaggings on the site and looks for the one that affects the relevant user.

Is there a clean way to grab a flagging set by a rules component and then set the value of a field for that flagging?


texts: How to resolve error "Failed to load MailChimp PHP library. Please refer to the installation requirements."?

texts:
I'm try to set up Mailchimp module but i keep geeting
Failed to load MailChimp PHP library. Please refer to the installation requirements.

My steps:

disable mailchimp module
install composer_manager package locally
run: curl -sS https://getcomposer.org/installer | php on my root
change composer.json(which lay on my root) - see it below
run: php composer.phar install --no-dev
mailchimp/mailchimp directory is installed in my /vendor folder
clear cache, re=enable module but still getting the error. In my report i see that the module cannot be found.

What i'm doing wrong??

{
    "name": "drupal/composer_manager",
    "type": "drupal-module",
    "description": "Composer Manager is a bridge to best-in-breed, standards compliant PHP libraries that are managed by Composer and Packagist.",
    "homepage": "http://drupal.org/project/composer_manager",
    "license": "GPL-2.0",
    "authors": [
        {
            "name": "Chris Pliakas",
            "email": "opensource@chrispliakas.com",
            "role": "Project Lead"
        },
        {
            "name": "See contributors",
            "homepage": "http://drupal.org/node/1929436/committers",
            "role": "Developer"
        }
    ],
    "support": {
        "issues": "http://drupal.org/project/issues/composer_manager"
    },
    "require": {
        "php": ">=5.3.0",
        "mailchimp/mailchimp": ">=2.0.4"
    }
}

MailChimp module => 7x.3-3

mailchimp library => 2.04


texts:
I've created a view from geocoded nodes which shows nodes on a map.
I've also created an attachment view which I've attached to this map view.
This is to have a listing under the map view to make items more accessible.

However, I can't get that to work properly e.g. filter properly.
The following describes filters on the map view:

Content: Geocodes (field_geocodes) - proximity (exposed)
Content: Date(Exposed Popup date) | Setting
Content: EventType (exposed)
Content: Type (= Event)
Content: Published (Yes)

On the attachment view I checked that it inherits contextual filters and filters. However,

I'm no aware that is it inheriting filter values e.g. that I need to
create those filter again in this view?
Or does inherit whole filtering as is?

Anyhow, attachment results won't filter and shows all from first published node or by changing view settings it won't show anything i.e. filters and there's no results.


texts: Why this specific string is untranslatable

texts:
I want to translate "You can only change the parent menu item for the published version of this content" which belongs to  Menu UI module.

The string is defined in /core/modules/menu_ui/src/Plugin/Validation/Constraint/MenuSettingsConstraint.php like below:

<?php

namespace Drupal\menu_ui\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Validation constraint for changing the menu settings in pending revisions.
 *
 * @Constraint(
 *   id = "MenuSettings",
 *   label = @Translation("Menu settings.", context = "Validation"),
 * )
 */
class MenuSettingsConstraint extends Constraint {

  // This string is untranslatable.
  public $message = 'You can only change the menu settings for the published version of this content.';
  public $messageWeight = 'You can only change the menu item weight for the published version of this content.';
  public $messageParent = 'You can only change the parent menu item for the published version of this content.';
  public $messageRemove = 'You can only remove the menu item in the published version of this content.';

}

This extends a class from Symfony and doesn't use t() function, but other strings defined in the same way are translatable(which means you can find the string in the localize.drupal.org). Below is an example of a translatable string.

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator\Constraints;

use Symfony\Component\Validator\Constraint;

/**
 * @Annotation
 * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
 *
 * @author Fabien Potencier <fabien@symfony.com>
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class Expression extends Constraint
{
    const EXPRESSION_FAILED_ERROR = '6b3befbc-2f01-4ddf-be21-b57898905284';

    protected static $errorNames = [
        self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR',
    ];

    // This string is translatable.
    public $message = 'This value is not valid.';
    public $expression;

    /**
     * {@inheritdoc}
     */
    public function getDefaultOption()
    {
        return 'expression';
    }

    /**
     * {@inheritdoc}
     */
    public function getRequiredOptions()
    {
        return ['expression'];
    }

    /**
     * {@inheritdoc}
     */
    public function getTargets()
    {
        return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT];
    }

    /**
     * {@inheritdoc}
     */
    public function validatedBy()
    {
        return 'validator.expression';
    }
}

I guess there're Drupal wrappers to make the strings originated in Symfony class implementations translatable. But why does the string in Menu UI remain untranslatable? It's not urgent, but I'm curious.

EDIT:
 Entity Validation API overview says
"Symfony validator is configured to use a Drupal translator class, such that violation messages correctly run through t(). ". So if my understanding is right, the untranslatable string also gets wrapped in t() eventually...?


texts:
In my local development environment, Drupal keeps crashing Apache when I try to load admin pages. The user pages all load fine, but any admin page causes apache to reset itself.
In the apache error log I get:

Parent: child process exited with status 255 -- Restarting.

The files were all copied from our test server, although I removed all the cached data inserts from the database while transferring it over.

We're running a separate admin theme (Garland for admin, custom theme for all other pages).  The custom themed pages work fine. I haven't found a way to determine if its the theme or the admin pages that are causing the problem.

I'm using Drupal 6 with WAMP, on Windows 7.

I'm looking for suggestions about what's causing the resets.


texts: I want to make ajax call to module functuion

texts:
I want on onclick event send some data to module and do some processing and get result back.

I have module name 'custom' and js code i have mentioned below. Url of page from where ajax call is made is 127.0.0.1/field-work

    Drupal.behaviors.custom = function (context, settings)
 {
    $(document).on('click', '#clear-filter', function() {
    console.log("Hello");
    jQuery.ajax({
            type: 'POST',
            url: 'custom/field-work',
            dataType: 'json',
            success: function(data){
            console.log(data);
           },
        });
    });
};

Module code to receive ajax call have mentioned below.

function custom_menu() {
    $items['custom/field-work'] = array(
    'title' => t('foo AJAX'),
    'type' => MENU_CALLBACK,
    'page callback' => 'details_data',
    'access arguments' => array('access content'),
    );
    return $items;
}

From details_data i am returning some random data. But ajax call is not working. If i am removing drupal behaviour the js part is working fine.

Please help me out.


texts: Trying to pass id to the ajax callback function, keeps overwriting, how to solve this?

texts:
I created a form which have a lot of images and a delete button on every each one of them. I used ajax to create a callback function which would delete the image. Here is part of my form:

foreach($result as $key=>$some){
    $form['image-entry'][$some->id] = array(
      '#type' => 'fieldset'
    );

    $form['image-entry'][$some->id]['image_' . $some->id] = array(
      '#markup' => theme('image', $variables[$key]),
    );

    $form['image-entry'][$some->id]['description_' . $some->id] = array(
      '#type' => 'textarea',
      '#default_value' => $some->description,
      '#attributes' => array(
        'placeholder' => t('Describe this picture'),
       ),
    );
    $form['image-entry'][$some->id]['submit3' . $some->id] = array(
      '#type' => 'submit',
      '#value' => 'Delete',
      '#ajax' => array(
        'callback' => 'image_gallery_delete_photo_callback',
       ),
    );
   $form['#foo'] = array($some->id);
  }

As you can see I have 3rd submit button which is ajax callback and from example I found out that I need to create a new form element (foo) in this case, which stores some data that I can pass. Everything works like a charm, this is my callback function:

function image_gallery_delete_photo_callback($form, $form_state, $args){
  $arguments = $form['#foo'];
  dpm($arguments);

  /*$photo_delete = db_delete('image_gallery_photos')
                  ->condition('id', $arguments)
                  ->execute();*/
}

I am able to fetch the id of the photo from the form, but here I face a brick wall.

Problem: id is overwritten because it is in a foreach loop, taking it out, doesn't help. It only stores last value from the loop.

How can I get an id of the element selected?


texts: Are there Drupal modules that help process e-mails dynamically

texts:
I had the idea of implementing a workflow module for e-mail communications, something like this:

User role 1 can write e-mails (as nodes or custom entities)
User role 2 can review and approve e-mails
User role 3 can press send

I would then like the website to catch replies and enter them into the database with reference to the user entities that touched the e-mail entity, so that the workflow can also be applied to replies.
The part that I'm not sure I can do here, is doing advanced e-mail processing based on which users touched the e-mail.

Are there any modules that can handle encoding these entity references into the reply-to or message of the e-mail so that the Drupal site can process the replies dynamically?


texts: JSONP requests not working in REST server

texts:
This is related to a bug report I filed just moments ago. If there's someone who has successfully used the REST server in the Services module with JSONP requests (cross-domain), I'd be happy to hear about it.

I'm currently trying to get cross-domain JSONP requests in services working. However, it seems that I'm out of luck. I have created a sandbox Drupal installation with just the service (and dependent) modules installed. The endpoint for testing is setup as follows:

name: api
server: REST
debug: disabled
authentication: session

The REST server is setup as follows:

response formatters: json, jsonp
request parsing: application/json, application/x-www-form-urlencoded, multipart/form-data

All resources provided by default are turned on. What I'm trying to achieve now is to get the user logged in, in order to be able to access other, permission based ressources such as node etc.

The test request is as follows:

url and params: http://d7.sandbox/api/user/login.json?callback=test&username=test&password=test
http header Content-Type: application/json

The response returns a 401 HTTP header and the following message:

401 (Unauthorized: Access denied for user anonymous)

It seems that this is not the desired behavior. JSON requests (e.g. a POST request to api/user/login.json) work fine. However, these cannot be used for applications running on other domains or devices to retrieve data from Drupal over the REST server.

Any ideas?

P.S. I went through the tests in the services package. It seems that tests for the JSONP functionality are missing as well.